GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( ca9c18...0a41a9 )
by Steeven
01:58
created
src/Models/Sql/Relations/BelongsTo.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
                         return $this->map->referenceModel->row = $this->map->referenceModel->result->first();
51 51
                     }
52 52
                 }
53
-            } elseif ( ! empty($this->map->referenceTable)) {
53
+            } elseif (!empty($this->map->referenceTable)) {
54 54
                 $result = $this->map->relationModel->qb
55 55
                     ->from($this->map->referenceTable)
56 56
                     ->getWhere($conditions, 1);
Please login to merge, or discard this patch.
src/Models/Sql/Traits/RecordTrait.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -85,57 +85,57 @@
 block discarded – undo
85 85
 
86 86
         $timestamp = $this->unixTimestamp === true ? strtotime(date('Y-m-d H:i:s')) : date('Y-m-d H:i:s');
87 87
 
88
-        if ( ! isset($sets[ 'record_status' ])) {
89
-            $sets[ 'record_status' ] = $this->recordStatus;
88
+        if (!isset($sets['record_status'])) {
89
+            $sets['record_status'] = $this->recordStatus;
90 90
         }
91 91
 
92 92
         if (empty($this->primary_keys)) {
93 93
             $primary_key = isset($this->primary_key) ? $this->primary_key : 'id';
94 94
 
95
-            if (empty($sets[ $primary_key ])) {
96
-                if ( ! isset($sets[ 'record_create_user' ])) {
97
-                    $sets[ 'record_create_user' ] = $this->recordUser;
95
+            if (empty($sets[$primary_key])) {
96
+                if (!isset($sets['record_create_user'])) {
97
+                    $sets['record_create_user'] = $this->recordUser;
98 98
                 }
99 99
 
100
-                if ( ! isset($sets[ 'record_create_timestamp' ])) {
101
-                    $sets[ 'record_create_timestamp' ] = $timestamp;
100
+                if (!isset($sets['record_create_timestamp'])) {
101
+                    $sets['record_create_timestamp'] = $timestamp;
102 102
                 }
103 103
             }
104 104
         } else {
105 105
             foreach ($this->primary_keys as $primary_key) {
106
-                if (empty($sets[ $primary_key ])) {
107
-                    if ( ! isset($sets[ 'record_create_user' ])) {
108
-                        $sets[ 'record_create_user' ] = $this->recordUser;
106
+                if (empty($sets[$primary_key])) {
107
+                    if (!isset($sets['record_create_user'])) {
108
+                        $sets['record_create_user'] = $this->recordUser;
109 109
                     }
110 110
 
111
-                    if ( ! isset($sets[ 'record_create_timestamp' ])) {
112
-                        $sets[ 'record_create_timestamp' ] = $timestamp;
111
+                    if (!isset($sets['record_create_timestamp'])) {
112
+                        $sets['record_create_timestamp'] = $timestamp;
113 113
                     }
114 114
                 }
115 115
             }
116 116
         }
117 117
 
118
-        $sets[ 'record_update_user' ] = $this->recordUser;
118
+        $sets['record_update_user'] = $this->recordUser;
119 119
 
120
-        if ( ! isset($sets[ 'record_update_timestamp' ])) {
121
-            $sets[ 'record_update_timestamp' ] = $timestamp;
120
+        if (!isset($sets['record_update_timestamp'])) {
121
+            $sets['record_update_timestamp'] = $timestamp;
122 122
         }
123 123
     }
124 124
 
125 125
     protected function updateRecordSets(array &$sets)
126 126
     {
127
-        $sets[ 'record_status' ] = $this->recordStatus;
128
-        $sets[ 'record_update_user' ] = $this->recordUser;
127
+        $sets['record_status'] = $this->recordStatus;
128
+        $sets['record_update_user'] = $this->recordUser;
129 129
 
130 130
         $timestamp = $this->unixTimestamp === true ? strtotime(date('Y-m-d H:i:s')) : date('Y-m-d H:i:s');
131 131
 
132
-        if ( ! isset($sets[ 'record_update_timestamp' ])) {
133
-            $sets[ 'record_update_timestamp' ] = $timestamp;
132
+        if (!isset($sets['record_update_timestamp'])) {
133
+            $sets['record_update_timestamp'] = $timestamp;
134 134
         }
135 135
 
136 136
         if ($this->recordStatus === 'PUBLISH') {
137
-            $sets[ 'record_delete_timestamp' ] = null;
138
-            $sets[ 'record_delete_user' ] = null;
137
+            $sets['record_delete_timestamp'] = null;
138
+            $sets['record_delete_user'] = null;
139 139
         }
140 140
     }
141 141
 
Please login to merge, or discard this patch.
src/Models/Sql/Traits/ModifierTrait.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
         }
50 50
 
51 51
         if (method_exists($this, 'getRecordOrdering')) {
52
-            if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) {
53
-                $sets[ 'record_ordering' ] = $this->getRecordOrdering($table);
52
+            if ($this->recordOrdering === true && empty($sets['record_ordering'])) {
53
+                $sets['record_ordering'] = $this->getRecordOrdering($table);
54 54
             }
55 55
         }
56 56
 
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 
88 88
         if (empty($where)) {
89 89
             if (empty($this->primaryKeys)) {
90
-                $where[ $primaryKey ] = $sets[ $primaryKey ];
90
+                $where[$primaryKey] = $sets[$primaryKey];
91 91
             } else {
92 92
                 foreach ($this->primaryKeys as $primaryKey) {
93
-                    $where[ $primaryKey ] = $sets[ $primaryKey ];
93
+                    $where[$primaryKey] = $sets[$primaryKey];
94 94
                 }
95 95
             }
96 96
         }
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
         }
109 109
 
110 110
         if (method_exists($this, 'getRecordOrdering')) {
111
-            if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) {
112
-                $sets[ 'record_ordering' ] = $this->getRecordOrdering($table);
111
+            if ($this->recordOrdering === true && empty($sets['record_ordering'])) {
112
+                $sets['record_ordering'] = $this->getRecordOrdering($table);
113 113
             }
114 114
         }
115 115
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
             foreach ($sets as $set) {
134 134
                 $this->insertRecordSets($set);
135 135
 
136
-                if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) {
137
-                    $set[ 'record_ordering' ] = $this->getRecordOrdering($table);
136
+                if ($this->recordOrdering === true && empty($sets['record_ordering'])) {
137
+                    $set['record_ordering'] = $this->getRecordOrdering($table);
138 138
                 }
139 139
             }
140 140
         }
@@ -163,11 +163,11 @@  discard block
 block discarded – undo
163 163
 
164 164
         $where = [];
165 165
         if (empty($this->primaryKeys)) {
166
-            $where[ $primaryKey ] = $sets[ $primaryKey ];
167
-            $this->qb->where($primaryKey, $sets[ $primaryKey ]);
166
+            $where[$primaryKey] = $sets[$primaryKey];
167
+            $this->qb->where($primaryKey, $sets[$primaryKey]);
168 168
         } else {
169 169
             foreach ($this->primaryKeys as $primaryKey) {
170
-                $where[ $primaryKey ] = $sets[ $primaryKey ];
170
+                $where[$primaryKey] = $sets[$primaryKey];
171 171
             }
172 172
         }
173 173
 
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
             foreach ($sets as $set) {
180 180
                 $this->updateRecordSets($set);
181 181
 
182
-                if ($this->recordOrdering === true && empty($sets[ 'record_ordering' ])) {
183
-                    $set[ 'record_ordering' ] = $this->getRecordOrdering($table);
182
+                if ($this->recordOrdering === true && empty($sets['record_ordering'])) {
183
+                    $set['record_ordering'] = $this->getRecordOrdering($table);
184 184
                 }
185 185
             }
186 186
         }
@@ -219,19 +219,19 @@  discard block
 block discarded – undo
219 219
         $where = [];
220 220
 
221 221
         if (empty($this->primaryKeys)) {
222
-            $where[ $primaryKey ] = $id;
223
-            $sets[ $primaryKey ] = $id;
222
+            $where[$primaryKey] = $id;
223
+            $sets[$primaryKey] = $id;
224 224
         } elseif (is_array($id)) {
225 225
             foreach ($this->primaryKeys as $primaryKey) {
226
-                $where[ $primaryKey ] = $sets[ $primaryKey ];
227
-                $sets[ $primaryKey ] = $id[ $primaryKey ];
226
+                $where[$primaryKey] = $sets[$primaryKey];
227
+                $sets[$primaryKey] = $id[$primaryKey];
228 228
             }
229 229
         } else {
230 230
             foreach ($this->primaryKeys as $primaryKey) {
231
-                $where[ $primaryKey ] = $sets[ $primaryKey ];
231
+                $where[$primaryKey] = $sets[$primaryKey];
232 232
             }
233 233
 
234
-            $sets[ reset($this->primaryKeys) ] = $id;
234
+            $sets[reset($this->primaryKeys)] = $id;
235 235
         }
236 236
 
237 237
         // Reset Primary Keys
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
         $affectedRows = [];
282 282
 
283 283
         foreach ($ids as $id) {
284
-            $affectedRows[ $id ] = $this->trash($id);
284
+            $affectedRows[$id] = $this->trash($id);
285 285
         }
286 286
 
287 287
         return $affectedRows;
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
         $affectedRows = [];
295 295
 
296 296
         foreach ($ids as $id) {
297
-            $affectedRows[ $id ] = $this->trashBy($id, $where, $table);
297
+            $affectedRows[$id] = $this->trashBy($id, $where, $table);
298 298
         }
299 299
 
300 300
         return $affectedRows;
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 
305 305
     public function delete($id, $force = false, $table = null)
306 306
     {
307
-        if ((isset($table) AND is_bool($table)) OR ! isset($table)) {
307
+        if ((isset($table) AND is_bool($table)) OR !isset($table)) {
308 308
             $table = $this->table;
309 309
         }
310 310
 
@@ -312,13 +312,13 @@  discard block
 block discarded – undo
312 312
 
313 313
         $where = [];
314 314
         if (empty($this->primaryKeys)) {
315
-            $where[ $primaryKey ] = $id;
315
+            $where[$primaryKey] = $id;
316 316
         } elseif (is_array($id)) {
317 317
             foreach ($this->primaryKeys as $primaryKey) {
318
-                $where[ $primaryKey ] = $id[ $primaryKey ];
318
+                $where[$primaryKey] = $id[$primaryKey];
319 319
             }
320 320
         } else {
321
-            $where[ reset($this->primaryKeys) ] = $id;
321
+            $where[reset($this->primaryKeys)] = $id;
322 322
         }
323 323
 
324 324
         // Reset Primary Keys
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
         $affectedRows = [];
357 357
 
358 358
         foreach ($ids as $id) {
359
-            $affectedRows[ $id ] = $this->delete($id, $force, $table);
359
+            $affectedRows[$id] = $this->delete($id, $force, $table);
360 360
         }
361 361
 
362 362
         return $affectedRows;
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
         $affectedRows = [];
368 368
 
369 369
         foreach ($ids as $id) {
370
-            $affectedRows[ $id ] = $this->deleteBy($id, $where, $force, $table);
370
+            $affectedRows[$id] = $this->deleteBy($id, $where, $force, $table);
371 371
         }
372 372
 
373 373
         return $affectedRows;
@@ -384,19 +384,19 @@  discard block
 block discarded – undo
384 384
         $where = [];
385 385
 
386 386
         if (empty($this->primaryKeys)) {
387
-            $where[ $primaryKey ] = $id;
388
-            $sets[ $primaryKey ] = $id;
387
+            $where[$primaryKey] = $id;
388
+            $sets[$primaryKey] = $id;
389 389
         } elseif (is_array($id)) {
390 390
             foreach ($this->primaryKeys as $primaryKey) {
391
-                $where[ $primaryKey ] = $sets[ $primaryKey ];
392
-                $sets[ $primaryKey ] = $id[ $primaryKey ];
391
+                $where[$primaryKey] = $sets[$primaryKey];
392
+                $sets[$primaryKey] = $id[$primaryKey];
393 393
             }
394 394
         } else {
395 395
             foreach ($this->primaryKeys as $primaryKey) {
396
-                $where[ $primaryKey ] = $sets[ $primaryKey ];
396
+                $where[$primaryKey] = $sets[$primaryKey];
397 397
             }
398 398
 
399
-            $sets[ reset($this->primaryKeys) ] = $id;
399
+            $sets[reset($this->primaryKeys)] = $id;
400 400
         }
401 401
 
402 402
         // Reset Primary Keys
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
         $affectedRows = [];
440 440
 
441 441
         foreach ($ids as $id) {
442
-            $affectedRows[ $id ] = $this->publish($id, $table);
442
+            $affectedRows[$id] = $this->publish($id, $table);
443 443
         }
444 444
 
445 445
         return $affectedRows;
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
         $affectedRows = [];
453 453
 
454 454
         foreach ($ids as $id) {
455
-            $affectedRows[ $id ] = $this->publishBy($id, $where, $table);
455
+            $affectedRows[$id] = $this->publishBy($id, $where, $table);
456 456
         }
457 457
 
458 458
         return $affectedRows;
Please login to merge, or discard this patch.
src/Models/Sql/Traits/HierarchicalTrait.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                         ]);
71 71
                 }
72 72
 
73
-                $update[ 'id' ] = $row->id;
73
+                $update['id'] = $row->id;
74 74
 
75 75
                 if ($this->hasChild($row->id)) {
76 76
                     $right = $this->rebuild($row->id, $right, $depth + 1);
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
                         ->update($update = [
81 81
                             'record_right' => $right,
82 82
                         ]);
83
-                    $update[ 'id' ] = $row->id;
83
+                    $update['id'] = $row->id;
84 84
                 }
85 85
 
86 86
                 $i++;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             ->get();
110 110
 
111 111
         if ($result) {
112
-            return (bool)($result->count() == 0 ? false : true);
112
+            return (bool) ($result->count() == 0 ? false : true);
113 113
         }
114 114
 
115 115
         return false;
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
             ->get();
162 162
 
163 163
         if ($result) {
164
-            return (bool)($result->count() == 0 ? false : true);
164
+            return (bool) ($result->count() == 0 ? false : true);
165 165
         }
166 166
 
167 167
         return false;
Please login to merge, or discard this patch.
src/Models/Sql/DataObjects/Result.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
             $ormResult = new \SplFixedArray($result->count());
45 45
 
46 46
             foreach ($result as $key => $row) {
47
-                $ormResult[ $key ] = new Result\Row($row, $model);
47
+                $ormResult[$key] = new Result\Row($row, $model);
48 48
             }
49 49
 
50 50
             parent::__construct($ormResult->toArray());
Please login to merge, or discard this patch.
src/Models/Sql/DataObjects/Result/Row.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
     {
45 45
         $this->model = new SplClassInfo($model);
46 46
 
47
-        if ( ! models()->has($this->model->getParameter())) {
47
+        if (!models()->has($this->model->getParameter())) {
48 48
             models()->register($this->model->getParameter(), $model);
49 49
         }
50 50
 
Please login to merge, or discard this patch.
src/autoload.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @param $className
17 17
  */
18 18
 spl_autoload_register(
19
-    function ($className) {
19
+    function($className) {
20 20
         if (strpos($className, 'O2System\Reactor\\') === false) {
21 21
             return;
22 22
         }
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
         if ($lastNsPos = strripos($className, '\\')) {
28 28
             $namespace = substr($className, 0, $lastNsPos);
29 29
             $className = substr($className, $lastNsPos + 1);
30
-            $filePath = $namespace . '\\';
30
+            $filePath = $namespace.'\\';
31 31
         }
32 32
 
33
-        $filePath .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
33
+        $filePath .= str_replace('_', DIRECTORY_SEPARATOR, $className).'.php';
34 34
 
35 35
         // Fixed Path
36
-        $filePath = str_replace('O2System\Reactor\\', __DIR__ . DIRECTORY_SEPARATOR, $filePath);
36
+        $filePath = str_replace('O2System\Reactor\\', __DIR__.DIRECTORY_SEPARATOR, $filePath);
37 37
         $filePath = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $filePath);
38 38
 
39 39
         if (file_exists($filePath)) {
Please login to merge, or discard this patch.
src/Helpers/Security.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 // ------------------------------------------------------------------------
18 18
 
19
-if ( ! function_exists('strip_image_tags')) {
19
+if (!function_exists('strip_image_tags')) {
20 20
     /**
21 21
      * strip_image_tags
22 22
      *
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
 //--------------------------------------------------------------------
43 43
 
44
-if ( ! function_exists('strip_cdata')) {
44
+if (!function_exists('strip_cdata')) {
45 45
     /**
46 46
      * strip_cdata
47 47
      *
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
     {
56 56
         preg_match_all('/<!\[cdata\[(.*?)\]\]>/is', $source_code, $matches);
57 57
 
58
-        return str_replace($matches[ 0 ], $matches[ 1 ], $source_code);
58
+        return str_replace($matches[0], $matches[1], $source_code);
59 59
     }
60 60
 }
61 61
 // ------------------------------------------------------------------------
62 62
 
63
-if ( ! function_exists('strips_all_tags')) {
63
+if (!function_exists('strips_all_tags')) {
64 64
     /**
65 65
      * strips_all_tags
66 66
      *
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
 // ------------------------------------------------------------------------
86 86
 
87
-if ( ! function_exists('strips_tags')) {
87
+if (!function_exists('strips_tags')) {
88 88
     /**
89 89
      * strips_tags
90 90
      *
@@ -100,52 +100,52 @@  discard block
 block discarded – undo
100 100
     function strips_tags($source_code, $disallowed_tags = 'script|style|noframes|select|option', $allowed_tags = '')
101 101
     {
102 102
         //prep the string
103
-        $source_code = ' ' . $source_code;
103
+        $source_code = ' '.$source_code;
104 104
 
105 105
         //initialize keep tag logic
106 106
         if (strlen($allowed_tags) > 0) {
107 107
             $k = explode('|', $allowed_tags);
108 108
             for ($i = 0; $i < count($k); $i++) {
109
-                $source_code = str_replace('<' . $k[ $i ], '[{(' . $k[ $i ], $source_code);
110
-                $source_code = str_replace('</' . $k[ $i ], '[{(/' . $k[ $i ], $source_code);
109
+                $source_code = str_replace('<'.$k[$i], '[{('.$k[$i], $source_code);
110
+                $source_code = str_replace('</'.$k[$i], '[{(/'.$k[$i], $source_code);
111 111
             }
112 112
         }
113 113
         //begin removal
114 114
         //remove comment blocks
115 115
         while (stripos($source_code, '<!--') > 0) {
116
-            $pos[ 1 ] = stripos($source_code, '<!--');
117
-            $pos[ 2 ] = stripos($source_code, '-->', $pos[ 1 ]);
118
-            $len[ 1 ] = $pos[ 2 ] - $pos[ 1 ] + 3;
119
-            $x = substr($source_code, $pos[ 1 ], $len[ 1 ]);
116
+            $pos[1] = stripos($source_code, '<!--');
117
+            $pos[2] = stripos($source_code, '-->', $pos[1]);
118
+            $len[1] = $pos[2] - $pos[1] + 3;
119
+            $x = substr($source_code, $pos[1], $len[1]);
120 120
             $source_code = str_replace($x, '', $source_code);
121 121
         }
122 122
         //remove tags with content between them
123 123
         if (strlen($disallowed_tags) > 0) {
124 124
             $e = explode('|', $disallowed_tags);
125 125
             for ($i = 0; $i < count($e); $i++) {
126
-                while (stripos($source_code, '<' . $e[ $i ]) > 0) {
127
-                    $len[ 1 ] = strlen('<' . $e[ $i ]);
128
-                    $pos[ 1 ] = stripos($source_code, '<' . $e[ $i ]);
129
-                    $pos[ 2 ] = stripos($source_code, $e[ $i ] . '>', $pos[ 1 ] + $len[ 1 ]);
130
-                    $len[ 2 ] = $pos[ 2 ] - $pos[ 1 ] + $len[ 1 ];
131
-                    $x = substr($source_code, $pos[ 1 ], $len[ 2 ]);
126
+                while (stripos($source_code, '<'.$e[$i]) > 0) {
127
+                    $len[1] = strlen('<'.$e[$i]);
128
+                    $pos[1] = stripos($source_code, '<'.$e[$i]);
129
+                    $pos[2] = stripos($source_code, $e[$i].'>', $pos[1] + $len[1]);
130
+                    $len[2] = $pos[2] - $pos[1] + $len[1];
131
+                    $x = substr($source_code, $pos[1], $len[2]);
132 132
                     $source_code = str_replace($x, '', $source_code);
133 133
                 }
134 134
             }
135 135
         }
136 136
         //remove remaining tags
137 137
         while (stripos($source_code, '<') > 0) {
138
-            $pos[ 1 ] = stripos($source_code, '<');
139
-            $pos[ 2 ] = stripos($source_code, '>', $pos[ 1 ]);
140
-            $len[ 1 ] = $pos[ 2 ] - $pos[ 1 ] + 1;
141
-            $x = substr($source_code, $pos[ 1 ], $len[ 1 ]);
138
+            $pos[1] = stripos($source_code, '<');
139
+            $pos[2] = stripos($source_code, '>', $pos[1]);
140
+            $len[1] = $pos[2] - $pos[1] + 1;
141
+            $x = substr($source_code, $pos[1], $len[1]);
142 142
             $source_code = str_replace($x, '', $source_code);
143 143
         }
144 144
         //finalize keep tag
145 145
         if (strlen($allowed_tags) > 0) {
146 146
             for ($i = 0; $i < count($k); $i++) {
147
-                $source_code = str_replace('[{(' . $k[ $i ], '<' . $k[ $i ], $source_code);
148
-                $source_code = str_replace('[{(/' . $k[ $i ], '</' . $k[ $i ], $source_code);
147
+                $source_code = str_replace('[{('.$k[$i], '<'.$k[$i], $source_code);
148
+                $source_code = str_replace('[{(/'.$k[$i], '</'.$k[$i], $source_code);
149 149
             }
150 150
         }
151 151
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 // ------------------------------------------------------------------------
157 157
 
158
-if ( ! function_exists('strip_word_doc')) {
158
+if (!function_exists('strip_word_doc')) {
159 159
     /**
160 160
      * strip_word_doc
161 161
      *
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 
253 253
 //--------------------------------------------------------------------
254 254
 
255
-if ( ! function_exists('strip_slashes_recursive')) {
255
+if (!function_exists('strip_slashes_recursive')) {
256 256
     /**
257 257
      * strip_slashes_recursive
258 258
      *
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
 // ------------------------------------------------------------------------
285 285
 
286
-if ( ! function_exists('strip_comments')) {
286
+if (!function_exists('strip_comments')) {
287 287
     /**
288 288
      * strip_comments
289 289
      *
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 
302 302
 // ------------------------------------------------------------------------
303 303
 
304
-if ( ! function_exists('clean_white_space')) {
304
+if (!function_exists('clean_white_space')) {
305 305
     /**
306 306
      * clean_white_space
307 307
      *
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 
322 322
 // ------------------------------------------------------------------------
323 323
 
324
-if ( ! function_exists('encode_php_tags')) {
324
+if (!function_exists('encode_php_tags')) {
325 325
     /**
326 326
      * encode_php_tags
327 327
      *
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 
340 340
 // ------------------------------------------------------------------------
341 341
 
342
-if ( ! function_exists('escape_html')) {
342
+if (!function_exists('escape_html')) {
343 343
     /**
344 344
      * escape_html
345 345
      *
Please login to merge, or discard this patch.
src/Helpers/Datetime.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1556,10 +1556,12 @@
 block discarded – undo
1556 1556
         }
1557 1557
         $range[] = $from->format($format);
1558 1558
 
1559
-        if (is_int($arg)) // Day intervals
1559
+        if (is_int($arg)) {
1560
+            // Day intervals
1560 1561
         {
1561 1562
             do {
1562 1563
                 $from->modify('+1 day');
1564
+        }
1563 1565
                 $range[] = $from->format($format);
1564 1566
             } while (--$arg > 0);
1565 1567
         } else // end date UNIX timestamp
Please login to merge, or discard this patch.
Spacing   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 // ------------------------------------------------------------------------
12 12
 
13
-if ( ! function_exists('timestamp')) {
13
+if (!function_exists('timestamp')) {
14 14
     /**
15 15
      * Timestamp
16 16
      *
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     function timestamp($timestamp = null)
24 24
     {
25
-        if ( ! isset($timestamp) OR $timestamp === 'NOW') {
25
+        if (!isset($timestamp) OR $timestamp === 'NOW') {
26 26
             $timestamp = now();
27 27
         } elseif (is_string($timestamp)) {
28 28
             $timestamp = strtotime($timestamp);
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 }
34 34
 // ------------------------------------------------------------------------
35 35
 
36
-if ( ! function_exists('unix_timestamp')) {
36
+if (!function_exists('unix_timestamp')) {
37 37
     /**
38 38
      * Unix Timestamp
39 39
      *
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
      */
46 46
     function unix_timestamp($timestamp = null)
47 47
     {
48
-        if ( ! isset($timestamp) OR $timestamp === 'NOW') {
48
+        if (!isset($timestamp) OR $timestamp === 'NOW') {
49 49
             return now();
50 50
         } elseif (is_string($timestamp)) {
51 51
             return strtotime($timestamp);
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
 // ------------------------------------------------------------------------
61 61
 
62
-if ( ! function_exists('format_date')) {
62
+if (!function_exists('format_date')) {
63 63
     /**
64 64
      * Day Date Time Functions
65 65
      *
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         $output = $format;
92 92
 
93 93
         foreach ($date as $replace => $value) {
94
-            $output = str_ireplace('%' . $replace, $value, $output);
94
+            $output = str_ireplace('%'.$replace, $value, $output);
95 95
         }
96 96
 
97 97
         return $output;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 }
100 100
 // ------------------------------------------------------------------------
101 101
 
102
-if ( ! function_exists('parse_date')) {
102
+if (!function_exists('parse_date')) {
103 103
     /**
104 104
      * Parse Date into Array
105 105
      *
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 }
154 154
 // ------------------------------------------------------------------------
155 155
 
156
-if ( ! function_exists('day_name')) {
156
+if (!function_exists('day_name')) {
157 157
     /**
158 158
      * Day Name in Languages
159 159
      *
@@ -176,12 +176,12 @@  discard block
 block discarded – undo
176 176
 
177 177
         language()->loadFile('calendar');
178 178
 
179
-        return language()->getLine(strtoupper('CAL_' . date($type, $timestamp)));
179
+        return language()->getLine(strtoupper('CAL_'.date($type, $timestamp)));
180 180
     }
181 181
 }
182 182
 // ------------------------------------------------------------------------
183 183
 
184
-if ( ! function_exists('month_name')) {
184
+if (!function_exists('month_name')) {
185 185
     /**
186 186
      * Month Name in Languages
187 187
      *
@@ -203,12 +203,12 @@  discard block
 block discarded – undo
203 203
                 )));
204 204
         language()->loadFile('calendar');
205 205
 
206
-        return language()->getLine(strtoupper('CAL_' . date($type, $timestamp)));
206
+        return language()->getLine(strtoupper('CAL_'.date($type, $timestamp)));
207 207
     }
208 208
 }
209 209
 // ------------------------------------------------------------------------
210 210
 
211
-if ( ! function_exists('part_time')) {
211
+if (!function_exists('part_time')) {
212 212
     /**
213 213
      * Part Time in Languages
214 214
      *
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 }
255 255
 // ------------------------------------------------------------------------
256 256
 
257
-if ( ! function_exists('string_time_elapsed')) {
257
+if (!function_exists('string_time_elapsed')) {
258 258
     /**
259 259
      * Day Date Time in String Format
260 260
      *
@@ -292,25 +292,25 @@  discard block
 block discarded – undo
292 292
 
293 293
         foreach ($string as $key => &$value) {
294 294
             if ($diff->$key) {
295
-                $value = $diff->$key . ' ' . $value . ($diff->$key > 1 && language()->getDefaultLocale() === 'en' ? 's' : '');
295
+                $value = $diff->$key.' '.$value.($diff->$key > 1 && language()->getDefaultLocale() === 'en' ? 's' : '');
296 296
             } else {
297
-                unset($string[ $key ]);
297
+                unset($string[$key]);
298 298
             }
299 299
         }
300 300
 
301
-        if ( ! $full) {
301
+        if (!$full) {
302 302
             $string = array_slice($string, 0, 1);
303 303
         }
304 304
 
305 305
         return $string ? implode(', ',
306
-                $string) . ' ' . language()->getLine('DATE_AGO') : language()->getLine('DATE_JUST_NOW');
306
+                $string).' '.language()->getLine('DATE_AGO') : language()->getLine('DATE_JUST_NOW');
307 307
 
308 308
     }
309 309
 }
310 310
 
311 311
 // ------------------------------------------------------------------------
312 312
 
313
-if ( ! function_exists('dates_between')) {
313
+if (!function_exists('dates_between')) {
314 314
     /**
315 315
      * Date Between
316 316
      *
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
     function dates_between($start_date, $end_date, $format = 'Y-m-d')
328 328
     {
329 329
         $day = 60 * 60 * 24;
330
-        $start_date = (! is_numeric($start_date) ? strtotime($start_date) : $start_date);
331
-        $end_date = (! is_numeric($end_date) ? strtotime($end_date) : $end_date);
330
+        $start_date = (!is_numeric($start_date) ? strtotime($start_date) : $start_date);
331
+        $end_date = (!is_numeric($end_date) ? strtotime($end_date) : $end_date);
332 332
 
333 333
         $days_diff = round(
334 334
             ($end_date - $start_date) / $day
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 
363 363
 // ------------------------------------------------------------------------
364 364
 
365
-if ( ! function_exists('time_range')) {
365
+if (!function_exists('time_range')) {
366 366
     /**
367 367
      * Time Range List
368 368
      *
@@ -378,15 +378,15 @@  discard block
 block discarded – undo
378 378
         $time = [];
379 379
         $minutes = range(0, (60 - $step), $step);
380 380
         for ($i = 0; $i <= 23; $i++) {
381
-            $hour = (strlen($i) == 1 ? '0' . $i : $i);
381
+            $hour = (strlen($i) == 1 ? '0'.$i : $i);
382 382
             foreach ($minutes as $minute) {
383
-                $hours = $hour . ':' . (strlen($minute) == 1 ? '0' . $minute : $minute);
383
+                $hours = $hour.':'.(strlen($minute) == 1 ? '0'.$minute : $minute);
384 384
                 $time_12 = date("h:i a", strtotime($hours));
385 385
                 $time_24 = $hours;
386 386
                 if ($mode == 12) {
387
-                    $time[ $time_12 ] = $time_12;
387
+                    $time[$time_12] = $time_12;
388 388
                 } elseif ($mode == 24) {
389
-                    $time[ $time_24 ] = $time_24;
389
+                    $time[$time_24] = $time_24;
390 390
                 }
391 391
             }
392 392
         }
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 
398 398
 // ------------------------------------------------------------------------
399 399
 
400
-if ( ! function_exists('calculate_days')) {
400
+if (!function_exists('calculate_days')) {
401 401
     /**
402 402
      * calculate_days
403 403
      *
@@ -415,8 +415,8 @@  discard block
 block discarded – undo
415 415
         $end_date = (is_numeric($end_date) ? date('d-m-Y', $end_date) : $end_date);
416 416
         $hour = (is_numeric($hour) ? date('h:i:s a', $hour) : $hour);
417 417
 
418
-        $start_date = $start_date . ' ' . $hour;
419
-        $end_date = $end_date . ' ' . $hour;
418
+        $start_date = $start_date.' '.$hour;
419
+        $end_date = $end_date.' '.$hour;
420 420
 
421 421
         $start_date = strtotime($start_date);
422 422
         $end_date = strtotime($end_date);
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
 }
430 430
 // ------------------------------------------------------------------------
431 431
 
432
-if ( ! function_exists('calculate_weeks')) {
432
+if (!function_exists('calculate_weeks')) {
433 433
     /**
434 434
      * calculate_weeks
435 435
      *
@@ -447,8 +447,8 @@  discard block
 block discarded – undo
447 447
         $end_date = (is_numeric($end_date) ? date('d-m-Y', $end_date) : $end_date);
448 448
         $hour = (is_numeric($hour) ? date('h:i:s a', $hour) : $hour);
449 449
 
450
-        $start_date = $start_date . ' ' . $hour;
451
-        $end_date = $end_date . ' ' . $hour;
450
+        $start_date = $start_date.' '.$hour;
451
+        $end_date = $end_date.' '.$hour;
452 452
 
453 453
         $start_date = strtotime($start_date);
454 454
         $end_date = strtotime($end_date);
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 }
462 462
 // ------------------------------------------------------------------------
463 463
 
464
-if ( ! function_exists('is_weekend')) {
464
+if (!function_exists('is_weekend')) {
465 465
     /**
466 466
      * Is Weekend
467 467
      *
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
      */
474 474
     function is_weekend($date)
475 475
     {
476
-        $date = (! is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date);
476
+        $date = (!is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date);
477 477
         $date = date('D', $date);
478 478
 
479 479
         if ($date == 'Sat' OR $date == 'Sun') {
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 }
486 486
 // ------------------------------------------------------------------------
487 487
 
488
-if ( ! function_exists('is_weekday')) {
488
+if (!function_exists('is_weekday')) {
489 489
     /**
490 490
      * Is Week Day
491 491
      *
@@ -497,10 +497,10 @@  discard block
 block discarded – undo
497 497
      */
498 498
     function is_weekday($date)
499 499
     {
500
-        $date = (! is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date);
500
+        $date = (!is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date);
501 501
         $date = date('D', $date);
502 502
 
503
-        if ( ! in_array($date, ['Sat', 'Sun'])) {
503
+        if (!in_array($date, ['Sat', 'Sun'])) {
504 504
             return true;
505 505
         }
506 506
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 }
510 510
 // ------------------------------------------------------------------------
511 511
 
512
-if ( ! function_exists('get_age')) {
512
+if (!function_exists('get_age')) {
513 513
     /**
514 514
      * Get Age
515 515
      *
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
      */
523 523
     function get_age($birthday, $return = 'years')
524 524
     {
525
-        $birthday = (! is_numeric($birthday) ? strtotime(str_replace('/', '-', $birthday)) : $birthday);
525
+        $birthday = (!is_numeric($birthday) ? strtotime(str_replace('/', '-', $birthday)) : $birthday);
526 526
 
527 527
         $birthday = new DateTime(date('Y-m-d', $birthday));
528 528
         $now = new DateTime(date('Y-m-d'));
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
         ];
538 538
 
539 539
         if (array_key_exists($return, $available)) {
540
-            return $interval->{$available[ $return ]};
540
+            return $interval->{$available[$return]};
541 541
         } elseif (isset($interval->{$return})) {
542 542
             return $interval->{$return};
543 543
         }
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 }
548 548
 // ------------------------------------------------------------------------
549 549
 
550
-if ( ! function_exists('get_tenure')) {
550
+if (!function_exists('get_tenure')) {
551 551
     /**
552 552
      * get_tenure
553 553
      *
@@ -573,15 +573,15 @@  discard block
 block discarded – undo
573 573
         $dateInterval = $date_start->diff($date_end);
574 574
 
575 575
         return strtolower($dateInterval->format(
576
-            '%y ' . language()->getLine('DATE_YEARS') .
577
-            ' &mdash; %m ' . language()->getLine('DATE_MONTHS') .
578
-            ' &mdash; %d ' . language()->getLine('DATE_DAYS')));
576
+            '%y '.language()->getLine('DATE_YEARS').
577
+            ' &mdash; %m '.language()->getLine('DATE_MONTHS').
578
+            ' &mdash; %d '.language()->getLine('DATE_DAYS')));
579 579
     }
580 580
 }
581 581
 
582 582
 // ------------------------------------------------------------------------
583 583
 
584
-if ( ! function_exists('time_breakdown')) {
584
+if (!function_exists('time_breakdown')) {
585 585
     /**
586 586
      * Time Breakdown
587 587
      *
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
      */
594 594
     function time_breakdown($time)
595 595
     {
596
-        if ( ! is_numeric($time)) {
596
+        if (!is_numeric($time)) {
597 597
             $time = strtotime($time);
598 598
         }
599 599
         $currentTime = time();
@@ -622,8 +622,8 @@  discard block
 block discarded – undo
622 622
             }
623 623
             foreach ($periods as $period => $seconds_in_period) {
624 624
                 if ($seconds >= $seconds_in_period) {
625
-                    $durations[ $period ] = floor($seconds / $seconds_in_period);
626
-                    $seconds -= $durations[ $period ] * $seconds_in_period;
625
+                    $durations[$period] = floor($seconds / $seconds_in_period);
626
+                    $seconds -= $durations[$period] * $seconds_in_period;
627 627
                 }
628 628
             }
629 629
         }
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 }
634 634
 // ------------------------------------------------------------------------
635 635
 
636
-if ( ! function_exists('sec2hms')) {
636
+if (!function_exists('sec2hms')) {
637 637
     /**
638 638
      * Second to Miliseconds
639 639
      *
@@ -645,12 +645,12 @@  discard block
 block discarded – undo
645 645
     {
646 646
         $str = '';
647 647
         $hours = intval(intval($num_secs) / 3600);
648
-        $str .= $hours . ':';
648
+        $str .= $hours.':';
649 649
         $minutes = intval(((intval($num_secs) / 60) % 60));
650 650
         if ($minutes < 10) {
651 651
             $str .= '0';
652 652
         }
653
-        $str .= $minutes . ':';
653
+        $str .= $minutes.':';
654 654
         $seconds = intval(intval(($num_secs % 60)));
655 655
         if ($seconds < 10) {
656 656
             $str .= '0';
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 }
663 663
 // ------------------------------------------------------------------------
664 664
 
665
-if ( ! function_exists('add_time_duration')) {
665
+if (!function_exists('add_time_duration')) {
666 666
     /**
667 667
      * Add Time Duration
668 668
      *
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
      */
675 675
     function add_time_duration($start_time, $duration, $return = 'time')
676 676
     {
677
-        $start_time = (! is_numeric($start_time) ? strtotime($start_time) : $start_time);
677
+        $start_time = (!is_numeric($start_time) ? strtotime($start_time) : $start_time);
678 678
         $duration = $duration * 60 * 60; // (x) hours * 60 minutes * 60 seconds
679 679
 
680 680
         $add_time = $start_time + $duration;
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 }
689 689
 // ------------------------------------------------------------------------
690 690
 
691
-if ( ! function_exists('calculate_hours')) {
691
+if (!function_exists('calculate_hours')) {
692 692
     /**
693 693
      * Calculate Hours
694 694
      *
@@ -700,8 +700,8 @@  discard block
 block discarded – undo
700 700
      */
701 701
     function calculate_hours($start_time, $end_time, $return = 'time')
702 702
     {
703
-        $start_time = (! is_numeric($start_time) ? strtotime($start_time) : $start_time);
704
-        $end_time = (! is_numeric($end_time) ? strtotime($end_time) : $end_time);
703
+        $start_time = (!is_numeric($start_time) ? strtotime($start_time) : $start_time);
704
+        $end_time = (!is_numeric($end_time) ? strtotime($end_time) : $end_time);
705 705
 
706 706
         // Times Difference
707 707
         $difference = $end_time - $start_time;
@@ -719,10 +719,10 @@  discard block
 block discarded – undo
719 719
         $final_minutes = round($minutes);
720 720
 
721 721
         if ($return === 'time') {
722
-            $final_hours = ($final_hours < 10 ? '0' . $final_hours : $final_hours);
723
-            $final_minutes = ($final_minutes < 10 ? '0' . $final_minutes : $final_minutes);
722
+            $final_hours = ($final_hours < 10 ? '0'.$final_hours : $final_hours);
723
+            $final_minutes = ($final_minutes < 10 ? '0'.$final_minutes : $final_minutes);
724 724
 
725
-            return $final_hours . ':' . $final_minutes;
725
+            return $final_hours.':'.$final_minutes;
726 726
         } elseif ($return === 'hours') {
727 727
             return $final_hours + ($final_minutes / 60);
728 728
         }
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 }
731 731
 // ------------------------------------------------------------------------
732 732
 
733
-if ( ! function_exists('time_difference')) {
733
+if (!function_exists('time_difference')) {
734 734
     /**
735 735
      * Time Difference
736 736
      *
@@ -742,8 +742,8 @@  discard block
 block discarded – undo
742 742
      */
743 743
     function time_difference($start_time, $end_time, $return = 'array')
744 744
     {
745
-        $start_time = (! is_numeric($start_time) ? strtotime($start_time) : $start_time);
746
-        $end_time = (! is_numeric($end_time) ? strtotime($end_time) : $end_time);
745
+        $start_time = (!is_numeric($start_time) ? strtotime($start_time) : $start_time);
746
+        $end_time = (!is_numeric($end_time) ? strtotime($end_time) : $end_time);
747 747
 
748 748
         // Times Difference
749 749
         $difference = $end_time - $start_time;
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
 }
759 759
 // ------------------------------------------------------------------------
760 760
 
761
-if ( ! function_exists('weeks_in_month')) {
761
+if (!function_exists('weeks_in_month')) {
762 762
     /**
763 763
      * @param null $month
764 764
      * @param null $year
@@ -769,13 +769,13 @@  discard block
 block discarded – undo
769 769
     {
770 770
         // Start Date in Month
771 771
         $start_date_month = mktime(0, 0, 0, $month, 1, $year);
772
-        $start_week_month = (int)date('W', $start_date_month);
772
+        $start_week_month = (int) date('W', $start_date_month);
773 773
 
774 774
         $amount_day = days_in_month($month, $year);
775 775
 
776 776
         // Finish Date in onth
777 777
         $finish_date_month = mktime(0, 0, 0, $month, $amount_day, $year);
778
-        $finish_week_month = (int)date('W', $finish_date_month);
778
+        $finish_week_month = (int) date('W', $finish_date_month);
779 779
 
780 780
         $amount_week = $finish_week_month - $start_week_month + 1;
781 781
 
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 }
785 785
 // ------------------------------------------------------------------------
786 786
 
787
-if ( ! function_exists('monday_of_week')) {
787
+if (!function_exists('monday_of_week')) {
788 788
     /**
789 789
      * Monday of Week
790 790
      *
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 }
810 810
 // ------------------------------------------------------------------------
811 811
 
812
-if ( ! function_exists('week_number_of_month')) {
812
+if (!function_exists('week_number_of_month')) {
813 813
     /**
814 814
      * Week Number of Month
815 815
      *
@@ -826,11 +826,11 @@  discard block
 block discarded – undo
826 826
 
827 827
         // Start Date in Month
828 828
         $start_date_month = mktime(0, 0, 0, $month, 1, $year);
829
-        $start_week_month = (int)date('W', $start_date_month);
829
+        $start_week_month = (int) date('W', $start_date_month);
830 830
 
831 831
         // Date Search
832 832
         $date_search = mktime(0, 0, 0, $month, $date, $year);
833
-        $date_week_search = (int)date('W', $date_search);
833
+        $date_week_search = (int) date('W', $date_search);
834 834
 
835 835
         $number_of_week = $date_week_search - $start_week_month + 1;
836 836
 
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
 }
840 840
 // ------------------------------------------------------------------------
841 841
 
842
-if ( ! function_exists('format_time')) {
842
+if (!function_exists('format_time')) {
843 843
     /**
844 844
      * Format Time from seconds
845 845
      *
@@ -868,12 +868,12 @@  discard block
 block discarded – undo
868 868
             $seconds -= $minutes * 60;
869 869
         }
870 870
 
871
-        $format[ 'days' ] = $days;
872
-        $format[ 'years' ] = $years;
873
-        $format[ 'months' ] = $months;
874
-        $format[ 'hours' ] = $hours;
875
-        $format[ 'minutes' ] = $minutes;
876
-        $format[ 'seconds' ] = $seconds;
871
+        $format['days'] = $days;
872
+        $format['years'] = $years;
873
+        $format['months'] = $months;
874
+        $format['hours'] = $hours;
875
+        $format['minutes'] = $minutes;
876
+        $format['seconds'] = $seconds;
877 877
 
878 878
         return new \O2System\Spl\DataStructures\SplArrayObject($format);
879 879
     }
@@ -928,7 +928,7 @@  discard block
 block discarded – undo
928 928
 
929 929
 // ------------------------------------------------------------------------
930 930
 
931
-if ( ! function_exists('now')) {
931
+if (!function_exists('now')) {
932 932
     /**
933 933
      * now
934 934
      *
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
 
961 961
 // ------------------------------------------------------------------------
962 962
 
963
-if ( ! function_exists('mdate')) {
963
+if (!function_exists('mdate')) {
964 964
     /**
965 965
      * Convert MySQL Style Datecodes
966 966
      *
@@ -998,7 +998,7 @@  discard block
 block discarded – undo
998 998
 
999 999
 // ------------------------------------------------------------------------
1000 1000
 
1001
-if ( ! function_exists('standard_date')) {
1001
+if (!function_exists('standard_date')) {
1002 1002
     /**
1003 1003
      * Standard Date
1004 1004
      *
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
 
1037 1037
 // ------------------------------------------------------------------------
1038 1038
 
1039
-if ( ! function_exists('timespan')) {
1039
+if (!function_exists('timespan')) {
1040 1040
     /**
1041 1041
      * Timespan
1042 1042
      *
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
         $years = floor($seconds / 31557600);
1064 1064
 
1065 1065
         if ($years > 0) {
1066
-            $str[] = $years . ' ' . language()->getLine($years > 1 ? 'DATE_YEARS' : 'DATE_YEAR');
1066
+            $str[] = $years.' '.language()->getLine($years > 1 ? 'DATE_YEARS' : 'DATE_YEAR');
1067 1067
         }
1068 1068
 
1069 1069
         $seconds -= $years * 31557600;
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
 
1072 1072
         if (count($str) < $units && ($years > 0 OR $months > 0)) {
1073 1073
             if ($months > 0) {
1074
-                $str[] = $months . ' ' . language()->getLine($months > 1 ? 'DATE_MONTHS' : 'DATE_MONTH');
1074
+                $str[] = $months.' '.language()->getLine($months > 1 ? 'DATE_MONTHS' : 'DATE_MONTH');
1075 1075
             }
1076 1076
 
1077 1077
             $seconds -= $months * 2629743;
@@ -1081,7 +1081,7 @@  discard block
 block discarded – undo
1081 1081
 
1082 1082
         if (count($str) < $units && ($years > 0 OR $months > 0 OR $weeks > 0)) {
1083 1083
             if ($weeks > 0) {
1084
-                $str[] = $weeks . ' ' . language()->getLine($weeks > 1 ? 'DATE_WEEKS' : 'DATE_WEEK');
1084
+                $str[] = $weeks.' '.language()->getLine($weeks > 1 ? 'DATE_WEEKS' : 'DATE_WEEK');
1085 1085
             }
1086 1086
 
1087 1087
             $seconds -= $weeks * 604800;
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 
1092 1092
         if (count($str) < $units && ($months > 0 OR $weeks > 0 OR $days > 0)) {
1093 1093
             if ($days > 0) {
1094
-                $str[] = $days . ' ' . language()->getLine($days > 1 ? 'DATE_DAYS' : 'DATE_DAY');
1094
+                $str[] = $days.' '.language()->getLine($days > 1 ? 'DATE_DAYS' : 'DATE_DAY');
1095 1095
             }
1096 1096
 
1097 1097
             $seconds -= $days * 86400;
@@ -1101,7 +1101,7 @@  discard block
 block discarded – undo
1101 1101
 
1102 1102
         if (count($str) < $units && ($days > 0 OR $hours > 0)) {
1103 1103
             if ($hours > 0) {
1104
-                $str[] = $hours . ' ' . language()->getLine($hours > 1 ? 'DATE_HOURS' : 'DATE_HOUR');
1104
+                $str[] = $hours.' '.language()->getLine($hours > 1 ? 'DATE_HOURS' : 'DATE_HOUR');
1105 1105
             }
1106 1106
 
1107 1107
             $seconds -= $hours * 3600;
@@ -1111,14 +1111,14 @@  discard block
 block discarded – undo
1111 1111
 
1112 1112
         if (count($str) < $units && ($days > 0 OR $hours > 0 OR $minutes > 0)) {
1113 1113
             if ($minutes > 0) {
1114
-                $str[] = $minutes . ' ' . language()->getLine($minutes > 1 ? 'DATE_MINUTES' : 'DATE_MINUTE');
1114
+                $str[] = $minutes.' '.language()->getLine($minutes > 1 ? 'DATE_MINUTES' : 'DATE_MINUTE');
1115 1115
             }
1116 1116
 
1117 1117
             $seconds -= $minutes * 60;
1118 1118
         }
1119 1119
 
1120 1120
         if (count($str) === 0) {
1121
-            $str[] = $seconds . ' ' . language()->getLine($seconds > 1 ? 'DATE_SECONDS' : 'DATE_SECOND');
1121
+            $str[] = $seconds.' '.language()->getLine($seconds > 1 ? 'DATE_SECONDS' : 'DATE_SECOND');
1122 1122
         }
1123 1123
 
1124 1124
         return implode(', ', $str);
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
 
1128 1128
 // ------------------------------------------------------------------------
1129 1129
 
1130
-if ( ! function_exists('days_in_month')) {
1130
+if (!function_exists('days_in_month')) {
1131 1131
     /**
1132 1132
      * Number of days in a month
1133 1133
      *
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
     {
1144 1144
         if ($month < 1 OR $month > 12) {
1145 1145
             return 0;
1146
-        } elseif ( ! is_numeric($year) OR strlen($year) !== 4) {
1146
+        } elseif (!is_numeric($year) OR strlen($year) !== 4) {
1147 1147
             $year = date('Y');
1148 1148
         }
1149 1149
 
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
         }
1153 1153
 
1154 1154
         if ($year >= 1970) {
1155
-            return (int)date('t', mktime(12, 0, 0, $month, 1, $year));
1155
+            return (int) date('t', mktime(12, 0, 0, $month, 1, $year));
1156 1156
         }
1157 1157
 
1158 1158
         if ($month == 2) {
@@ -1163,13 +1163,13 @@  discard block
 block discarded – undo
1163 1163
 
1164 1164
         $days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
1165 1165
 
1166
-        return $days_in_month[ $month - 1 ];
1166
+        return $days_in_month[$month - 1];
1167 1167
     }
1168 1168
 }
1169 1169
 
1170 1170
 // ------------------------------------------------------------------------
1171 1171
 
1172
-if ( ! function_exists('local_to_gmt')) {
1172
+if (!function_exists('local_to_gmt')) {
1173 1173
     /**
1174 1174
      * Converts a local Unix timestamp to GMT
1175 1175
      *
@@ -1196,7 +1196,7 @@  discard block
 block discarded – undo
1196 1196
 
1197 1197
 // ------------------------------------------------------------------------
1198 1198
 
1199
-if ( ! function_exists('gmt_to_local')) {
1199
+if (!function_exists('gmt_to_local')) {
1200 1200
     /**
1201 1201
      * Converts GMT time to a localized value
1202 1202
      *
@@ -1224,7 +1224,7 @@  discard block
 block discarded – undo
1224 1224
 
1225 1225
 // ------------------------------------------------------------------------
1226 1226
 
1227
-if ( ! function_exists('mysql_to_unix')) {
1227
+if (!function_exists('mysql_to_unix')) {
1228 1228
     /**
1229 1229
      * Converts a MySQL Timestamp to Unix
1230 1230
      *
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
 
1255 1255
 // ------------------------------------------------------------------------
1256 1256
 
1257
-if ( ! function_exists('unix_to_human')) {
1257
+if (!function_exists('unix_to_human')) {
1258 1258
     /**
1259 1259
      * Unix to "Human"
1260 1260
      *
@@ -1268,20 +1268,20 @@  discard block
 block discarded – undo
1268 1268
      */
1269 1269
     function unix_to_human($time = '', $seconds = false, $fmt = 'us')
1270 1270
     {
1271
-        $r = date('Y', $time) . '-' . date('m', $time) . '-' . date('d', $time) . ' ';
1271
+        $r = date('Y', $time).'-'.date('m', $time).'-'.date('d', $time).' ';
1272 1272
 
1273 1273
         if ($fmt === 'us') {
1274
-            $r .= date('h', $time) . ':' . date('i', $time);
1274
+            $r .= date('h', $time).':'.date('i', $time);
1275 1275
         } else {
1276
-            $r .= date('H', $time) . ':' . date('i', $time);
1276
+            $r .= date('H', $time).':'.date('i', $time);
1277 1277
         }
1278 1278
 
1279 1279
         if ($seconds) {
1280
-            $r .= ':' . date('s', $time);
1280
+            $r .= ':'.date('s', $time);
1281 1281
         }
1282 1282
 
1283 1283
         if ($fmt === 'us') {
1284
-            return $r . ' ' . date('A', $time);
1284
+            return $r.' '.date('A', $time);
1285 1285
         }
1286 1286
 
1287 1287
         return $r;
@@ -1290,7 +1290,7 @@  discard block
 block discarded – undo
1290 1290
 
1291 1291
 // ------------------------------------------------------------------------
1292 1292
 
1293
-if ( ! function_exists('human_to_unix')) {
1293
+if (!function_exists('human_to_unix')) {
1294 1294
     /**
1295 1295
      * Convert "human" date to GMT
1296 1296
      *
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
 
1309 1309
         $date = preg_replace('/\040+/', ' ', trim($date));
1310 1310
 
1311
-        if ( ! preg_match(
1311
+        if (!preg_match(
1312 1312
             '/^(\d{2}|\d{4})\-[0-9]{1,2}\-[0-9]{1,2}\s[0-9]{1,2}:[0-9]{1,2}(?::[0-9]{1,2})?(?:\s[AP]M)?$/i',
1313 1313
             $date
1314 1314
         )
@@ -1323,9 +1323,9 @@  discard block
 block discarded – undo
1323 1323
         if (isset($ampm)) {
1324 1324
             $ampm = strtolower($ampm);
1325 1325
 
1326
-            if ($ampm[ 0 ] === 'p' && $hour < 12) {
1326
+            if ($ampm[0] === 'p' && $hour < 12) {
1327 1327
                 $hour += 12;
1328
-            } elseif ($ampm[ 0 ] === 'a' && $hour === 12) {
1328
+            } elseif ($ampm[0] === 'a' && $hour === 12) {
1329 1329
                 $hour = 0;
1330 1330
             }
1331 1331
         }
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
 
1337 1337
 // ------------------------------------------------------------------------
1338 1338
 
1339
-if ( ! function_exists('nice_date')) {
1339
+if (!function_exists('nice_date')) {
1340 1340
     /**
1341 1341
      * Turns many "reasonably-date-like" strings into something
1342 1342
      * that is actually useful. This only works for dates after unix epoch.
@@ -1364,17 +1364,17 @@  discard block
 block discarded – undo
1364 1364
                 $year = substr($bad_date, 2, 4);
1365 1365
             }
1366 1366
 
1367
-            return date($format, strtotime($year . '-' . $month . '-01'));
1367
+            return date($format, strtotime($year.'-'.$month.'-01'));
1368 1368
         }
1369 1369
 
1370 1370
         // Date Like: YYYYMMDD
1371 1371
         if (preg_match('/^(\d{2})\d{2}(\d{4})$/i', $bad_date, $matches)) {
1372
-            return date($format, strtotime($matches[ 1 ] . '/01/' . $matches[ 2 ]));
1372
+            return date($format, strtotime($matches[1].'/01/'.$matches[2]));
1373 1373
         }
1374 1374
 
1375 1375
         // Date Like: MM-DD-YYYY __or__ M-D-YYYY (or anything in between)
1376 1376
         if (preg_match('/^(\d{1,2})-(\d{1,2})-(\d{4})$/i', $bad_date, $matches)) {
1377
-            return date($format, strtotime($matches[ 3 ] . '-' . $matches[ 1 ] . '-' . $matches[ 2 ]));
1377
+            return date($format, strtotime($matches[3].'-'.$matches[1].'-'.$matches[2]));
1378 1378
         }
1379 1379
 
1380 1380
         // Any other kind of string, when converted into UNIX time,
@@ -1391,7 +1391,7 @@  discard block
 block discarded – undo
1391 1391
 
1392 1392
 // ------------------------------------------------------------------------
1393 1393
 
1394
-if ( ! function_exists('timezones')) {
1394
+if (!function_exists('timezones')) {
1395 1395
     /**
1396 1396
      * Timezones
1397 1397
      *
@@ -1454,13 +1454,13 @@  discard block
 block discarded – undo
1454 1454
             return $zones;
1455 1455
         }
1456 1456
 
1457
-        return isset($zones[ $tz ]) ? $zones[ $tz ] : 0;
1457
+        return isset($zones[$tz]) ? $zones[$tz] : 0;
1458 1458
     }
1459 1459
 }
1460 1460
 
1461 1461
 // ------------------------------------------------------------------------
1462 1462
 
1463
-if ( ! function_exists('date_range_unix')) {
1463
+if (!function_exists('date_range_unix')) {
1464 1464
     /**
1465 1465
      * Date range
1466 1466
      *
@@ -1483,11 +1483,11 @@  discard block
 block discarded – undo
1483 1483
             return false;
1484 1484
         }
1485 1485
 
1486
-        $is_unix = ! ( ! $is_unix OR $is_unix === 'days');
1486
+        $is_unix = !(!$is_unix OR $is_unix === 'days');
1487 1487
 
1488 1488
         // Validate input and try strtotime() on invalid timestamps/intervals, just in case
1489
-        if (( ! ctype_digit((string)$unix_start) && ($unix_start = @strtotime($unix_start)) === false)
1490
-            OR ( ! ctype_digit((string)$mixed) && ($is_unix === false OR ($mixed = @strtotime(
1489
+        if ((!ctype_digit((string) $unix_start) && ($unix_start = @strtotime($unix_start)) === false)
1490
+            OR (!ctype_digit((string) $mixed) && ($is_unix === false OR ($mixed = @strtotime(
1491 1491
                         $mixed
1492 1492
                     )) === false))
1493 1493
             OR ($is_unix === true && $mixed < $unix_start)
@@ -1525,7 +1525,7 @@  discard block
 block discarded – undo
1525 1525
                 $arg = new DateTime();
1526 1526
                 $arg->setTimestamp($mixed);
1527 1527
             } else {
1528
-                $arg = (int)$mixed;
1528
+                $arg = (int) $mixed;
1529 1529
             }
1530 1530
 
1531 1531
             $period = new DatePeriod($from, new DateInterval('P1D'), $arg);
@@ -1538,7 +1538,7 @@  discard block
 block discarded – undo
1538 1538
              * the end date might actually be less than 24 hours away from the previously
1539 1539
              * generated DateTime object, but either way - we have to append it manually.
1540 1540
              */
1541
-            if ( ! is_int($arg) && $range[ count($range) - 1 ] !== $arg->format($format)) {
1541
+            if (!is_int($arg) && $range[count($range) - 1] !== $arg->format($format)) {
1542 1542
                 $range[] = $arg->format($format);
1543 1543
             }
1544 1544
 
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
             $arg->setDate(date('Y', $mixed), date('n', $mixed), date('j', $mixed));
1553 1553
             $arg->setTime(date('G', $mixed), date('i', $mixed), date('s', $mixed));
1554 1554
         } else {
1555
-            $arg = (int)$mixed;
1555
+            $arg = (int) $mixed;
1556 1556
         }
1557 1557
         $range[] = $from->format($format);
1558 1558
 
Please login to merge, or discard this patch.