1 | <?php |
||
12 | class Calendar |
||
13 | { |
||
14 | /** |
||
15 | * Canvas calendar context |
||
16 | * @var CalendarContext |
||
17 | */ |
||
18 | protected $context; |
||
19 | |||
20 | /** |
||
21 | * ICS or webcal feed URL |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $feedUrl; |
||
25 | |||
26 | /** |
||
27 | * Name of this calendar (extracted from feed) |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $name; |
||
31 | |||
32 | /** |
||
33 | * Transformations for events in this calendar_event |
||
34 | * @var Transform[] |
||
35 | */ |
||
36 | protected $transforms; |
||
37 | |||
38 | /** |
||
39 | * Filters for events in this calendar |
||
40 | * @var Filter[] |
||
41 | */ |
||
42 | protected $filters; |
||
43 | |||
44 | /** |
||
45 | * Construct a Calendar object |
||
46 | * |
||
47 | * @param string $canvasUrl URL of a Canvas calendar context |
||
48 | * @param string $feedUrl URL of a webcal or ICS calendar feed |
||
49 | * @param boolean $enableFilter (Optional, default `false`) |
||
50 | * @param string $include (Optional) Regular expression to select events |
||
51 | * for inclusion in the calendar sync |
||
52 | * @param string $exclude (Optional) Regular expression to select events |
||
53 | * for exclusion from the calendar sync |
||
54 | */ |
||
55 | public function __construct($canvasUrl, $feedUrl, $enableFilter = false, $include = null, $exclude = null) |
||
65 | |||
66 | /** |
||
67 | * Set the Canvas calendar context |
||
68 | * |
||
69 | * @param CalendarContext $context |
||
70 | * @throws Exception If `$context` is null |
||
71 | */ |
||
72 | public function setContext(CalendarContext $context) |
||
82 | |||
83 | /** |
||
84 | * Get the Canvas calendar context |
||
85 | * |
||
86 | * @return CalendarContext |
||
87 | */ |
||
88 | public function getContext() |
||
92 | |||
93 | /** |
||
94 | * Set the webcal or ICS feed URl for this calendar |
||
95 | * |
||
96 | * @param string $feedUrl |
||
97 | * @throws Exception If `$feedUrl` is not a valid URL |
||
98 | */ |
||
99 | public function setFeedUrl($feedUrl) |
||
112 | |||
113 | /** |
||
114 | * Get the feed URL for this calendar |
||
115 | * |
||
116 | * @return string |
||
117 | */ |
||
118 | public function getFeedUrl() |
||
122 | |||
123 | /** |
||
124 | * Set the name of the calendar |
||
125 | * |
||
126 | * @param string $name |
||
127 | */ |
||
128 | public function setName($name) |
||
132 | |||
133 | /** |
||
134 | * Get the name of the calendar |
||
135 | * |
||
136 | * @return string |
||
137 | */ |
||
138 | public function getName() |
||
142 | |||
143 | /** |
||
144 | * Set the regular expression filter for this calendar |
||
145 | * |
||
146 | * @param Filter $filter |
||
147 | */ |
||
148 | public function setFilter(Filter $filter) |
||
152 | |||
153 | /** |
||
154 | * Get the regular expression filter for this calendar |
||
155 | * |
||
156 | * @return Filter |
||
157 | */ |
||
158 | public function getFilter() |
||
162 | |||
163 | /** |
||
164 | * Generate a unique ID to identify this particular pairing of ICS feed and |
||
165 | * Canvas calendar |
||
166 | **/ |
||
167 | public function getId($algorithm = 'md5') |
||
171 | |||
172 | /** |
||
173 | * Get the Canvas context code for this calendar |
||
174 | * |
||
175 | * @return string |
||
176 | */ |
||
177 | public function getContextCode() |
||
181 | |||
182 | /** |
||
183 | * Save this calendar to the database |
||
184 | * |
||
185 | * @return void |
||
186 | */ |
||
187 | public function save() |
||
246 | |||
247 | /** |
||
248 | * Load a Calendar from the database |
||
249 | * |
||
250 | * @param string|int $id |
||
251 | * @return Calendar |
||
252 | */ |
||
253 | public static function load($id) |
||
270 | |||
271 | /** |
||
272 | * Delete this calendar from the database |
||
273 | * |
||
274 | * @return void |
||
275 | */ |
||
276 | public function delete() |
||
283 | |||
284 | /** |
||
285 | * Sync the calendar feed into Canvas |
||
286 | * |
||
287 | * @param Log $log |
||
288 | * @return void |
||
289 | */ |
||
290 | public function sync(Log $log) |
||
372 | |||
373 | /** |
||
374 | * Write to the log, if we have one |
||
375 | * |
||
376 | * @param string $message |
||
377 | * @param Log $log |
||
378 | * @param mixed $priority |
||
379 | * @return void |
||
380 | */ |
||
381 | private function log($message, Log $log, $priority = PEAR_LOG_INFO) |
||
387 | |||
388 | /** |
||
389 | * Write exception to the log, if we have one, or re-throw the exception |
||
390 | * |
||
391 | * @param Exception $exception |
||
392 | * @param Log $log |
||
393 | * @param string $priority |
||
394 | * @return void |
||
395 | * @throws Exception If no log is available |
||
396 | */ |
||
397 | private function logThrow( |
||
408 | } |
||
409 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.