@@ -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 | /** |
@@ -722,14 +722,14 @@ discard block |
||
722 | 722 | |
723 | 723 | // create new or update existing |
724 | 724 | if ($this->_isPhantom) { |
725 | - DB::nonQuery((new Insert())->setTable(static::$tableName)->set($set), null, [static::class,'handleError']); |
|
725 | + DB::nonQuery((new Insert())->setTable(static::$tableName)->set($set), null, [static::class, 'handleError']); |
|
726 | 726 | $this->_record[$this->getPrimaryKey()] = DB::insertID(); |
727 | 727 | $this->_isPhantom = false; |
728 | 728 | $this->_isNew = true; |
729 | 729 | } elseif (count($set)) { |
730 | 730 | DB::nonQuery((new Update())->setTable(static::$tableName)->set($set)->where( |
731 | 731 | sprintf('`%s` = %u', static::_cn($this->getPrimaryKey()), $this->getPrimaryKeyValue()) |
732 | - ), null, [static::class,'handleError']); |
|
732 | + ), null, [static::class, 'handleError']); |
|
733 | 733 | |
734 | 734 | $this->_isUpdated = true; |
735 | 735 | } |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | $recordValues = $this->_prepareRecordValues(); |
762 | 762 | $set = static::_mapValuesToSet($recordValues); |
763 | 763 | |
764 | - DB::nonQuery((new Insert())->setTable(static::getHistoryTable())->set($set), null, [static::class,'handleError']); |
|
764 | + DB::nonQuery((new Insert())->setTable(static::getHistoryTable())->set($set), null, [static::class, 'handleError']); |
|
765 | 765 | } |
766 | 766 | } |
767 | 767 | |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | */ |
777 | 777 | public static function delete($id) |
778 | 778 | { |
779 | - DB::nonQuery((new Delete())->setTable(static::$tableName)->where(sprintf('`%s` = %u', static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'), $id)), null, [static::class,'handleError']); |
|
779 | + DB::nonQuery((new Delete())->setTable(static::$tableName)->where(sprintf('`%s` = %u', static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'), $id)), null, [static::class, 'handleError']); |
|
780 | 780 | |
781 | 781 | return DB::affectedRows() > 0; |
782 | 782 | } |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | { |
830 | 830 | static::init(); |
831 | 831 | if (!static::fieldExists($field)) { |
832 | - throw new Exception('getColumnName called on nonexisting column: ' . get_called_class().'->'.$field); |
|
832 | + throw new Exception('getColumnName called on nonexisting column: '.get_called_class().'->'.$field); |
|
833 | 833 | } |
834 | 834 | |
835 | 835 | return static::$_classFields[get_called_class()][$field]['columnName']; |
@@ -1234,7 +1234,7 @@ discard block |
||
1234 | 1234 | case 'boolean': |
1235 | 1235 | { |
1236 | 1236 | if (!isset($this->_convertedValues[$field])) { |
1237 | - $this->_convertedValues[$field] = (boolean)$value; |
|
1237 | + $this->_convertedValues[$field] = (boolean) $value; |
|
1238 | 1238 | } |
1239 | 1239 | |
1240 | 1240 | return $this->_convertedValues[$field]; |
@@ -1462,7 +1462,7 @@ discard block |
||
1462 | 1462 | foreach ($order as $key => $value) { |
1463 | 1463 | if (is_string($key)) { |
1464 | 1464 | $columnName = static::_cn($key); |
1465 | - $direction = strtoupper($value)=='DESC' ? 'DESC' : 'ASC'; |
|
1465 | + $direction = strtoupper($value) == 'DESC' ? 'DESC' : 'ASC'; |
|
1466 | 1466 | } else { |
1467 | 1467 | $columnName = static::_cn($value); |
1468 | 1468 | $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; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | // extract video streams |
119 | - $videoStreams = array_filter($output['streams'], function ($streamInfo) { |
|
119 | + $videoStreams = array_filter($output['streams'], function($streamInfo) { |
|
120 | 120 | return $streamInfo['codec_type'] == 'video'; |
121 | 121 | }); |
122 | 122 | |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | $mediaInfo['streams'] = $output['streams']; |
129 | 129 | $mediaInfo['videoStream'] = array_shift($videoStreams); |
130 | 130 | |
131 | - $mediaInfo['width'] = (int)$mediaInfo['videoStream']['width']; |
|
132 | - $mediaInfo['height'] = (int)$mediaInfo['videoStream']['height']; |
|
133 | - $mediaInfo['duration'] = (double)$mediaInfo['videoStream']['duration']; |
|
131 | + $mediaInfo['width'] = (int) $mediaInfo['videoStream']['width']; |
|
132 | + $mediaInfo['height'] = (int) $mediaInfo['videoStream']['height']; |
|
133 | + $mediaInfo['duration'] = (double) $mediaInfo['videoStream']['duration']; |
|
134 | 134 | |
135 | 135 | return $mediaInfo; |
136 | 136 | } |
@@ -10,6 +10,6 @@ |
||
10 | 10 | use \Divergence\App as App; |
11 | 11 | |
12 | 12 | return [ |
13 | - 'debug' => file_exists(App::$App->ApplicationPath . '/.debug'), |
|
14 | - 'environment' => (file_exists(App::$App->ApplicationPath . '/.dev') ? 'dev' : 'production'), |
|
13 | + 'debug' => file_exists(App::$App->ApplicationPath.'/.debug'), |
|
14 | + 'environment' => (file_exists(App::$App->ApplicationPath.'/.dev') ? 'dev' : 'production'), |
|
15 | 15 | ]; |
@@ -99,7 +99,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |