@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @var $type |
19 | 19 | */ |
20 | - public $type='controller'; |
|
20 | + public $type = 'controller'; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * @var array |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * @var array |
38 | 38 | */ |
39 | - protected $commandRule=[ |
|
39 | + protected $commandRule = [ |
|
40 | 40 | 'create' => ['controller'], |
41 | - 'rename' => ['controller','rename'], |
|
41 | + 'rename' => ['controller', 'rename'], |
|
42 | 42 | 'all' => [], |
43 | 43 | ]; |
44 | 44 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | $this->argument['bundleName'] = $controller.''.StaticPathList::$controllerBundleName; |
56 | 56 | |
57 | - if(!file_exists(app()->path()->controller())){ |
|
57 | + if (!file_exists(app()->path()->controller())) { |
|
58 | 58 | $this->directory['createController'] = app()->path()->controller(); |
59 | 59 | } |
60 | 60 | |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | |
73 | 73 | $fullNamespaceForController = $this->argument['controllerNamespace'].'\\'.$this->argument['serviceClass'].''.$this->argument['callClassPrefix']; |
74 | 74 | |
75 | - $this->directory['routes'] = path()->route(); |
|
75 | + $this->directory['routes'] = path()->route(); |
|
76 | 76 | |
77 | 77 | // with the directory operation, |
78 | 78 | // we get to the service directory, which is called the controller. |
79 | 79 | $this->file->makeDirectory($this); |
80 | 80 | |
81 | - if(isset($this->argument['resource']) && file_exists($this->directory['endpoint'])){ |
|
81 | + if (isset($this->argument['resource']) && file_exists($this->directory['endpoint'])) { |
|
82 | 82 | |
83 | - $this->touch['service/resource'] = $this->directory['resource'].''.DIRECTORY_SEPARATOR.''.$this->argument['resource'].'.php'; |
|
83 | + $this->touch['service/resource'] = $this->directory['resource'].''.DIRECTORY_SEPARATOR.''.$this->argument['resource'].'.php'; |
|
84 | 84 | |
85 | 85 | $this->file->touch($this); |
86 | 86 | |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | echo $this->classical(' > Resource Controller called as "'.$this->argument['resource'].'" has been successfully created in the '.$this->directory['resource'].''); |
89 | 89 | |
90 | 90 | } |
91 | - elseif(isset($this->argument['file']) && file_exists($this->directory['endpoint'])){ |
|
91 | + elseif (isset($this->argument['file']) && file_exists($this->directory['endpoint'])) { |
|
92 | 92 | |
93 | - $this->touch['service/controllerfile'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].''. $this->argument['callClassPrefix'].'.php'; |
|
93 | + $this->touch['service/controllerfile'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].''.$this->argument['callClassPrefix'].'.php'; |
|
94 | 94 | |
95 | 95 | $this->file->touch($this); |
96 | 96 | |
@@ -98,18 +98,18 @@ discard block |
||
98 | 98 | echo $this->classical(' > Controller called as "'.$this->argument['file'].'" has been successfully created in the '.$this->directory['endpoint'].''); |
99 | 99 | |
100 | 100 | } |
101 | - else{ |
|
101 | + else { |
|
102 | 102 | |
103 | 103 | // we process the processes related to file creation operations. |
104 | 104 | // and then create files related to the touch method of the file object as it is in the directory process. |
105 | 105 | |
106 | - if(isset($this->argument['type']) && $this->argument['type']=='Crud'){ |
|
107 | - $this->touch['service/endpointcrud'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''. $this->argument['callClassPrefix'].'.php'; |
|
106 | + if (isset($this->argument['type']) && $this->argument['type']=='Crud') { |
|
107 | + $this->touch['service/endpointcrud'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''.$this->argument['callClassPrefix'].'.php'; |
|
108 | 108 | $this->touch['service/routecrud'] = $this->directory['routes'].''.DIRECTORY_SEPARATOR.''.$controller.'Route.php'; |
109 | 109 | |
110 | 110 | } |
111 | - else{ |
|
112 | - $this->touch['service/endpoint'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''. $this->argument['callClassPrefix'].'.php'; |
|
111 | + else { |
|
112 | + $this->touch['service/endpoint'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''.$this->argument['callClassPrefix'].'.php'; |
|
113 | 113 | $this->touch['service/route'] = $this->directory['routes'].''.DIRECTORY_SEPARATOR.''.$controller.'Route.php'; |
114 | 114 | |
115 | 115 | } |
@@ -121,9 +121,9 @@ discard block |
||
121 | 121 | $this->touch['service/dummy'] = $this->directory['configuration'].''.DIRECTORY_SEPARATOR.'Dummy.yaml'; |
122 | 122 | $this->touch['service/doc'] = $this->directory['configuration'].''.DIRECTORY_SEPARATOR.'Doc.yaml'; |
123 | 123 | $this->touch['service/readme'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.'README.md'; |
124 | - $this->touch['service/policy'] = $this->directory['policy'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''. $this->argument['callClassPrefix'].'Policy.php'; |
|
124 | + $this->touch['service/policy'] = $this->directory['policy'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''.$this->argument['callClassPrefix'].'Policy.php'; |
|
125 | 125 | |
126 | - $this->file->touch($this,[ |
|
126 | + $this->file->touch($this, [ |
|
127 | 127 | 'stub'=>'Controller_Create' |
128 | 128 | ]); |
129 | 129 | |
@@ -147,24 +147,24 @@ discard block |
||
147 | 147 | { |
148 | 148 | $path = path()->controller().'/'.$this->argument['controller'].''.StaticPathList::$controllerBundleName; |
149 | 149 | |
150 | - if(file_exists($path)){ |
|
150 | + if (file_exists($path)) { |
|
151 | 151 | |
152 | - $newPathName = str_replace($this->argument['controller'],$this->argument['rename'],$path); |
|
152 | + $newPathName = str_replace($this->argument['controller'], $this->argument['rename'], $path); |
|
153 | 153 | |
154 | 154 | |
155 | - rename($path,$newPathName); |
|
155 | + rename($path, $newPathName); |
|
156 | 156 | |
157 | 157 | $getAllFiles = files()->getAllFilesInDirectory($newPathName); |
158 | 158 | |
159 | - $getPathWithPhpExtensions = Utils::getPathWithPhpExtension($getAllFiles,$newPathName); |
|
159 | + $getPathWithPhpExtensions = Utils::getPathWithPhpExtension($getAllFiles, $newPathName); |
|
160 | 160 | |
161 | - foreach ($getPathWithPhpExtensions as $getPathWithPhpExtension){ |
|
161 | + foreach ($getPathWithPhpExtensions as $getPathWithPhpExtension) { |
|
162 | 162 | |
163 | - $withoutFullPath = str_replace($newPathName,"",$getPathWithPhpExtension); |
|
163 | + $withoutFullPath = str_replace($newPathName, "", $getPathWithPhpExtension); |
|
164 | 164 | |
165 | 165 | $newName = $newPathName."".preg_replace("((.*)".$this->argument['controller'].")", "$1".$this->argument['rename'], $withoutFullPath); |
166 | 166 | |
167 | - rename($getPathWithPhpExtension,$newName); |
|
167 | + rename($getPathWithPhpExtension, $newName); |
|
168 | 168 | |
169 | 169 | Utils::changeClass($newName, |
170 | 170 | [ |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | private function docUpdate() |
185 | 185 | { |
186 | - $docPath = $this->directory['configuration'] .'/Doc.yaml'; |
|
186 | + $docPath = $this->directory['configuration'].'/Doc.yaml'; |
|
187 | 187 | |
188 | 188 | $doc = Utils::yaml($docPath); |
189 | 189 |
@@ -87,8 +87,7 @@ discard block |
||
87 | 87 | // and as a result we print the result on the console screen. |
88 | 88 | echo $this->classical(' > Resource Controller called as "'.$this->argument['resource'].'" has been successfully created in the '.$this->directory['resource'].''); |
89 | 89 | |
90 | - } |
|
91 | - elseif(isset($this->argument['file']) && file_exists($this->directory['endpoint'])){ |
|
90 | + } elseif(isset($this->argument['file']) && file_exists($this->directory['endpoint'])){ |
|
92 | 91 | |
93 | 92 | $this->touch['service/controllerfile'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].''. $this->argument['callClassPrefix'].'.php'; |
94 | 93 | |
@@ -97,8 +96,7 @@ discard block |
||
97 | 96 | // and as a result we print the result on the console screen. |
98 | 97 | echo $this->classical(' > Controller called as "'.$this->argument['file'].'" has been successfully created in the '.$this->directory['endpoint'].''); |
99 | 98 | |
100 | - } |
|
101 | - else{ |
|
99 | + } else{ |
|
102 | 100 | |
103 | 101 | // we process the processes related to file creation operations. |
104 | 102 | // and then create files related to the touch method of the file object as it is in the directory process. |
@@ -107,8 +105,7 @@ discard block |
||
107 | 105 | $this->touch['service/endpointcrud'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''. $this->argument['callClassPrefix'].'.php'; |
108 | 106 | $this->touch['service/routecrud'] = $this->directory['routes'].''.DIRECTORY_SEPARATOR.''.$controller.'Route.php'; |
109 | 107 | |
110 | - } |
|
111 | - else{ |
|
108 | + } else{ |
|
112 | 109 | $this->touch['service/endpoint'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''. $this->argument['callClassPrefix'].'.php'; |
113 | 110 | $this->touch['service/route'] = $this->directory['routes'].''.DIRECTORY_SEPARATOR.''.$controller.'Route.php'; |
114 | 111 |