@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | |
738 | 738 | // create new or update existing |
739 | 739 | if ($this->_isPhantom) { |
740 | - DB::nonQuery((new Insert())->setTable(static::$tableName)->set($set), null, [static::class,'handleException']); |
|
740 | + DB::nonQuery((new Insert())->setTable(static::$tableName)->set($set), null, [static::class, 'handleException']); |
|
741 | 741 | $primaryKey = $this->getPrimaryKey(); |
742 | 742 | $insertID = DB::insertID(); |
743 | 743 | $fields = static::getClassFields(); |
@@ -750,8 +750,8 @@ discard block |
||
750 | 750 | $this->_isNew = true; |
751 | 751 | } elseif (count($set)) { |
752 | 752 | DB::nonQuery((new Update())->setTable(static::$tableName)->set($set)->where( |
753 | - sprintf('`%s` = %u', static::_cn($this->getPrimaryKey()), (string)$this->getPrimaryKeyValue()) |
|
754 | - ), null, [static::class,'handleException']); |
|
753 | + sprintf('`%s` = %u', static::_cn($this->getPrimaryKey()), (string) $this->getPrimaryKeyValue()) |
|
754 | + ), null, [static::class, 'handleException']); |
|
755 | 755 | |
756 | 756 | $this->_isUpdated = true; |
757 | 757 | } |
@@ -783,11 +783,11 @@ discard block |
||
783 | 783 | $recordValues = $this->_prepareRecordValues(); |
784 | 784 | $set = static::_mapValuesToSet($recordValues); |
785 | 785 | |
786 | - DB::nonQuery((new Insert())->setTable(static::getHistoryTable())->set($set), null, [static::class,'handleException']); |
|
786 | + DB::nonQuery((new Insert())->setTable(static::getHistoryTable())->set($set), null, [static::class, 'handleException']); |
|
787 | 787 | } |
788 | 788 | } |
789 | 789 | |
790 | - return static::delete((string)$this->getPrimaryKeyValue()); |
|
790 | + return static::delete((string) $this->getPrimaryKeyValue()); |
|
791 | 791 | } |
792 | 792 | |
793 | 793 | /** |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | */ |
799 | 799 | public static function delete($id): bool |
800 | 800 | { |
801 | - DB::nonQuery((new Delete())->setTable(static::$tableName)->where(sprintf('`%s` = %u', static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'), $id)), null, [static::class,'handleException']); |
|
801 | + DB::nonQuery((new Delete())->setTable(static::$tableName)->where(sprintf('`%s` = %u', static::_cn(static::$primaryKey ? static::$primaryKey : 'ID'), $id)), null, [static::class, 'handleException']); |
|
802 | 802 | |
803 | 803 | return DB::affectedRows() > 0; |
804 | 804 | } |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | { |
852 | 852 | static::init(); |
853 | 853 | if (!static::fieldExists($field)) { |
854 | - throw new Exception('getColumnName called on nonexisting column: ' . get_called_class().'->'.$field); |
|
854 | + throw new Exception('getColumnName called on nonexisting column: '.get_called_class().'->'.$field); |
|
855 | 855 | } |
856 | 856 | |
857 | 857 | return static::$_classFields[get_called_class()][$field]['columnName']; |
@@ -1018,7 +1018,7 @@ discard block |
||
1018 | 1018 | // clear buffer (required for the next query to work without running fetchAll first |
1019 | 1019 | $Statement->closeCursor(); |
1020 | 1020 | |
1021 | - return $Connection->query((string)$query); // now the query should finish with no error |
|
1021 | + return $Connection->query((string) $query); // now the query should finish with no error |
|
1022 | 1022 | } else { |
1023 | 1023 | return DB::handleException($e, $query, $queryLog); |
1024 | 1024 | } |
@@ -1117,8 +1117,8 @@ discard block |
||
1117 | 1117 | |
1118 | 1118 | // skip these because they are built in |
1119 | 1119 | if (in_array($property->getName(), [ |
1120 | - '_classFields','_classRelationships','_classBeforeSave','_classAfterSave','_fieldsDefined','_relationshipsDefined','_eventsDefined','_record','_validator' |
|
1121 | - ,'_validationErrors','_isDirty','_isValid','_convertedValues','_originalValues','_isPhantom','_wasPhantom','_isNew','_isUpdated','_relatedObjects' |
|
1120 | + '_classFields', '_classRelationships', '_classBeforeSave', '_classAfterSave', '_fieldsDefined', '_relationshipsDefined', '_eventsDefined', '_record', '_validator' |
|
1121 | + ,'_validationErrors', '_isDirty', '_isValid', '_convertedValues', '_originalValues', '_isPhantom', '_wasPhantom', '_isNew', '_isUpdated', '_relatedObjects' |
|
1122 | 1122 | ])) { |
1123 | 1123 | continue; |
1124 | 1124 | } |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | private function applyNewValue($type, $field, $value) |
1249 | 1249 | { |
1250 | 1250 | if (!isset($this->_convertedValues[$field])) { |
1251 | - if (is_null($value) && !in_array($type, ['set','list'])) { |
|
1251 | + if (is_null($value) && !in_array($type, ['set', 'list'])) { |
|
1252 | 1252 | unset($this->_convertedValues[$field]); |
1253 | 1253 | return null; |
1254 | 1254 | } |
@@ -1521,7 +1521,7 @@ discard block |
||
1521 | 1521 | foreach ($order as $key => $value) { |
1522 | 1522 | if (is_string($key)) { |
1523 | 1523 | $columnName = static::_cn($key); |
1524 | - $direction = strtoupper($value)=='DESC' ? 'DESC' : 'ASC'; |
|
1524 | + $direction = strtoupper($value) == 'DESC' ? 'DESC' : 'ASC'; |
|
1525 | 1525 | } else { |
1526 | 1526 | $columnName = static::_cn($value); |
1527 | 1527 | $direction = 'ASC'; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | public $searchConditions = [ |
47 | 47 | 'Caption' => [ |
48 | - 'qualifiers' => ['any','caption'] |
|
48 | + 'qualifiers' => ['any', 'caption'] |
|
49 | 49 | ,'points' => 2 |
50 | 50 | ,'sql' => 'Caption LIKE "%%%s%%"', |
51 | 51 | ] |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | } elseif ($_SERVER['REQUEST_METHOD'] == 'PUT') { |
203 | 203 | $put = fopen(static::$inputStream, 'r'); // open input stream |
204 | 204 | |
205 | - $tmp = tempnam('/tmp', 'dvr'); // use PHP to make a temporary file |
|
205 | + $tmp = tempnam('/tmp', 'dvr'); // use PHP to make a temporary file |
|
206 | 206 | $fp = fopen($tmp, 'w'); // open write stream to temp file |
207 | 207 | |
208 | 208 | // write |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | } |
239 | 239 | |
240 | 240 | return $this->respond('uploadComplete', [ |
241 | - 'success' => (bool)$Media |
|
241 | + 'success' => (bool) $Media |
|
242 | 242 | ,'data' => $Media, |
243 | 243 | ]); |
244 | 244 | } |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | */ |
261 | 261 | public function setCache(Response $response): Response |
262 | 262 | { |
263 | - $expires = 60*60*24*365; |
|
263 | + $expires = 60 * 60 * 24 * 365; |
|
264 | 264 | return $response->withHeader('Cache-Control', "public, max-age= $expires") |
265 | - ->withHeader('Expires', gmdate('D, d M Y H:i:s \G\M\T', time()+$expires)) |
|
265 | + ->withHeader('Expires', gmdate('D, d M Y H:i:s \G\M\T', time() + $expires)) |
|
266 | 266 | ->withHeader('Pragma', 'public'); |
267 | 267 | } |
268 | 268 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | // if partial content provide proper response header |
330 | 330 | if (isset($chunkStart)) { |
331 | 331 | // only send 206 if response is less than the whole file |
332 | - if ($end-$start+1<$size) { |
|
332 | + if ($end - $start + 1 < $size) { |
|
333 | 333 | $response = $response->withStatus(206); |
334 | 334 | } |
335 | 335 | $response = $response->withHeader('Content-Range', "bytes $start-$end/$size") |
@@ -35,7 +35,7 @@ |
||
35 | 35 | public function getBody(): StreamInterface |
36 | 36 | { |
37 | 37 | $fp = new Stream(fopen($this->template, 'r')); |
38 | - if (isset($this->start) && $this->start>0) { |
|
38 | + if (isset($this->start) && $this->start > 0) { |
|
39 | 39 | return new LimitStream($fp, $this->length, $this->start); |
40 | 40 | } |
41 | 41 | return $fp; |