@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @param int $length - the number of rows to return |
36 | 36 | * @return array an array of key value pairs |
37 | 37 | */ |
38 | - public function getDataMap($key, $query='', $filters=[], $fields=[], $start = 0, $length = 100); |
|
38 | + public function getDataMap($key, $query = '', $filters = [], $fields = [], $start = 0, $length = 100); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Looks up maps from the map ids. |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * If not set then return the default map field for the class. |
51 | 51 | * @return string |
52 | 52 | */ |
53 | - public function makeMapLookupRequest($key, $ids, $fields=[]); |
|
53 | + public function makeMapLookupRequest($key, $ids, $fields = []); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * Return results from a previously called makeMapLookupRequest request |
@@ -56,12 +56,12 @@ discard block |
||
56 | 56 | * @param string $file - the path to the config file |
57 | 57 | * @throws \Exception - if the environment variable value is an array |
58 | 58 | */ |
59 | - public static function setEnvironmentFromFile($file, $overwrite=false) |
|
59 | + public static function setEnvironmentFromFile($file, $overwrite = false) |
|
60 | 60 | { |
61 | 61 | if (file_exists($file)) { |
62 | 62 | // we need to load in the locally set environment ini file |
63 | 63 | $iniSettings = parse_ini_file($file, false, INI_SCANNER_TYPED); |
64 | - foreach($iniSettings as $name => $value) { |
|
64 | + foreach ($iniSettings as $name => $value) { |
|
65 | 65 | Env::setEnvironmentVariable($name, $value, $overwrite); |
66 | 66 | } |
67 | 67 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param bool $overwrite Whether to force overwriting the environment variable if it already exists defaults to false |
76 | 76 | * @throws \Exception - if the environment variable value is an array |
77 | 77 | */ |
78 | - public static function setEnvironmentVariable($key, $value, $overwrite=false) |
|
78 | + public static function setEnvironmentVariable($key, $value, $overwrite = false) |
|
79 | 79 | { |
80 | 80 | if (is_array($value)) { |
81 | 81 | throw new \Exception('Environment variables do not support nesting. The variable "'.print_r($key, true).'" is poop.'); |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | throw new \Exception('DIR_ROOT constant must be defined as the path to the root of your neon application'); |
110 | 110 | } |
111 | 111 | |
112 | - defined('DIR_CONFIG') || define('DIR_CONFIG', DIR_ROOT . '/config'); |
|
113 | - defined('DIR_VAR') || define('DIR_VAR', DIR_ROOT . '/var'); |
|
114 | - defined('DIR_SYSTEM') || define('DIR_SYSTEM', DIR_ROOT . '/system'); |
|
112 | + defined('DIR_CONFIG') || define('DIR_CONFIG', DIR_ROOT.'/config'); |
|
113 | + defined('DIR_VAR') || define('DIR_VAR', DIR_ROOT.'/var'); |
|
114 | + defined('DIR_SYSTEM') || define('DIR_SYSTEM', DIR_ROOT.'/system'); |
|
115 | 115 | |
116 | 116 | Env::environment(); |
117 | 117 | if (!class_exists('Neon')) |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @param string $name |
157 | 157 | * @param boolean $saveToEnvFile |
158 | 158 | */ |
159 | - private static function createEnvironmentVariable($name, $saveToEnvFile=true) |
|
159 | + private static function createEnvironmentVariable($name, $saveToEnvFile = true) |
|
160 | 160 | { |
161 | 161 | $value = Hash::uuid64().Hash::uuid64().Hash::uuid64().Hash::uuid64(); |
162 | 162 | if ($saveToEnvFile && file_exists(DIR_CONFIG.'/env.ini')) |
@@ -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 |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | // Register the core apps |
166 | 166 | $this->registerApps($this->getCoreApps()); |
167 | 167 | // Check neon is installed |
168 | - if (! $this->isInstalled() || InstallHelper::isInstallRoute()) { |
|
168 | + if (!$this->isInstalled() || InstallHelper::isInstallRoute()) { |
|
169 | 169 | // We can not bootstrap the apps as they can not rely on a database connection |
170 | 170 | // so conclude the bootstrap process |
171 | 171 | return; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function getDocsPath() |
186 | 186 | { |
187 | - return __DIR__ . '/docs'; |
|
187 | + return __DIR__.'/docs'; |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -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 | /** |
@@ -28,7 +28,7 @@ |
||
28 | 28 | public function getClientOptions($model, $attribute) |
29 | 29 | { |
30 | 30 | $options = parent::getClientOptions($model, $attribute); |
31 | - $options['integerOnly']=$this->integerOnly; |
|
31 | + $options['integerOnly'] = $this->integerOnly; |
|
32 | 32 | return $options; |
33 | 33 | } |
34 | 34 | } |
35 | 35 | \ No newline at end of file |
@@ -29,7 +29,7 @@ |
||
29 | 29 | 'message' => $this->formatMessage($this->message, [ |
30 | 30 | 'attribute' => $model->getAttributeLabel($attribute), |
31 | 31 | ]), |
32 | - 'enableIDN' => (bool)$this->enableIDN, |
|
32 | + 'enableIDN' => (bool) $this->enableIDN, |
|
33 | 33 | ]; |
34 | 34 | if ($this->skipOnEmpty) { |
35 | 35 | $options['skipOnEmpty'] = 1; |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | 'captcha' => ['class'=>'yii\captcha\CaptchaValidator'], |
20 | 20 | 'compare' => ['class'=>'yii\validators\CompareValidator'], |
21 | 21 | 'date' => ['class'=>'neon\core\validators\DateValidator'], |
22 | - 'datetime' => ['class' => 'neon\core\validators\DateValidator', 'type' => DateValidator::TYPE_DATETIME,], |
|
23 | - 'time' => ['class' => 'yii\validators\DateValidator', 'type' => DateValidator::TYPE_TIME,], |
|
22 | + 'datetime' => ['class' => 'neon\core\validators\DateValidator', 'type' => DateValidator::TYPE_DATETIME, ], |
|
23 | + 'time' => ['class' => 'yii\validators\DateValidator', 'type' => DateValidator::TYPE_TIME, ], |
|
24 | 24 | 'default' => ['class'=>'yii\validators\DefaultValueValidator'], |
25 | 25 | 'double' => ['class'=>'neon\core\validators\NumberValidator'], |
26 | 26 | 'each' => ['class'=>'yii\validators\EachValidator'], |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | 'filter' => ['class'=>'yii\validators\FilterValidator'], |
31 | 31 | 'image' => ['class'=>'yii\validators\ImageValidator'], |
32 | 32 | 'in' => ['class'=>'yii\validators\RangeValidator'], |
33 | - 'integer' => ['class' => 'neon\core\validators\NumberValidator', 'integerOnly' => true,], |
|
33 | + 'integer' => ['class' => 'neon\core\validators\NumberValidator', 'integerOnly' => true, ], |
|
34 | 34 | 'match' => ['class'=>'neon\core\validators\RegularExpressionValidator'], |
35 | 35 | 'number' => ['class'=>'neon\core\validators\NumberValidator'], |
36 | 36 | 'required' => ['class'=>'neon\core\validators\RequiredValidator'], |
37 | 37 | 'safe' => ['class'=>'yii\validators\SafeValidator'], |
38 | 38 | 'string' => ['class'=>'neon\core\validators\StringValidator'], |
39 | - 'trim' => ['class' => 'yii\validators\FilterValidator', 'filter' => 'trim', 'skipOnArray' => true,], |
|
39 | + 'trim' => ['class' => 'yii\validators\FilterValidator', 'filter' => 'trim', 'skipOnArray' => true, ], |
|
40 | 40 | 'unique' => ['class'=>'yii\validators\UniqueValidator'], |
41 | 41 | 'url' => ['class'=>'neon\core\validators\UrlValidator'], |
42 | 42 | 'ip' => ['class'=>'yii\validators\IpValidator'], |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | if ($type instanceof \Closure || ($model->hasMethod($type) && !isset(static::$builtInValidators[$type]))) { |
65 | 65 | // method-based validator |
66 | - $params['class'] = __NAMESPACE__ . '\InlineValidator'; |
|
66 | + $params['class'] = __NAMESPACE__.'\InlineValidator'; |
|
67 | 67 | $params['method'] = $type; |
68 | 68 | } else { |
69 | 69 | if (isset(static::$builtInValidators[$type])) { |
@@ -17,9 +17,9 @@ |
||
17 | 17 | * @param string $label |
18 | 18 | * @return MockModel|null |
19 | 19 | */ |
20 | - public static function get($label='') |
|
20 | + public static function get($label = '') |
|
21 | 21 | { |
22 | - if (self::$mock===null) |
|
22 | + if (self::$mock === null) |
|
23 | 23 | self::$mock = new self(); |
24 | 24 | self::$mock->label = $label; |
25 | 25 | return self::$mock; |
@@ -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 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | /** |
233 | 233 | * Add the edit and delete DDS object buttons to the grid |
234 | 234 | */ |
235 | - public function addActionButtonColumn($title=false) |
|
235 | + public function addActionButtonColumn($title = false) |
|
236 | 236 | { |
237 | 237 | $buttonCol = $this->addButtonColumn('edit')->setTitle($title); |
238 | 238 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | |
247 | 247 | if ($this->hasScope('deleted') && $this->isScopeActive('deleted')) { |
248 | 248 | if ($this->showGridUndeleteButton) { |
249 | - $buttonCol->addButton('undelete', '','', 'fa fa-undo', 'btn-default', [ |
|
249 | + $buttonCol->addButton('undelete', '', '', 'fa fa-undo', 'btn-default', [ |
|
250 | 250 | 'data-toggle' => 'tooltip', |
251 | 251 | 'title' => 'Restore', |
252 | 252 | 'data-action' => 'actionUndelete' |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | * Load appropriate columns based on DDS details |
378 | 378 | * @deprecated - just set the classType - either in the init or the config |
379 | 379 | */ |
380 | - public function ddsLoadGrid($classType, $includeDeleted=false, $pageSize=50) |
|
380 | + public function ddsLoadGrid($classType, $includeDeleted = false, $pageSize = 50) |
|
381 | 381 | { |
382 | 382 | if ($this->title == null) |
383 | 383 | $this->title = $classType; |
@@ -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 |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | - $paginator = [ |
|
64 | + $paginator = [ |
|
65 | 65 | 'start' => $pagination->getOffset(), |
66 | 66 | 'length' => $pagination->getLimit(), |
67 | 67 | 'total' => $pagination->totalCount |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $form = $this->getForm(); |
76 | 76 | |
77 | 77 | $data = []; |
78 | - foreach($results as $object) { |
|
78 | + foreach ($results as $object) { |
|
79 | 79 | $form->reset(); |
80 | 80 | $form->loadFromDb($object); |
81 | 81 | $data[] = array_merge($object, $form->getDataDisplay()); |
@@ -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 |