@@ -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 |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | if ($options['type'] == 'one-one') { |
70 | 70 | if (empty($options['local'])) { |
71 | - $options['local'] = $relationship . 'ID'; |
|
71 | + $options['local'] = $relationship.'ID'; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | if (empty($options['foreign'])) { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | if (empty($options['foreign'])) { |
83 | - $options['foreign'] = $classShortName. 'ID'; |
|
83 | + $options['foreign'] = $classShortName.'ID'; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | if (!isset($options['indexField'])) { |
@@ -142,12 +142,12 @@ discard block |
||
142 | 142 | } |
143 | 143 | |
144 | 144 | if (empty($options['linkLocal'])) { |
145 | - $options['linkLocal'] = $classShortName . 'ID'; |
|
145 | + $options['linkLocal'] = $classShortName.'ID'; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | if (empty($options['linkForeign'])) { |
149 | 149 | $foreignShortname = basename(str_replace('\\', '/', $options['class']::$rootClass)); |
150 | - $options['linkForeign'] = $foreignShortname . 'ID'; |
|
150 | + $options['linkForeign'] = $foreignShortname.'ID'; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | if (empty($options['local'])) { |
@@ -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 | /** |
@@ -723,14 +723,14 @@ discard block |
||
723 | 723 | |
724 | 724 | // create new or update existing |
725 | 725 | if ($this->_isPhantom) { |
726 | - DB::nonQuery((new Insert())->setTable(static::$tableName)->set($set), null, [static::class,'handleException']); |
|
726 | + DB::nonQuery((new Insert())->setTable(static::$tableName)->set($set), null, [static::class, 'handleException']); |
|
727 | 727 | $this->_record[$this->getPrimaryKey()] = DB::insertID(); |
728 | 728 | $this->_isPhantom = false; |
729 | 729 | $this->_isNew = true; |
730 | 730 | } elseif (count($set)) { |
731 | 731 | DB::nonQuery((new Update())->setTable(static::$tableName)->set($set)->where( |
732 | 732 | sprintf('`%s` = %u', static::_cn($this->getPrimaryKey()), $this->getPrimaryKeyValue()) |
733 | - ), null, [static::class,'handleException']); |
|
733 | + ), null, [static::class, 'handleException']); |
|
734 | 734 | |
735 | 735 | $this->_isUpdated = true; |
736 | 736 | } |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | $recordValues = $this->_prepareRecordValues(); |
763 | 763 | $set = static::_mapValuesToSet($recordValues); |
764 | 764 | |
765 | - DB::nonQuery((new Insert())->setTable(static::getHistoryTable())->set($set), null, [static::class,'handleException']); |
|
765 | + DB::nonQuery((new Insert())->setTable(static::getHistoryTable())->set($set), null, [static::class, 'handleException']); |
|
766 | 766 | } |
767 | 767 | } |
768 | 768 | |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | */ |
778 | 778 | public static function delete($id) |
779 | 779 | { |
780 | - DB::nonQuery((new Delete())->setTable(static::$tableName)->where(sprintf('`%s` = %u', static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'), $id)), null, [static::class,'handleException']); |
|
780 | + DB::nonQuery((new Delete())->setTable(static::$tableName)->where(sprintf('`%s` = %u', static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'), $id)), null, [static::class, 'handleException']); |
|
781 | 781 | |
782 | 782 | return DB::affectedRows() > 0; |
783 | 783 | } |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | { |
831 | 831 | static::init(); |
832 | 832 | if (!static::fieldExists($field)) { |
833 | - throw new Exception('getColumnName called on nonexisting column: ' . get_called_class().'->'.$field); |
|
833 | + throw new Exception('getColumnName called on nonexisting column: '.get_called_class().'->'.$field); |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | return static::$_classFields[get_called_class()][$field]['columnName']; |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | // clear buffer (required for the next query to work without running fetchAll first |
998 | 998 | $Statement->closeCursor(); |
999 | 999 | |
1000 | - return $Connection->query((string)$query); // now the query should finish with no error |
|
1000 | + return $Connection->query((string) $query); // now the query should finish with no error |
|
1001 | 1001 | } else { |
1002 | 1002 | return DB::handleException($e, $query, $queryLog); |
1003 | 1003 | } |
@@ -1235,7 +1235,7 @@ discard block |
||
1235 | 1235 | case 'boolean': |
1236 | 1236 | { |
1237 | 1237 | if (!isset($this->_convertedValues[$field])) { |
1238 | - $this->_convertedValues[$field] = (bool)$value; |
|
1238 | + $this->_convertedValues[$field] = (bool) $value; |
|
1239 | 1239 | } |
1240 | 1240 | |
1241 | 1241 | return $this->_convertedValues[$field]; |
@@ -1463,7 +1463,7 @@ discard block |
||
1463 | 1463 | foreach ($order as $key => $value) { |
1464 | 1464 | if (is_string($key)) { |
1465 | 1465 | $columnName = static::_cn($key); |
1466 | - $direction = strtoupper($value)=='DESC' ? 'DESC' : 'ASC'; |
|
1466 | + $direction = strtoupper($value) == 'DESC' ? 'DESC' : 'ASC'; |
|
1467 | 1467 | } else { |
1468 | 1468 | $columnName = static::_cn($value); |
1469 | 1469 | $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]"); |
@@ -90,7 +90,7 @@ |
||
90 | 90 | $PreviewMedia = Media::createFromFile($previewPath, [ |
91 | 91 | 'ContextClass' => 'Media' |
92 | 92 | ,'ContextID' => $this->ID |
93 | - ,'Caption' => sprintf('%u sec preview (%us-%us)', static::$previewDuration, $startTime, $startTime+static::$previewDuration), |
|
93 | + ,'Caption' => sprintf('%u sec preview (%us-%us)', static::$previewDuration, $startTime, $startTime + static::$previewDuration), |
|
94 | 94 | ]); |
95 | 95 | |
96 | 96 | return $PreviewMedia; |
@@ -43,9 +43,9 @@ |
||
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 | } |
@@ -80,7 +80,7 @@ discard block |
||
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 |
||
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 |
||
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; |
@@ -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 |