@@ -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) |
@@ -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); |
@@ -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 | ]; |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @param string $label |
| 101 | 101 | * @return void |
| 102 | 102 | */ |
| 103 | - public static function setConnection(string $label=null) |
|
| 103 | + public static function setConnection(string $label = null) |
|
| 104 | 104 | { |
| 105 | 105 | if ($label === null && static::$currentConnection === null) { |
| 106 | 106 | static::$currentConnection = static::getDefaultLabel(); |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | * @uses static::$Timezone |
| 134 | 134 | * @uses PDO |
| 135 | 135 | */ |
| 136 | - public static function getConnection($label=null) |
|
| 136 | + public static function getConnection($label = null) |
|
| 137 | 137 | { |
| 138 | 138 | if ($label === null) { |
| 139 | 139 | if (static::$currentConnection === null) { |
@@ -152,10 +152,10 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | if (isset($config['socket'])) { |
| 154 | 154 | // socket connection |
| 155 | - $DSN = 'mysql:unix_socket=' . $config['socket'] . ';dbname=' . $config['database']; |
|
| 155 | + $DSN = 'mysql:unix_socket='.$config['socket'].';dbname='.$config['database']; |
|
| 156 | 156 | } else { |
| 157 | 157 | // tcp connection |
| 158 | - $DSN = 'mysql:host=' . $config['host'] . ';port=' . $config['port'] .';dbname=' . $config['database']; |
|
| 158 | + $DSN = 'mysql:host='.$config['host'].';port='.$config['port'].';dbname='.$config['database']; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | try { |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | { |
| 187 | 187 | if (is_string($data)) { |
| 188 | 188 | $data = static::getConnection()->quote($data); |
| 189 | - $data = substr($data, 1, strlen($data)-2); |
|
| 189 | + $data = substr($data, 1, strlen($data) - 2); |
|
| 190 | 190 | return $data; |
| 191 | 191 | } elseif (is_array($data)) { |
| 192 | 192 | foreach ($data as $key=>$string) { |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | $error = static::getConnection()->errorInfo(); |
| 512 | 512 | $message = $error[2]; |
| 513 | 513 | |
| 514 | - if (App::$App->Config['environment']=='dev') { |
|
| 514 | + if (App::$App->Config['environment'] == 'dev') { |
|
| 515 | 515 | /** @var \Whoops\Handler\PrettyPageHandler */ |
| 516 | 516 | $Handler = \Divergence\App::$App->whoops->popHandler(); |
| 517 | 517 | |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | */ |
| 556 | 556 | protected static function startQueryLog($query) |
| 557 | 557 | { |
| 558 | - if (App::$App->Config['environment']!='dev') { |
|
| 558 | + if (App::$App->Config['environment'] != 'dev') { |
|
| 559 | 559 | return false; |
| 560 | 560 | } |
| 561 | 561 | |
@@ -87,7 +87,7 @@ |
||
| 87 | 87 | $PreviewMedia = Media::createFromFile($previewPath, [ |
| 88 | 88 | 'ContextClass' => 'Media' |
| 89 | 89 | ,'ContextID' => $this->getValue('ID') |
| 90 | - ,'Caption' => sprintf('%u sec preview (%us-%us)', static::$previewDuration, $startTime, $startTime+static::$previewDuration), |
|
| 90 | + ,'Caption' => sprintf('%u sec preview (%us-%us)', static::$previewDuration, $startTime, $startTime + static::$previewDuration), |
|
| 91 | 91 | ]); |
| 92 | 92 | |
| 93 | 93 | return $PreviewMedia; |