@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $root = neon()->getAlias("@root").DIRECTORY_SEPARATOR; |
83 | 83 | |
84 | 84 | // 1. Check that Babel is installed and if not install it |
85 | - if (($result = $this->checkBabel())!=0) |
|
85 | + if (($result = $this->checkBabel()) != 0) |
|
86 | 86 | return $result; |
87 | 87 | |
88 | 88 | // 2. Create the babel config file |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | return $result; |
91 | 91 | |
92 | 92 | // 3. Run babel over the project |
93 | - $sourceDirectory = $root.$path;; |
|
93 | + $sourceDirectory = $root.$path; ; |
|
94 | 94 | $outDirectory = $root.'babelOut'; |
95 | 95 | $command = "babel --root-mode=upward $sourceDirectory --out-dir=$outDirectory --out-file-extension=.build.js --ignore='$sourceDirectory/**/*.build.js','$sourceDirectory/**/vendor/*','$sourceDirectory/**/*.min.js'"; |
96 | 96 | $this->stdout("\n-> Running the babel command over $path\n"); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | // 5. Remove the babel directory |
112 | 112 | $this->stdout("\n-> Removing the temporary directory $outDirectory\n"); |
113 | - $deleteCommand="rm -rf $outDirectory"; |
|
113 | + $deleteCommand = "rm -rf $outDirectory"; |
|
114 | 114 | $this->stdout("-> $deleteCommand\n"); |
115 | 115 | $delete = new Process($deleteCommand); |
116 | 116 | $delete->start(); |
@@ -82,12 +82,14 @@ |
||
82 | 82 | $root = neon()->getAlias("@root").DIRECTORY_SEPARATOR; |
83 | 83 | |
84 | 84 | // 1. Check that Babel is installed and if not install it |
85 | - if (($result = $this->checkBabel())!=0) |
|
86 | - return $result; |
|
85 | + if (($result = $this->checkBabel())!=0) { |
|
86 | + return $result; |
|
87 | + } |
|
87 | 88 | |
88 | 89 | // 2. Create the babel config file |
89 | - if (($result = $this->checkBabelConfig($root)) != 0) |
|
90 | - return $result; |
|
90 | + if (($result = $this->checkBabelConfig($root)) != 0) { |
|
91 | + return $result; |
|
92 | + } |
|
91 | 93 | |
92 | 94 | // 3. Run babel over the project |
93 | 95 | $sourceDirectory = $root.$path;; |
@@ -68,7 +68,7 @@ |
||
68 | 68 | * 'order' => 1010, |
69 | 69 | * 'url' => ['/cms/index/index'], |
70 | 70 | * 'visible => neon()->user->is('neon-administrator') |
71 | - * ]; |
|
71 | + * ]; |
|
72 | 72 | * ``` |
73 | 73 | */ |
74 | 74 | public function getMenu(); |
@@ -17,11 +17,11 @@ discard block |
||
17 | 17 | */ |
18 | 18 | trait PropertiesTrait |
19 | 19 | { |
20 | - public function toArray($except=[]) |
|
20 | + public function toArray($except = []) |
|
21 | 21 | { |
22 | - $array= []; |
|
22 | + $array = []; |
|
23 | 23 | $properties = $this->getProperties(); |
24 | - foreach($properties as $key => $value) { |
|
24 | + foreach ($properties as $key => $value) { |
|
25 | 25 | if (in_array($value, $except)) { continue; } |
26 | 26 | list($prop, $value) = $this->resolveProperty($key, $value); |
27 | 27 | $array[$prop] = $this->valueToArray($value); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | public function valueToArray($value) |
48 | 48 | { |
49 | 49 | if (is_array($value)) { |
50 | - foreach($value as $key => $val) { |
|
50 | + foreach ($value as $key => $val) { |
|
51 | 51 | $value[$key] = $this->valueToArray($val); |
52 | 52 | } |
53 | 53 | } else if (is_object($value) && $value instanceof IArrayable) { |
@@ -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 | |
45 | 48 | return [$key, $value]; |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require NEON_VENDOR . '/yiisoft/yii2/BaseYii.php'; |
|
3 | +require NEON_VENDOR.'/yiisoft/yii2/BaseYii.php'; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * The Neon class extends YiiBase and is a convenience class for setting up a Yii application |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public static function getVersion() |
20 | 20 | { |
21 | - return trim(file_get_contents(__DIR__ . '/../../version')); |
|
21 | + return trim(file_get_contents(__DIR__.'/../../version')); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public static function powered() |
105 | 105 | { |
106 | - return 'Powered by <a href="' . self::neonLink() . '" rel="external" target="_blank">Neon</a>'; |
|
106 | + return 'Powered by <a href="'.self::neonLink().'" rel="external" target="_blank">Neon</a>'; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $stop = microtime(true); |
152 | 152 | $bootstrapTime = $stop - $start; |
153 | 153 | if ($bootstrapTime > $maxTime) { |
154 | - $error = $error ? $error : 'The profile "' . $token . '" took longer than ' . $maxTime . ' seconds'; |
|
154 | + $error = $error ? $error : 'The profile "'.$token.'" took longer than '.$maxTime.' seconds'; |
|
155 | 155 | \Neon::error($error, $category); |
156 | 156 | } |
157 | 157 | self::endProfile($token, $category); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
171 | - public static function endProfile($token=null, $category = 'application') |
|
171 | + public static function endProfile($token = null, $category = 'application') |
|
172 | 172 | { |
173 | 173 | if (neon()->debug) { |
174 | 174 | if ($token === null) |
@@ -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 | } |
@@ -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 |
@@ -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])) { |