@@ -26,8 +26,9 @@ discard block |
||
| 26 | 26 | list($prop, $value) = $this->resolveProperty($key, $value); |
| 27 | 27 | $array[$prop] = $this->valueToArray($value); |
| 28 | 28 | } |
| 29 | - if (!isset($array['class'])) |
|
| 30 | - $array['class'] = get_called_class(); |
|
| 29 | + if (!isset($array['class'])) { |
|
| 30 | + $array['class'] = get_called_class(); |
|
| 31 | + } |
|
| 31 | 32 | return $array; |
| 32 | 33 | } |
| 33 | 34 | |
@@ -39,7 +40,9 @@ discard block |
||
| 39 | 40 | */ |
| 40 | 41 | public function resolveProperty($key, $value) |
| 41 | 42 | { |
| 42 | - if (is_int($key)) $key = $value; |
|
| 43 | + if (is_int($key)) { |
|
| 44 | + $key = $value; |
|
| 45 | + } |
|
| 43 | 46 | $value = is_string($value) ? $this->$value : call_user_func($value, $this, $key); |
| 44 | 47 | return [$key, $value]; |
| 45 | 48 | } |
@@ -171,8 +171,9 @@ |
||
| 171 | 171 | public static function endProfile($token=null, $category = 'application') |
| 172 | 172 | { |
| 173 | 173 | if (neon()->debug) { |
| 174 | - if ($token === null) |
|
| 175 | - list($token, $category) = array_pop(self::$_logStack); |
|
| 174 | + if ($token === null) { |
|
| 175 | + list($token, $category) = array_pop(self::$_logStack); |
|
| 176 | + } |
|
| 176 | 177 | parent::endProfile($token, $category); |
| 177 | 178 | } |
| 178 | 179 | } |
@@ -34,8 +34,9 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public static function getNeonSecret() |
| 36 | 36 | { |
| 37 | - if (empty(env('NEON_SECRET'))) |
|
| 38 | - Env::createEnvironmentVariable('NEON_SECRET'); |
|
| 37 | + if (empty(env('NEON_SECRET'))) { |
|
| 38 | + Env::createEnvironmentVariable('NEON_SECRET'); |
|
| 39 | + } |
|
| 39 | 40 | return env('NEON_SECRET'); |
| 40 | 41 | } |
| 41 | 42 | |
@@ -45,8 +46,9 @@ discard block |
||
| 45 | 46 | */ |
| 46 | 47 | public static function getNeonEncryptionKey() |
| 47 | 48 | { |
| 48 | - if (empty(env('NEON_ENCRYPTION_KEY'))) |
|
| 49 | - Env::createEnvironmentVariable('NEON_ENCRYPTION_KEY'); |
|
| 49 | + if (empty(env('NEON_ENCRYPTION_KEY'))) { |
|
| 50 | + Env::createEnvironmentVariable('NEON_ENCRYPTION_KEY'); |
|
| 51 | + } |
|
| 50 | 52 | return env('NEON_ENCRYPTION_KEY'); |
| 51 | 53 | } |
| 52 | 54 | |
@@ -114,8 +116,9 @@ discard block |
||
| 114 | 116 | defined('DIR_SYSTEM') || define('DIR_SYSTEM', DIR_ROOT . '/system'); |
| 115 | 117 | |
| 116 | 118 | Env::environment(); |
| 117 | - if (!class_exists('Neon')) |
|
| 118 | - require DIR_NEON.'/core/Yii.php'; |
|
| 119 | + if (!class_exists('Neon')) { |
|
| 120 | + require DIR_NEON.'/core/Yii.php'; |
|
| 121 | + } |
|
| 119 | 122 | |
| 120 | 123 | \Neon::setAlias('neon', DIR_NEON); |
| 121 | 124 | \Neon::setAlias('root', DIR_ROOT); |
@@ -159,8 +162,9 @@ discard block |
||
| 159 | 162 | private static function createEnvironmentVariable($name, $saveToEnvFile=true) |
| 160 | 163 | { |
| 161 | 164 | $value = Hash::uuid64().Hash::uuid64().Hash::uuid64().Hash::uuid64(); |
| 162 | - if ($saveToEnvFile && file_exists(DIR_CONFIG.'/env.ini')) |
|
| 163 | - file_put_contents(DIR_CONFIG.'/env.ini', PHP_EOL."$name = '$value'", FILE_APPEND | LOCK_EX); |
|
| 165 | + if ($saveToEnvFile && file_exists(DIR_CONFIG.'/env.ini')) { |
|
| 166 | + file_put_contents(DIR_CONFIG.'/env.ini', PHP_EOL."$name = '$value'", FILE_APPEND | LOCK_EX); |
|
| 167 | + } |
|
| 164 | 168 | static::setEnvironmentVariable($name, $value, true); |
| 165 | 169 | } |
| 166 | 170 | |
@@ -102,8 +102,9 @@ |
||
| 102 | 102 | public function init() |
| 103 | 103 | { |
| 104 | 104 | parent::init(); |
| 105 | - if ($this->isInstalled() && neon()->dev) |
|
| 106 | - neon()->dev->debugBootstrap(); |
|
| 105 | + if ($this->isInstalled() && neon()->dev) { |
|
| 106 | + neon()->dev->debugBootstrap(); |
|
| 107 | + } |
|
| 107 | 108 | } |
| 108 | 109 | |
| 109 | 110 | /** |
@@ -19,8 +19,9 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | public static function get($label='') |
| 21 | 21 | { |
| 22 | - if (self::$mock===null) |
|
| 23 | - self::$mock = new self(); |
|
| 22 | + if (self::$mock===null) { |
|
| 23 | + self::$mock = new self(); |
|
| 24 | + } |
|
| 24 | 25 | self::$mock->label = $label; |
| 25 | 26 | return self::$mock; |
| 26 | 27 | } |
@@ -148,8 +148,9 @@ discard block |
||
| 148 | 148 | { |
| 149 | 149 | $this->_classType = $value; |
| 150 | 150 | // Set a default title |
| 151 | - if ($this->title === null) |
|
| 152 | - $this->title = $this->_classType; |
|
| 151 | + if ($this->title === null) { |
|
| 152 | + $this->title = $this->_classType; |
|
| 153 | + } |
|
| 153 | 154 | } |
| 154 | 155 | |
| 155 | 156 | /** |
@@ -191,18 +192,21 @@ discard block |
||
| 191 | 192 | parent::init(); |
| 192 | 193 | // don't configure the grid if the class type has not been set! |
| 193 | 194 | if ($this->_classType === null) { |
| 194 | - if (neon()->debug) |
|
| 195 | - throw new \RuntimeException('You need to configure the grid class type before calling init'); |
|
| 195 | + if (neon()->debug) { |
|
| 196 | + throw new \RuntimeException('You need to configure the grid class type before calling init'); |
|
| 197 | + } |
|
| 196 | 198 | return null; |
| 197 | 199 | } |
| 198 | 200 | |
| 199 | 201 | $this->addColumnsFromClassMembers(); |
| 200 | 202 | $this->addDdsObjectColumns(); |
| 201 | 203 | |
| 202 | - if ($this->useActiveScope) |
|
| 203 | - $this->addScope('active', 'Active'); |
|
| 204 | - if ($this->useDeletedScope) |
|
| 205 | - $this->addScope('deleted', 'Deleted'); |
|
| 204 | + if ($this->useActiveScope) { |
|
| 205 | + $this->addScope('active', 'Active'); |
|
| 206 | + } |
|
| 207 | + if ($this->useDeletedScope) { |
|
| 208 | + $this->addScope('deleted', 'Deleted'); |
|
| 209 | + } |
|
| 206 | 210 | } |
| 207 | 211 | |
| 208 | 212 | /** |
@@ -368,8 +372,9 @@ discard block |
||
| 368 | 372 | 'class' => 'neon\core\grid\column\DefinitionColumn', |
| 369 | 373 | 'member' => new $columnType($member), |
| 370 | 374 | ]; |
| 371 | - if (is_array($config)) |
|
| 372 | - $colConfig = array_merge($colConfig, $config); |
|
| 375 | + if (is_array($config)) { |
|
| 376 | + $colConfig = array_merge($colConfig, $config); |
|
| 377 | + } |
|
| 373 | 378 | return $this->addColumn($member, $colConfig); |
| 374 | 379 | } |
| 375 | 380 | |
@@ -379,8 +384,9 @@ discard block |
||
| 379 | 384 | */ |
| 380 | 385 | public function ddsLoadGrid($classType, $includeDeleted=false, $pageSize=50) |
| 381 | 386 | { |
| 382 | - if ($this->title == null) |
|
| 383 | - $this->title = $classType; |
|
| 387 | + if ($this->title == null) { |
|
| 388 | + $this->title = $classType; |
|
| 389 | + } |
|
| 384 | 390 | // TODO: should be in constructor can't create a DDS grid without the DDS class ref |
| 385 | 391 | $this->classType = $classType; |
| 386 | 392 | |
@@ -42,10 +42,12 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function init() |
| 44 | 44 | { |
| 45 | - if (empty($this->phoebeType)) |
|
| 46 | - throw new \RuntimeException('PhoebeDataProvider: the phoebe type has not been set. It needs to be set on construction'); |
|
| 47 | - if (empty($this->classType)) |
|
| 48 | - throw new \RuntimeException('PhoebeDataProvider: the phoebe class type has not been set. It needs to be set on construction'); |
|
| 45 | + if (empty($this->phoebeType)) { |
|
| 46 | + throw new \RuntimeException('PhoebeDataProvider: the phoebe type has not been set. It needs to be set on construction'); |
|
| 47 | + } |
|
| 48 | + if (empty($this->classType)) { |
|
| 49 | + throw new \RuntimeException('PhoebeDataProvider: the phoebe class type has not been set. It needs to be set on construction'); |
|
| 50 | + } |
|
| 49 | 51 | } |
| 50 | 52 | |
| 51 | 53 | /** |
@@ -142,8 +144,9 @@ discard block |
||
| 142 | 144 | */ |
| 143 | 145 | protected function getFormDefinition() |
| 144 | 146 | { |
| 145 | - if ($this->formDefinition == null) |
|
| 146 | - $this->formDefinition = neon('phoebe')->getFormDefinition($this->phoebeType, $this->classType); |
|
| 147 | + if ($this->formDefinition == null) { |
|
| 148 | + $this->formDefinition = neon('phoebe')->getFormDefinition($this->phoebeType, $this->classType); |
|
| 149 | + } |
|
| 147 | 150 | return $this->formDefinition; |
| 148 | 151 | } |
| 149 | 152 | |
@@ -40,7 +40,8 @@ |
||
| 40 | 40 | public function __clone() |
| 41 | 41 | { |
| 42 | 42 | parent::__clone(); |
| 43 | - if ($this->_queryBuilder) |
|
| 44 | - $this->_queryBuilder = clone $this->_queryBuilder; |
|
| 43 | + if ($this->_queryBuilder) { |
|
| 44 | + $this->_queryBuilder = clone $this->_queryBuilder; |
|
| 45 | + } |
|
| 45 | 46 | } |
| 46 | 47 | } |
| 47 | 48 | \ No newline at end of file |
@@ -105,8 +105,9 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function getEmptyCellDisplay() |
| 107 | 107 | { |
| 108 | - if ($this->_emptyCellDisplay !== null) |
|
| 109 | - return $this->_emptyCellDisplay; |
|
| 108 | + if ($this->_emptyCellDisplay !== null) { |
|
| 109 | + return $this->_emptyCellDisplay; |
|
| 110 | + } |
|
| 110 | 111 | return $this->getGrid()->emptyCellDisplay; |
| 111 | 112 | } |
| 112 | 113 | |
@@ -437,10 +438,12 @@ discard block |
||
| 437 | 438 | public function renderHeaderCell() |
| 438 | 439 | { |
| 439 | 440 | $options = $this->getHeaderCellAttributes(); |
| 440 | - if ($this->grid->hasSort($this->key)) |
|
| 441 | - Html::addCssClass($options, ($this->grid->hasSortDescending() ? 'desc' : 'asc')); |
|
| 442 | - if (trim($this->width) != '') |
|
| 443 | - Html::addCssStyle($options, ["width" => $this->width]); |
|
| 441 | + if ($this->grid->hasSort($this->key)) { |
|
| 442 | + Html::addCssClass($options, ($this->grid->hasSortDescending() ? 'desc' : 'asc')); |
|
| 443 | + } |
|
| 444 | + if (trim($this->width) != '') { |
|
| 445 | + Html::addCssStyle($options, ["width" => $this->width]); |
|
| 446 | + } |
|
| 444 | 447 | Html::addCssStyle($options, $this->_style); |
| 445 | 448 | |
| 446 | 449 | return Html::tag('th', $this->renderHeaderCellContent(), $options); |
@@ -451,8 +454,9 @@ discard block |
||
| 451 | 454 | */ |
| 452 | 455 | public function renderHeaderCellContent() |
| 453 | 456 | { |
| 454 | - if (!$this->isSortable()) |
|
| 455 | - return $this->getTitle(); |
|
| 457 | + if (!$this->isSortable()) { |
|
| 458 | + return $this->getTitle(); |
|
| 459 | + } |
|
| 456 | 460 | $sort = ''; |
| 457 | 461 | if ($this->grid->hasSort($this->key)) { |
| 458 | 462 | $sort = $this->grid->hasSortDescending() ? ' - ' : ' + '; |
@@ -482,10 +486,12 @@ discard block |
||
| 482 | 486 | */ |
| 483 | 487 | public function renderFilterCellContent() |
| 484 | 488 | { |
| 485 | - if ($this->filter === false) |
|
| 486 | - return ''; |
|
| 487 | - if (!$this->getGrid()->getFilterForm()->hasField($this->getKey())) |
|
| 488 | - return ''; |
|
| 489 | + if ($this->filter === false) { |
|
| 490 | + return ''; |
|
| 491 | + } |
|
| 492 | + if (!$this->getGrid()->getFilterForm()->hasField($this->getKey())) { |
|
| 493 | + return ''; |
|
| 494 | + } |
|
| 489 | 495 | $field = $this->getGrid()->getFilterForm()->getField($this->getKey()); |
| 490 | 496 | // remove any automatic validators |
| 491 | 497 | $field->setValidators([], true); |
@@ -513,8 +519,9 @@ discard block |
||
| 513 | 519 | public function getFilterField() |
| 514 | 520 | { |
| 515 | 521 | $field = $this->getBaseFilterField(); |
| 516 | - foreach($this->filterFieldConfig as $key => $value) |
|
| 517 | - $field[$key] = $value; |
|
| 522 | + foreach($this->filterFieldConfig as $key => $value) { |
|
| 523 | + $field[$key] = $value; |
|
| 524 | + } |
|
| 518 | 525 | return $field; |
| 519 | 526 | } |
| 520 | 527 | |
@@ -530,8 +537,9 @@ discard block |
||
| 530 | 537 | public function setMemberConfig($config) |
| 531 | 538 | { |
| 532 | 539 | foreach($config as $key => $value) { |
| 533 | - if (isset($this->member->$key)) |
|
| 534 | - $this->member->$key = $value; |
|
| 540 | + if (isset($this->member->$key)) { |
|
| 541 | + $this->member->$key = $value; |
|
| 542 | + } |
|
| 535 | 543 | } |
| 536 | 544 | return $this; |
| 537 | 545 | } |
@@ -709,7 +717,9 @@ discard block |
||
| 709 | 717 | $out = '<div class="neonGrid_rowActions">'; |
| 710 | 718 | $i = 0; |
| 711 | 719 | foreach($this->_actions as $actionKey => $linkOptions) { |
| 712 | - if ($i > 0) $out .= ' | '; |
|
| 720 | + if ($i > 0) { |
|
| 721 | + $out .= ' | '; |
|
| 722 | + } |
|
| 713 | 723 | if (isset($linkOptions['function'])) { |
| 714 | 724 | $func = $linkOptions['function']; |
| 715 | 725 | $out .= $this->callFunction($func, [$model, $key, $index]); |