@@ -50,7 +50,7 @@ |
||
| 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); |
@@ -35,7 +35,7 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -53,7 +53,7 @@ |
||
| 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; |
@@ -84,7 +84,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -76,7 +76,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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'; |
@@ -64,11 +64,11 @@ |
||
| 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')) { |
@@ -45,7 +45,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -251,9 +251,9 @@ discard block |
||
| 251 | 251 | */ |
| 252 | 252 | public function setCache(Response $response): Response |
| 253 | 253 | { |
| 254 | - $expires = 60*60*24*365; |
|
| 254 | + $expires = 60 * 60 * 24 * 365; |
|
| 255 | 255 | return $response->withHeader('Cache-Control', "public, max-age= $expires") |
| 256 | - ->withHeader('Expires', gmdate('D, d M Y H:i:s \G\M\T', time()+$expires)) |
|
| 256 | + ->withHeader('Expires', gmdate('D, d M Y H:i:s \G\M\T', time() + $expires)) |
|
| 257 | 257 | ->withHeader('Pragma', 'public'); |
| 258 | 258 | } |
| 259 | 259 | |
@@ -550,9 +550,9 @@ discard block |
||
| 550 | 550 | // send caching headers |
| 551 | 551 | if (!headers_sent()) { |
| 552 | 552 | // @codeCoverageIgnoreStart |
| 553 | - $expires = 60*60*24*365; |
|
| 553 | + $expires = 60 * 60 * 24 * 365; |
|
| 554 | 554 | header("Cache-Control: public, max-age=$expires"); |
| 555 | - header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time()+$expires)); |
|
| 555 | + header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + $expires)); |
|
| 556 | 556 | header('Pragma: public'); |
| 557 | 557 | // @codeCoverageIgnoreEnd |
| 558 | 558 | } |