@@ -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]"); |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | static::$tableName, |
724 | 724 | join(',', $set), |
725 | 725 | ], |
726 | - [static::class,'handleError'] |
|
726 | + [static::class, 'handleError'] |
|
727 | 727 | ); |
728 | 728 | $this->_record[static::$primaryKey ? static::$primaryKey : 'ID'] = DB::insertID(); |
729 | 729 | $this->_isPhantom = false; |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'), |
738 | 738 | $this->getPrimaryKeyValue(), |
739 | 739 | ], |
740 | - [static::class,'handleError'] |
|
740 | + [static::class, 'handleError'] |
|
741 | 741 | ); |
742 | 742 | |
743 | 743 | $this->_isUpdated = true; |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | static::$tableName, |
796 | 796 | static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'), |
797 | 797 | $id, |
798 | - ], [static::class,'handleError']); |
|
798 | + ], [static::class, 'handleError']); |
|
799 | 799 | |
800 | 800 | return DB::affectedRows() > 0; |
801 | 801 | } |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | return ', '.$value.' AS '.$key; |
815 | 815 | } |
816 | 816 | } else { |
817 | - return ', ' . $columns; |
|
817 | + return ', '.$columns; |
|
818 | 818 | } |
819 | 819 | } |
820 | 820 | } |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | public static function buildHaving($having) |
829 | 829 | { |
830 | 830 | if (!empty($having)) { |
831 | - return ' HAVING (' . (is_array($having) ? join(') AND (', static::_mapConditions($having)) : $having) . ')'; |
|
831 | + return ' HAVING ('.(is_array($having) ? join(') AND (', static::_mapConditions($having)) : $having).')'; |
|
832 | 832 | } |
833 | 833 | } |
834 | 834 | |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | { |
892 | 892 | static::init(); |
893 | 893 | if (!static::fieldExists($field)) { |
894 | - throw new Exception('getColumnName called on nonexisting column: ' . get_called_class().'->'.$field); |
|
894 | + throw new Exception('getColumnName called on nonexisting column: '.get_called_class().'->'.$field); |
|
895 | 895 | } |
896 | 896 | |
897 | 897 | return static::$_classFields[get_called_class()][$field]['columnName']; |
@@ -1296,7 +1296,7 @@ discard block |
||
1296 | 1296 | case 'boolean': |
1297 | 1297 | { |
1298 | 1298 | if (!isset($this->_convertedValues[$field])) { |
1299 | - $this->_convertedValues[$field] = (boolean)$value; |
|
1299 | + $this->_convertedValues[$field] = (boolean) $value; |
|
1300 | 1300 | } |
1301 | 1301 | |
1302 | 1302 | return $this->_convertedValues[$field]; |
@@ -1524,7 +1524,7 @@ discard block |
||
1524 | 1524 | foreach ($order as $key => $value) { |
1525 | 1525 | if (is_string($key)) { |
1526 | 1526 | $columnName = static::_cn($key); |
1527 | - $direction = strtoupper($value)=='DESC' ? 'DESC' : 'ASC'; |
|
1527 | + $direction = strtoupper($value) == 'DESC' ? 'DESC' : 'ASC'; |
|
1528 | 1528 | } else { |
1529 | 1529 | $columnName = static::_cn($value); |
1530 | 1530 | $direction = 'ASC'; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | public $searchConditions = [ |
41 | 41 | 'Caption' => [ |
42 | - 'qualifiers' => ['any','caption'] |
|
42 | + 'qualifiers' => ['any', 'caption'] |
|
43 | 43 | ,'points' => 2 |
44 | 44 | ,'sql' => 'Caption LIKE "%%%s%%"', |
45 | 45 | ] |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | } elseif ($_SERVER['REQUEST_METHOD'] == 'PUT') { |
192 | 192 | $put = fopen(static::$inputStream, 'r'); // open input stream |
193 | 193 | |
194 | - $tmp = tempnam('/tmp', 'dvr'); // use PHP to make a temporary file |
|
194 | + $tmp = tempnam('/tmp', 'dvr'); // use PHP to make a temporary file |
|
195 | 195 | $fp = fopen($tmp, 'w'); // open write stream to temp file |
196 | 196 | |
197 | 197 | // write |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | } |
228 | 228 | |
229 | 229 | return $this->respond('uploadComplete', [ |
230 | - 'success' => (boolean)$Media |
|
230 | + 'success' => (boolean) $Media |
|
231 | 231 | ,'data' => $Media, |
232 | 232 | ]); |
233 | 233 | } |
@@ -277,11 +277,11 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | // send caching headers |
280 | - $expires = 60*60*24*365; |
|
280 | + $expires = 60 * 60 * 24 * 365; |
|
281 | 281 | if (!headers_sent()) { |
282 | 282 | // @codeCoverageIgnoreStart |
283 | 283 | header("Cache-Control: public, max-age=$expires"); |
284 | - header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time()+$expires)); |
|
284 | + header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + $expires)); |
|
285 | 285 | header('Pragma: public'); |
286 | 286 | // @codeCoverageIgnoreEnd |
287 | 287 | } |
@@ -524,9 +524,9 @@ discard block |
||
524 | 524 | // send caching headers |
525 | 525 | if (!headers_sent()) { |
526 | 526 | // @codeCoverageIgnoreStart |
527 | - $expires = 60*60*24*365; |
|
527 | + $expires = 60 * 60 * 24 * 365; |
|
528 | 528 | header("Cache-Control: public, max-age=$expires"); |
529 | - header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time()+$expires)); |
|
529 | + header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + $expires)); |
|
530 | 530 | header('Pragma: public'); |
531 | 531 | // @codeCoverageIgnoreEnd |
532 | 532 | } |