Passed
Push — release ( cb0359...181435 )
by Henry
08:47 queued 05:24
created
src/Models/Getters.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         return DB::oneRecord(
186 186
             (new Select())->setTable(static::$tableName)->where(join(') AND (', $conditions))->order($order ? join(',', $order) : '')->limit('1'),
187 187
             null,
188
-            [static::class,'handleException']
188
+            [static::class, 'handleException']
189 189
         );
190 190
     }
191 191
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
      */
199 199
     public static function getByQuery($query, $params = [])
200 200
     {
201
-        return static::instantiateRecord(DB::oneRecord($query, $params, [static::class,'handleException']));
201
+        return static::instantiateRecord(DB::oneRecord($query, $params, [static::class, 'handleException']));
202 202
     }
203 203
 
204 204
     /**
@@ -309,9 +309,9 @@  discard block
 block discarded – undo
309 309
             $select->limit(sprintf('%u,%u', $options['offset'], $options['limit']));
310 310
         }
311 311
         if ($options['indexField']) {
312
-            return DB::table(static::_cn($options['indexField']), $select, null, null, [static::class,'handleException']);
312
+            return DB::table(static::_cn($options['indexField']), $select, null, null, [static::class, 'handleException']);
313 313
         } else {
314
-            return DB::allRecords($select, null, [static::class,'handleException']);
314
+            return DB::allRecords($select, null, [static::class, 'handleException']);
315 315
         }
316 316
     }
317 317
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
      */
325 325
     public static function getAllByQuery($query, $params = [])
326 326
     {
327
-        return static::instantiateRecords(DB::allRecords($query, $params, [static::class,'handleException']));
327
+        return static::instantiateRecords(DB::allRecords($query, $params, [static::class, 'handleException']));
328 328
     }
329 329
 
330 330
     /**
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
      */
338 338
     public static function getTableByQuery($keyField, $query, $params = [])
339 339
     {
340
-        return static::instantiateRecords(DB::table($keyField, $query, $params, [static::class,'handleException']));
340
+        return static::instantiateRecords(DB::table($keyField, $query, $params, [static::class, 'handleException']));
341 341
     }
342 342
 
343 343
     /**
@@ -395,9 +395,9 @@  discard block
 block discarded – undo
395 395
         }
396 396
 
397 397
         if ($options['indexField']) {
398
-            return DB::table(static::_cn($options['indexField']), $select, null, null, [static::class,'handleException']);
398
+            return DB::table(static::_cn($options['indexField']), $select, null, null, [static::class, 'handleException']);
399 399
         } else {
400
-            return DB::allRecords($select, null, [static::class,'handleException']);
400
+            return DB::allRecords($select, null, [static::class, 'handleException']);
401 401
         }
402 402
     }
403 403
 
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
                     return ', '.$value.' AS '.$key;
468 468
                 }
469 469
             } else {
470
-                return ', ' . $columns;
470
+                return ', '.$columns;
471 471
             }
472 472
         }
473 473
     }
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
     public static function buildHaving($having)
482 482
     {
483 483
         if (!empty($having)) {
484
-            return ' (' . (is_array($having) ? join(') AND (', static::_mapConditions($having)) : $having) . ')';
484
+            return ' ('.(is_array($having) ? join(') AND (', static::_mapConditions($having)) : $having).')';
485 485
         }
486 486
     }
487 487
 }
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -64,11 +64,11 @@
 block discarded – undo
64 64
     }
65 65
 
66 66
     /**
67
-    * Same as getByContextObject but this method lets you specify the ContextClass manually.
68
-    *
69
-    * @param array $record An array of database rows.
70
-    * @return static|null An array of instantiated ActiveRecord models from the provided data.
71
-    */
67
+     * Same as getByContextObject but this method lets you specify the ContextClass manually.
68
+     *
69
+     * @param array $record An array of database rows.
70
+     * @return static|null An array of instantiated ActiveRecord models from the provided data.
71
+     */
72 72
     public static function getByContext($contextClass, $contextID, $options = [])
73 73
     {
74 74
         if (!static::fieldExists('ContextClass')) {
Please login to merge, or discard this patch.
src/Responders/Emitter.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
     public function emit(): void
51 51
     {
52 52
         if (!isset($this->responseChunkSize)) {
53
-            $this->responseChunkSize= 4096;
53
+            $this->responseChunkSize = 4096;
54 54
         }
55 55
         $response = $this->response;
56 56
         $isEmpty = $this->isResponseEmpty($response);
Please login to merge, or discard this patch.
src/App.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     {
36 36
         $this->ApplicationPath = $Path;
37 37
 
38
-        if (php_sapi_name()!=='cli' || defined('PHPUNIT_TESTSUITE')) {
38
+        if (php_sapi_name() !== 'cli' || defined('PHPUNIT_TESTSUITE')) {
39 39
             $this->Path = new Path($_SERVER['REQUEST_URI']);
40 40
         }
41 41
 
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
 
47 47
     public function config($Label)
48 48
     {
49
-        $Config = $this->ApplicationPath . '/config/' . $Label . '.php';
49
+        $Config = $this->ApplicationPath.'/config/'.$Label.'.php';
50 50
         if (!file_exists($Config)) {
51
-            throw new \Exception($Config . ' not found in '.static::class.'::config()');
51
+            throw new \Exception($Config.' not found in '.static::class.'::config()');
52 52
         }
53 53
         return require $Config;
54 54
     }
Please login to merge, or discard this patch.
src/Models/Media/Video.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
 
95 95
     // public methods
96
-    public function getImage($sourceFile = null): false|\GdImage
96
+    public function getImage($sourceFile = null): false | \GdImage
97 97
     {
98 98
         if (!isset($sourceFile)) {
99 99
             $sourceFile = $this->getValue('FilesystemPath') ? $this->getValue('FilesystemPath') : $this->getValue('BlankPath');
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         }
128 128
 
129 129
         // extract video streams
130
-        $videoStreams = array_filter($json['streams'], function ($streamInfo) {
130
+        $videoStreams = array_filter($json['streams'], function($streamInfo) {
131 131
             return $streamInfo['codec_type'] == 'video';
132 132
         });
133 133
 
@@ -139,9 +139,9 @@  discard block
 block discarded – undo
139 139
         $mediaInfo['streams'] = $json['streams'];
140 140
         $mediaInfo['videoStream'] = array_shift($videoStreams);
141 141
 
142
-        $mediaInfo['width'] = (int)$mediaInfo['videoStream']['width'];
143
-        $mediaInfo['height'] = (int)$mediaInfo['videoStream']['height'];
144
-        $mediaInfo['duration'] = (float)$mediaInfo['videoStream']['duration'];
142
+        $mediaInfo['width'] = (int) $mediaInfo['videoStream']['width'];
143
+        $mediaInfo['height'] = (int) $mediaInfo['videoStream']['height'];
144
+        $mediaInfo['duration'] = (float) $mediaInfo['videoStream']['duration'];
145 145
 
146 146
         return $mediaInfo;
147 147
     }
Please login to merge, or discard this patch.
src/Models/Media/PDF.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
 
54 54
 
55 55
     // public methods
56
-    public function getImage($sourceFile = null): false|\GdImage
56
+    public function getImage($sourceFile = null): false | \GdImage
57 57
     {
58 58
         if (!isset($sourceFile)) {
59 59
             $sourceFile = $this->FilesystemPath ? $this->FilesystemPath : $this->BlankPath;
Please login to merge, or discard this patch.
src/Models/Media/Media.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
     public static $searchConditions = [
86 86
         'Caption' => [
87
-            'qualifiers' => ['any','caption'],
87
+            'qualifiers' => ['any', 'caption'],
88 88
             'points' => 2,
89 89
             'sql' => 'Caption LIKE "%%%s%%"',
90 90
         ],
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     public static $defaultFilenameFormat = 'default.%s.jpg';
114 114
     public static $newDirectoryPermissions = 0775;
115 115
     public static $newFilePermissions = 0664;
116
-    public static $magicPath = null;//'/usr/share/misc/magic.mgc';
116
+    public static $magicPath = null; //'/usr/share/misc/magic.mgc';
117 117
     public static $useFaceDetection = true;
118 118
     public static $faceDetectionTimeLimit = 10;
119 119
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
      * @throws Exception
212 212
      * @return \GdImage|false
213 213
      */
214
-    public function getImage($sourceFile = null): \GdImage|false
214
+    public function getImage($sourceFile = null): \GdImage | false
215 215
     {
216 216
         if (!isset($sourceFile)) {
217 217
             $sourceFile = $this->getValue('FilesystemPath') ? $this->getValue('FilesystemPath') : $this->getValue('BlankPath');
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
         // determine handler
552 552
         $staticClass = get_called_class();
553 553
         if (!isset(static::$mimeHandlers[$mediaInfo['mimeType']]) || $staticClass != __CLASS__) {
554
-            throw new Exception('No class registered for mime type "' . $mediaInfo['mimeType'] . '"');
554
+            throw new Exception('No class registered for mime type "'.$mediaInfo['mimeType'].'"');
555 555
         } else {
556 556
             $className = $mediaInfo['className'] = static::$mimeHandlers[$mediaInfo['mimeType']];
557 557
 
Please login to merge, or discard this patch.
src/Models/Relations.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
     protected static function _prepareOneOne(string $relationship, array $options): array
78 78
     {
79
-        $options['local'] = $options['local'] ?? $relationship . 'ID';
79
+        $options['local'] = $options['local'] ?? $relationship.'ID';
80 80
         $options['foreign'] = $options['foreign'] ?? 'ID';
81 81
         return $options;
82 82
     }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     protected static function _prepareOneMany(string $classShortName, array $options): array
85 85
     {
86 86
         $options['local'] = $options['local'] ?? 'ID';
87
-        $options['foreign'] = $options['foreign'] ?? $classShortName. 'ID';
87
+        $options['foreign'] = $options['foreign'] ?? $classShortName.'ID';
88 88
         $options['indexField'] = $options['indexField'] ?? false;
89 89
         $options['conditions'] = $options['conditions'] ?? [];
90 90
         $options['conditions'] = is_string($options['conditions']) ? [$options['conditions']] : $options['conditions'];
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
             throw new Exception('Relationship type many-many option requires a linkClass setting.');
122 122
         }
123 123
 
124
-        $options['linkLocal'] = $options['linkLocal'] ?? $classShortName . 'ID';
124
+        $options['linkLocal'] = $options['linkLocal'] ?? $classShortName.'ID';
125 125
         $options['linkForeign'] = $options['linkForeign'] ?? basename(str_replace('\\', '/', $options['class']::$rootClass)).'ID';
126 126
         $options['local'] = $options['local'] ?? 'ID';
127 127
         $options['foreign'] = $options['foreign'] ?? 'ID';
Please login to merge, or discard this patch.
src/Models/Mapping/DefaultSetMapper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,17 +28,17 @@
 block discarded – undo
28 28
 
29 29
     public static function setBooleanValue($value): bool
30 30
     {
31
-        return (bool)$value;
31
+        return (bool) $value;
32 32
     }
33 33
 
34 34
     public static function setDecimalValue($value): ?float
35 35
     {
36
-        return is_null($value) ? null : (float)preg_replace('/[^-\d.]/', '', $value);
36
+        return is_null($value) ? null : (float) preg_replace('/[^-\d.]/', '', $value);
37 37
     }
38 38
 
39 39
     public static function setIntegerValue($value): ?int
40 40
     {
41
-        return is_null($value) ? null : (int)preg_replace('/[^-\d]/', '', $value);
41
+        return is_null($value) ? null : (int) preg_replace('/[^-\d]/', '', $value);
42 42
     }
43 43
 
44 44
     public static function setTimestampValue($value): ?string
Please login to merge, or discard this patch.
src/Controllers/MediaRequestHandler.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
     public $searchConditions = [
47 47
         'Caption' => [
48
-            'qualifiers' => ['any','caption']
48
+            'qualifiers' => ['any', 'caption']
49 49
             ,'points' => 2
50 50
             ,'sql' => 'Caption LIKE "%%%s%%"',
51 51
         ]
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         } elseif ($_SERVER['REQUEST_METHOD'] == 'PUT') {
203 203
             $put = fopen(static::$inputStream, 'r'); // open input stream
204 204
 
205
-            $tmp = tempnam('/tmp', 'dvr');  // use PHP to make a temporary file
205
+            $tmp = tempnam('/tmp', 'dvr'); // use PHP to make a temporary file
206 206
             $fp = fopen($tmp, 'w'); // open write stream to temp file
207 207
 
208 208
             // write
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
         }
239 239
 
240 240
         return $this->respond('uploadComplete', [
241
-            'success' => (bool)$Media
241
+            'success' => (bool) $Media
242 242
             ,'data' => $Media,
243 243
         ]);
244 244
     }
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
      */
261 261
     public function setCache(Response $response): Response
262 262
     {
263
-        $expires = 60*60*24*365;
263
+        $expires = 60 * 60 * 24 * 365;
264 264
         return $response->withHeader('Cache-Control', "public, max-age= $expires")
265
-        ->withHeader('Expires', gmdate('D, d M Y H:i:s \G\M\T', time()+$expires))
265
+        ->withHeader('Expires', gmdate('D, d M Y H:i:s \G\M\T', time() + $expires))
266 266
         ->withHeader('Pragma', 'public');
267 267
     }
268 268
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
         // if partial content provide proper response header
330 330
         if (isset($chunkStart)) {
331 331
             // only send 206 if response is less than the whole file
332
-            if ($end-$start+1<$size) {
332
+            if ($end - $start + 1 < $size) {
333 333
                 $response = $response->withStatus(206);
334 334
             }
335 335
             $response = $response->withHeader('Content-Range', "bytes $start-$end/$size")
Please login to merge, or discard this patch.