Passed
Push — master ( effb91...3e9a54 )
by Reza
04:04
created
src/Commands/CRUDActions/CommandBase.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         ];
100 100
     }
101 101
 
102
-    private function setCRUDInstance(){
102
+    private function setCRUDInstance() {
103 103
         $modelName = $this->getNameInput();
104 104
 
105 105
         return $this->crudInstance = getCrudConfig($modelName);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
     protected function qualifyModel($model)
124 124
     {
125
-        if (class_exists($model)){
125
+        if (class_exists($model)) {
126 126
             return $model;
127 127
         }
128 128
 
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/HTMLInputs/Select.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@
 block discarded – undo
14 14
 
15 15
         [$class, $method] = $array;
16 16
 
17
-        if (! class_exists($class)){
17
+        if (!class_exists($class)) {
18 18
             throw new Exception("Class {$class} doesn't exist.");
19 19
         }
20 20
 
21 21
         $method = $method ?: 'handle';
22 22
 
23
-        if (! method_exists($class, $method)){
23
+        if (!method_exists($class, $method)) {
24 24
             throw new Exception("Method {$method} doesn't exist on {$class} class.");
25 25
         }
26 26
 
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.
src/Http/Middleware/LangChanger.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     {
14 14
         $lang = session()->has('easypanel_lang')
15 15
             ? session()->get('easypanel_lang')
16
-            : (config('easy_panel.lang') ?? 'en') .'_panel';
16
+            : (config('easy_panel.lang') ?? 'en').'_panel';
17 17
 
18 18
         App::setLocale($lang);
19 19
 
Please login to merge, or discard this patch.
src/Http/Livewire/CRUD/Create.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -61,19 +61,19 @@  discard block
 block discarded – undo
61 61
     {
62 62
         $this->validate();
63 63
 
64
-        if (!class_exists($this->model) or ! app()->make($this->model) instanceof Model){
64
+        if (!class_exists($this->model) or !app()->make($this->model) instanceof Model) {
65 65
             $this->addError('model', __('Namespace is invalid'));
66 66
 
67 67
             return;
68 68
         }
69 69
 
70
-        if (!preg_match('/^([a-z]|[0-9])+/', $this->route)){
70
+        if (!preg_match('/^([a-z]|[0-9])+/', $this->route)) {
71 71
             $this->addError('route', __('Route is invalid'));
72 72
 
73 73
             return;
74 74
         }
75 75
 
76
-        try{
76
+        try {
77 77
             $name = $this->getModelName($this->model);
78 78
 
79 79
             CRUD::create([
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
                 '--force' => true
89 89
             ]);
90 90
 
91
-            $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('CRUD') ])]);
92
-        } catch(\Exception $exception){
93
-            $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('UnknownError') ]);
91
+            $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CreatedMessage', ['name' => __('CRUD')])]);
92
+        } catch (\Exception $exception) {
93
+            $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('UnknownError')]);
94 94
         }
95 95
 
96 96
 
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
     public function render()
102 102
     {
103 103
         return view('admin::livewire.crud.create')
104
-            ->layout('admin::layouts.app', ['title' => __('CreateTitle', ['name' => __('CRUD') ])]);
104
+            ->layout('admin::layouts.app', ['title' => __('CreateTitle', ['name' => __('CRUD')])]);
105 105
     }
106 106
 
107
-    private function getModelName($model){
107
+    private function getModelName($model) {
108 108
         $model = explode('\\', $model);
109 109
 
110 110
         return end($model);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
         foreach ($files as $file) {
122 122
 
123
-            if ($this->fileCanNotBeListed($file->getFilename(), $query)){
123
+            if ($this->fileCanNotBeListed($file->getFilename(), $query)) {
124 124
                 continue;
125 125
             }
126 126
 
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
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
38 38
         $this->store = $store;
39 39
     }
40 40
 
41
-    public function setAuthType(bool $hasAuth){
41
+    public function setAuthType(bool $hasAuth) {
42 42
         $this->hasAuth = $hasAuth;
43 43
     }
44 44
 
45
-    public function setFields(array $fields){
45
+    public function setFields(array $fields) {
46 46
         $this->fields = $fields;
47 47
     }
48 48
 
49
-    public function setInputs(array $inputs){
49
+    public function setInputs(array $inputs) {
50 50
         $this->inputs = $inputs;
51 51
     }
52 52
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         $fields = array_keys($this->inputs);
99 99
         $str = '';
100 100
 
101
-        if(in_array($this->inputName, $fields)){
101
+        if (in_array($this->inputName, $fields)) {
102 102
             $this->error("Model name must not equal to column names, fix it and rerun command with -f flag");
103 103
             die;
104 104
         }
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
 
172 172
         foreach ($this->inputs as $key => $field) {
173 173
             $newLine = ($field != end($this->inputs) or $this->hasAuth);
174
-            $str .=  "'$key' => " . '$this' . "->$key,".$this->makeTab(3, $newLine);
174
+            $str .= "'$key' => ".'$this'."->$key,".$this->makeTab(3, $newLine);
175 175
         }
176 176
 
177
-        if($this->hasAuth){
177
+        if ($this->hasAuth) {
178 178
             $str .= "'user_id' => auth()->id(),";
179 179
         }
180 180
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
     /**
185 185
      * Create Blade from stub
186 186
      */
187
-    public function parseBlade($stub){
187
+    public function parseBlade($stub) {
188 188
         $modelName = $this->getModelName($this->parsedModel);
189 189
 
190 190
         $array = [
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
     /**
264 264
      * Tab Maker (Each tabs mean 4 space)
265 265
      */
266
-    public function makeTab($count, $newLine = true){
266
+    public function makeTab($count, $newLine = true) {
267 267
         $count = $count * 4;
268 268
         $tabs = str_repeat(' ', $count);
269 269
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 
280 280
     public function normalizeField($field)
281 281
     {
282
-        if($field instanceof Field){
282
+        if ($field instanceof Field) {
283 283
             return $field;
284 284
         }
285 285
 
@@ -288,8 +288,8 @@  discard block
 block discarded – undo
288 288
         return Field::title($title);
289 289
     }
290 290
 
291
-    public function normalizeInput($key, $input){
292
-        if ($input instanceof BaseInput){
291
+    public function normalizeInput($key, $input) {
292
+        if ($input instanceof BaseInput) {
293 293
             return $input;
294 294
         }
295 295
 
Please login to merge, or discard this patch.