Passed
Push — master ( b67c9a...07eb6c )
by Reza
03:12
created
src/Parsers/StubParser.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
         $this->store = $store;
38 38
     }
39 39
 
40
-    public function setAuthType(bool $hasAuth){
40
+    public function setAuthType(bool $hasAuth) {
41 41
         $this->hasAuth = $hasAuth;
42 42
     }
43 43
 
44
-    public function setFields(array $fields){
44
+    public function setFields(array $fields) {
45 45
         $this->fields = $fields;
46 46
     }
47 47
 
48
-    public function setInputs(array $inputs){
48
+    public function setInputs(array $inputs) {
49 49
         $this->inputs = $inputs;
50 50
     }
51 51
 
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             $decodedFile = json_decode(File::get($file), 1);
82 82
             $texts = $this->texts;
83 83
             foreach ($texts as $key => $text) {
84
-                if (array_key_exists($key, $decodedFile)){
84
+                if (array_key_exists($key, $decodedFile)) {
85 85
                     unset($texts[$text]);
86 86
                 }
87 87
             }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         $fields = array_keys($this->inputs);
109 109
         $str = '';
110 110
 
111
-        if(in_array($this->inputName, $fields)){
111
+        if (in_array($this->inputName, $fields)) {
112 112
             $this->error("Model name must not equal to column names, fix it and rerun command with -f flag");
113 113
             die;
114 114
         }
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
 
182 182
         foreach ($this->inputs as $key => $field) {
183 183
             $newLine = ($field != end($this->inputs) or $this->hasAuth);
184
-            $str .=  "'$key' => " . '$this' . "->$key,".$this->makeTab(3, $newLine);
184
+            $str .= "'$key' => ".'$this'."->$key,".$this->makeTab(3, $newLine);
185 185
         }
186 186
 
187
-        if($this->hasAuth){
187
+        if ($this->hasAuth) {
188 188
             $str .= "'user_id' => auth()->id(),";
189 189
         }
190 190
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
     /**
195 195
      * Create Blade from stub
196 196
      */
197
-    public function parseBlade($stub){
197
+    public function parseBlade($stub) {
198 198
         $modelName = $this->getModelName($this->parsedModel);
199 199
 
200 200
         $array = [
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
             $str .= $inputObject->setKey($key)->setAction($this->inputName)->render();
271 271
 
272 272
             $this->texts[$inputObject->getTitle()] = $inputObject->getTitle();
273
-            if ($placeholder = $inputObject->getPlaceholder()){
273
+            if ($placeholder = $inputObject->getPlaceholder()) {
274 274
                 $this->texts[$placeholder] = $placeholder;
275 275
             }
276 276
         }
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
     /**
282 282
      * Tab Maker (Each tabs mean 4 space)
283 283
      */
284
-    public function makeTab($count, $newLine = true){
284
+    public function makeTab($count, $newLine = true) {
285 285
         $count = $count * 4;
286 286
         $tabs = str_repeat(' ', $count);
287 287
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 
298 298
     public function normalizeField($field)
299 299
     {
300
-        if($field instanceof Field){
300
+        if ($field instanceof Field) {
301 301
             return $field;
302 302
         }
303 303
 
@@ -306,8 +306,8 @@  discard block
 block discarded – undo
306 306
         return Field::title($title);
307 307
     }
308 308
 
309
-    public function normalizeInput($key, $input){
310
-        if ($input instanceof BaseInput){
309
+    public function normalizeInput($key, $input) {
310
+        if ($input instanceof BaseInput) {
311 311
             return $input;
312 312
         }
313 313
 
Please login to merge, or discard this patch.
src/Parsers/Fields/Field.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
     public function asImage()
39 39
     {
40
-        if($this->dataStub != 'linked-image.stub'){
40
+        if ($this->dataStub != 'linked-image.stub') {
41 41
             $this->dataStub = 'image.stub';
42 42
         }
43 43
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
     private function getTitleStubContent()
166 166
     {
167
-        if ($this->isRelational()){
167
+        if ($this->isRelational()) {
168 168
             return file_get_contents(__DIR__.'/stubs/titles/not-sortable.stub');
169 169
         }
170 170
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
         return \Str::contains($this->key, '.');
177 177
     }
178 178
 
179
-    private function parseRelationalKey($key){
179
+    private function parseRelationalKey($key) {
180 180
         return str_replace('.', '->', $key);
181 181
     }
182 182
 
Please login to merge, or discard this patch.
src/Http/Middleware/isAdmin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@
 block discarded – undo
15 15
 
16 16
         auth()->shouldUse($defaultGuard);
17 17
 
18
-        if(auth()->guest()){
18
+        if (auth()->guest()) {
19 19
             return redirect($redirectPath);
20 20
         }
21 21
 
22
-        if(!AuthFacade::check(auth()->user()->id)){
22
+        if (!AuthFacade::check(auth()->user()->id)) {
23 23
             return redirect($redirectPath);
24 24
         }
25 25
 
Please login to merge, or discard this patch.
src/helpers.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 use EasyPanel\Contracts\CRUDComponent;
4 4
 
5
-if(! function_exists('getRouteName')) {
6
-    function getRouteName(){
5
+if (!function_exists('getRouteName')) {
6
+    function getRouteName() {
7 7
         $routeName = config('easy_panel.route_prefix');
8 8
         $routeName = trim($routeName, '/');
9 9
         $routeName = str_replace('/', '.', $routeName);
@@ -11,19 +11,19 @@  discard block
 block discarded – undo
11 11
     }
12 12
 }
13 13
 
14
-if(! function_exists('getCrudConfig')) {
15
-    function getCrudConfig($name){
14
+if (!function_exists('getCrudConfig')) {
15
+    function getCrudConfig($name) {
16 16
 
17
-        $crudName=ucfirst($name);
17
+        $crudName = ucfirst($name);
18 18
         $namespace = "\\App\\CRUD\\{$crudName}Component";
19 19
 
20
-        if (!file_exists(app_path("/CRUD/{$crudName}Component.php")) or !class_exists($namespace)){
20
+        if (!file_exists(app_path("/CRUD/{$crudName}Component.php")) or !class_exists($namespace)) {
21 21
             abort(403, "Class with {$namespace} namespace doesn't exist");
22 22
         }
23 23
 
24 24
         $instance = app()->make($namespace);
25 25
 
26
-        if (!$instance instanceof CRUDComponent){
26
+        if (!$instance instanceof CRUDComponent) {
27 27
             abort(403, "{$namespace} should implement CRUDComponent interface");
28 28
         }
29 29
 
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
     }
32 32
 }
33 33
 
34
-if(! function_exists('crud')) {
35
-    function crud($name){
34
+if (!function_exists('crud')) {
35
+    function crud($name) {
36 36
         return \EasyPanel\Models\CRUD::query()->where('name', $name)->first();
37 37
     }
38 38
 }
Please login to merge, or discard this patch.