File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ class Calendar extends Component implements HasTimezones
34
34
35
35
private ?string $ productIdentifier = null ;
36
36
37
+ private ?string $ source = null ;
38
+
37
39
public static function create (string $ name = null ): Calendar
38
40
{
39
41
return new self ($ name );
@@ -146,6 +148,18 @@ public function refreshInterval(int $minutes): Calendar
146
148
return $ this ;
147
149
}
148
150
151
+ /**
152
+ * Identifies a location where a client can retrieve updated data for the calendar.
153
+ *
154
+ * @link https://datatracker.ietf.org/doc/html/rfc7986#section-5.7
155
+ */
156
+ public function source (string $ source ): self
157
+ {
158
+ $ this ->source = $ source ;
159
+
160
+ return $ this ;
161
+ }
162
+
149
163
public function get (): string
150
164
{
151
165
return $ this ->toString ();
@@ -173,6 +187,10 @@ protected function payload(): ComponentPayload
173
187
$ this ->description ,
174
188
fn () => TextProperty::create ('DESCRIPTION ' , $ this ->description )->addAlias ('X-WR-CALDESC ' )
175
189
)
190
+ ->optional (
191
+ $ this ->source ,
192
+ fn () => TextProperty::create ('SOURCE ' , $ this ->source )->addParameter (new Parameter ('VALUE ' , 'URI ' ))
193
+ )
176
194
->optional (
177
195
$ this ->refreshInterval ,
178
196
fn () => DurationProperty::create ('REFRESH-INTERVAL ' , $ this ->refreshInterval )->addParameter (new Parameter ('VALUE ' , 'DURATION ' ))
Original file line number Diff line number Diff line change @@ -154,6 +154,18 @@ public function a_refresh_rate_can_be_set()
154
154
->expectParameterValue ('VALUE ' , 'DURATION ' );
155
155
}
156
156
157
+ /** @test */
158
+ public function a_source_can_be_set ()
159
+ {
160
+ $ payload = Calendar::create ()
161
+ ->source ('https://example.org/cal.ics ' )
162
+ ->resolvePayload ();
163
+
164
+ PropertyExpectation::create ($ payload , 'SOURCE ' )
165
+ ->expectValue ('https://example.org/cal.ics ' )
166
+ ->expectParameterValue ('VALUE ' , 'URI ' );
167
+ }
168
+
157
169
/** @test */
158
170
public function it_will_automatically_add_multiple_timezone_components ()
159
171
{
You can’t perform that action at this time.
0 commit comments