Test Failed
Push — master ( 192bd4...d78f35 )
by Php Easy Api
06:14
created
src/resta/Console/Source/Controller/Controller.php 2 patches
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     /**
19 19
      * @var $type
20 20
      */
21
-    public $type='controller';
21
+    public $type = 'controller';
22 22
 
23 23
     /**
24 24
      * @var array
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
     /**
38 38
      * @var array
39 39
      */
40
-    protected $commandRule=[
40
+    protected $commandRule = [
41 41
         'create'    => ['controller'],
42
-        'rename'    => ['controller','rename'],
42
+        'rename'    => ['controller', 'rename'],
43 43
         'all'       => [],
44 44
     ];
45 45
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
         $this->argument['bundleName'] = $controller.''.StaticPathList::$controllerBundleName;
57 57
 
58
-        if(!file_exists(app()->path()->controller())){
58
+        if (!file_exists(app()->path()->controller())) {
59 59
             $this->directory['createController'] = app()->path()->controller();
60 60
         }
61 61
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
         $fullNamespaceForController             = $this->argument['controllerNamespace'].'\\'.$this->argument['serviceClass'].''.$this->argument['callClassPrefix'];
75 75
 
76
-        $this->directory['routes']       = path()->route();
76
+        $this->directory['routes'] = path()->route();
77 77
 
78 78
         $routePath = $this->directory['routes'].''.DIRECTORY_SEPARATOR.''.$controller.'Route.php';
79 79
 
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
         // we get to the service directory, which is called the controller.
82 82
         $this->file->makeDirectory($this);
83 83
 
84
-        if(isset($this->argument['resource']) && file_exists($this->directory['endpoint'])){
84
+        if (isset($this->argument['resource']) && file_exists($this->directory['endpoint'])) {
85 85
 
86
-            $this->touch['service/resource']   = $this->directory['resource'].''.DIRECTORY_SEPARATOR.''.$this->argument['resource'].'.php';
86
+            $this->touch['service/resource'] = $this->directory['resource'].''.DIRECTORY_SEPARATOR.''.$this->argument['resource'].'.php';
87 87
 
88 88
             $this->file->touch($this);
89 89
 
@@ -91,30 +91,30 @@  discard block
 block discarded – undo
91 91
             echo $this->classical(' > Resource Controller called as "'.$this->argument['resource'].'" has been successfully created in the '.$this->directory['resource'].'');
92 92
 
93 93
         }
94
-        elseif(isset($this->argument['file']) && file_exists($this->directory['endpoint'])){
95
-            if(isset($this->argument['type']) && $this->argument['type']=='Crud'){
94
+        elseif (isset($this->argument['file']) && file_exists($this->directory['endpoint'])) {
95
+            if (isset($this->argument['type']) && $this->argument['type']=='Crud') {
96 96
                 
97
-                $this->touch['service/controllerfilecrud']   = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].''. $this->argument['callClassPrefix'].'.php';
97
+                $this->touch['service/controllerfilecrud'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].''.$this->argument['callClassPrefix'].'.php';
98 98
 
99
-                $this->file->touch($this,[
99
+                $this->file->touch($this, [
100 100
                     'stub'=>'Controller_Create'
101 101
                 ]);
102 102
 
103
-                files()->append($routePath,PHP_EOL.'Route::namespace(\''.$controller.'\')->get("/'.strtolower($this->argument['file']).'","'.$this->argument['file'].'Controller@get");');
104
-                files()->append($routePath,PHP_EOL.'Route::namespace(\''.$controller.'\')->post("/'.strtolower($this->argument['file']).'","'.$this->argument['file'].'Controller@create");');
105
-                files()->append($routePath,PHP_EOL.'Route::namespace(\''.$controller.'\')->put("/'.strtolower($this->argument['file']).'","'.$this->argument['file'].'Controller@update");');
106
-                files()->append($routePath,PHP_EOL.'Route::namespace(\''.$controller.'\')->delete("/'.strtolower($this->argument['file']).'","'.$this->argument['file'].'Controller@delete");');
103
+                files()->append($routePath, PHP_EOL.'Route::namespace(\''.$controller.'\')->get("/'.strtolower($this->argument['file']).'","'.$this->argument['file'].'Controller@get");');
104
+                files()->append($routePath, PHP_EOL.'Route::namespace(\''.$controller.'\')->post("/'.strtolower($this->argument['file']).'","'.$this->argument['file'].'Controller@create");');
105
+                files()->append($routePath, PHP_EOL.'Route::namespace(\''.$controller.'\')->put("/'.strtolower($this->argument['file']).'","'.$this->argument['file'].'Controller@update");');
106
+                files()->append($routePath, PHP_EOL.'Route::namespace(\''.$controller.'\')->delete("/'.strtolower($this->argument['file']).'","'.$this->argument['file'].'Controller@delete");');
107 107
 
108 108
             }
109
-            else{
109
+            else {
110 110
 
111
-                $this->touch['service/controllerfile']   = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].''. $this->argument['callClassPrefix'].'.php';
111
+                $this->touch['service/controllerfile'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].''.$this->argument['callClassPrefix'].'.php';
112 112
 
113
-                $this->file->touch($this,[
113
+                $this->file->touch($this, [
114 114
                     'stub'=>'Controller_Create'
115 115
                 ]);
116 116
 
117
-                files()->append($routePath,PHP_EOL.'Route::namespace(\''.$controller.'\')->get("/'.strtolower($this->argument['file']).'","'.$this->argument['file'].'Controller@index");');
117
+                files()->append($routePath, PHP_EOL.'Route::namespace(\''.$controller.'\')->get("/'.strtolower($this->argument['file']).'","'.$this->argument['file'].'Controller@index");');
118 118
 
119 119
             }
120 120
             
@@ -122,21 +122,21 @@  discard block
 block discarded – undo
122 122
             echo $this->classical(' > Controller called as "'.$this->argument['file'].'" has been successfully created in the '.$this->directory['endpoint'].'');
123 123
 
124 124
         }
125
-        else{
125
+        else {
126 126
 
127 127
             // we process the processes related to file creation operations.
128 128
             // and then create files related to the touch method of the file object as it is in the directory process.
129 129
             
130
-            if(isset($this->argument['type']) && $this->argument['type']=='Crud'){
130
+            if (isset($this->argument['type']) && $this->argument['type']=='Crud') {
131 131
                 
132 132
                 $this->argument['file'] = $this->argument['serviceClass'];
133 133
                 
134
-                $this->touch['service/controllerfilecrud']  = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''. $this->argument['callClassPrefix'].'.php';
134
+                $this->touch['service/controllerfilecrud']  = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''.$this->argument['callClassPrefix'].'.php';
135 135
                 $this->touch['service/routecrud']           = $routePath;
136 136
 
137 137
             }
138
-            else{
139
-                $this->touch['service/endpoint']        = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''. $this->argument['callClassPrefix'].'.php';
138
+            else {
139
+                $this->touch['service/endpoint']        = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''.$this->argument['callClassPrefix'].'.php';
140 140
                 $this->touch['service/route']           = $routePath;
141 141
 
142 142
             }
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
             $this->touch['service/dummy']           = $this->directory['configuration'].''.DIRECTORY_SEPARATOR.'Dummy.yaml';
149 149
             $this->touch['service/doc']             = $this->directory['configuration'].''.DIRECTORY_SEPARATOR.'Doc.yaml';
150 150
             $this->touch['service/readme']          = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.'README.md';
151
-            $this->touch['service/policy']          = $this->directory['policy'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''. $this->argument['callClassPrefix'].'Policy.php';
151
+            $this->touch['service/policy']          = $this->directory['policy'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''.$this->argument['callClassPrefix'].'Policy.php';
152 152
 
153
-            $this->file->touch($this,[
153
+            $this->file->touch($this, [
154 154
                 'stub'=>'Controller_Create'
155 155
             ]);
156 156
 
@@ -174,24 +174,24 @@  discard block
 block discarded – undo
174 174
     {
175 175
         $path = path()->controller().'/'.$this->argument['controller'].''.StaticPathList::$controllerBundleName;
176 176
 
177
-        if(file_exists($path)){
177
+        if (file_exists($path)) {
178 178
 
179
-            $newPathName = str_replace($this->argument['controller'],$this->argument['rename'],$path);
179
+            $newPathName = str_replace($this->argument['controller'], $this->argument['rename'], $path);
180 180
 
181 181
 
182
-            rename($path,$newPathName);
182
+            rename($path, $newPathName);
183 183
 
184 184
             $getAllFiles = files()->getAllFilesInDirectory($newPathName);
185 185
 
186
-            $getPathWithPhpExtensions = Utils::getPathWithPhpExtension($getAllFiles,$newPathName);
186
+            $getPathWithPhpExtensions = Utils::getPathWithPhpExtension($getAllFiles, $newPathName);
187 187
 
188
-            foreach ($getPathWithPhpExtensions as $getPathWithPhpExtension){
188
+            foreach ($getPathWithPhpExtensions as $getPathWithPhpExtension) {
189 189
 
190
-                $withoutFullPath = str_replace($newPathName,"",$getPathWithPhpExtension);
190
+                $withoutFullPath = str_replace($newPathName, "", $getPathWithPhpExtension);
191 191
 
192 192
                 $newName = $newPathName."".preg_replace("((.*)".$this->argument['controller'].")", "$1".$this->argument['rename'], $withoutFullPath);
193 193
 
194
-                rename($getPathWithPhpExtension,$newName);
194
+                rename($getPathWithPhpExtension, $newName);
195 195
 
196 196
                 Utils::changeClass($newName,
197 197
                     [
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      */
211 211
     private function docUpdate()
212 212
     {
213
-        $docPath = $this->directory['configuration'] .'/Doc.yaml';
213
+        $docPath = $this->directory['configuration'].'/Doc.yaml';
214 214
 
215 215
         $doc = Utils::yaml($docPath);
216 216
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -90,8 +90,7 @@  discard block
 block discarded – undo
90 90
             // and as a result we print the result on the console screen.
91 91
             echo $this->classical(' > Resource Controller called as "'.$this->argument['resource'].'" has been successfully created in the '.$this->directory['resource'].'');
92 92
 
93
-        }
94
-        elseif(isset($this->argument['file']) && file_exists($this->directory['endpoint'])){
93
+        } elseif(isset($this->argument['file']) && file_exists($this->directory['endpoint'])){
95 94
             if(isset($this->argument['type']) && $this->argument['type']=='Crud'){
96 95
                 
97 96
                 $this->touch['service/controllerfilecrud']   = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].''. $this->argument['callClassPrefix'].'.php';
@@ -105,8 +104,7 @@  discard block
 block discarded – undo
105 104
                 files()->append($routePath,PHP_EOL.'Route::namespace(\''.$controller.'\')->put("/'.strtolower($this->argument['file']).'","'.$this->argument['file'].'Controller@update");');
106 105
                 files()->append($routePath,PHP_EOL.'Route::namespace(\''.$controller.'\')->delete("/'.strtolower($this->argument['file']).'","'.$this->argument['file'].'Controller@delete");');
107 106
 
108
-            }
109
-            else{
107
+            } else{
110 108
 
111 109
                 $this->touch['service/controllerfile']   = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].''. $this->argument['callClassPrefix'].'.php';
112 110
 
@@ -121,8 +119,7 @@  discard block
 block discarded – undo
121 119
             // and as a result we print the result on the console screen.
122 120
             echo $this->classical(' > Controller called as "'.$this->argument['file'].'" has been successfully created in the '.$this->directory['endpoint'].'');
123 121
 
124
-        }
125
-        else{
122
+        } else{
126 123
 
127 124
             // we process the processes related to file creation operations.
128 125
             // and then create files related to the touch method of the file object as it is in the directory process.
@@ -134,8 +131,7 @@  discard block
 block discarded – undo
134 131
                 $this->touch['service/controllerfilecrud']  = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''. $this->argument['callClassPrefix'].'.php';
135 132
                 $this->touch['service/routecrud']           = $routePath;
136 133
 
137
-            }
138
-            else{
134
+            } else{
139 135
                 $this->touch['service/endpoint']        = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''. $this->argument['callClassPrefix'].'.php';
140 136
                 $this->touch['service/route']           = $routePath;
141 137
 
Please login to merge, or discard this patch.