Completed
Branch develop (b1c313)
by Seth
02:32
created
src/SyncIntoCanvas/Filter.php 2 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -34,6 +34,9 @@  discard block
 block discarded – undo
34 34
         $this->setExcludeExpression($exclude);
35 35
     }
36 36
 
37
+    /**
38
+     * @param boolean $enabled
39
+     */
37 40
     public function setEnabled($enabled)
38 41
     {
39 42
         $this->enabled = (boolean) $enabled;
@@ -44,6 +47,9 @@  discard block
 block discarded – undo
44 47
         return $enabled;
45 48
     }
46 49
 
50
+    /**
51
+     * @param string|null $regex
52
+     */
47 53
     public function setIncludeExpression($regex)
48 54
     {
49 55
         $this->include = (string) $regex;
@@ -57,6 +63,9 @@  discard block
 block discarded – undo
57 63
         return $this->include;
58 64
     }
59 65
 
66
+    /**
67
+     * @param string|null $regex
68
+     */
60 69
     public function setExcludeExpression($regex)
61 70
     {
62 71
         $this->exclude = (string) $regex;
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -76,17 +76,17 @@
 block discarded – undo
76 76
             // include this event if filtering is off...
77 77
             $this->isEnabled() == false ||
78 78
             (
79
-               (
80
-                   ( // if filtering is on, and there's an include pattern test that pattern...
81
-                       $this->getIncludeExpression() &&
79
+                (
80
+                    ( // if filtering is on, and there's an include pattern test that pattern...
81
+                        $this->getIncludeExpression() &&
82 82
                        preg_match('%' . $this->getIncludeExpression() . '%', $event->getProperty('SUMMARY'))
83
-                   )
84
-               ) &&
83
+                    )
84
+                ) &&
85 85
                !( // if there is an exclude pattern, make sure that this event is NOT excluded
86
-                   $this->getExcludeExpression() &&
86
+                    $this->getExcludeExpression() &&
87 87
                    preg_match('%' . $this->getExcludeExpression() . '%', $event->getProperty('SUMMARY'))
88
-               )
89
-           )
88
+                )
89
+            )
90 90
         );
91 91
     }
92 92
 }
Please login to merge, or discard this patch.
src/SyncIntoCanvas/Syncable.php 1 patch
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,6 @@
 block discarded – undo
53 53
     /**
54 54
      * Update the MySQL connection
55 55
      *
56
-     * @param PDO $db
57 56
      * @throws Exception If `$db` is null
58 57
      */
59 58
     public static function setDatabase(PDO $database)
Please login to merge, or discard this patch.
src/SyncIntoCanvas/Calendar.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -323,6 +323,9 @@
 block discarded – undo
323 323
         $this->log(static::getTimestamp() . ' sync finished', $log);
324 324
     }
325 325
 
326
+    /**
327
+     * @param string $message
328
+     */
326 329
     private function log($message, Log $log, $flag = PEAR_LOG_INFO)
327 330
     {
328 331
         if ($log) {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace smtech\CanvasICSSync\SyncIntoCanvas;
4 4
 
5
-use DateTime;
6 5
 use vcalendar;
7 6
 use Battis\DataUtilities;
8 7
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
             $this->logThrow(new Exception("Cannot sync calendars without a valid Canvas context"), $log);
258 258
         }
259 259
 
260
-        if (!DataUtilities::URLexists($this>getFeedUrl())) {
260
+        if (!DataUtilities::URLexists($this > getFeedUrl())) {
261 261
             $this->logThrow(new Exception("Cannot sync calendars with a valid calendar feed"), $log);
262 262
         }
263 263
 
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
          *     today's date, probably a better system? issue:12
286 286
          */
287 287
         foreach ($ics->selectComponents(
288
-            date('Y')-1, // startYear
288
+            date('Y') - 1, // startYear
289 289
             date('m'), // startMonth
290 290
             date('d'), // startDay
291
-            date('Y')+1, // endYEar
291
+            date('Y') + 1, // endYEar
292 292
             date('m'), // endMonth
293 293
             date('d'), // endDay
294 294
             'vevent', // cType
Please login to merge, or discard this patch.
src/SyncIntoCanvas/Event.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -204,6 +204,9 @@
 block discarded – undo
204 204
         }
205 205
     }
206 206
 
207
+    /**
208
+     * @param Calendar $calendar
209
+     */
207 210
     public static function purgeUnmatched($timestamp, $calendar)
208 211
     {
209 212
         $db = static::getDatabase();
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +3 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 /* store any requested actions for future handling */
15 15
 $action = (empty($_REQUEST['action']) ?
16
-    ACTION_UNSPECIFIED :
17
-    strtolower($_REQUEST['action'])
16
+    ACTION_UNSPECIFIED : strtolower($_REQUEST['action'])
18 17
 );
19 18
 
20 19
 /* action requests only come from outside the LTI! */
@@ -49,8 +48,7 @@  discard block
 block discarded – undo
49 48
 /* if not authenticated, default to showing credentials */
50 49
 } else {
51 50
     $action = (empty($action) ?
52
-        ACTION_CONFIG :
53
-        $action
51
+        ACTION_CONFIG : $action
54 52
     );
55 53
 }
56 54
 
@@ -59,7 +57,7 @@  discard block
 block discarded – undo
59 57
     /* reset cached install data from config file */
60 58
     case ACTION_INSTALL:
61 59
         $_SESSION['toolbox'] = Toolbox::fromConfiguration(CONFIG_FILE, true);
62
-        $toolbox =& $_SESSION['toolbox'];
60
+        $toolbox = & $_SESSION['toolbox'];
63 61
 
64 62
         /* test to see if we can connect to the API */
65 63
         try {
Please login to merge, or discard this patch.
common.inc.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@
 block discarded – undo
13 13
 
14 14
 /* prepare the toolbox */
15 15
 if (empty($_SESSION[Toolbox::class])) {
16
-    $_SESSION[Toolbox::class] =& Toolbox::fromConfiguration(CONFIG_FILE);
16
+    $_SESSION[Toolbox::class] = & Toolbox::fromConfiguration(CONFIG_FILE);
17 17
 }
18
-$toolbox =& $_SESSION[Toolbox::class];
18
+$toolbox = & $_SESSION[Toolbox::class];
19 19
 $toolbox->smarty_prependTemplateDir(__DIR__ . '/templates', basename(__DIR__));
20 20
 $toolbox->smarty_assign([
21 21
     'category' => DataUtilities::titleCase(preg_replace('/[\-_]+/', ' ', basename(__DIR__)))
Please login to merge, or discard this patch.
import.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -73,9 +73,9 @@
 block discarded – undo
73 73
 function filterEvent($event, $calendarCache)
74 74
 {
75 75
 
76
-     return (
77
-         // include this event if filtering is off...
78
-         $calendarCache['enable_regexp_filter'] == false ||
76
+        return (
77
+            // include this event if filtering is off...
78
+            $calendarCache['enable_regexp_filter'] == false ||
79 79
          (
80 80
             (
81 81
                 ( // if filtering is on, and there's an include pattern test that pattern...
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -186,10 +186,10 @@
 block discarded – undo
186 186
                 // TODO:0 the best window for syncing would be the term of the course in question, right? issue:12
187 187
                 // TODO:0 Arbitrarily selecting events in for a year on either side of today's date, probably a better system? issue:12
188 188
                 foreach ($ics->selectComponents(
189
-                    date('Y')-1, // startYear
189
+                    date('Y') - 1, // startYear
190 190
                     date('m'), // startMonth
191 191
                     date('d'), // startDay
192
-                    date('Y')+1, // endYEar
192
+                    date('Y') + 1, // endYEar
193 193
                     date('m'), // endMonth
194 194
                     date('d'), // endDay
195 195
                     'vevent', // cType
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -424,7 +424,9 @@
 block discarded – undo
424 424
             'The Canvas URL you submitted could not be parsed.<pre>' . $_REQUEST['canvas_url'] . '</pre>',
425 425
             NotificationMessage::ERROR
426 426
         );
427
-        if (php_sapi_name() != 'cli') $smarty->display('page.tpl');
427
+        if (php_sapi_name() != 'cli') {
428
+            $smarty->display('page.tpl');
429
+        }
428 430
         exit;
429 431
     }
430 432
 }
Please login to merge, or discard this patch.
visualize.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,5 +33,5 @@
 block discarded – undo
33 33
 }
34 34
 
35 35
 $smarty->assign('ics', $ics);
36
-$smarty->assign('veventProperties', array('unique' => array('CLASS','CREATED','SUMMARY','DESCRIPTION','DTSTART','X-CURRENT-DTSTART','DTEND','X-CURRENT-DTEND','DURATION','GEO','LAST-MOD','LOCATION','ORGANIZER','PRIORITY','DTSTAMP','SEQ','STATUS','TRANSP','UID','URL','RECURID'),'multiple'=>array('ATTACH','ATTENDEE','CATEGORIES','COMMENT','CONTACT','EXDATE','EXRULE','RSTATUS','RELATED','RESOURCES','RDATE','RRULE','X-PROP')));
36
+$smarty->assign('veventProperties', array('unique' => array('CLASS', 'CREATED', 'SUMMARY', 'DESCRIPTION', 'DTSTART', 'X-CURRENT-DTSTART', 'DTEND', 'X-CURRENT-DTEND', 'DURATION', 'GEO', 'LAST-MOD', 'LOCATION', 'ORGANIZER', 'PRIORITY', 'DTSTAMP', 'SEQ', 'STATUS', 'TRANSP', 'UID', 'URL', 'RECURID'), 'multiple'=>array('ATTACH', 'ATTENDEE', 'CATEGORIES', 'COMMENT', 'CONTACT', 'EXDATE', 'EXRULE', 'RSTATUS', 'RELATED', 'RESOURCES', 'RDATE', 'RRULE', 'X-PROP')));
37 37
 $smarty->display('visualize.tpl');
Please login to merge, or discard this patch.