@@ -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,11 +98,11 @@ 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 | - $this->touch['service/endpoint'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''. $this->argument['callClassPrefix'].'.php'; |
|
105 | + $this->touch['service/endpoint'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''.$this->argument['callClassPrefix'].'.php'; |
|
106 | 106 | $this->touch['service/route'] = $this->directory['routes'].''.DIRECTORY_SEPARATOR.''.$controller.'Route.php'; |
107 | 107 | $this->touch['service/resourceIndex'] = $this->directory['resource'].''.DIRECTORY_SEPARATOR.'index.html'; |
108 | 108 | $this->touch['service/app'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.'App.php'; |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | $this->touch['service/dummy'] = $this->directory['configuration'].''.DIRECTORY_SEPARATOR.'Dummy.yaml'; |
112 | 112 | $this->touch['service/doc'] = $this->directory['configuration'].''.DIRECTORY_SEPARATOR.'Doc.yaml'; |
113 | 113 | $this->touch['service/readme'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.'README.md'; |
114 | - $this->touch['service/policy'] = $this->directory['policy'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''. $this->argument['callClassPrefix'].'Policy.php'; |
|
114 | + $this->touch['service/policy'] = $this->directory['policy'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''.$this->argument['callClassPrefix'].'Policy.php'; |
|
115 | 115 | |
116 | - $this->file->touch($this,[ |
|
116 | + $this->file->touch($this, [ |
|
117 | 117 | 'stub'=>'Controller_Create' |
118 | 118 | ]); |
119 | 119 | |
@@ -141,24 +141,24 @@ discard block |
||
141 | 141 | { |
142 | 142 | $path = path()->controller().'/'.$this->argument['controller'].''.StaticPathList::$controllerBundleName; |
143 | 143 | |
144 | - if(file_exists($path)){ |
|
144 | + if (file_exists($path)) { |
|
145 | 145 | |
146 | - $newPathName = str_replace($this->argument['controller'],$this->argument['rename'],$path); |
|
146 | + $newPathName = str_replace($this->argument['controller'], $this->argument['rename'], $path); |
|
147 | 147 | |
148 | 148 | |
149 | - rename($path,$newPathName); |
|
149 | + rename($path, $newPathName); |
|
150 | 150 | |
151 | 151 | $getAllFiles = Utils::getAllFilesInDirectory($newPathName); |
152 | 152 | |
153 | - $getPathWithPhpExtensions = Utils::getPathWithPhpExtension($getAllFiles,$newPathName); |
|
153 | + $getPathWithPhpExtensions = Utils::getPathWithPhpExtension($getAllFiles, $newPathName); |
|
154 | 154 | |
155 | - foreach ($getPathWithPhpExtensions as $getPathWithPhpExtension){ |
|
155 | + foreach ($getPathWithPhpExtensions as $getPathWithPhpExtension) { |
|
156 | 156 | |
157 | - $withoutFullPath = str_replace($newPathName,"",$getPathWithPhpExtension); |
|
157 | + $withoutFullPath = str_replace($newPathName, "", $getPathWithPhpExtension); |
|
158 | 158 | |
159 | 159 | $newName = $newPathName."".preg_replace("((.*)".$this->argument['controller'].")", "$1".$this->argument['rename'], $withoutFullPath); |
160 | 160 | |
161 | - rename($getPathWithPhpExtension,$newName); |
|
161 | + rename($getPathWithPhpExtension, $newName); |
|
162 | 162 | |
163 | 163 | Utils::changeClass($newName, |
164 | 164 | [ |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | private function docUpdate() |
179 | 179 | { |
180 | - $docPath = $this->directory['configuration'] .'/Doc.yaml'; |
|
180 | + $docPath = $this->directory['configuration'].'/Doc.yaml'; |
|
181 | 181 | |
182 | 182 | $doc = Utils::yaml($docPath); |
183 | 183 |
@@ -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. |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * @var $type |
16 | 16 | */ |
17 | - public $type='repository'; |
|
17 | + public $type = 'repository'; |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * @var array |
@@ -31,39 +31,39 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * @var $commandRule |
33 | 33 | */ |
34 | - public $commandRule=['repository','?source']; |
|
34 | + public $commandRule = ['repository', '?source']; |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * @method create |
38 | 38 | * @return mixed |
39 | 39 | */ |
40 | - public function create(){ |
|
40 | + public function create() { |
|
41 | 41 | |
42 | - $repository=$this->argument['repository']; |
|
42 | + $repository = $this->argument['repository']; |
|
43 | 43 | |
44 | - $repositoryPath=$this->repository().'/'.$repository; |
|
44 | + $repositoryPath = $this->repository().'/'.$repository; |
|
45 | 45 | |
46 | - $this->argument['repositoryNamespace']=Utils::getNamespace($repositoryPath); |
|
46 | + $this->argument['repositoryNamespace'] = Utils::getNamespace($repositoryPath); |
|
47 | 47 | |
48 | - if($this->sourceCreate()) return true; |
|
48 | + if ($this->sourceCreate()) return true; |
|
49 | 49 | |
50 | 50 | $this->directory['repositoryPath'] = $this->repository(); |
51 | - $this->directory['repositoryDir']=$repositoryPath; |
|
51 | + $this->directory['repositoryDir'] = $repositoryPath; |
|
52 | 52 | |
53 | - $this->directory['repositorySourceDir']=$this->repository().'/'.$repository.'/Source'; |
|
54 | - $this->directory['repositorySourceMainDir']=$this->directory['repositorySourceDir'].'/Main'; |
|
53 | + $this->directory['repositorySourceDir'] = $this->repository().'/'.$repository.'/Source'; |
|
54 | + $this->directory['repositorySourceMainDir'] = $this->directory['repositorySourceDir'].'/Main'; |
|
55 | 55 | |
56 | 56 | //set project directory |
57 | 57 | $this->file->makeDirectory($this); |
58 | 58 | |
59 | - $this->touch['repository/adapter'] =$this->directory['repositoryDir'].'/'.$repository.'Adapter.php'; |
|
60 | - $this->touch['repository/contract'] =$this->directory['repositoryDir'].'/'.$repository.'Contract.php'; |
|
59 | + $this->touch['repository/adapter'] = $this->directory['repositoryDir'].'/'.$repository.'Adapter.php'; |
|
60 | + $this->touch['repository/contract'] = $this->directory['repositoryDir'].'/'.$repository.'Contract.php'; |
|
61 | 61 | //$this->touch['repository/trait'] =$this->directory['repositoryDir'].'/'.$repository.'Trait.php'; |
62 | 62 | |
63 | - $this->touch['repository/sourcemain'] =$this->directory['repositorySourceMainDir'].'/'.$repository.'Main.php'; |
|
63 | + $this->touch['repository/sourcemain'] = $this->directory['repositorySourceMainDir'].'/'.$repository.'Main.php'; |
|
64 | 64 | |
65 | 65 | //set project touch |
66 | - $this->file->touch($this,[ |
|
66 | + $this->file->touch($this, [ |
|
67 | 67 | 'stub'=>'Repository_Create' |
68 | 68 | ]); |
69 | 69 | |
@@ -77,16 +77,16 @@ discard block |
||
77 | 77 | /** |
78 | 78 | * @return bool |
79 | 79 | */ |
80 | - private function sourceCreate(){ |
|
80 | + private function sourceCreate() { |
|
81 | 81 | |
82 | - if(isset($this->argument['source'])){ |
|
82 | + if (isset($this->argument['source'])) { |
|
83 | 83 | |
84 | - $this->directory['repositorySourceCustomDir']=$this->repository().'/'.$this->argument['repository'].'/Source/'.$this->argument['source']; |
|
84 | + $this->directory['repositorySourceCustomDir'] = $this->repository().'/'.$this->argument['repository'].'/Source/'.$this->argument['source']; |
|
85 | 85 | |
86 | 86 | //set project directory |
87 | 87 | $this->file->makeDirectory($this); |
88 | 88 | |
89 | - $this->touch['repository/sourcecustommain']=$this->directory['repositorySourceCustomDir'].'/'.$this->argument['repository'].''.$this->argument['source'].'.php'; |
|
89 | + $this->touch['repository/sourcecustommain'] = $this->directory['repositorySourceCustomDir'].'/'.$this->argument['repository'].''.$this->argument['source'].'.php'; |
|
90 | 90 | |
91 | 91 | //set project touch |
92 | 92 | $this->file->touch($this); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | /** |
103 | 103 | * @return bool |
104 | 104 | */ |
105 | - private function setAnnotations(){ |
|
105 | + private function setAnnotations() { |
|
106 | 106 | |
107 | 107 | return Utils::changeClass(path()->version().'/ServiceAnnotationsManager.php', |
108 | 108 | ['Trait ServiceAnnotationsManager'=>'Trait ServiceAnnotationsManager'.PHP_EOL.' * @method \\'.app()->namespace()->repository().'\\'.$this->argument['repository'].'\\'.$this->argument['repository'].'Contract '.lcfirst($this->argument['repository']).'Repository' |
@@ -45,7 +45,9 @@ |
||
45 | 45 | |
46 | 46 | $this->argument['repositoryNamespace']=Utils::getNamespace($repositoryPath); |
47 | 47 | |
48 | - if($this->sourceCreate()) return true; |
|
48 | + if($this->sourceCreate()) { |
|
49 | + return true; |
|
50 | + } |
|
49 | 51 | |
50 | 52 | $this->directory['repositoryPath'] = $this->repository(); |
51 | 53 | $this->directory['repositoryDir']=$repositoryPath; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * @var $type |
17 | 17 | */ |
18 | - public $type='factory'; |
|
18 | + public $type = 'factory'; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @var array |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * @var $commandRule |
34 | 34 | */ |
35 | - protected $commandRule=[[ |
|
35 | + protected $commandRule = [[ |
|
36 | 36 | 'create'=>[] |
37 | 37 | ]]; |
38 | 38 | |
@@ -54,21 +54,21 @@ discard block |
||
54 | 54 | |
55 | 55 | $this->file->makeDirectory($this); |
56 | 56 | |
57 | - if(!file_exists($this->factory().'/Factory.php')){ |
|
57 | + if (!file_exists($this->factory().'/Factory.php')) { |
|
58 | 58 | |
59 | 59 | $this->touch['factory/factory'] = $this->factory().'/Factory.php'; |
60 | 60 | $this->touch['factory/factorymanager'] = $this->factory().'/FactoryManager.php'; |
61 | 61 | } |
62 | 62 | |
63 | - if(file_exists( $this->directory['factoryArgumentDir'])){ |
|
63 | + if (file_exists($this->directory['factoryArgumentDir'])) { |
|
64 | 64 | |
65 | 65 | $factoryargumentmanager = $this->directory['factoryArgumentDir'].'/'.$factoryArgument.'Manager.php'; |
66 | 66 | $factoryargumentmanagerInterface = $this->directory['factoryArgumentDirInterfaces'].'/'.$factoryArgument.'Interface.php'; |
67 | 67 | |
68 | - if(!file_exists($this->directory['factoryArgumentDir'].'/'.$factoryArgument.'Manager.php')){ |
|
68 | + if (!file_exists($this->directory['factoryArgumentDir'].'/'.$factoryArgument.'Manager.php')) { |
|
69 | 69 | |
70 | - $this->touch['factory/factoryargumentmanager'] = $factoryargumentmanager; |
|
71 | - $this->touch['factory/factoryargumentmanagerinterface'] = $factoryargumentmanagerInterface; |
|
70 | + $this->touch['factory/factoryargumentmanager'] = $factoryargumentmanager; |
|
71 | + $this->touch['factory/factoryargumentmanagerinterface'] = $factoryargumentmanagerInterface; |
|
72 | 72 | $this->touch['factory/index'] = $this->directory['factoryArgumentDirResources'].'/index.html'; |
73 | 73 | |
74 | 74 | $this->file->touch($this); |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | {'=>'class Factory extends FactoryManager |
79 | 79 | { |
80 | 80 | /** |
81 | - * @return '.$factoryArgument .'Interface |
|
81 | + * @return '.$factoryArgument.'Interface |
|
82 | 82 | */ |
83 | - public static function '.strtolower($factoryArgument ).'() : '.$factoryArgument.'Interface |
|
83 | + public static function '.strtolower($factoryArgument).'() : '.$factoryArgument.'Interface |
|
84 | 84 | { |
85 | 85 | return static::singleton('.$factoryArgument.'Manager::class); |
86 | 86 | } |
@@ -96,15 +96,15 @@ discard block |
||
96 | 96 | ]); |
97 | 97 | } |
98 | 98 | |
99 | - if(isset($this->argument['resource'])){ |
|
99 | + if (isset($this->argument['resource'])) { |
|
100 | 100 | $resourceArgument = $this->argument['resource']; |
101 | 101 | |
102 | - if($resourceArgument!==null){ |
|
102 | + if ($resourceArgument!==null) { |
|
103 | 103 | $factoryArgumentResourceDir = $this->directory['factoryArgumentDir'].''.DIRECTORY_SEPARATOR.'Resources'; |
104 | - $this->directory['factoryArgumentResourceArgumentDir'] =$factoryArgumentResourceDir.''.DIRECTORY_SEPARATOR.''.$resourceArgument; |
|
104 | + $this->directory['factoryArgumentResourceArgumentDir'] = $factoryArgumentResourceDir.''.DIRECTORY_SEPARATOR.''.$resourceArgument; |
|
105 | 105 | $this->file->makeDirectory($this); |
106 | 106 | |
107 | - if(!file_exists($this->directory['factoryArgumentResourceArgumentDir'].''.DIRECTORY_SEPARATOR.''.$resourceArgument.'.php')){ |
|
107 | + if (!file_exists($this->directory['factoryArgumentResourceArgumentDir'].''.DIRECTORY_SEPARATOR.''.$resourceArgument.'.php')) { |
|
108 | 108 | |
109 | 109 | $this->touch['factory/factoryargumentresource'] = $this->directory['factoryArgumentResourceArgumentDir'].''.DIRECTORY_SEPARATOR.''.$resourceArgument.'.php'; |
110 | 110 | $this->touch['factory/factoryargumentresourceinterface'] = $this->directory['factoryArgumentDirInterfaces'].'/'.$resourceArgument.'Interface.php'; |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * @var $type |
16 | 16 | */ |
17 | - public $type='auto-service'; |
|
17 | + public $type = 'auto-service'; |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * @var array |
@@ -26,24 +26,24 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * @var $commandRule |
28 | 28 | */ |
29 | - protected $commandRule=[]; |
|
29 | + protected $commandRule = []; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * @method create |
33 | 33 | * @return mixed |
34 | 34 | */ |
35 | - public function create(){ |
|
35 | + public function create() { |
|
36 | 36 | |
37 | - $autoDirectory=explode("\\",$this->argument['project']); |
|
37 | + $autoDirectory = explode("\\", $this->argument['project']); |
|
38 | 38 | |
39 | - $this->argument['autoservice']=$autoDirectory[0]; |
|
39 | + $this->argument['autoservice'] = $autoDirectory[0]; |
|
40 | 40 | |
41 | 41 | $this->argument['methodPrefix'] = StaticPathModel::$methodPrefix; |
42 | - $this->directory['path'] = $this->autoService().'/'.$autoDirectory[0]; |
|
42 | + $this->directory['path'] = $this->autoService().'/'.$autoDirectory[0]; |
|
43 | 43 | |
44 | - $this->file->makeDirectory($this,true); |
|
44 | + $this->file->makeDirectory($this, true); |
|
45 | 45 | |
46 | - $this->touch['service/autoendpoint'] = $this->directory['path'].'/'.$autoDirectory[0].'Service.php'; |
|
46 | + $this->touch['service/autoendpoint'] = $this->directory['path'].'/'.$autoDirectory[0].'Service.php'; |
|
47 | 47 | |
48 | 48 | $this->file->touch($this); |
49 | 49 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | /** |
17 | 17 | * @var $type |
18 | 18 | */ |
19 | - public $type='route'; |
|
19 | + public $type = 'route'; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * @var array |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @var $commandRule |
35 | 35 | */ |
36 | - public $commandRule=[]; |
|
36 | + public $commandRule = []; |
|
37 | 37 | |
38 | 38 | /** |
39 | 39 | * @return bool |
@@ -42,24 +42,24 @@ discard block |
||
42 | 42 | |
43 | 43 | echo $this->info('All Route Controller Lists :'); |
44 | 44 | |
45 | - $this->table->setHeaders(['no','endpoint','http','namespace','method','definition','beforeMiddleware','afterMiddleware','doc','status']); |
|
45 | + $this->table->setHeaders(['no', 'endpoint', 'http', 'namespace', 'method', 'definition', 'beforeMiddleware', 'afterMiddleware', 'doc', 'status']); |
|
46 | 46 | |
47 | 47 | $routes = Router::getRoutes(); |
48 | 48 | $routeData = isset($routes['data']) ? $routes['data'] : []; |
49 | 49 | $routePattern = isset($routes['pattern']) ? $routes['pattern'] : []; |
50 | 50 | |
51 | - $counter=0; |
|
51 | + $counter = 0; |
|
52 | 52 | |
53 | 53 | $application = app(); |
54 | 54 | |
55 | 55 | $application->loadIfNotExistBoot(['middleware']); |
56 | 56 | $middlewareProvider = $application['middleware']; |
57 | 57 | |
58 | - foreach($routeData as $key=>$data){ |
|
58 | + foreach ($routeData as $key=>$data) { |
|
59 | 59 | |
60 | - $middlewareProvider->setKeyOdds('endpoint',$data['endpoint']); |
|
61 | - $middlewareProvider->setKeyOdds('method',$data['method']); |
|
62 | - $middlewareProvider->setKeyOdds('http',$data['http']); |
|
60 | + $middlewareProvider->setKeyOdds('endpoint', $data['endpoint']); |
|
61 | + $middlewareProvider->setKeyOdds('method', $data['method']); |
|
62 | + $middlewareProvider->setKeyOdds('http', $data['http']); |
|
63 | 63 | |
64 | 64 | $middlewareProvider->handleMiddlewareProcess(); |
65 | 65 | $beforeMiddleware = $middlewareProvider->getShow(); |
@@ -74,17 +74,17 @@ discard block |
||
74 | 74 | |
75 | 75 | $methodDefinition = ''; |
76 | 76 | |
77 | - if(preg_match('@#define:(.*?)\n@is',$methodDocument,$definition)){ |
|
78 | - if(isset($definition[1])){ |
|
77 | + if (preg_match('@#define:(.*?)\n@is', $methodDocument, $definition)) { |
|
78 | + if (isset($definition[1])) { |
|
79 | 79 | $methodDefinition = rtrim($definition[1]); |
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | - $endpointData = $endpoint.'/'.implode("/",$routePattern[$key]); |
|
83 | + $endpointData = $endpoint.'/'.implode("/", $routePattern[$key]); |
|
84 | 84 | |
85 | - if(isset($this->argument['filter'])){ |
|
85 | + if (isset($this->argument['filter'])) { |
|
86 | 86 | |
87 | - if(preg_match('@'.$this->argument['filter'].'@is',$endpointData)){ |
|
87 | + if (preg_match('@'.$this->argument['filter'].'@is', $endpointData)) { |
|
88 | 88 | |
89 | 89 | $this->table->addRow([ |
90 | 90 | ++$counter, |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | $controllerNamespace, |
94 | 94 | $data['method'], |
95 | 95 | $methodDefinition, |
96 | - implode(",",$beforeMiddleware), |
|
97 | - implode(",",$afterMiddleware), |
|
96 | + implode(",", $beforeMiddleware), |
|
97 | + implode(",", $afterMiddleware), |
|
98 | 98 | '', |
99 | 99 | 'not available', |
100 | 100 | true |
101 | 101 | ]); |
102 | 102 | } |
103 | 103 | } |
104 | - else{ |
|
104 | + else { |
|
105 | 105 | |
106 | 106 | $this->table->addRow([ |
107 | 107 | ++$counter, |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | $controllerNamespace, |
111 | 111 | $data['method'], |
112 | 112 | $methodDefinition, |
113 | - implode(",",$beforeMiddleware), |
|
114 | - implode(",",$afterMiddleware), |
|
113 | + implode(",", $beforeMiddleware), |
|
114 | + implode(",", $afterMiddleware), |
|
115 | 115 | 'not available', |
116 | 116 | true |
117 | 117 | ]); |
@@ -100,8 +100,7 @@ |
||
100 | 100 | true |
101 | 101 | ]); |
102 | 102 | } |
103 | - } |
|
104 | - else{ |
|
103 | + } else{ |
|
105 | 104 | |
106 | 105 | $this->table->addRow([ |
107 | 106 | ++$counter, |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * @var $type |
17 | 17 | */ |
18 | - public $type='request'; |
|
18 | + public $type = 'request'; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @var array |
@@ -32,15 +32,15 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * @var $commandRule |
34 | 34 | */ |
35 | - public $commandRule=['request']; |
|
35 | + public $commandRule = ['request']; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * @method create |
39 | 39 | * @return mixed |
40 | 40 | */ |
41 | - public function create(){ |
|
41 | + public function create() { |
|
42 | 42 | |
43 | - $request=$this->argument['request']; |
|
43 | + $request = $this->argument['request']; |
|
44 | 44 | |
45 | 45 | |
46 | 46 | $this->directory['requestCreate'] = path()->request(); |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | //set project directory |
51 | 51 | $this->file->makeDirectory($this); |
52 | 52 | |
53 | - if(!file_exists($this->directory['requestCreate'].'/Request.php')){ |
|
53 | + if (!file_exists($this->directory['requestCreate'].'/Request.php')) { |
|
54 | 54 | $this->touch['source/request'] = $this->directory['requestCreate'].'/Request.php'; |
55 | 55 | $this->touch['source/requestGenerator'] = $this->directory['requestCreate'].'/RequestGenerator.php'; |
56 | 56 | } |
57 | 57 | |
58 | - if(!file_exists($this->directory['requestCreate'].'/RequestProvider.php')){ |
|
58 | + if (!file_exists($this->directory['requestCreate'].'/RequestProvider.php')) { |
|
59 | 59 | $this->touch['source/requestProvider'] = $this->directory['requestCreate'].'/RequestProvider.php'; |
60 | 60 | } |
61 | 61 |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @var $type |
15 | 15 | */ |
16 | - public $type='command'; |
|
16 | + public $type = 'command'; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @var array |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * @var $commandRule |
27 | 27 | */ |
28 | - protected $commandRule=['command']; |
|
28 | + protected $commandRule = ['command']; |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * @method create |
32 | 32 | * @return mixed |
33 | 33 | */ |
34 | - public function create(){ |
|
34 | + public function create() { |
|
35 | 35 | |
36 | 36 | $this->directory['commandDir'] = path()->command(); |
37 | 37 | $this->argument['commandNamespace'] = app()->namespace()->command(); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | //set project directory |
41 | 41 | $this->file->makeDirectory($this); |
42 | 42 | |
43 | - $this->touch['command/file'] = $this->directory['commandDir'].'/'.$this->argument['command'].'.php'; |
|
43 | + $this->touch['command/file'] = $this->directory['commandDir'].'/'.$this->argument['command'].'.php'; |
|
44 | 44 | |
45 | 45 | $this->file->touch($this); |
46 | 46 |
@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | { |
17 | 17 | |
18 | 18 | //if there is no arguments constant |
19 | - if(!defined('arguments')) define ('arguments',['api']); |
|
19 | + if(!defined('arguments')) { |
|
20 | + define ('arguments',['api']); |
|
21 | + } |
|
20 | 22 | |
21 | 23 | //get psr standard console arguments |
22 | 24 | return core()->consoleArguments = Utils::upperCase(arguments); |
@@ -71,8 +73,7 @@ discard block |
||
71 | 73 | if($key=="0"){ |
72 | 74 | |
73 | 75 | $listKey['project']=$value; |
74 | - } |
|
75 | - else{ |
|
76 | + } else{ |
|
76 | 77 | |
77 | 78 | $colonExplode=explode(":",$value); |
78 | 79 | $listKey[strtolower($colonExplode[0])]=ucfirst($colonExplode[1]); |
@@ -113,6 +114,8 @@ discard block |
||
113 | 114 | define('group',StaticPathList::$projectPrefixGroup); |
114 | 115 | } |
115 | 116 | |
116 | - if(!defined('app') and isset($arguments[2])) define('app',$app); |
|
117 | + if(!defined('app') and isset($arguments[2])) { |
|
118 | + define('app',$app); |
|
119 | + } |
|
117 | 120 | } |
118 | 121 | } |
119 | 122 | \ No newline at end of file |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | { |
17 | 17 | |
18 | 18 | //if there is no arguments constant |
19 | - if(!defined('arguments')) define ('arguments',['api']); |
|
19 | + if (!defined('arguments')) define('arguments', ['api']); |
|
20 | 20 | |
21 | 21 | //get psr standard console arguments |
22 | 22 | return core()->consoleArguments = Utils::upperCase(arguments); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @method getConsoleClass |
27 | 27 | * @return mixed |
28 | 28 | */ |
29 | - public function getConsoleClass(){ |
|
29 | + public function getConsoleClass() { |
|
30 | 30 | |
31 | 31 | return current($this->getArguments()); |
32 | 32 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @method getConsoleClassMethod |
36 | 36 | * @return mixed |
37 | 37 | */ |
38 | - public function getConsoleClassMethod(){ |
|
38 | + public function getConsoleClassMethod() { |
|
39 | 39 | |
40 | 40 | return $this->getArguments()[1]; |
41 | 41 | } |
@@ -44,44 +44,44 @@ discard block |
||
44 | 44 | * @method getConsoleClassMethod |
45 | 45 | * @return mixed |
46 | 46 | */ |
47 | - public function getConsoleClassRealArguments(){ |
|
47 | + public function getConsoleClassRealArguments() { |
|
48 | 48 | |
49 | - return array_slice($this->getArguments(),2); |
|
49 | + return array_slice($this->getArguments(), 2); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
53 | 53 | * @method getConsoleArgumentsWithKey |
54 | 54 | * @return array |
55 | 55 | */ |
56 | - public function getConsoleArgumentsWithKey(){ |
|
56 | + public function getConsoleArgumentsWithKey() { |
|
57 | 57 | |
58 | 58 | //get console class real arguments |
59 | - $getConsoleClassRealArguments=$this->getConsoleClassRealArguments(); |
|
59 | + $getConsoleClassRealArguments = $this->getConsoleClassRealArguments(); |
|
60 | 60 | |
61 | - $listKey=[]; |
|
62 | - $listKey['project']=null; |
|
61 | + $listKey = []; |
|
62 | + $listKey['project'] = null; |
|
63 | 63 | |
64 | - if(property_exists($this,'consoleClassNamespace')){ |
|
64 | + if (property_exists($this, 'consoleClassNamespace')) { |
|
65 | 65 | $listKey['class'] = strtolower(class_basename($this->consoleClassNamespace)); |
66 | 66 | $listKey['classMethod'] = strtolower($this->getConsoleClassMethod()); |
67 | 67 | } |
68 | 68 | |
69 | - foreach($getConsoleClassRealArguments as $key=>$value){ |
|
69 | + foreach ($getConsoleClassRealArguments as $key=>$value) { |
|
70 | 70 | |
71 | - if($key=="0"){ |
|
71 | + if ($key=="0") { |
|
72 | 72 | |
73 | - $listKey['project']=$value; |
|
73 | + $listKey['project'] = $value; |
|
74 | 74 | } |
75 | - else{ |
|
75 | + else { |
|
76 | 76 | |
77 | - $colonExplode=explode(":",$value); |
|
78 | - $listKey[strtolower($colonExplode[0])]=ucfirst($colonExplode[1]); |
|
77 | + $colonExplode = explode(":", $value); |
|
78 | + $listKey[strtolower($colonExplode[0])] = ucfirst($colonExplode[1]); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | } |
82 | 82 | |
83 | 83 | //get app version |
84 | - $listKey['version']=UrlVersionIdentifier::version(); |
|
84 | + $listKey['version'] = UrlVersionIdentifier::version(); |
|
85 | 85 | |
86 | 86 | return $listKey; |
87 | 87 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | /** |
91 | 91 | * @return string |
92 | 92 | */ |
93 | - public function consoleClassNamespace(){ |
|
93 | + public function consoleClassNamespace() { |
|
94 | 94 | return 'Resta\Console\\Source\\'.$this->getConsoleClass().'\\'.$this->getConsoleClass(); |
95 | 95 | } |
96 | 96 | |
@@ -101,18 +101,18 @@ discard block |
||
101 | 101 | public function defineAppnameForCustomConsole() |
102 | 102 | { |
103 | 103 | |
104 | - $arguments=$this->getArguments(); |
|
104 | + $arguments = $this->getArguments(); |
|
105 | 105 | |
106 | 106 | $this->getConsoleArgumentsWithKey(); |
107 | 107 | |
108 | - if(isset($arguments[2])){ |
|
109 | - $app=$arguments[2]; |
|
108 | + if (isset($arguments[2])) { |
|
109 | + $app = $arguments[2]; |
|
110 | 110 | } |
111 | 111 | |
112 | - if(!defined('group')){ |
|
113 | - define('group',StaticPathList::$projectPrefixGroup); |
|
112 | + if (!defined('group')) { |
|
113 | + define('group', StaticPathList::$projectPrefixGroup); |
|
114 | 114 | } |
115 | 115 | |
116 | - if(!defined('app') and isset($arguments[2])) define('app',$app); |
|
116 | + if (!defined('app') and isset($arguments[2])) define('app', $app); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | \ No newline at end of file |
@@ -155,8 +155,7 @@ |
||
155 | 155 | |
156 | 156 | if(isset($this->argument['group'])){ |
157 | 157 | $argument=current($dataParse).''.$seperate.''.$this->argument['group']; |
158 | - } |
|
159 | - else{ |
|
158 | + } else{ |
|
160 | 159 | $argument=current($dataParse); |
161 | 160 | } |
162 | 161 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * @var $directory |
42 | 42 | */ |
43 | - public $directory=array(); |
|
43 | + public $directory = array(); |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * @var $app |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * @var $touch |
57 | 57 | */ |
58 | - public $touch=array(); |
|
58 | + public $touch = array(); |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * ConsoleOutputter constructor. |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * @param $app |
64 | 64 | * @param $command |
65 | 65 | */ |
66 | - public function __construct($argument,$app) { |
|
66 | + public function __construct($argument, $app) { |
|
67 | 67 | |
68 | 68 | // Set up shell colors |
69 | 69 | $this->foreground_colors['black'] = '0;30'; |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | $this->background_colors['cyan'] = '46'; |
93 | 93 | $this->background_colors['light_gray'] = '47'; |
94 | 94 | |
95 | - $this->app=$app; |
|
96 | - $this->argument=$argument; |
|
97 | - $this->file=new FileProcess(); |
|
95 | + $this->app = $app; |
|
96 | + $this->argument = $argument; |
|
97 | + $this->file = new FileProcess(); |
|
98 | 98 | require_once ('ConsoleTable.php'); |
99 | - $this->table=new \console_table(); |
|
99 | + $this->table = new \console_table(); |
|
100 | 100 | |
101 | 101 | |
102 | - if(isset($this->argument['project'])){ |
|
102 | + if (isset($this->argument['project'])) { |
|
103 | 103 | |
104 | 104 | $this->argument['repositoryNamespace'] = app()->namespace()->repository(); |
105 | 105 | $this->argument['modelNamespace'] = app()->namespace()->model(); |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | $this->argument['versionNamespace'] = app()->namespace()->version(); |
108 | 108 | |
109 | 109 | |
110 | - $this->argument['project']=$this->argument['project'].'\\'.StaticPathList::$projectPrefixGroup; |
|
110 | + $this->argument['project'] = $this->argument['project'].'\\'.StaticPathList::$projectPrefixGroup; |
|
111 | 111 | |
112 | 112 | |
113 | - $this->project=StaticPathModel::appPath().'/'.str_replace('\\','/',$this->argument['project']); |
|
113 | + $this->project = StaticPathModel::appPath().'/'.str_replace('\\', '/', $this->argument['project']); |
|
114 | 114 | |
115 | 115 | |
116 | 116 | } |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | return array_keys($this->background_colors); |
128 | 128 | } |
129 | 129 | |
130 | - public function ReadStdin($prompt=null, $valid_inputs=null, $default = '') { |
|
131 | - while(!isset($input) || (is_array($valid_inputs) && !in_array($input, $valid_inputs)) || ($valid_inputs == 'is_file' && !is_file($input))) { |
|
130 | + public function ReadStdin($prompt = null, $valid_inputs = null, $default = '') { |
|
131 | + while (!isset($input) || (is_array($valid_inputs) && !in_array($input, $valid_inputs)) || ($valid_inputs=='is_file' && !is_file($input))) { |
|
132 | 132 | echo $this->input($prompt); |
133 | 133 | $input = strtolower(trim(fgets(STDIN))); |
134 | - if(empty($input) && !empty($default)) { |
|
134 | + if (empty($input) && !empty($default)) { |
|
135 | 135 | $input = $default; |
136 | 136 | } |
137 | 137 | } |
@@ -142,22 +142,22 @@ discard block |
||
142 | 142 | * @param $commander |
143 | 143 | * @return string |
144 | 144 | */ |
145 | - public function exception($commander){ |
|
145 | + public function exception($commander) { |
|
146 | 146 | return $this->error('[['.$commander['argument'].']] parameter is missing for commander'); |
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
150 | 150 | * @param $data |
151 | 151 | */ |
152 | - public function checkGroupArgument($data,$seperate="\\"){ |
|
152 | + public function checkGroupArgument($data, $seperate = "\\") { |
|
153 | 153 | |
154 | - $dataParse=explode("\\",$data); |
|
154 | + $dataParse = explode("\\", $data); |
|
155 | 155 | |
156 | - if(isset($this->argument['group'])){ |
|
157 | - $argument=current($dataParse).''.$seperate.''.$this->argument['group']; |
|
156 | + if (isset($this->argument['group'])) { |
|
157 | + $argument = current($dataParse).''.$seperate.''.$this->argument['group']; |
|
158 | 158 | } |
159 | - else{ |
|
160 | - $argument=current($dataParse); |
|
159 | + else { |
|
160 | + $argument = current($dataParse); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | return $argument; |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | /** |
167 | 167 | * @param $string |
168 | 168 | */ |
169 | - public function consoleLogger($string,$level) |
|
169 | + public function consoleLogger($string, $level) |
|
170 | 170 | { |
171 | - if(config('app')!==null && config('app.consoleLogger')){ |
|
171 | + if (config('app')!==null && config('app.consoleLogger')) { |
|
172 | 172 | |
173 | 173 | logger('console')->{$level}([ |
174 | - 'argument' => implode(" ",core()->consoleArguments), |
|
174 | + 'argument' => implode(" ", core()->consoleArguments), |
|
175 | 175 | 'result' => $string, |
176 | 176 | ]); |
177 | 177 | } |