Passed
Push — develop ( f1f3d3...a1d6fd )
by Henry
02:23
created
src/IO/Database/MySQL.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      * @param string $label
100 100
      * @return void
101 101
      */
102
-    public static function setConnection(string $label=null)
102
+    public static function setConnection(string $label = null)
103 103
     {
104 104
         if ($label === null && static::$currentConnection === null) {
105 105
             static::$currentConnection = static::getDefaultLabel();
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
      * @uses static::$Timezone
133 133
      * @uses PDO
134 134
      */
135
-    public static function getConnection($label=null)
135
+    public static function getConnection($label = null)
136 136
     {
137 137
         if ($label === null) {
138 138
             if (static::$currentConnection === null) {
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 
152 152
             if (isset($config['socket'])) {
153 153
                 // socket connection
154
-                $DSN = 'mysql:unix_socket=' . $config['socket'] . ';dbname=' . $config['database'];
154
+                $DSN = 'mysql:unix_socket='.$config['socket'].';dbname='.$config['database'];
155 155
             } else {
156 156
                 // tcp connection
157
-                $DSN = 'mysql:host=' . $config['host'] . ';port=' . $config['port'] .';dbname=' . $config['database'];
157
+                $DSN = 'mysql:host='.$config['host'].';port='.$config['port'].';dbname='.$config['database'];
158 158
             }
159 159
 
160 160
             try {
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     {
184 184
         if (is_string($data)) {
185 185
             $data = static::getConnection()->quote($data);
186
-            $data = substr($data, 1, strlen($data)-2);
186
+            $data = substr($data, 1, strlen($data) - 2);
187 187
             return $data;
188 188
         } elseif (is_array($data)) {
189 189
             foreach ($data as $key=>$string) {
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
         $error = static::getConnection()->errorInfo();
521 521
         $message = $error[2];
522 522
 
523
-        if (App::$App->Config['environment']=='dev') {
523
+        if (App::$App->Config['environment'] == 'dev') {
524 524
             $Handler = \Divergence\App::$App->whoops->popHandler();
525 525
 
526 526
             $Handler->addDataTable("Query Information", [
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
      */
562 562
     protected static function startQueryLog($query)
563 563
     {
564
-        if (App::$App->Config['environment']!='dev') {
564
+        if (App::$App->Config['environment'] != 'dev') {
565 565
             return false;
566 566
         }
567 567
 
Please login to merge, or discard this patch.
src/Controllers/RecordsRequestHandler.php 1 patch
Spacing   +7 added lines, -10 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             // check access for API response modes
69 69
             $this->responseBuilder = JsonBuilder::class;
70 70
 
71
-            if (in_array($this->responseBuilder, [JsonBuilder::class,JsonpBuilder::class])) {
71
+            if (in_array($this->responseBuilder, [JsonBuilder::class, JsonpBuilder::class])) {
72 72
                 if (!$this->checkAPIAccess()) {
73 73
                     return $this->throwAPIUnAuthorizedError();
74 74
                 }
@@ -81,8 +81,7 @@  discard block
 block discarded – undo
81 81
     public function handleRecordsRequest($action = false): ResponseInterface
82 82
     {
83 83
         switch ($action ? $action : $action = $this->shiftPath()) {
84
-            case 'save':
85
-            {
84
+            case 'save' : {
86 85
                 return $this->handleMultiSaveRequest();
87 86
             }
88 87
 
@@ -223,9 +222,7 @@  discard block
 block discarded – undo
223 222
         }
224 223
 
225 224
         switch ($action ? $action : $action = $this->shiftPath()) {
226
-            case '':
227
-            case false:
228
-            {
225
+            case '' : case false : {
229 226
                 $className = static::$recordClass;
230 227
 
231 228
                 return $this->respond($this->getTemplateName($className::$singularNoun), [
@@ -313,7 +310,7 @@  discard block
 block discarded – undo
313 310
     {
314 311
         $className = static::$recordClass;
315 312
 
316
-        $this->prepareResponseModeJSON(['POST','PUT']);
313
+        $this->prepareResponseModeJSON(['POST', 'PUT']);
317 314
 
318 315
         if ($className::fieldExists(key($_REQUEST['data']))) {
319 316
             $_REQUEST['data'] = [$_REQUEST['data']];
@@ -385,7 +382,7 @@  discard block
 block discarded – undo
385 382
     {
386 383
         $className = static::$recordClass;
387 384
 
388
-        $this->prepareResponseModeJSON(['POST','PUT','DELETE']);
385
+        $this->prepareResponseModeJSON(['POST', 'PUT', 'DELETE']);
389 386
 
390 387
         if ($className::fieldExists(key($_REQUEST['data']))) {
391 388
             $_REQUEST['data'] = [$_REQUEST['data']];
@@ -447,7 +444,7 @@  discard block
 block discarded – undo
447 444
             return $this->throwUnauthorizedError();
448 445
         }
449 446
 
450
-        if (in_array($_SERVER['REQUEST_METHOD'], ['POST','PUT'])) {
447
+        if (in_array($_SERVER['REQUEST_METHOD'], ['POST', 'PUT'])) {
451 448
             if ($this->responseBuilder === JsonBuilder::class) {
452 449
                 $_REQUEST = JSON::getRequestData();
453 450
                 if (is_array($_REQUEST['data'])) {
@@ -597,7 +594,7 @@  discard block
 block discarded – undo
597 594
 
598 595
     public function getTemplateName($noun)
599 596
     {
600
-        return preg_replace_callback('/\s+([a-zA-Z])/', function ($matches) {
597
+        return preg_replace_callback('/\s+([a-zA-Z])/', function($matches) {
601 598
             return strtoupper($matches[1]);
602 599
         }, $noun);
603 600
     }
Please login to merge, or discard this patch.
src/App.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@
 block discarded – undo
43 43
 
44 44
     public function config($Label)
45 45
     {
46
-        $Config = $this->ApplicationPath . '/config/' . $Label . '.php';
46
+        $Config = $this->ApplicationPath.'/config/'.$Label.'.php';
47 47
         if (!file_exists($Config)) {
48
-            throw new \Exception($Config . ' not found in '.static::class.'::config()');
48
+            throw new \Exception($Config.' not found in '.static::class.'::config()');
49 49
         }
50 50
         return require $Config;
51 51
     }
Please login to merge, or discard this patch.
src/Controllers/MediaRequestHandler.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
     public $searchConditions = [
39 39
         'Caption' => [
40
-            'qualifiers' => ['any','caption']
40
+            'qualifiers' => ['any', 'caption']
41 41
             ,'points' => 2
42 42
             ,'sql' => 'Caption LIKE "%%%s%%"',
43 43
         ]
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         } elseif ($_SERVER['REQUEST_METHOD'] == 'PUT') {
190 190
             $put = fopen('php://input', 'r'); // open input stream
191 191
 
192
-            $tmp = tempnam('/tmp', 'dvr');  // use PHP to make a temporary file
192
+            $tmp = tempnam('/tmp', 'dvr'); // use PHP to make a temporary file
193 193
             $fp = fopen($tmp, 'w'); // open write stream to temp file
194 194
 
195 195
             // write
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         }
226 226
 
227 227
         return $this->respond('uploadComplete', [
228
-            'success' => (boolean)$Media
228
+            'success' => (boolean) $Media
229 229
             ,'data' => $Media
230 230
         ]);
231 231
     }
@@ -273,10 +273,10 @@  discard block
 block discarded – undo
273 273
             }
274 274
 
275 275
             // send caching headers
276
-            $expires = 60*60*24*365;
276
+            $expires = 60 * 60 * 24 * 365;
277 277
             if (!headers_sent()) {
278 278
                 header("Cache-Control: public, max-age=$expires");
279
-                header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time()+$expires));
279
+                header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + $expires));
280 280
                 header('Pragma: public');
281 281
             }
282 282
 
@@ -505,9 +505,9 @@  discard block
 block discarded – undo
505 505
     public function handleThumbnailRequest(Media $Media = null): ResponseInterface
506 506
     {
507 507
         // send caching headers
508
-        $expires = 60*60*24*365;
508
+        $expires = 60 * 60 * 24 * 365;
509 509
         header("Cache-Control: public, max-age=$expires");
510
-        header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time()+$expires));
510
+        header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + $expires));
511 511
         header('Pragma: public');
512 512
 
513 513
 
Please login to merge, or discard this patch.
src/Models/Media/Media.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
     public static $searchConditions = [
82 82
         'Caption' => [
83
-            'qualifiers' => ['any','caption'],
83
+            'qualifiers' => ['any', 'caption'],
84 84
             'points' => 2,
85 85
             'sql' => 'Caption LIKE "%%%s%%"',
86 86
         ],
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     public static $defaultFilenameFormat = 'default.%s.jpg';
110 110
     public static $newDirectoryPermissions = 0775;
111 111
     public static $newFilePermissions = 0664;
112
-    public static $magicPath = null;//'/usr/share/misc/magic.mgc';
112
+    public static $magicPath = null; //'/usr/share/misc/magic.mgc';
113 113
     public static $useFaceDetection = true;
114 114
     public static $faceDetectionTimeLimit = 10;
115 115
 
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 
629 629
     public static function getBlankPath($contextClass)
630 630
     {
631
-        $path = ['site-root','img',sprintf(static::$defaultFilenameFormat, $contextClass)];
631
+        $path = ['site-root', 'img', sprintf(static::$defaultFilenameFormat, $contextClass)];
632 632
 
633 633
         if ($node = Site::resolvePath($path)) {
634 634
             return $node->RealPath;
Please login to merge, or discard this patch.