@@ -45,8 +45,9 @@ |
||
| 45 | 45 | public function __clone() |
| 46 | 46 | { |
| 47 | 47 | parent::__clone(); |
| 48 | - if ($this->_queryBuilder) |
|
| 49 | - $this->_queryBuilder = clone $this->_queryBuilder; |
|
| 48 | + if ($this->_queryBuilder) { |
|
| 49 | + $this->_queryBuilder = clone $this->_queryBuilder; |
|
| 50 | + } |
|
| 50 | 51 | } |
| 51 | 52 | |
| 52 | 53 | /** |
@@ -133,13 +133,15 @@ |
||
| 133 | 133 | $pagination = $this->_grid->getDataProvider()->getPagination(); |
| 134 | 134 | $filters = []; |
| 135 | 135 | foreach($this->_grid->getFilterForm()->getFields() as $field) { |
| 136 | - if (!empty($field->getValue())) |
|
| 137 | - $filters[$field->getInputName()] = $field->getValue(); |
|
| 136 | + if (!empty($field->getValue())) { |
|
| 137 | + $filters[$field->getInputName()] = $field->getValue(); |
|
| 138 | + } |
|
| 138 | 139 | } |
| 139 | 140 | $queryParams = neon()->request->queryParams; |
| 140 | 141 | // remove any pre existing grid specific filters from the url - we don't want to add them twice |
| 141 | - if (isset($queryParams[$this->_grid->gridName()])) |
|
| 142 | - unset($queryParams[$this->_grid->gridName()]); |
|
| 142 | + if (isset($queryParams[$this->_grid->gridName()])) { |
|
| 143 | + unset($queryParams[$this->_grid->gridName()]); |
|
| 144 | + } |
|
| 143 | 145 | // gross - we need to remove any pre existing filters from the query params |
| 144 | 146 | $pagination->params = $queryParams + $filters; |
| 145 | 147 | |
@@ -124,8 +124,9 @@ |
||
| 124 | 124 | */ |
| 125 | 125 | public function getDataProvider() |
| 126 | 126 | { |
| 127 | - if (!$this->_dataProvider) |
|
| 128 | - throw new \RuntimeException('You need to call phoebeLoadGrid before the grid can be used'); |
|
| 127 | + if (!$this->_dataProvider) { |
|
| 128 | + throw new \RuntimeException('You need to call phoebeLoadGrid before the grid can be used'); |
|
| 129 | + } |
|
| 129 | 130 | return $this->_dataProvider; |
| 130 | 131 | } |
| 131 | 132 | |
@@ -30,10 +30,11 @@ |
||
| 30 | 30 | if (is_array($column)) { |
| 31 | 31 | return $this->addArrayOfWheres($column); |
| 32 | 32 | } |
| 33 | - if ($operator==='=') |
|
| 34 | - $this->_activeQuery->andWhere([$column => $value]); |
|
| 35 | - else |
|
| 36 | - $this->_activeQuery->andWhere([$operator, $column, $value]); |
|
| 33 | + if ($operator==='=') { |
|
| 34 | + $this->_activeQuery->andWhere([$column => $value]); |
|
| 35 | + } else { |
|
| 36 | + $this->_activeQuery->andWhere([$operator, $column, $value]); |
|
| 37 | + } |
|
| 37 | 38 | return $this; |
| 38 | 39 | } |
| 39 | 40 | |
@@ -147,8 +147,9 @@ |
||
| 147 | 147 | { |
| 148 | 148 | $tableName = $this->tableName(); |
| 149 | 149 | foreach($fields as $field) { |
| 150 | - if (!$this->hasAttribute($field)) |
|
| 151 | - throw new \InvalidArgumentException("No '$field' exists on the '$tableName' table. $message"); |
|
| 150 | + if (!$this->hasAttribute($field)) { |
|
| 151 | + throw new \InvalidArgumentException("No '$field' exists on the '$tableName' table. $message"); |
|
| 152 | + } |
|
| 152 | 153 | } |
| 153 | 154 | } |
| 154 | 155 | |
@@ -113,8 +113,9 @@ discard block |
||
| 113 | 113 | public function getNewMigrationsForApp($appName) |
| 114 | 114 | { |
| 115 | 115 | $app = Neon::$app->getApp($appName); |
| 116 | - if ($app === null) |
|
| 117 | - throw new \Exception('No app exists with id "'.$appName.'"'); |
|
| 116 | + if ($app === null) { |
|
| 117 | + throw new \Exception('No app exists with id "'.$appName.'"'); |
|
| 118 | + } |
|
| 118 | 119 | $alias = $app->getClassAlias().'/migrations'; |
| 119 | 120 | $migrationAlias = $app->getMigrationAlias().'/migrations'; |
| 120 | 121 | $applied = []; |
@@ -136,8 +137,9 @@ discard block |
||
| 136 | 137 | */ |
| 137 | 138 | private function getNewMigrationsInPath($pathAlias, $applied, $migrationAlias=null) |
| 138 | 139 | { |
| 139 | - if ($migrationAlias === null) |
|
| 140 | - $migrationAlias = $pathAlias; |
|
| 140 | + if ($migrationAlias === null) { |
|
| 141 | + $migrationAlias = $pathAlias; |
|
| 142 | + } |
|
| 141 | 143 | $migrations = []; |
| 142 | 144 | $migrationPath = Neon::getAlias($pathAlias); |
| 143 | 145 | if (file_exists($migrationPath)) { |
@@ -402,9 +404,7 @@ discard block |
||
| 402 | 404 | $string = $prefix.$message; |
| 403 | 405 | } |
| 404 | 406 | return Console::stdout("$string\n"); |
| 405 | - } |
|
| 406 | - |
|
| 407 | - else { |
|
| 407 | + } else { |
|
| 408 | 408 | return $message; |
| 409 | 409 | } |
| 410 | 410 | } |
@@ -431,15 +431,17 @@ discard block |
||
| 431 | 431 | foreach ($migrations as $migration) { |
| 432 | 432 | // remove any paths to get the migration itself |
| 433 | 433 | $migrationPart = $migration; |
| 434 | - if (strpos($migration,'/')!==false) |
|
| 435 | - $migrationPart = substr($migration, strrpos($migration,'/')+1); |
|
| 434 | + if (strpos($migration,'/')!==false) { |
|
| 435 | + $migrationPart = substr($migration, strrpos($migration,'/')+1); |
|
| 436 | + } |
|
| 436 | 437 | |
| 437 | 438 | $parts = explode('_', substr($migrationPart,1)); // remove initial m |
| 438 | 439 | |
| 439 | 440 | // check it was a migration and has enough parts |
| 440 | 441 | if (count($parts) == 1) { |
| 441 | - if (!is_numeric($parts[0])) |
|
| 442 | - continue; |
|
| 442 | + if (!is_numeric($parts[0])) { |
|
| 443 | + continue; |
|
| 444 | + } |
|
| 443 | 445 | $date = $parts[0]; |
| 444 | 446 | $time = '000000'; |
| 445 | 447 | } else { |
@@ -449,24 +451,28 @@ discard block |
||
| 449 | 451 | |
| 450 | 452 | // some handwritten migrations have bad datetimes |
| 451 | 453 | // capture case where no time has been set or is actually a date |
| 452 | - if (!is_numeric($time) || strlen($time) != 6) |
|
| 453 | - $time = '000000'; |
|
| 454 | + if (!is_numeric($time) || strlen($time) != 6) { |
|
| 455 | + $time = '000000'; |
|
| 456 | + } |
|
| 454 | 457 | // some datetimes are YYYYMMDD and others YYMMDD. Canonicalise these |
| 455 | - if (strlen($date)==6) |
|
| 456 | - $date = "20$date"; |
|
| 458 | + if (strlen($date)==6) { |
|
| 459 | + $date = "20$date"; |
|
| 460 | + } |
|
| 457 | 461 | // turn this into 'YYYY-MM-DD HH:MM:SS' and then into a timestamp |
| 458 | 462 | $dateTime = substr($date,0,4)."-".substr($date,4,2)."-".substr($date,6,2)." ".substr($time,0,2).":".substr($time,2,2).":".substr($time,4,2); |
| 459 | 463 | $timestamp = strtotime($dateTime); |
| 460 | - if ($timestamp == false) |
|
| 461 | - throw new \Exception("Invalid datetime in migration $migration. Date(yyyymmdd)=$date and time(hhmmss)=$time. Please fix."); |
|
| 464 | + if ($timestamp == false) { |
|
| 465 | + throw new \Exception("Invalid datetime in migration $migration. Date(yyyymmdd)=$date and time(hhmmss)=$time. Please fix."); |
|
| 466 | + } |
|
| 462 | 467 | // beware migrations with same timestamp |
| 463 | 468 | $sortableMigrations[$timestamp][] = $migration; |
| 464 | 469 | } |
| 465 | 470 | ksort($sortableMigrations); |
| 466 | 471 | $sortedMigrations = []; |
| 467 | 472 | foreach ($sortableMigrations as $mgs) { |
| 468 | - foreach ($mgs as $mig) |
|
| 469 | - $sortedMigrations[] = $mig; |
|
| 473 | + foreach ($mgs as $mig) { |
|
| 474 | + $sortedMigrations[] = $mig; |
|
| 475 | + } |
|
| 470 | 476 | } |
| 471 | 477 | return $sortedMigrations; |
| 472 | 478 | } |
@@ -42,14 +42,16 @@ |
||
| 42 | 42 | parent::init(); |
| 43 | 43 | // the main config can set this - but it can also be loaded by application settings (and possibly user setting in future) |
| 44 | 44 | $this->dateFormat = setting('settings', 'dateFormat', $this->dateFormat); |
| 45 | - if ($this->dateFormat === 'custom') |
|
| 46 | - $this->dateFormat = setting('settings', 'dateFormatCustom', $this->dateFormat); |
|
| 45 | + if ($this->dateFormat === 'custom') { |
|
| 46 | + $this->dateFormat = setting('settings', 'dateFormatCustom', $this->dateFormat); |
|
| 47 | + } |
|
| 47 | 48 | |
| 48 | 49 | $this->timeFormat = setting('settings', 'timeFormat', $this->timeFormat); |
| 49 | 50 | $this->nullDisplay = setting('settings', 'nullDisplay', $this->nullDisplay); |
| 50 | 51 | $this->datetimeFormat = setting('settings', 'datetimeFormat', $this->datetimeFormat); |
| 51 | - if ($this->datetimeFormat === 'custom') |
|
| 52 | - $this->datetimeFormat = setting('settings', 'datetimeFormatCustom', $this->datetimeFormat); |
|
| 52 | + if ($this->datetimeFormat === 'custom') { |
|
| 53 | + $this->datetimeFormat = setting('settings', 'datetimeFormatCustom', $this->datetimeFormat); |
|
| 54 | + } |
|
| 53 | 55 | } |
| 54 | 56 | |
| 55 | 57 | /** |
@@ -99,8 +99,9 @@ |
||
| 99 | 99 | */ |
| 100 | 100 | public function getValueDisplay() |
| 101 | 101 | { |
| 102 | - if (empty($this->value)) |
|
| 103 | - return Html::encodeEntities($this->value); |
|
| 102 | + if (empty($this->value)) { |
|
| 103 | + return Html::encodeEntities($this->value); |
|
| 104 | + } |
|
| 104 | 105 | return Html::a(neon()->firefly->getFileName($this->value), neon()->firefly->getUrl($this->value), ['target' => '_blank']); |
| 105 | 106 | } |
| 106 | 107 | |
@@ -105,8 +105,9 @@ |
||
| 105 | 105 | public function getItemsDisplay() |
| 106 | 106 | { |
| 107 | 107 | $items = $this->getItems(); |
| 108 | - foreach ($items as $key => $value) |
|
| 109 | - $items[$key] = '<span class="neonField_labelText">'.$value.'</span>'; |
|
| 108 | + foreach ($items as $key => $value) { |
|
| 109 | + $items[$key] = '<span class="neonField_labelText">'.$value.'</span>'; |
|
| 110 | + } |
|
| 110 | 111 | return $items; |
| 111 | 112 | } |
| 112 | 113 | |