@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | class Variable extends Model |
10 | 10 | { |
11 | - use HasEpesiConnection; |
|
11 | + use HasEpesiConnection; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * @var Collection |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | |
28 | 28 | protected function init(): void |
29 | 29 | { |
30 | - parent::init(); |
|
30 | + parent::init(); |
|
31 | 31 | |
32 | - $this->addFields([ |
|
33 | - 'name', |
|
34 | - 'value' => ['type' => 'text', 'serialize' => 'json'] |
|
35 | - ]); |
|
32 | + $this->addFields([ |
|
33 | + 'name', |
|
34 | + 'value' => ['type' => 'text', 'serialize' => 'json'] |
|
35 | + ]); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | public static function recall($name, $default = null) { |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | $variable = self::create()->addCondition('name', $name)->tryLoadAny(); |
58 | 58 | |
59 | 59 | if ($variable->loaded()) { |
60 | - $variable->save(compact('value')); |
|
60 | + $variable->save(compact('value')); |
|
61 | 61 | } |
62 | 62 | else { |
63 | - $variable->insert(compact('name', 'value')); |
|
63 | + $variable->insert(compact('name', 'value')); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | public $strict_types = false; |
21 | 21 | |
22 | 22 | private static function cache() { |
23 | - if(isset(self::$variables)) return; |
|
23 | + if (isset(self::$variables)) return; |
|
24 | 24 | |
25 | 25 | self::$variables = self::pluck('value', 'name'); |
26 | 26 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
67 | - public static function forget($name, $throwError=true) { |
|
67 | + public static function forget($name, $throwError = true) { |
|
68 | 68 | self::cache(); |
69 | 69 | |
70 | 70 | if (!self::$variables->has($name) && $throwError) { |
@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | public $strict_types = false; |
21 | 21 | |
22 | 22 | private static function cache() { |
23 | - if(isset(self::$variables)) return; |
|
23 | + if(isset(self::$variables)) { |
|
24 | + return; |
|
25 | + } |
|
24 | 26 | |
25 | 27 | self::$variables = self::pluck('value', 'name'); |
26 | 28 | } |
@@ -38,7 +40,9 @@ discard block |
||
38 | 40 | public static function recall($name, $default = null) { |
39 | 41 | self::cache(); |
40 | 42 | |
41 | - if (!self::$variables->has($name)) return $default; |
|
43 | + if (!self::$variables->has($name)) { |
|
44 | + return $default; |
|
45 | + } |
|
42 | 46 | |
43 | 47 | return self::$variables->get($name, $default) ?? $default; |
44 | 48 | } |
@@ -58,8 +62,7 @@ discard block |
||
58 | 62 | |
59 | 63 | if ($variable->loaded()) { |
60 | 64 | $variable->save(compact('value')); |
61 | - } |
|
62 | - else { |
|
65 | + } else { |
|
63 | 66 | $variable->insert(compact('name', 'value')); |
64 | 67 | } |
65 | 68 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | public function addLegend($container = null) |
91 | 91 | { |
92 | - $container = $container?: $this; |
|
92 | + $container = $container ?: $this; |
|
93 | 93 | |
94 | 94 | $legend = \atk4\ui\Header::addTo($container, [__('Scan of Environment Parameters')])->setStyle('margin-left', '2em'); |
95 | 95 | $legend = View::addTo($container)->setStyle('margin-left', 'auto'); |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | |
102 | 102 | public function addGroupResults($group, $testResults = [], $container = null) |
103 | 103 | { |
104 | - if (! $testResults) return; |
|
104 | + if (!$testResults) return; |
|
105 | 105 | |
106 | - $container = $container?: $this; |
|
106 | + $container = $container ?: $this; |
|
107 | 107 | |
108 | 108 | $container->add([Header::class, $group]); |
109 | 109 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | foreach ($testResults as $test) { |
113 | 113 | $color = $severityMap[$test['severity']]['color']; |
114 | - $result = $test['result']?? $severityMap[$test['severity']]['result']; |
|
114 | + $result = $test['result'] ?? $severityMap[$test['severity']]['result']; |
|
115 | 115 | |
116 | 116 | $row = View::addTo($container, ['class' => ['row']]); |
117 | 117 | View::addTo($row, [$test['name'], 'class' => ['nine wide column']]); |
@@ -125,13 +125,13 @@ discard block |
||
125 | 125 | |
126 | 126 | @Schema::dropIfExists('test'); |
127 | 127 | |
128 | - @Schema::create('test', function (Blueprint $table) { |
|
128 | + @Schema::create('test', function(Blueprint $table) { |
|
129 | 129 | $table->increments('id'); |
130 | 130 | }); |
131 | 131 | |
132 | 132 | $create = Schema::hasTable('test'); |
133 | 133 | |
134 | - @Schema::table('test', function (Blueprint $table) { |
|
134 | + @Schema::table('test', function(Blueprint $table) { |
|
135 | 135 | $table->addColumn('TEXT', 'field_name'); |
136 | 136 | }); |
137 | 137 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $delete = @DB::delete('DELETE FROM test'); |
143 | 143 | @Schema::dropIfExists('test'); |
144 | 144 | |
145 | - $drop = ! Schema::hasTable('test'); |
|
145 | + $drop = !Schema::hasTable('test'); |
|
146 | 146 | |
147 | 147 | ob_end_clean(); |
148 | 148 | |
@@ -151,8 +151,8 @@ discard block |
||
151 | 151 | array_walk($result, function(& $testResult, $testName) { |
152 | 152 | $testResult = [ |
153 | 153 | 'name' => __(':permission permission', ['permission' => strtoupper($testName)]), |
154 | - 'result' => $testResult? __('OK'): __('Failed'), |
|
155 | - 'severity' => $testResult? 0: 2 |
|
154 | + 'result' => $testResult ? __('OK') : __('Failed'), |
|
155 | + 'severity' => $testResult ? 0 : 2 |
|
156 | 156 | ]; |
157 | 157 | }); |
158 | 158 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | protected function unitToInt($string) |
163 | 163 | { |
164 | - return (int) preg_replace_callback('/(\-?\d+)(.?)/', function ($m) { |
|
164 | + return (int) preg_replace_callback('/(\-?\d+)(.?)/', function($m) { |
|
165 | 165 | return $m[1] * pow(1024, strpos('BKMG', $m[2])); |
166 | 166 | }, strtoupper($string)); |
167 | 167 | } |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | { |
171 | 171 | $ret = []; |
172 | 172 | |
173 | - if ($requiredPhpVersion = $this->getApp()->packageInfo()['require']['php']?? null) { |
|
173 | + if ($requiredPhpVersion = $this->getApp()->packageInfo()['require']['php'] ?? null) { |
|
174 | 174 | $ret[] = [ |
175 | 175 | 'name' => __('PHP version required :version', ['version' => $requiredPhpVersion]), |
176 | 176 | 'result' => PHP_VERSION, |
177 | - 'severity' => version_compare(PHP_VERSION, $requiredPhpVersion, '>=')? 0: 2 |
|
177 | + 'severity' => version_compare(PHP_VERSION, $requiredPhpVersion, '>=') ? 0 : 2 |
|
178 | 178 | ]; |
179 | 179 | } |
180 | 180 | |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | $result = $callback($extension); |
211 | 211 | |
212 | 212 | $ret[] = array_merge($test, [ |
213 | - 'result' => $result? __('OK'): __('Missing'), |
|
214 | - 'severity' => $result? 0: $test['severity'] |
|
213 | + 'result' => $result ? __('OK') : __('Missing'), |
|
214 | + 'severity' => $result ? 0 : $test['severity'] |
|
215 | 215 | ]); |
216 | 216 | } |
217 | 217 | } |