Passed
Push — master ( 6b8d45...b1f6fe )
by Reza
03:41
created
src/helpers.php 1 patch
Spacing   +13 added lines, -13 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,14 +31,14 @@  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
 }
39 39
 
40
-if(! function_exists('get_icon')) {
41
-    function get_icon($type){
40
+if (!function_exists('get_icon')) {
41
+    function get_icon($type) {
42 42
         $array = [
43 43
             'file-text' => ['posts', 'article', 'stories', 'post', 'articles', 'story'],
44 44
             'users' => ['users', 'user', 'accounts', 'account', 'admins', 'admin', 'employee', 'employees'],
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
             'truck' => ['product', 'products', 'shops', 'shop'],
56 56
             'message-circle' => ['comments', 'messages', 'pm', 'comment', 'message', 'chats', 'chat'],
57 57
         ];
58
-        foreach ($array as $key => $arrayValues){
59
-            if(in_array($type, $arrayValues)){
58
+        foreach ($array as $key => $arrayValues) {
59
+            if (in_array($type, $arrayValues)) {
60 60
                 $val = $key;
61 61
             }
62 62
         }
Please login to merge, or discard this patch.
src/Parsers/StubParser.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -48,15 +48,15 @@  discard block
 block discarded – undo
48 48
         $this->store = $store;
49 49
     }
50 50
 
51
-    public function setAuthType(bool $hasAuth){
51
+    public function setAuthType(bool $hasAuth) {
52 52
         $this->hasAuth = $hasAuth;
53 53
     }
54 54
 
55
-    public function setFields(array $fields){
55
+    public function setFields(array $fields) {
56 56
         $this->fields = $fields;
57 57
     }
58 58
 
59
-    public function setInputs(array $inputs){
59
+    public function setInputs(array $inputs) {
60 60
         $this->inputs = $inputs;
61 61
     }
62 62
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             $decodedFile = json_decode(File::get($file), 1);
93 93
             $texts = $this->texts;
94 94
             foreach ($texts as $key => $text) {
95
-                if (array_key_exists($key, $decodedFile)){
95
+                if (array_key_exists($key, $decodedFile)) {
96 96
                     unset($texts[$text]);
97 97
                 }
98 98
             }
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         $fields = array_keys($this->inputs);
120 120
         $str = '';
121 121
 
122
-        if(in_array($this->inputName, $fields)){
122
+        if (in_array($this->inputName, $fields)) {
123 123
             $this->error("Model name must not equal to column names, fix it and rerun command with -f flag");
124 124
             die;
125 125
         }
@@ -190,10 +190,10 @@  discard block
 block discarded – undo
190 190
 
191 191
         foreach ($this->inputs as $key => $field) {
192 192
             $newLine = ($field != end($this->inputs) or $this->hasAuth);
193
-            $str .=  "'$key' => " . '$this' . "->$key,".$this->makeTab(3, $newLine);
193
+            $str .= "'$key' => ".'$this'."->$key,".$this->makeTab(3, $newLine);
194 194
         }
195 195
 
196
-        if($this->hasAuth){
196
+        if ($this->hasAuth) {
197 197
             $str .= "'user_id' => auth()->id(),";
198 198
         }
199 199
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
     /**
204 204
      * Create Blade from stub
205 205
      */
206
-    public function parseBlade($stub){
206
+    public function parseBlade($stub) {
207 207
         $modelName = $this->getModelName($this->parsedModel);
208 208
 
209 209
         $array = [
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         foreach ($fields as $key => $field) {
232 232
             $str .= $field->setModel($modelName)->setKey($key)->renderData();
233 233
 
234
-            if (array_key_first($fields) != $key){
234
+            if (array_key_first($fields) != $key) {
235 235
                 $str .= $this->makeTab(1, array_key_last($fields) != $key);
236 236
             }
237 237
         }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
         foreach ($fields as $key => $field) {
253 253
             $str .= $field->setModel($modelName)->setKey($key)->renderTitle();
254 254
 
255
-            if (array_key_first($fields) != $key){
255
+            if (array_key_first($fields) != $key) {
256 256
                 $str .= $this->makeTab(6, array_key_last($fields) != $key);
257 257
             }
258 258
 
@@ -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
 
Please login to merge, or discard this patch.
src/Parsers/HTMLInputs/InputList.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 
24 24
     public static function get($name)
25 25
     {
26
-        if (!key_exists($name, static::inputClassMap)){
26
+        if (!key_exists($name, static::inputClassMap)) {
27 27
             throw new \Exception("The [$name] input type doesn't exist in input list!");
28 28
         }
29 29
 
Please login to merge, or discard this patch.
src/Parsers/Fields/Field.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
     private function getTitleStubContent()
139 139
     {
140
-        if ($this->isRelational()){
140
+        if ($this->isRelational()) {
141 141
             return file_get_contents(__DIR__.'/stubs/titles/relational.stub');
142 142
         }
143 143
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         return \Str::contains($this->key, '.');
150 150
     }
151 151
 
152
-    private function parseRelationalKey($key){
152
+    private function parseRelationalKey($key) {
153 153
         return str_replace('.', '->', $key);
154 154
     }
155 155
 
Please login to merge, or discard this patch.