@@ -98,7 +98,7 @@ |
||
98 | 98 | |
99 | 99 | // check validator |
100 | 100 | if (!is_callable($validator)) { |
101 | - throw new Exception('Validator for field ' . $options['id'] . ' is not callable'); |
|
101 | + throw new Exception('Validator for field '.$options['id'].' is not callable'); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 |
@@ -11,7 +11,7 @@ |
||
11 | 11 | throw new \Exception(json_last_error_msg()); |
12 | 12 | } |
13 | 13 | header('Content-type: application/javascript; charset=utf-8', true); |
14 | - echo 'var data = ' . $JSON; |
|
14 | + echo 'var data = '.$JSON; |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | public static function translateAndRespond($data) |
@@ -84,8 +84,8 @@ |
||
84 | 84 | |
85 | 85 | |
86 | 86 | /** |
87 | - * @var array $validators Validation checks |
|
88 | - */ |
|
87 | + * @var array $validators Validation checks |
|
88 | + */ |
|
89 | 89 | public static $validators = []; |
90 | 90 | |
91 | 91 | /** |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | |
728 | 728 | // create new or update existing |
729 | 729 | if ($this->_isPhantom) { |
730 | - DB::nonQuery((new Insert())->setTable(static::$tableName)->set($set), null, [static::class,'handleException']); |
|
730 | + DB::nonQuery((new Insert())->setTable(static::$tableName)->set($set), null, [static::class, 'handleException']); |
|
731 | 731 | $primaryKey = $this->getPrimaryKey(); |
732 | 732 | $insertID = DB::insertID(); |
733 | 733 | $fields = static::getClassFields(); |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | } elseif (count($set)) { |
742 | 742 | DB::nonQuery((new Update())->setTable(static::$tableName)->set($set)->where( |
743 | 743 | sprintf('`%s` = %u', static::_cn($this->getPrimaryKey()), $this->getPrimaryKeyValue()) |
744 | - ), null, [static::class,'handleException']); |
|
744 | + ), null, [static::class, 'handleException']); |
|
745 | 745 | |
746 | 746 | $this->_isUpdated = true; |
747 | 747 | } |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | $recordValues = $this->_prepareRecordValues(); |
774 | 774 | $set = static::_mapValuesToSet($recordValues); |
775 | 775 | |
776 | - DB::nonQuery((new Insert())->setTable(static::getHistoryTable())->set($set), null, [static::class,'handleException']); |
|
776 | + DB::nonQuery((new Insert())->setTable(static::getHistoryTable())->set($set), null, [static::class, 'handleException']); |
|
777 | 777 | } |
778 | 778 | } |
779 | 779 | |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | */ |
789 | 789 | public static function delete($id): bool |
790 | 790 | { |
791 | - DB::nonQuery((new Delete())->setTable(static::$tableName)->where(sprintf('`%s` = %u', static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'), $id)), null, [static::class,'handleException']); |
|
791 | + DB::nonQuery((new Delete())->setTable(static::$tableName)->where(sprintf('`%s` = %u', static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'), $id)), null, [static::class, 'handleException']); |
|
792 | 792 | |
793 | 793 | return DB::affectedRows() > 0; |
794 | 794 | } |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | { |
842 | 842 | static::init(); |
843 | 843 | if (!static::fieldExists($field)) { |
844 | - throw new Exception('getColumnName called on nonexisting column: ' . get_called_class().'->'.$field); |
|
844 | + throw new Exception('getColumnName called on nonexisting column: '.get_called_class().'->'.$field); |
|
845 | 845 | } |
846 | 846 | |
847 | 847 | return static::$_classFields[get_called_class()][$field]['columnName']; |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | // clear buffer (required for the next query to work without running fetchAll first |
1009 | 1009 | $Statement->closeCursor(); |
1010 | 1010 | |
1011 | - return $Connection->query((string)$query); // now the query should finish with no error |
|
1011 | + return $Connection->query((string) $query); // now the query should finish with no error |
|
1012 | 1012 | } else { |
1013 | 1013 | return DB::handleException($e, $query, $queryLog); |
1014 | 1014 | } |
@@ -1107,8 +1107,8 @@ discard block |
||
1107 | 1107 | |
1108 | 1108 | // skip these because they are built in |
1109 | 1109 | if (in_array($property->getName(), [ |
1110 | - '_classFields','_classRelationships','_classBeforeSave','_classAfterSave','_fieldsDefined','_relationshipsDefined','_eventsDefined','_record','_validator' |
|
1111 | - ,'_validationErrors','_isDirty','_isValid','fieldSetMapper','_convertedValues','_originalValues','_isPhantom','_wasPhantom','_isNew','_isUpdated','_relatedObjects' |
|
1110 | + '_classFields', '_classRelationships', '_classBeforeSave', '_classAfterSave', '_fieldsDefined', '_relationshipsDefined', '_eventsDefined', '_record', '_validator' |
|
1111 | + ,'_validationErrors', '_isDirty', '_isValid', 'fieldSetMapper', '_convertedValues', '_originalValues', '_isPhantom', '_wasPhantom', '_isNew', '_isUpdated', '_relatedObjects' |
|
1112 | 1112 | ])) { |
1113 | 1113 | continue; |
1114 | 1114 | } |
@@ -1302,7 +1302,7 @@ discard block |
||
1302 | 1302 | case 'boolean': |
1303 | 1303 | { |
1304 | 1304 | if (!isset($this->_convertedValues[$field])) { |
1305 | - $this->_convertedValues[$field] = (bool)$value; |
|
1305 | + $this->_convertedValues[$field] = (bool) $value; |
|
1306 | 1306 | } |
1307 | 1307 | |
1308 | 1308 | return $this->_convertedValues[$field]; |
@@ -1538,7 +1538,7 @@ discard block |
||
1538 | 1538 | foreach ($order as $key => $value) { |
1539 | 1539 | if (is_string($key)) { |
1540 | 1540 | $columnName = static::_cn($key); |
1541 | - $direction = strtoupper($value)=='DESC' ? 'DESC' : 'ASC'; |
|
1541 | + $direction = strtoupper($value) == 'DESC' ? 'DESC' : 'ASC'; |
|
1542 | 1542 | } else { |
1543 | 1543 | $columnName = static::_cn($value); |
1544 | 1544 | $direction = 'ASC'; |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | public static function escape($str) |
33 | 33 | { |
34 | 34 | return str_replace( |
35 | - ["\\", "\x00", "\n", "\r", "'", '"', "\x1a"], |
|
36 | - ["\\\\","\\0","\\n", "\\r", "\'", '\"', "\\Z"], |
|
35 | + ["\\", "\x00", "\n", "\r", "'", '"', "\x1a"], |
|
36 | + ["\\\\", "\\0", "\\n", "\\r", "\'", '\"', "\\Z"], |
|
37 | 37 | $str |
38 | 38 | ); |
39 | 39 | } |
@@ -210,10 +210,10 @@ discard block |
||
210 | 210 | return 'year'; |
211 | 211 | |
212 | 212 | case 'enum': |
213 | - return sprintf('enum("%s")', join('","', array_map([static::class,'escape'], $field['values']))); |
|
213 | + return sprintf('enum("%s")', join('","', array_map([static::class, 'escape'], $field['values']))); |
|
214 | 214 | |
215 | 215 | case 'set': |
216 | - return sprintf('set("%s")', join('","', array_map([static::class,'escape'], $field['values']))); |
|
216 | + return sprintf('set("%s")', join('","', array_map([static::class, 'escape'], $field['values']))); |
|
217 | 217 | |
218 | 218 | default: |
219 | 219 | throw new Exception("getSQLType: unhandled type $field[type]"); |
@@ -113,7 +113,7 @@ |
||
113 | 113 | $Session->setFields($sessionData); |
114 | 114 | if (function_exists('fastcgi_finish_request')) { |
115 | 115 | // @codeCoverageIgnoreStart |
116 | - register_shutdown_function(function ($Session) { |
|
116 | + register_shutdown_function(function($Session) { |
|
117 | 117 | $Session->save(); |
118 | 118 | }, $Session); |
119 | 119 | // @codeCoverageIgnoreEnd |
@@ -153,7 +153,7 @@ |
||
153 | 153 | // save a copy to history table |
154 | 154 | $recordValues = $this->_prepareRecordValues(); |
155 | 155 | $set = static::_mapValuesToSet($recordValues); |
156 | - DB::nonQuery((new Insert())->setTable(static::getHistoryTable())->set($set), null, [static::class,'handleError']); |
|
156 | + DB::nonQuery((new Insert())->setTable(static::getHistoryTable())->set($set), null, [static::class, 'handleError']); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | |
52 | 52 | public function __toString(): string |
53 | 53 | { |
54 | - $expression = ($this->calcFoundRows ? 'SQL_CALC_FOUND_ROWS ' : '') . $this->expression; |
|
54 | + $expression = ($this->calcFoundRows ? 'SQL_CALC_FOUND_ROWS ' : '').$this->expression; |
|
55 | 55 | |
56 | 56 | if (isset($this->tableAlias)) { |
57 | 57 | $from = sprintf('`%s` AS `%s`', $this->table, $this->tableAlias); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | |
41 | 41 | public $searchConditions = [ |
42 | 42 | 'Caption' => [ |
43 | - 'qualifiers' => ['any','caption'] |
|
43 | + 'qualifiers' => ['any', 'caption'] |
|
44 | 44 | ,'points' => 2 |
45 | 45 | ,'sql' => 'Caption LIKE "%%%s%%"', |
46 | 46 | ] |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | } elseif ($_SERVER['REQUEST_METHOD'] == 'PUT') { |
193 | 193 | $put = fopen(static::$inputStream, 'r'); // open input stream |
194 | 194 | |
195 | - $tmp = tempnam('/tmp', 'dvr'); // use PHP to make a temporary file |
|
195 | + $tmp = tempnam('/tmp', 'dvr'); // use PHP to make a temporary file |
|
196 | 196 | $fp = fopen($tmp, 'w'); // open write stream to temp file |
197 | 197 | |
198 | 198 | // write |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | } |
229 | 229 | |
230 | 230 | return $this->respond('uploadComplete', [ |
231 | - 'success' => (bool)$Media |
|
231 | + 'success' => (bool) $Media |
|
232 | 232 | ,'data' => $Media, |
233 | 233 | ]); |
234 | 234 | } |
@@ -278,11 +278,11 @@ discard block |
||
278 | 278 | } |
279 | 279 | |
280 | 280 | // send caching headers |
281 | - $expires = 60*60*24*365; |
|
281 | + $expires = 60 * 60 * 24 * 365; |
|
282 | 282 | if (!headers_sent()) { |
283 | 283 | // @codeCoverageIgnoreStart |
284 | 284 | header("Cache-Control: public, max-age=$expires"); |
285 | - header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time()+$expires)); |
|
285 | + header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + $expires)); |
|
286 | 286 | header('Pragma: public'); |
287 | 287 | // @codeCoverageIgnoreEnd |
288 | 288 | } |
@@ -525,9 +525,9 @@ discard block |
||
525 | 525 | // send caching headers |
526 | 526 | if (!headers_sent()) { |
527 | 527 | // @codeCoverageIgnoreStart |
528 | - $expires = 60*60*24*365; |
|
528 | + $expires = 60 * 60 * 24 * 365; |
|
529 | 529 | header("Cache-Control: public, max-age=$expires"); |
530 | - header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time()+$expires)); |
|
530 | + header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + $expires)); |
|
531 | 531 | header('Pragma: public'); |
532 | 532 | // @codeCoverageIgnoreEnd |
533 | 533 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } |
122 | 122 | |
123 | 123 | // extract video streams |
124 | - $videoStreams = array_filter($output['streams'], function ($streamInfo) { |
|
124 | + $videoStreams = array_filter($output['streams'], function($streamInfo) { |
|
125 | 125 | return $streamInfo['codec_type'] == 'video'; |
126 | 126 | }); |
127 | 127 | |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | $mediaInfo['streams'] = $output['streams']; |
134 | 134 | $mediaInfo['videoStream'] = array_shift($videoStreams); |
135 | 135 | |
136 | - $mediaInfo['width'] = (int)$mediaInfo['videoStream']['width']; |
|
137 | - $mediaInfo['height'] = (int)$mediaInfo['videoStream']['height']; |
|
138 | - $mediaInfo['duration'] = (float)$mediaInfo['videoStream']['duration']; |
|
136 | + $mediaInfo['width'] = (int) $mediaInfo['videoStream']['width']; |
|
137 | + $mediaInfo['height'] = (int) $mediaInfo['videoStream']['height']; |
|
138 | + $mediaInfo['duration'] = (float) $mediaInfo['videoStream']['duration']; |
|
139 | 139 | |
140 | 140 | return $mediaInfo; |
141 | 141 | } |