Completed
Push — FVSv2 ( 1cdbcb...01e32a )
by Patrick
01:36
created
app/Schedules/class.SimplePDF.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
             $timeStr = $start->format('g:i A').' till '.$end->format('g:i A');
36 36
             if(strlen($shifts[$i]['name']) > 0)
37 37
             {
38
-                $timeStr .=' - <i>'.$shifts[$i]['name'].'</i>';
38
+                $timeStr .= ' - <i>'.$shifts[$i]['name'].'</i>';
39 39
             }
40 40
             if(!isset($days[$dateStr]))
41 41
             {
@@ -50,22 +50,22 @@  discard block
 block discarded – undo
50 50
         ksort($days);
51 51
         foreach($days as $dateStr=>$day)
52 52
         {
53
-            $html .='<h2>'.$dateStr.'</h2>';
53
+            $html .= '<h2>'.$dateStr.'</h2>';
54 54
             uksort($day, array($this, 'groupSort'));
55 55
             foreach($day as $shiftStr=>$shifts)
56 56
             {
57 57
                 usort($shifts, array($this, 'shiftSort'));
58
-                $html .='<h3>'.$shiftStr.'</h3>';
59
-                $html .='<table width="100%"><tr><th style="width: 20%">Role</th><th>Volunteer Name</th><th>Volunteer Camp</th></tr>';
58
+                $html .= '<h3>'.$shiftStr.'</h3>';
59
+                $html .= '<table width="100%"><tr><th style="width: 20%">Role</th><th>Volunteer Name</th><th>Volunteer Camp</th></tr>';
60 60
                 foreach($shifts as $shift)
61 61
                 {
62 62
                     //TODO Volunteer info for shift...
63
-                    $html .='<tr><td>'.$this->getRoleNameFromID($shift['roleID']).'</td><td></td><td></td></tr>';
63
+                    $html .= '<tr><td>'.$this->getRoleNameFromID($shift['roleID']).'</td><td></td><td></td></tr>';
64 64
                 }
65
-                $html .='</table>';
65
+                $html .= '</table>';
66 66
             }
67 67
         }
68
-        $html .='</body>';
68
+        $html .= '</body>';
69 69
         $this->setPDFFromHTML($html);
70 70
     }
71 71
 } 
Please login to merge, or discard this patch.
api/v1/class.VolunteerAPI.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -5,6 +5,9 @@
 block discarded – undo
5 5
     protected $isAdmin = null;
6 6
     protected $isLead = null;
7 7
 
8
+    /**
9
+     * @param string $dataTableName
10
+     */
8 11
     public function __construct($dataTableName, $idField = '_id')
9 12
     {
10 13
         parent::__construct('fvs', $dataTableName, $idField);
Please login to merge, or discard this patch.
api/v1/class.DepartmentAPI.php 1 patch
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -109,6 +109,9 @@  discard block
 block discarded – undo
109 109
         return $response->withJson($shifts);
110 110
     }
111 111
 
112
+    /**
113
+     * @param string $table
114
+     */
112 115
     protected function createEntityForDepartment($request, $response, $args, $table)
113 116
     {
114 117
         $deptId = $args['dept'];
@@ -212,6 +215,9 @@  discard block
 block discarded – undo
212 215
         return $response;
213 216
     }
214 217
 
218
+    /**
219
+     * @param string $type
220
+     */
215 221
     public function generateGridSchedule($dept, $shifts, $response, $type)
216 222
     {
217 223
         $ss = new \Schedules\GridSchedule($dept, $shifts);
Please login to merge, or discard this patch.
api/v1/class.Processor.php 1 patch
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -1,6 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 trait Processor
3 3
 {
4
+    /**
5
+     * @param string $certType
6
+     */
4 7
     protected function certCheck($requirements, $certs, $certType)
5 8
     {
6 9
         if(isset($requirements[$certType]) && $requirements[$certType])
@@ -12,6 +15,9 @@  discard block
 block discarded – undo
12 15
 
13 16
     protected abstract function isVolunteerAdmin($request);
14 17
 
18
+    /**
19
+     * @param VolunteerProfile|null $user
20
+     */
15 21
     public function canUserDoRole($user, $role)
16 22
     {
17 23
         if($role['publicly_visible'] === true)
@@ -152,6 +158,9 @@  discard block
 block discarded – undo
152 158
         return !in_array($deptId, $privateDepts);
153 159
     }
154 160
 
161
+    /**
162
+     * @param VolunteerShift $shift
163
+     */
155 164
     protected function doShiftTimeChecks($shift, $entry)
156 165
     {
157 166
         $now = new DateTime();
Please login to merge, or discard this patch.
app/Schedules/class.GridSchedule.php 2 patches
Doc Comments   +17 added lines patch added patch discarded remove patch
@@ -45,6 +45,11 @@  discard block
 block discarded – undo
45 45
         return ($hour - 12).'p';
46 46
     }
47 47
 
48
+    /**
49
+     * @param integer $hourCount
50
+     * @param integer $rowCount
51
+     * @param \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $sheat
52
+     */
48 53
     protected function grayOutUnused($hourCount, $rowCount, $sheat)
49 54
     {
50 55
         for($i = 0; $i < $hourCount; $i++)
@@ -74,6 +79,9 @@  discard block
 block discarded – undo
74 79
         }
75 80
     }
76 81
 
82
+    /**
83
+     * @param double $hourCount
84
+     */
77 85
     protected function getHoursArrays($hour, $hourCount)
78 86
     {
79 87
         $simpleHours = array();
@@ -91,12 +99,21 @@  discard block
 block discarded – undo
91 99
         return array($simpleHours, $militaryHours);
92 100
     }
93 101
 
102
+    /**
103
+     * @param \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $sheat
104
+     * @param double $col
105
+     * @param integer $row
106
+     */
94 107
     protected function createShiftCell($sheat, $col, $row, $shift)
95 108
     {
96 109
         $sheat->mergeCellsByColumnAndRow($col, $row, $col+$shift['length']-1, $row);
97 110
         $this->setShiftNameInCell($sheat, $col, $row, $shift);
98 111
     }
99 112
 
113
+    /**
114
+     * @param double $col
115
+     * @param \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $sheat
116
+     */
100 117
     protected function getRowForShift($roleID, $rows, $col, $sheat)
101 118
     {
102 119
         $firstRow = array_search($roleID, $rows);
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         {
52 52
             for($j = 0; $j < $rowCount; $j++)
53 53
             {
54
-                 $cell = $sheat->getCellByColumnAndRow($i+2, $j+4);
54
+                 $cell = $sheat->getCellByColumnAndRow($i + 2, $j + 4);
55 55
                  if($cell->isInMergeRange())
56 56
                  {
57 57
                       continue;
@@ -93,28 +93,28 @@  discard block
 block discarded – undo
93 93
 
94 94
     protected function createShiftCell($sheat, $col, $row, $shift)
95 95
     {
96
-        $sheat->mergeCellsByColumnAndRow($col, $row, $col+$shift['length']-1, $row);
96
+        $sheat->mergeCellsByColumnAndRow($col, $row, $col + $shift['length'] - 1, $row);
97 97
         $this->setShiftNameInCell($sheat, $col, $row, $shift);
98 98
     }
99 99
 
100 100
     protected function getRowForShift($roleID, $rows, $col, $sheat)
101 101
     {
102 102
         $firstRow = array_search($roleID, $rows);
103
-        $cell = $sheat->getCellByColumnAndRow($col, $firstRow+4);
103
+        $cell = $sheat->getCellByColumnAndRow($col, $firstRow + 4);
104 104
         if($cell->isInMergeRange())
105 105
         {
106
-            while($rows[$firstRow+$i] === $roleID)
106
+            while($rows[$firstRow + $i] === $roleID)
107 107
             {
108
-                $cell = $sheat->getCellByColumnAndRow($hoursFromStart+2, $firstRow+4+$i);
108
+                $cell = $sheat->getCellByColumnAndRow($hoursFromStart + 2, $firstRow + 4 + $i);
109 109
                 if(!$cell->isInMergeRange())
110 110
                 {
111 111
                     break;
112 112
                 }
113 113
                 $i++;
114 114
             }
115
-            return $firstRow+4+$i;
115
+            return $firstRow + 4 + $i;
116 116
         }
117
-        return $firstRow+4;
117
+        return $firstRow + 4;
118 118
     }
119 119
 
120 120
     protected function createSpreadSheet()
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
         $start = date_parse($str);
162 162
         $lastShift = $shifts[$count - 1];
163 163
         $interval = $lastShift['endTime']->diff($shifts[0]['startTime']);
164
-        $hourCount = ($interval->d*24) + $interval->h;
164
+        $hourCount = ($interval->d * 24) + $interval->h;
165 165
         $tmp = $this->getHoursArrays($start['hour'], $hourCount);
166 166
         $simpleHours = $tmp[0];
167 167
         $militaryHours = $tmp[1];
@@ -232,13 +232,13 @@  discard block
 block discarded – undo
232 232
         {
233 233
             $i = 1;
234 234
             $timeDiff = $originalStartTime->diff($shift['startTime']);
235
-            $hoursFromStart = ($timeDiff->d*24)+$timeDiff->h;
236
-            $rowForShift = $this->getRowForShift($shift['roleID'], $rows, $hoursFromStart+2, $sheat);
237
-            $this->createShiftCell($sheat, $hoursFromStart+2, $rowForShift, $shift);
235
+            $hoursFromStart = ($timeDiff->d * 24) + $timeDiff->h;
236
+            $rowForShift = $this->getRowForShift($shift['roleID'], $rows, $hoursFromStart + 2, $sheat);
237
+            $this->createShiftCell($sheat, $hoursFromStart + 2, $rowForShift, $shift);
238 238
             $shift = array_shift($shifts);
239 239
         }
240 240
         $rowCount = count($rows);
241
-        $style = $sheat->getStyleByColumnAndRow(2, 4, 1+count($simpleHours), 3 + $rowCount);
241
+        $style = $sheat->getStyleByColumnAndRow(2, 4, 1 + count($simpleHours), 3 + $rowCount);
242 242
         $style->getBorders()->getAllBorders()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN);
243 243
         $hourCount = count($simpleHours);
244 244
         $this->grayOutUnused($hourCount, $rowCount, $sheat);
Please login to merge, or discard this patch.