@@ -57,8 +57,7 @@ |
||
| 57 | 57 | |
| 58 | 58 | if(is_array($event = $this->fireEvent('output',true))){
|
| 59 | 59 | $controller = $event; |
| 60 | - } |
|
| 61 | - else{
|
|
| 60 | + } else{
|
|
| 62 | 61 | |
| 63 | 62 | //the singleton eager class is a class built to temporarily prevent |
| 64 | 63 | //the use of user-side kernel objects used by the rest system. |
@@ -20,19 +20,19 @@ discard block |
||
| 20 | 20 | * @param bool $return |
| 21 | 21 | * @return mixed|void |
| 22 | 22 | */ |
| 23 | - private function fireEvent($event=null,$return=false) |
|
| 23 | + private function fireEvent($event = null, $return = false) |
|
| 24 | 24 | {
|
| 25 | 25 | // if an array of response-events is registered |
| 26 | 26 | // in the container system, the event will fire. |
| 27 | - if($this->app->has('response-event.'.$event)){
|
|
| 27 | + if ($this->app->has('response-event.'.$event)) {
|
|
| 28 | 28 | $event = $this->app->get('response-event.'.$event);
|
| 29 | 29 | |
| 30 | 30 | // the event to be fired must be |
| 31 | 31 | // a closure instance. |
| 32 | - if($event instanceof Closure){
|
|
| 32 | + if ($event instanceof Closure) {
|
|
| 33 | 33 | $eventResolved = $event($this->app); |
| 34 | 34 | |
| 35 | - if($return){
|
|
| 35 | + if ($return) {
|
|
| 36 | 36 | return $eventResolved; |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -49,16 +49,16 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | private function callController() |
| 51 | 51 | {
|
| 52 | - $this->fireEvent('before',true);
|
|
| 52 | + $this->fireEvent('before', true);
|
|
| 53 | 53 | |
| 54 | - if($this->app->has('output')){
|
|
| 54 | + if ($this->app->has('output')) {
|
|
| 55 | 55 | return $this->app->get('output');
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - if(is_array($event = $this->fireEvent('output',true))){
|
|
| 58 | + if (is_array($event = $this->fireEvent('output', true))) {
|
|
| 59 | 59 | $controller = $event; |
| 60 | 60 | } |
| 61 | - else{
|
|
| 61 | + else {
|
|
| 62 | 62 | |
| 63 | 63 | //the singleton eager class is a class built to temporarily prevent |
| 64 | 64 | //the use of user-side kernel objects used by the rest system. |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $controller = $this->getCallBindController(); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $this->app->register('output',$controller);
|
|
| 72 | + $this->app->register('output', $controller);
|
|
| 73 | 73 | |
| 74 | 74 | return $controller; |
| 75 | 75 | } |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | private function getCallBindController() |
| 83 | 83 | {
|
| 84 | 84 | //we finally process the method of the class invoked by the user as a process and prepare it for the response |
| 85 | - return app()->resolve(RouteWatch::class)->watch(function(){
|
|
| 85 | + return app()->resolve(RouteWatch::class)->watch(function() {
|
|
| 86 | 86 | |
| 87 | 87 | // if the method in the instance object exists, |
| 88 | 88 | // this method is executed to produce the output. |
| 89 | - if(method_exists($this->app['instanceController'],$this->app['method'])){
|
|
| 90 | - return $this->app['di']($this->app['instanceController'],$this->app['method']); |
|
| 89 | + if (method_exists($this->app['instanceController'], $this->app['method'])) {
|
|
| 90 | + return $this->app['di']($this->app['instanceController'], $this->app['method']); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | //throw exception as unsuccessful |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function handle() |
| 107 | 107 | {
|
| 108 | - $this->app->register('routerResult',$this->callController());
|
|
| 108 | + $this->app->register('routerResult', $this->callController());
|
|
| 109 | 109 | |
| 110 | 110 | //we call our services as controller |
| 111 | 111 | return $this->app['routerResult']; |
@@ -122,8 +122,8 @@ discard block |
||
| 122 | 122 | $namespace = $this->getControllerNamespace(); |
| 123 | 123 | |
| 124 | 124 | //utils make bind via dependency injection named as service container |
| 125 | - $this->app->register('serviceConf',$this->app['fileSystem']->callFile(StaticPathModel::getServiceConf()));
|
|
| 126 | - $this->app->register('instanceController',$this->app->resolve($namespace));
|
|
| 125 | + $this->app->register('serviceConf', $this->app['fileSystem']->callFile(StaticPathModel::getServiceConf()));
|
|
| 126 | + $this->app->register('instanceController', $this->app->resolve($namespace));
|
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | // based on the serviceConf variable, |
| 142 | 142 | // we are doing parameter bindings in the method context in the routeParameters array key. |
| 143 | - $this->app->register('serviceConf','routeParameters',[$method=>$parameters]);
|
|
| 143 | + $this->app->register('serviceConf', 'routeParameters', [$method=>$parameters]);
|
|
| 144 | 144 | |
| 145 | 145 | } |
| 146 | 146 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function setMethodNameViaDefine($methodName) |
| 154 | 154 | {
|
| 155 | - define('methodName',strtolower($methodName));
|
|
| 155 | + define('methodName', strtolower($methodName));
|
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $fromRoutes = Route::getRouteResolve(); |
| 184 | 184 | $method = $fromRoutes['method'] ?? $method; |
| 185 | 185 | |
| 186 | - $this->app->register('method',$method);
|
|
| 186 | + $this->app->register('method', $method);
|
|
| 187 | 187 | $this->app->register('routeParameters', $this->routeParametersAssign($this->resolveMethod($method)));
|
| 188 | 188 | |
| 189 | 189 | } |
@@ -28,13 +28,13 @@ discard block |
||
| 28 | 28 | //the auto service to be called. |
| 29 | 29 | return ClosureDispatcher::bind($controllerInstance)->call(function() use($controllerInstance){
|
| 30 | 30 | |
| 31 | - if(property_exists($controllerInstance,'response')){
|
|
| 31 | + if (property_exists($controllerInstance, 'response')) {
|
|
| 32 | 32 | return $controllerInstance->response; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | // if the client wishes, |
| 36 | 36 | // data can be returned in the supported format. |
| 37 | - if(app()->has('clientResponseType')){
|
|
| 37 | + if (app()->has('clientResponseType')) {
|
|
| 38 | 38 | return app()->get('clientResponseType');
|
| 39 | 39 | } |
| 40 | 40 | |
@@ -49,19 +49,19 @@ discard block |
||
| 49 | 49 | * @param bool $return |
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | - protected function fireEvent($event=null,$return=false) |
|
| 52 | + protected function fireEvent($event = null, $return = false) |
|
| 53 | 53 | {
|
| 54 | 54 | // if an array of response-events is registered |
| 55 | 55 | // in the container system, the event will fire. |
| 56 | - if($this->app->has('response-event.'.$event)){
|
|
| 56 | + if ($this->app->has('response-event.'.$event)) {
|
|
| 57 | 57 | $event = $this->app->get('response-event.'.$event);
|
| 58 | 58 | |
| 59 | 59 | // the event to be fired must be |
| 60 | 60 | // a closure instance. |
| 61 | - if($event instanceof Closure){
|
|
| 61 | + if ($event instanceof Closure) {
|
|
| 62 | 62 | $eventResolved = $event($this->app); |
| 63 | 63 | |
| 64 | - if($return){
|
|
| 64 | + if ($return) {
|
|
| 65 | 65 | return $eventResolved; |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -100,8 +100,7 @@ discard block |
||
| 100 | 100 | {
|
| 101 | 101 | //we get the response type by checking the instanceController object from the router. |
| 102 | 102 | //Each type of response is in the base class in project directory. |
| 103 | - return ($this->getControllerInstance()===null) ? core()->responseType : |
|
| 104 | - $this->appResponseType(); |
|
| 103 | + return ($this->getControllerInstance()===null) ? core()->responseType : $this->appResponseType(); |
|
| 105 | 104 | } |
| 106 | 105 | |
| 107 | 106 | /** |
@@ -112,13 +111,13 @@ discard block |
||
| 112 | 111 | public function handle() |
| 113 | 112 | {
|
| 114 | 113 | //definition for singleton instance |
| 115 | - define ('responseApp',true);
|
|
| 114 | + define('responseApp', true);
|
|
| 116 | 115 | |
| 117 | 116 | //get out putter for response |
| 118 | 117 | $formatter = $this->formatter(); |
| 119 | 118 | |
| 120 | 119 | //if out putter is not null |
| 121 | - if(Utils::isNamespaceExists($formatter)){
|
|
| 120 | + if (Utils::isNamespaceExists($formatter)) {
|
|
| 122 | 121 | |
| 123 | 122 | //get outputter for result |
| 124 | 123 | $outPutter = $this->getOutPutter(); |
@@ -127,9 +126,9 @@ discard block |
||
| 127 | 126 | // and run the handle method. |
| 128 | 127 | $result = app()->resolve($formatter)->{$this->getResponseKind()}($outPutter);
|
| 129 | 128 | |
| 130 | - $this->app->register('result',$result);
|
|
| 129 | + $this->app->register('result', $result);
|
|
| 131 | 130 | |
| 132 | - $this->fireEvent('after',true);
|
|
| 131 | + $this->fireEvent('after', true);
|
|
| 133 | 132 | } |
| 134 | 133 | } |
| 135 | 134 | |
@@ -139,7 +138,7 @@ discard block |
||
| 139 | 138 | * @param array $data |
| 140 | 139 | * @return array |
| 141 | 140 | */ |
| 142 | - public function outputFormatter($data=array(),$outputter='json') |
|
| 141 | + public function outputFormatter($data = array(), $outputter = 'json') |
|
| 143 | 142 | {
|
| 144 | 143 | $dataCapsule = config('response.data');
|
| 145 | 144 | |
@@ -18,7 +18,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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");');
|
|
| 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 | 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 |
||
| 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 | } |
@@ -147,10 +147,10 @@ discard block |
||
| 147 | 147 | //$this->touch['service/conf'] = $this->directory['configuration'].''.DIRECTORY_SEPARATOR.'ServiceConf.php'; |
| 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 | - $this->touch['service/readme'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.'README.md'; |
|
| 150 | + $this->touch['service/readme'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.'README.md'; |
|
| 151 | 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 |
||
| 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 |
||
| 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 | |
@@ -90,8 +90,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * @var $type |
| 17 | 17 | */ |
| 18 | - public $type='project'; |
|
| 18 | + public $type = 'project'; |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * @var array |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * @var $commandRule |
| 34 | 34 | */ |
| 35 | - public $commandRule=[]; |
|
| 35 | + public $commandRule = []; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @method create |
@@ -47,18 +47,18 @@ discard block |
||
| 47 | 47 | $this->directory['projectDir'] = $this->projectPath(); |
| 48 | 48 | $this->argument['exceptionNamespace'] = app()->namespace()->exception(); |
| 49 | 49 | $this->argument['resourcePath'] = app()->path()->appResourche(); |
| 50 | - $this->argument['commandNamespace'] = app()->namespace()->command(); |
|
| 51 | - $this->argument['testNamespace'] = app()->namespace()->tests(); |
|
| 50 | + $this->argument['commandNamespace'] = app()->namespace()->command(); |
|
| 51 | + $this->argument['testNamespace'] = app()->namespace()->tests(); |
|
| 52 | 52 | |
| 53 | - $recursiveDefaultDirectory = explode("\\",$this->argument['project']);
|
|
| 53 | + $recursiveDefaultDirectory = explode("\\", $this->argument['project']);
|
|
| 54 | 54 | $this->argument['applicationName'] = pos($recursiveDefaultDirectory); |
| 55 | 55 | $recursiveDefaultDirectory[] = 'V1'; |
| 56 | 56 | $recursiveDefaultDirectoryList = []; |
| 57 | 57 | |
| 58 | - foreach (array_slice($recursiveDefaultDirectory,1) as $defaultDirectory){
|
|
| 58 | + foreach (array_slice($recursiveDefaultDirectory, 1) as $defaultDirectory) {
|
|
| 59 | 59 | |
| 60 | - $recursiveDefaultDirectoryList[]=$defaultDirectory; |
|
| 61 | - $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/",$recursiveDefaultDirectoryList);
|
|
| 60 | + $recursiveDefaultDirectoryList[] = $defaultDirectory; |
|
| 61 | + $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/", $recursiveDefaultDirectoryList);
|
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | //$this->directory['optionalDir'] = $this->optional(); |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | $this->touch['kernel/exception'] = $this->provider().'/ExceptionServiceProvider.php'; |
| 102 | 102 | $this->touch['kernel/response'] = $this->provider().'/ResponseServiceProvider.php'; |
| 103 | 103 | $this->touch['kernel/entity'] = $this->provider().'/EntityServiceProvider.php'; |
| 104 | - $this->touch['kernel/cache'] = $this->provider().'/CacheServiceProvider.php'; |
|
| 104 | + $this->touch['kernel/cache'] = $this->provider().'/CacheServiceProvider.php'; |
|
| 105 | 105 | $this->touch['kernel/authenticate'] = $this->provider().'/AuthenticateServiceProvider.php'; |
| 106 | 106 | $this->touch['kernel/role'] = $this->provider().'/RoleServiceProvider.php'; |
| 107 | 107 | $this->touch['kernel/track'] = $this->provider().'/TrackServiceProvider.php'; |
| 108 | - $this->touch['test/testcase'] = $this->test().'/TestCase.php'; |
|
| 108 | + $this->touch['test/testcase'] = $this->test().'/TestCase.php'; |
|
| 109 | 109 | $this->touch['kernel/consoleevent'] = $this->provider().'/ConsoleEventServiceProvider.php'; |
| 110 | 110 | $this->touch['middleware/authenticate'] = $this->middleware().'/Authenticate.php'; |
| 111 | 111 | $this->touch['middleware/ratelimit'] = $this->middleware().'/RateLimit.php'; |
@@ -123,19 +123,19 @@ discard block |
||
| 123 | 123 | $this->touch['resource/index'] = $this->resource().'/index.html'; |
| 124 | 124 | $this->touch['resource/index'] = $this->resource().'/'.StaticPathModel::$cache.'/index.html'; |
| 125 | 125 | $this->touch['stub/index'] = $this->stub().'/index.html'; |
| 126 | - $this->touch['stub/cccrudapp'] = $this->directory['stubControllerCreateCrudFileDir'] .'/app.stub'; |
|
| 127 | - $this->touch['stub/cccrudconf'] = $this->directory['stubControllerCreateCrudFileDir'] .'/conf.stub'; |
|
| 128 | - $this->touch['stub/cccrudcontrollerfilecrud'] = $this->directory['stubControllerCreateCrudFileDir'] .'/controllerfilecrud.stub'; |
|
| 129 | - $this->touch['stub/cccruddeveloper'] = $this->directory['stubControllerCreateCrudFileDir'] .'/developer.stub'; |
|
| 130 | - $this->touch['stub/cccruddoc'] = $this->directory['stubControllerCreateCrudFileDir'] .'/doc.stub'; |
|
| 131 | - $this->touch['stub/cccruddummy'] = $this->directory['stubControllerCreateCrudFileDir'] .'/dummy.stub'; |
|
| 132 | - $this->touch['stub/cccrudroute'] = $this->directory['stubControllerCreateCrudFileDir'] .'/routecrud.stub'; |
|
| 133 | - $this->touch['stub/cccrudpolicy'] = $this->directory['stubControllerCreateCrudFileDir'] .'/policy.stub'; |
|
| 134 | - $this->touch['stub/cccrudreadme'] = $this->directory['stubControllerCreateCrudFileDir'] .'/readme.stub'; |
|
| 135 | - $this->touch['stub/cccrudresourceindex'] = $this->directory['stubControllerCreateCrudFileDir'] .'/resourceIndex.stub'; |
|
| 126 | + $this->touch['stub/cccrudapp'] = $this->directory['stubControllerCreateCrudFileDir'].'/app.stub'; |
|
| 127 | + $this->touch['stub/cccrudconf'] = $this->directory['stubControllerCreateCrudFileDir'].'/conf.stub'; |
|
| 128 | + $this->touch['stub/cccrudcontrollerfilecrud'] = $this->directory['stubControllerCreateCrudFileDir'].'/controllerfilecrud.stub'; |
|
| 129 | + $this->touch['stub/cccruddeveloper'] = $this->directory['stubControllerCreateCrudFileDir'].'/developer.stub'; |
|
| 130 | + $this->touch['stub/cccruddoc'] = $this->directory['stubControllerCreateCrudFileDir'].'/doc.stub'; |
|
| 131 | + $this->touch['stub/cccruddummy'] = $this->directory['stubControllerCreateCrudFileDir'].'/dummy.stub'; |
|
| 132 | + $this->touch['stub/cccrudroute'] = $this->directory['stubControllerCreateCrudFileDir'].'/routecrud.stub'; |
|
| 133 | + $this->touch['stub/cccrudpolicy'] = $this->directory['stubControllerCreateCrudFileDir'].'/policy.stub'; |
|
| 134 | + $this->touch['stub/cccrudreadme'] = $this->directory['stubControllerCreateCrudFileDir'].'/readme.stub'; |
|
| 135 | + $this->touch['stub/cccrudresourceindex'] = $this->directory['stubControllerCreateCrudFileDir'].'/resourceIndex.stub'; |
|
| 136 | 136 | $this->touch['config/hateoas'] = $this->config().'/Hateoas.php'; |
| 137 | 137 | //$this->touch['config/response'] = $this->config().'/Response.php'; |
| 138 | - $this->touch['command/clientEntity'] = $this->directory['commandDir'].'/ClientEntity.php'; |
|
| 138 | + $this->touch['command/clientEntity'] = $this->directory['commandDir'].'/ClientEntity.php'; |
|
| 139 | 139 | $this->touch['config/redis'] = $this->config().'/Redis.php'; |
| 140 | 140 | $this->touch['config/app'] = $this->config().'/App.php'; |
| 141 | 141 | $this->touch['config/autoservice'] = $this->config().'/AutoServices.php'; |
@@ -157,9 +157,9 @@ discard block |
||
| 157 | 157 | $this->touch['app/gitignore'] = $this->projectPath().'/.gitignore'; |
| 158 | 158 | $this->touch['app/composer'] = $this->projectPath().'/composer.json'; |
| 159 | 159 | $this->touch['test/index'] = $this->storage().'/index.html'; |
| 160 | - $this->touch['exception/authenticate'] = $this->directory['exceptionDir'] .'/AuthenticateException.php'; |
|
| 161 | - $this->touch['exception/noinput'] = $this->directory['exceptionDir'] .'/NoInputException.php'; |
|
| 162 | - $this->touch['helpers/general'] = $this->directory['helperDir'] .'/General.php'; |
|
| 160 | + $this->touch['exception/authenticate'] = $this->directory['exceptionDir'].'/AuthenticateException.php'; |
|
| 161 | + $this->touch['exception/noinput'] = $this->directory['exceptionDir'].'/NoInputException.php'; |
|
| 162 | + $this->touch['helpers/general'] = $this->directory['helperDir'].'/General.php'; |
|
| 163 | 163 | |
| 164 | 164 | //set project touch |
| 165 | 165 | $this->file->touch($this); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $path = realpath($path) ?: $path; |
| 131 | 131 | $tempPath = tempnam(dirname($path), basename($path)); |
| 132 | 132 | // Fix permissions of tempPath because `tempnam()` creates it with permissions set to 0600... |
| 133 | - chmod($tempPath, 0777 - umask()); |
|
| 133 | + chmod($tempPath, 0777-umask()); |
|
| 134 | 134 | file_put_contents($tempPath, $content); |
| 135 | 135 | rename($tempPath, $path); |
| 136 | 136 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $success = true; |
| 190 | 190 | foreach ($paths as $path) { |
| 191 | 191 | try { |
| 192 | - if (! @unlink($path)) { |
|
| 192 | + if (!@unlink($path)) { |
|
| 193 | 193 | $success = false; |
| 194 | 194 | } |
| 195 | 195 | } catch (ErrorException $e) { |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | public function link($target, $link) |
| 234 | 234 | { |
| 235 | - if (! windows_os()) { |
|
| 235 | + if (!windows_os()) { |
|
| 236 | 236 | return symlink($target, $link); |
| 237 | 237 | } |
| 238 | 238 | $mode = $this->isDirectory($target) ? 'J' : 'H'; |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | public function files($directory, $hidden = false) |
| 394 | 394 | { |
| 395 | 395 | return iterator_to_array( |
| 396 | - Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->depth(0)->sortByName(), |
|
| 396 | + Finder::create()->files()->ignoreDotFiles(!$hidden)->in($directory)->depth(0)->sortByName(), |
|
| 397 | 397 | false |
| 398 | 398 | ); |
| 399 | 399 | } |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | public function allFiles($directory, $hidden = false) |
| 409 | 409 | { |
| 410 | 410 | return iterator_to_array( |
| 411 | - Finder::create()->files()->ignoreDotFiles(! $hidden)->in($directory)->sortByName(), |
|
| 411 | + Finder::create()->files()->ignoreDotFiles(!$hidden)->in($directory)->sortByName(), |
|
| 412 | 412 | false |
| 413 | 413 | ); |
| 414 | 414 | } |
@@ -455,10 +455,10 @@ discard block |
||
| 455 | 455 | */ |
| 456 | 456 | public function moveDirectory($from, $to, $overwrite = false) |
| 457 | 457 | { |
| 458 | - if ($overwrite && $this->isDirectory($to) && ! $this->deleteDirectory($to)) { |
|
| 458 | + if ($overwrite && $this->isDirectory($to) && !$this->deleteDirectory($to)) { |
|
| 459 | 459 | return false; |
| 460 | 460 | } |
| 461 | - return @rename($from, $to) === true; |
|
| 461 | + return @rename($from, $to)===true; |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | /** |
@@ -471,14 +471,14 @@ discard block |
||
| 471 | 471 | */ |
| 472 | 472 | public function copyDirectory($directory, $destination, $options = null) |
| 473 | 473 | { |
| 474 | - if (! $this->isDirectory($directory)) { |
|
| 474 | + if (!$this->isDirectory($directory)) { |
|
| 475 | 475 | return false; |
| 476 | 476 | } |
| 477 | 477 | $options = $options ?: FilesystemIterator::SKIP_DOTS; |
| 478 | 478 | // If the destination directory does not actually exist, we will go ahead and |
| 479 | 479 | // create it recursively, which just gets the destination prepared to copy |
| 480 | 480 | // the files over. Once we make the directory we'll proceed the copying. |
| 481 | - if (! $this->isDirectory($destination)) { |
|
| 481 | + if (!$this->isDirectory($destination)) { |
|
| 482 | 482 | $this->makeDirectory($destination, 0777, true); |
| 483 | 483 | } |
| 484 | 484 | $items = new FilesystemIterator($directory, $options); |
@@ -489,7 +489,7 @@ discard block |
||
| 489 | 489 | $target = $destination.'/'.$item->getBasename(); |
| 490 | 490 | if ($item->isDir()) { |
| 491 | 491 | $path = $item->getPathname(); |
| 492 | - if (! $this->copyDirectory($path, $target, $options)) { |
|
| 492 | + if (!$this->copyDirectory($path, $target, $options)) { |
|
| 493 | 493 | return false; |
| 494 | 494 | } |
| 495 | 495 | } |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | // location and keep looping. If for some reason the copy fails we'll bail out |
| 498 | 498 | // and return false, so the developer is aware that the copy process failed. |
| 499 | 499 | else { |
| 500 | - if (! $this->copy($item->getPathname(), $target)) { |
|
| 500 | + if (!$this->copy($item->getPathname(), $target)) { |
|
| 501 | 501 | return false; |
| 502 | 502 | } |
| 503 | 503 | } |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | */ |
| 517 | 517 | public function deleteDirectory($directory, $preserve = false) |
| 518 | 518 | { |
| 519 | - if (! $this->isDirectory($directory)) { |
|
| 519 | + if (!$this->isDirectory($directory)) { |
|
| 520 | 520 | return false; |
| 521 | 521 | } |
| 522 | 522 | $items = new FilesystemIterator($directory); |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | // If the item is a directory, we can just recurse into the function and |
| 525 | 525 | // delete that sub-directory otherwise we'll just delete the file and |
| 526 | 526 | // keep iterating through each file until the directory is cleaned. |
| 527 | - if ($item->isDir() && ! $item->isLink()) { |
|
| 527 | + if ($item->isDir() && !$item->isLink()) { |
|
| 528 | 528 | $this->deleteDirectory($item->getPathname()); |
| 529 | 529 | } |
| 530 | 530 | // If the item is just a file, we can go ahead and delete it since we're |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | $this->delete($item->getPathname()); |
| 535 | 535 | } |
| 536 | 536 | } |
| 537 | - if (! $preserve) { |
|
| 537 | + if (!$preserve) { |
|
| 538 | 538 | @rmdir($directory); |
| 539 | 539 | } |
| 540 | 540 | return true; |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | public function deleteDirectories($directory) |
| 550 | 550 | { |
| 551 | 551 | $allDirectories = $this->directories($directory); |
| 552 | - if (! empty($allDirectories)) { |
|
| 552 | + if (!empty($allDirectories)) { |
|
| 553 | 553 | foreach ($allDirectories as $directoryName) { |
| 554 | 554 | $this->deleteDirectory($directoryName); |
| 555 | 555 | } |
@@ -580,17 +580,17 @@ discard block |
||
| 580 | 580 | */ |
| 581 | 581 | public function getAllFilesInDirectory($dir, $recursive = true, $basedir = '', $include_dirs = false) |
| 582 | 582 | { |
| 583 | - if ($dir == '') {return array();} else {$results = array(); $subresults = array();} |
|
| 584 | - if (!is_dir($dir)) {$dir = dirname($dir);} // so a files path can be sent |
|
| 585 | - if ($basedir == '') {$basedir = realpath($dir).DIRECTORY_SEPARATOR;} |
|
| 583 | + if ($dir=='') {return array(); } else {$results = array(); $subresults = array(); } |
|
| 584 | + if (!is_dir($dir)) {$dir = dirname($dir); } // so a files path can be sent |
|
| 585 | + if ($basedir=='') {$basedir = realpath($dir).DIRECTORY_SEPARATOR; } |
|
| 586 | 586 | |
| 587 | 587 | $files = scandir($dir); |
| 588 | - foreach ($files as $key => $value){ |
|
| 589 | - if ( ($value != '.') && ($value != '..') ) { |
|
| 588 | + foreach ($files as $key => $value) { |
|
| 589 | + if (($value!='.') && ($value!='..')) { |
|
| 590 | 590 | $path = realpath($dir.DIRECTORY_SEPARATOR.$value); |
| 591 | 591 | if (is_dir($path)) { |
| 592 | 592 | // optionally include directories in file list |
| 593 | - if ($include_dirs) {$subresults[] = str_replace($basedir, '', $path);} |
|
| 593 | + if ($include_dirs) {$subresults[] = str_replace($basedir, '', $path); } |
|
| 594 | 594 | // optionally get file list for all subdirectories |
| 595 | 595 | if ($recursive) { |
| 596 | 596 | $subdirresults = $this->getAllFilesInDirectory($path, $recursive, $basedir, $include_dirs); |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | } |
| 604 | 604 | } |
| 605 | 605 | // merge the subarray to give the list of files then subdirectory files |
| 606 | - if (count($subresults) > 0) {$results = array_merge($subresults, $results);} |
|
| 606 | + if (count($subresults)>0) {$results = array_merge($subresults, $results); } |
|
| 607 | 607 | return $results; |
| 608 | 608 | } |
| 609 | 609 | |
@@ -625,15 +625,15 @@ discard block |
||
| 625 | 625 | * @param $param |
| 626 | 626 | * @return bool |
| 627 | 627 | */ |
| 628 | - public function change($executionPath,$param) |
|
| 628 | + public function change($executionPath, $param) |
|
| 629 | 629 | { |
| 630 | 630 | $dt = fopen($executionPath, "r"); |
| 631 | 631 | $content = fread($dt, filesize($executionPath)); |
| 632 | 632 | fclose($dt); |
| 633 | 633 | |
| 634 | - foreach ($param as $key=>$value){ |
|
| 634 | + foreach ($param as $key=>$value) { |
|
| 635 | 635 | |
| 636 | - $content=str_replace("".$key."",$value,$content); |
|
| 636 | + $content = str_replace("".$key."", $value, $content); |
|
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | $dt = fopen($executionPath, "w"); |
@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | $kernelConfig = []; |
| 34 | 34 | |
| 35 | 35 | //we are getting the config data from the kernel object.. |
| 36 | - if(isset(core()->appConfig)){
|
|
| 36 | + if (isset(core()->appConfig)) {
|
|
| 37 | 37 | $kernelConfig = core()->appConfig; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // if the config variable is not sent, |
| 41 | 41 | // we print the kernel config data directly. |
| 42 | - if(null===$this->config) {
|
|
| 42 | + if (null===$this->config) {
|
|
| 43 | 43 | return (count($kernelConfig)) ? $kernelConfig : null; |
| 44 | 44 | } |
| 45 | 45 | |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | $this->configList = Str::stringToArray($this->config); |
| 49 | 49 | |
| 50 | 50 | //if the config object exists in the kernel, start the process. |
| 51 | - if(isset($kernelConfig[$config = current($this->configList)])){
|
|
| 51 | + if (isset($kernelConfig[$config = current($this->configList)])) {
|
|
| 52 | 52 | |
| 53 | 53 | // get config data |
| 54 | 54 | // we process and rotate on point basis. |
| 55 | - $configData = $this->getConfigData($kernelConfig,$config); |
|
| 55 | + $configData = $this->getConfigData($kernelConfig, $config); |
|
| 56 | 56 | return $this->configProcessResult($configData); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -66,14 +66,14 @@ discard block |
||
| 66 | 66 | private function configProcessResult($config) |
| 67 | 67 | {
|
| 68 | 68 | //config data if dotted. |
| 69 | - if(count($this->configList)){
|
|
| 69 | + if (count($this->configList)) {
|
|
| 70 | 70 | |
| 71 | 71 | array_shift($this->configList); |
| 72 | 72 | $configdotted = $config; |
| 73 | 73 | |
| 74 | 74 | //we apply the dotted-knit config dataset as nested. |
| 75 | - foreach ($this->configList as $key=>$value){
|
|
| 76 | - $configdotted = Arr::isset($configdotted,$value); |
|
| 75 | + foreach ($this->configList as $key=>$value) {
|
|
| 76 | + $configdotted = Arr::isset($configdotted, $value); |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
@@ -90,28 +90,28 @@ discard block |
||
| 90 | 90 | * @throws \DI\DependencyException |
| 91 | 91 | * @throws \DI\NotFoundException |
| 92 | 92 | */ |
| 93 | - private function getConfigData($kernelConfig,$config) |
|
| 93 | + private function getConfigData($kernelConfig, $config) |
|
| 94 | 94 | {
|
| 95 | 95 | //if the config data is a class instance, we get it as an object. |
| 96 | - if(Utils::isNamespaceExists($configFile = ($kernelConfig[$config]['namespace'] ?? ''))){
|
|
| 96 | + if (Utils::isNamespaceExists($configFile = ($kernelConfig[$config]['namespace'] ?? ''))) {
|
|
| 97 | 97 | $configData = app()->resolve($configFile)->handle(); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $configFile = $kernelConfig[$config]['file'] ?? ''; |
| 101 | 101 | |
| 102 | 102 | //if the config data is just an array. |
| 103 | - if( |
|
| 103 | + if ( |
|
| 104 | 104 | !isset($configData) |
| 105 | - && substr($configFile,-4)=='.php' |
|
| 105 | + && substr($configFile, -4)=='.php' |
|
| 106 | 106 | && file_exists($configFile) |
| 107 | - ){
|
|
| 107 | + ) {
|
|
| 108 | 108 | $configData = require($configFile); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | // if there is data key in the kernelConfig array |
| 112 | 112 | // this is not the file data, |
| 113 | 113 | // a loading that contains a hand-written array. |
| 114 | - if(isset($kernelConfig[$config]['data'])) {
|
|
| 114 | + if (isset($kernelConfig[$config]['data'])) {
|
|
| 115 | 115 | return $kernelConfig[$config]['data']; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @throws ReflectionExceptionAlias |
| 72 | 72 | */ |
| 73 | - public function __construct($clientData=null) |
|
| 73 | + public function __construct($clientData = null) |
|
| 74 | 74 | {
|
| 75 | 75 | //reflection process |
| 76 | 76 | $this->reflection = app()['reflection']($this); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $this->setClientName(); |
| 81 | 81 | |
| 82 | 82 | //get http method via request http manager class |
| 83 | - $this->requestHttp = app()->resolve(ClientHttpManager::class,['client'=>$this]); |
|
| 83 | + $this->requestHttp = app()->resolve(ClientHttpManager::class, ['client'=>$this]); |
|
| 84 | 84 | |
| 85 | 85 | //get request client data |
| 86 | 86 | $this->clientData = ($clientData===null) ? $this->requestHttp->resolve() : $clientData; |
@@ -97,9 +97,9 @@ discard block |
||
| 97 | 97 | private function autoValidate($validate) |
| 98 | 98 | {
|
| 99 | 99 | //we get the values to auto-validate. |
| 100 | - foreach ($this->{$validate} as $object=>$datas){
|
|
| 100 | + foreach ($this->{$validate} as $object=>$datas) {
|
|
| 101 | 101 | |
| 102 | - if(false===Utils::isNamespaceExists($object)){
|
|
| 102 | + if (false===Utils::isNamespaceExists($object)) {
|
|
| 103 | 103 | return; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -109,30 +109,30 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | // we get the index values, |
| 111 | 111 | // which are called methods of the auto-validate value that represents the class. |
| 112 | - foreach ($datas as $dataKey=>$data){
|
|
| 112 | + foreach ($datas as $dataKey=>$data) {
|
|
| 113 | 113 | |
| 114 | 114 | // if the methods of the auto-validate class resolved by the container resolve method apply, |
| 115 | 115 | // the process of auto-validate automatic implementation will be completed. |
| 116 | - if(method_exists($getObjectInstance,$dataKey) && is_array($data)){
|
|
| 117 | - foreach ($data as $dataItem){
|
|
| 118 | - if(isset($this->origin[$dataItem])){
|
|
| 119 | - $getObjectInstance->{$dataKey}($this->origin[$dataItem],$this,$dataItem);
|
|
| 116 | + if (method_exists($getObjectInstance, $dataKey) && is_array($data)) {
|
|
| 117 | + foreach ($data as $dataItem) {
|
|
| 118 | + if (isset($this->origin[$dataItem])) {
|
|
| 119 | + $getObjectInstance->{$dataKey}($this->origin[$dataItem], $this, $dataItem);
|
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if(method_exists($this,$afterMethod = 'after'.ucfirst($dataKey))){
|
|
| 123 | - $this->{$afterMethod}($this,$dataItem);
|
|
| 122 | + if (method_exists($this, $afterMethod = 'after'.ucfirst($dataKey))) {
|
|
| 123 | + $this->{$afterMethod}($this, $dataItem);
|
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | // if the methods of the auto-validate class resolved by the container resolve method apply, |
| 129 | 129 | // the process of auto-validate automatic implementation will be completed. |
| 130 | - if(is_numeric($dataKey) && method_exists($getObjectInstance,$data) && isset($this->origin[$data])){
|
|
| 131 | - if(!is_array($this->origin[$data])){
|
|
| 130 | + if (is_numeric($dataKey) && method_exists($getObjectInstance, $data) && isset($this->origin[$data])) {
|
|
| 131 | + if (!is_array($this->origin[$data])) {
|
|
| 132 | 132 | $this->origin[$data] = array($this->origin[$data]); |
| 133 | 133 | } |
| 134 | - foreach ($this->origin[$data] as $originData){
|
|
| 135 | - $getObjectInstance->{$data}($originData,$this,$data);
|
|
| 134 | + foreach ($this->origin[$data] as $originData) {
|
|
| 135 | + $getObjectInstance->{$data}($originData, $this, $data);
|
|
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | } |
@@ -147,39 +147,39 @@ discard block |
||
| 147 | 147 | private function capsule() |
| 148 | 148 | {
|
| 149 | 149 | //a process can be added to the capsule array using the method. |
| 150 | - if(method_exists($this,'capsuleMethod')){
|
|
| 151 | - $this->capsule = array_merge($this->capsule,$this->capsuleMethod()); |
|
| 150 | + if (method_exists($this, 'capsuleMethod')) {
|
|
| 151 | + $this->capsule = array_merge($this->capsule, $this->capsuleMethod()); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | // expected method is executed. |
| 155 | 155 | // this method is a must for http method values to be found in this property. |
| 156 | - if($this->checkProperties('capsule')){
|
|
| 156 | + if ($this->checkProperties('capsule')) {
|
|
| 157 | 157 | |
| 158 | - if(property_exists($this,'auto_capsule') && is_array($this->auto_capsule)){
|
|
| 159 | - $this->capsule = array_merge($this->capsule,$this->auto_capsule); |
|
| 158 | + if (property_exists($this, 'auto_capsule') && is_array($this->auto_capsule)) {
|
|
| 159 | + $this->capsule = array_merge($this->capsule, $this->auto_capsule); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - if($this->checkProperties('groups')){
|
|
| 163 | - $this->capsule = array_merge($this->capsule,$this->groups); |
|
| 162 | + if ($this->checkProperties('groups')) {
|
|
| 163 | + $this->capsule = array_merge($this->capsule, $this->groups); |
|
| 164 | 164 | |
| 165 | 165 | foreach ($this->capsule as $item) {
|
| 166 | - $groupProcess = $this->groupsProcess($item,true); |
|
| 167 | - if(is_array($groupProcess)){
|
|
| 166 | + $groupProcess = $this->groupsProcess($item, true); |
|
| 167 | + if (is_array($groupProcess)) {
|
|
| 168 | 168 | $defaultInputs = $this->inputs; |
| 169 | - $this->inputs = array_merge($this->inputs,$groupProcess); |
|
| 169 | + $this->inputs = array_merge($this->inputs, $groupProcess); |
|
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - foreach($this->inputs as $input=>$value){
|
|
| 174 | + foreach ($this->inputs as $input=>$value) {
|
|
| 175 | 175 | |
| 176 | - if($this->checkProperties('capsule') && !in_array($input,$this->capsule)){
|
|
| 177 | - exception('clientCapsule',['key'=>$input])
|
|
| 176 | + if ($this->checkProperties('capsule') && !in_array($input, $this->capsule)) {
|
|
| 177 | + exception('clientCapsule', ['key'=>$input])
|
|
| 178 | 178 | ->overflow('The '.$input.' value cannot be sent.');
|
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | - if(isset($defaultInputs)){
|
|
| 182 | + if (isset($defaultInputs)) {
|
|
| 183 | 183 | $this->inputs = $defaultInputs; |
| 184 | 184 | } |
| 185 | 185 | } |
@@ -197,15 +197,15 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | // Determines which HTTP method |
| 199 | 199 | // the request object will be exposed to. |
| 200 | - if($this->checkProperties('http')){
|
|
| 200 | + if ($this->checkProperties('http')) {
|
|
| 201 | 201 | |
| 202 | 202 | // if the current http method does not exist |
| 203 | 203 | // in the http object, the exception will be thrown. |
| 204 | - if(!in_array($method,$this->http)){
|
|
| 204 | + if (!in_array($method, $this->http)) {
|
|
| 205 | 205 | |
| 206 | 206 | //exception batMethodCall |
| 207 | 207 | exception()->badMethodCall( |
| 208 | - 'Invalid http method process for '.basename($this).'.That is accepted http methods ['.implode(",",$this->http).'] ');
|
|
| 208 | + 'Invalid http method process for '.basename($this).'.That is accepted http methods ['.implode(",", $this->http).'] ');
|
|
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | {
|
| 221 | 221 | // from the properties of the object properties to |
| 222 | 222 | // the existing variables, control the array and at least one element. |
| 223 | - return (property_exists($this,$properties) |
|
| 223 | + return (property_exists($this, $properties) |
|
| 224 | 224 | && is_array($this->{$properties}) && count($this->{$properties})) ? true : false;
|
| 225 | 225 | } |
| 226 | 226 | |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | {
|
| 234 | 234 | // we are saving the expected values for the request in container. |
| 235 | 235 | // this record can be returned in exception information. |
| 236 | - app()->register('requestExpected',$this->expected);
|
|
| 236 | + app()->register('requestExpected', $this->expected);
|
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -245,15 +245,15 @@ discard block |
||
| 245 | 245 | public function except($except) |
| 246 | 246 | {
|
| 247 | 247 | // the except parameter is a callable value. |
| 248 | - if(is_callable($except)){
|
|
| 249 | - $call = call_user_func_array($except,[$this]); |
|
| 248 | + if (is_callable($except)) {
|
|
| 249 | + $call = call_user_func_array($except, [$this]); |
|
| 250 | 250 | $except = $call; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | // except with the except exceptions property |
| 254 | 254 | // and then assigning them to the inputs property. |
| 255 | - $this->except = array_merge($this->except,$except); |
|
| 256 | - $this->inputs = array_diff_key($this->inputs,array_flip($this->except)); |
|
| 255 | + $this->except = array_merge($this->except, $except); |
|
| 256 | + $this->inputs = array_diff_key($this->inputs, array_flip($this->except)); |
|
| 257 | 257 | |
| 258 | 258 | return $this; |
| 259 | 259 | } |
@@ -267,32 +267,32 @@ discard block |
||
| 267 | 267 | {
|
| 268 | 268 | // expected method is executed. |
| 269 | 269 | // this method is a must for http method values to be found in this property. |
| 270 | - if($this->checkProperties('expected')){
|
|
| 270 | + if ($this->checkProperties('expected')) {
|
|
| 271 | 271 | |
| 272 | 272 | // if the expected values are not found in the inputs array, |
| 273 | 273 | // the exception will be thrown. |
| 274 | - foreach ($this->expected as $expected){
|
|
| 274 | + foreach ($this->expected as $expected) {
|
|
| 275 | 275 | |
| 276 | 276 | $expectedValues = []; |
| 277 | 277 | |
| 278 | 278 | // mandatory expected data for each key can be separated by | operator. |
| 279 | 279 | // this is evaluated as "or". |
| 280 | - foreach($expectedData = explode("|",$expected) as $inputs){
|
|
| 280 | + foreach ($expectedData = explode("|", $expected) as $inputs) {
|
|
| 281 | 281 | |
| 282 | 282 | // we should do key control for group format. |
| 283 | 283 | // this process will allow us to perform key control for 2D array correctly. |
| 284 | 284 | $this->groupsProcess($inputs); |
| 285 | 285 | |
| 286 | - if(!isset($this->inputs[$inputs])){
|
|
| 286 | + if (!isset($this->inputs[$inputs])) {
|
|
| 287 | 287 | $expectedValues[$inputs] = $inputs; |
| 288 | 288 | } |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | // if the expectedData and expectedValues |
| 292 | 292 | // array are numerically equal to the expected key, the exception is thrown. |
| 293 | - if(count($expectedData)===count($expectedValues)){
|
|
| 294 | - exception('clientExpected',['key'=>$expected])
|
|
| 295 | - ->unexpectedValue('You absolutely have to send the value '.implode(" or ",$expectedValues).' for request object');
|
|
| 293 | + if (count($expectedData)===count($expectedValues)) {
|
|
| 294 | + exception('clientExpected', ['key'=>$expected])
|
|
| 295 | + ->unexpectedValue('You absolutely have to send the value '.implode(" or ", $expectedValues).' for request object');
|
|
| 296 | 296 | } |
| 297 | 297 | } |
| 298 | 298 | } |
@@ -307,17 +307,17 @@ discard block |
||
| 307 | 307 | {
|
| 308 | 308 | // check the presence of the generator object |
| 309 | 309 | // and operate the generator over this object. |
| 310 | - if($this->checkProperties('auto_generators')){
|
|
| 310 | + if ($this->checkProperties('auto_generators')) {
|
|
| 311 | 311 | $generators = $this->getAutoGenerators(); |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | // check the presence of the generator object |
| 315 | 315 | // and operate the generator over this object. |
| 316 | - if($this->checkProperties('generators')){
|
|
| 317 | - $generators = array_merge(isset($generators) ? $generators: [],$this->getGenerators()); |
|
| 316 | + if ($this->checkProperties('generators')) {
|
|
| 317 | + $generators = array_merge(isset($generators) ? $generators : [], $this->getGenerators()); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - if(isset($generators)){
|
|
| 320 | + if (isset($generators)) {
|
|
| 321 | 321 | $this->generatorMethod($generators); |
| 322 | 322 | } |
| 323 | 323 | } |
@@ -332,21 +332,21 @@ discard block |
||
| 332 | 332 | private function generatorMethod($generators) |
| 333 | 333 | {
|
| 334 | 334 | //generator array object |
| 335 | - foreach ($generators as $generator){
|
|
| 335 | + foreach ($generators as $generator) {
|
|
| 336 | 336 | |
| 337 | 337 | //generator method name |
| 338 | 338 | $generatorMethodName = $generator.'Generator'; |
| 339 | 339 | |
| 340 | 340 | // if the generator method is present, |
| 341 | 341 | // the fake value is assigned. |
| 342 | - if(method_exists($this,$generatorMethodName)){
|
|
| 342 | + if (method_exists($this, $generatorMethodName)) {
|
|
| 343 | 343 | |
| 344 | 344 | //fake registration |
| 345 | - if(!isset($this->inputs[$generator])){
|
|
| 345 | + if (!isset($this->inputs[$generator])) {
|
|
| 346 | 346 | |
| 347 | 347 | $generatorMethodNameResult = $this->{$generatorMethodName}();
|
| 348 | 348 | |
| 349 | - if(!is_null($generatorMethodNameResult)){
|
|
| 349 | + if (!is_null($generatorMethodNameResult)) {
|
|
| 350 | 350 | $this->{$generator} = $calledGenerator = $generatorMethodNameResult;
|
| 351 | 351 | $this->inputs[$generator] = $calledGenerator; |
| 352 | 352 | $this->generatorList[] = $generator; |
@@ -354,15 +354,15 @@ discard block |
||
| 354 | 354 | } |
| 355 | 355 | else {
|
| 356 | 356 | |
| 357 | - if($this->checkProperties('auto_generators_dont_overwrite')
|
|
| 358 | - && in_array($generator,$this->getAutoGeneratorsDontOverwrite())){
|
|
| 357 | + if ($this->checkProperties('auto_generators_dont_overwrite')
|
|
| 358 | + && in_array($generator, $this->getAutoGeneratorsDontOverwrite())) {
|
|
| 359 | 359 | $this->{$generator} = $calledGenerator = $this->{$generatorMethodName}();
|
| 360 | 360 | $this->inputs[$generator] = $calledGenerator; |
| 361 | 361 | $this->generatorList[] = $generator; |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | - if($this->checkProperties('generators_dont_overwrite')
|
|
| 365 | - && in_array($generator,$this->getGeneratorsDontOverwrite())){
|
|
| 364 | + if ($this->checkProperties('generators_dont_overwrite')
|
|
| 365 | + && in_array($generator, $this->getGeneratorsDontOverwrite())) {
|
|
| 366 | 366 | $this->{$generator} = $calledGenerator = $this->{$generatorMethodName}();
|
| 367 | 367 | $this->inputs[$generator] = $calledGenerator; |
| 368 | 368 | $this->generatorList[] = $generator; |
@@ -393,28 +393,28 @@ discard block |
||
| 393 | 393 | * @param null $callback |
| 394 | 394 | * @return mixed|void |
| 395 | 395 | */ |
| 396 | - public function groupsProcess($key=null,$callback=null) |
|
| 396 | + public function groupsProcess($key = null, $callback = null) |
|
| 397 | 397 | {
|
| 398 | - if(property_exists($this,'groups') && is_array($this->groups)){
|
|
| 398 | + if (property_exists($this, 'groups') && is_array($this->groups)) {
|
|
| 399 | 399 | |
| 400 | 400 | $clientObjects = $this->getClientObjects(); |
| 401 | 401 | |
| 402 | - foreach ($this->groups as $group){
|
|
| 402 | + foreach ($this->groups as $group) {
|
|
| 403 | 403 | |
| 404 | - if(true === $callback){
|
|
| 405 | - if(isset($clientObjects['origin'][$key])){
|
|
| 404 | + if (true===$callback) {
|
|
| 405 | + if (isset($clientObjects['origin'][$key])) {
|
|
| 406 | 406 | return $clientObjects['origin'][$key]; |
| 407 | 407 | } |
| 408 | 408 | return []; |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | - if(isset($clientObjects['origin'][$group][$key])){
|
|
| 411 | + if (isset($clientObjects['origin'][$group][$key])) {
|
|
| 412 | 412 | |
| 413 | 413 | $this->{$key} = $clientObjects['origin'][$group][$key];
|
| 414 | 414 | $this->inputs[$key] = $this->{$key};
|
| 415 | 415 | |
| 416 | - if(is_callable($callback)){
|
|
| 417 | - call_user_func_array($callback,[$key]); |
|
| 416 | + if (is_callable($callback)) {
|
|
| 417 | + call_user_func_array($callback, [$key]); |
|
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | 420 | } |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | //that coming with the post. |
| 440 | 440 | $this->initClient(); |
| 441 | 441 | |
| 442 | - if(method_exists($this,'eventBefore')){
|
|
| 442 | + if (method_exists($this, 'eventBefore')) {
|
|
| 443 | 443 | $this->eventBefore(); |
| 444 | 444 | } |
| 445 | 445 | |
@@ -475,11 +475,11 @@ discard block |
||
| 475 | 475 | // are subtracted from all input values. |
| 476 | 476 | $this->requestExcept(); |
| 477 | 477 | |
| 478 | - if(app()->has('clientRequestInputs')){
|
|
| 478 | + if (app()->has('clientRequestInputs')) {
|
|
| 479 | 479 | app()->terminate('clientRequestInputs');
|
| 480 | 480 | } |
| 481 | 481 | |
| 482 | - app()->register('clientRequestInputs',$this->inputs);
|
|
| 482 | + app()->register('clientRequestInputs', $this->inputs);
|
|
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | /** |
@@ -490,18 +490,18 @@ discard block |
||
| 490 | 490 | private function unity() |
| 491 | 491 | {
|
| 492 | 492 | // unity method is executed. |
| 493 | - if($this->checkProperties('unity')){
|
|
| 493 | + if ($this->checkProperties('unity')) {
|
|
| 494 | 494 | |
| 495 | 495 | $list = []; |
| 496 | 496 | |
| 497 | - foreach ($this->unity as $unity){
|
|
| 498 | - if(isset($this->inputs[$unity])){
|
|
| 497 | + foreach ($this->unity as $unity) {
|
|
| 498 | + if (isset($this->inputs[$unity])) {
|
|
| 499 | 499 | $list[] = $unity; |
| 500 | 500 | } |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | - if(count($list)>1){
|
|
| 504 | - exception('clientUnityExpected',['key'=>implode(',',$this->unity)])
|
|
| 503 | + if (count($list)>1) {
|
|
| 504 | + exception('clientUnityExpected', ['key'=>implode(',', $this->unity)])
|
|
| 505 | 505 | ->invalidArgument('clientUnityExpected');
|
| 506 | 506 | } |
| 507 | 507 | } |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | {
|
| 517 | 517 | // we use the http method to write |
| 518 | 518 | // the values to the inputs and origin properties. |
| 519 | - foreach($this->clientData as $key=>$value){
|
|
| 519 | + foreach ($this->clientData as $key=>$value) {
|
|
| 520 | 520 | |
| 521 | 521 | //inputs and origin properties |
| 522 | 522 | $this->inputs[$key] = $value; |
@@ -532,9 +532,9 @@ discard block |
||
| 532 | 532 | */ |
| 533 | 533 | private function requestExcept() |
| 534 | 534 | {
|
| 535 | - if(property_exists($this,'requestExcept') && is_array($this->requestExcept)){
|
|
| 536 | - foreach ($this->requestExcept as $item){
|
|
| 537 | - if(isset($this->inputs[$item])){
|
|
| 535 | + if (property_exists($this, 'requestExcept') && is_array($this->requestExcept)) {
|
|
| 536 | + foreach ($this->requestExcept as $item) {
|
|
| 537 | + if (isset($this->inputs[$item])) {
|
|
| 538 | 538 | unset($this->inputs[$item]); |
| 539 | 539 | } |
| 540 | 540 | } |
@@ -547,16 +547,16 @@ discard block |
||
| 547 | 547 | * @param null|string $clientName |
| 548 | 548 | * @return void|mixed |
| 549 | 549 | */ |
| 550 | - public function setClientName($clientName=null) |
|
| 550 | + public function setClientName($clientName = null) |
|
| 551 | 551 | {
|
| 552 | - if(!is_null($clientName) && is_string($clientName)){
|
|
| 552 | + if (!is_null($clientName) && is_string($clientName)) {
|
|
| 553 | 553 | return $this->clientName = $clientName; |
| 554 | 554 | } |
| 555 | 555 | |
| 556 | - if(!is_null(Utils::trace(0)) && isset(Utils::trace(0)['object'])){
|
|
| 556 | + if (!is_null(Utils::trace(0)) && isset(Utils::trace(0)['object'])) {
|
|
| 557 | 557 | $backTrace = Utils::trace(0)['object']; |
| 558 | 558 | |
| 559 | - if(property_exists($backTrace,'clientName')){
|
|
| 559 | + if (property_exists($backTrace, 'clientName')) {
|
|
| 560 | 560 | $this->clientName = $backTrace->clientName; |
| 561 | 561 | } |
| 562 | 562 | } |
@@ -573,16 +573,16 @@ discard block |
||
| 573 | 573 | |
| 574 | 574 | // we update the input values after |
| 575 | 575 | // we receive and check the saved objects. |
| 576 | - foreach ($clientObjects as $key=>$value){
|
|
| 576 | + foreach ($clientObjects as $key=>$value) {
|
|
| 577 | 577 | |
| 578 | 578 | // we should do key control for group format. |
| 579 | 579 | // this process will allow us to perform key control for 2D array correctly. |
| 580 | - $this->groupsProcess($key,function($key){
|
|
| 580 | + $this->groupsProcess($key, function($key) {
|
|
| 581 | 581 | $this->registerRequestInputs($key); |
| 582 | 582 | unset($this->inputs[$key]); |
| 583 | 583 | }); |
| 584 | 584 | |
| 585 | - if(!in_array($key,$this->generatorList) && isset($clientObjects['origin'][$key])){
|
|
| 585 | + if (!in_array($key, $this->generatorList) && isset($clientObjects['origin'][$key])) {
|
|
| 586 | 586 | |
| 587 | 587 | $this->{$key} = $clientObjects['origin'][$key];
|
| 588 | 588 | $this->inputs[$key] = $this->{$key};
|
@@ -610,11 +610,11 @@ discard block |
||
| 610 | 610 | |
| 611 | 611 | // the request update to be performed using |
| 612 | 612 | // the method name to be used with the http method. |
| 613 | - $this->setRequestInputs($requestMethod,$key); |
|
| 613 | + $this->setRequestInputs($requestMethod, $key); |
|
| 614 | 614 | |
| 615 | 615 | // the request update to be performed using |
| 616 | 616 | // the method name to be used without the http method. |
| 617 | - $this->setRequestInputs($key,$key); |
|
| 617 | + $this->setRequestInputs($key, $key); |
|
| 618 | 618 | } |
| 619 | 619 | |
| 620 | 620 | /** |
@@ -625,28 +625,28 @@ discard block |
||
| 625 | 625 | * |
| 626 | 626 | * @throws ReflectionExceptionAlias |
| 627 | 627 | */ |
| 628 | - private function setRequestInputs($method,$key) |
|
| 628 | + private function setRequestInputs($method, $key) |
|
| 629 | 629 | {
|
| 630 | - if(!in_array($key,$this->generatorList) && method_exists($this,$method) && $this->reflection->reflectionMethodParams($method)->isProtected){
|
|
| 630 | + if (!in_array($key, $this->generatorList) && method_exists($this, $method) && $this->reflection->reflectionMethodParams($method)->isProtected) {
|
|
| 631 | 631 | |
| 632 | 632 | //check annotations for method |
| 633 | - $annotation = app()->resolve(ClientAnnotationManager::class,['request'=>$this]); |
|
| 634 | - $annotation->annotation($method,$key); |
|
| 633 | + $annotation = app()->resolve(ClientAnnotationManager::class, ['request'=>$this]); |
|
| 634 | + $annotation->annotation($method, $key); |
|
| 635 | 635 | |
| 636 | - if(isset($this->inputs[$key]) && is_array($this->inputs[$key])){
|
|
| 636 | + if (isset($this->inputs[$key]) && is_array($this->inputs[$key])) {
|
|
| 637 | 637 | |
| 638 | 638 | $inputKeys = $this->inputs[$key]; |
| 639 | 639 | |
| 640 | 640 | $this->inputs[$key] = []; |
| 641 | - foreach ($inputKeys as $ikey=>$input){
|
|
| 641 | + foreach ($inputKeys as $ikey=>$input) {
|
|
| 642 | 642 | |
| 643 | 643 | $this->{$key}[$ikey] = $input;
|
| 644 | 644 | $keyMethod = $this->{$method}();
|
| 645 | 645 | $this->inputs[$key] = $keyMethod; |
| 646 | 646 | } |
| 647 | 647 | } |
| 648 | - else{
|
|
| 649 | - if(isset($this->inputs[$key])){
|
|
| 648 | + else {
|
|
| 649 | + if (isset($this->inputs[$key])) {
|
|
| 650 | 650 | $keyMethod = $this->{$method}();
|
| 651 | 651 | $this->inputs[$key] = $keyMethod; |
| 652 | 652 | } |
@@ -665,8 +665,8 @@ discard block |
||
| 665 | 665 | // the auto object validate property is the property |
| 666 | 666 | // where all of your request values are automatically validated. |
| 667 | 667 | /** @noinspection PhpParamsInspection */ |
| 668 | - if(property_exists($this,'autoObjectValidate') |
|
| 669 | - && is_array($this->autoObjectValidate) && count($this->autoObjectValidate)){
|
|
| 668 | + if (property_exists($this, 'autoObjectValidate') |
|
| 669 | + && is_array($this->autoObjectValidate) && count($this->autoObjectValidate)) {
|
|
| 670 | 670 | $this->autoValidate('autoObjectValidate');
|
| 671 | 671 | } |
| 672 | 672 | } |
@@ -351,8 +351,7 @@ discard block |
||
| 351 | 351 | $this->inputs[$generator] = $calledGenerator; |
| 352 | 352 | $this->generatorList[] = $generator; |
| 353 | 353 | } |
| 354 | - } |
|
| 355 | - else {
|
|
| 354 | + } else {
|
|
| 356 | 355 | |
| 357 | 356 | if($this->checkProperties('auto_generators_dont_overwrite')
|
| 358 | 357 | && in_array($generator,$this->getAutoGeneratorsDontOverwrite())){
|
@@ -644,8 +643,7 @@ discard block |
||
| 644 | 643 | $keyMethod = $this->{$method}();
|
| 645 | 644 | $this->inputs[$key] = $keyMethod; |
| 646 | 645 | } |
| 647 | - } |
|
| 648 | - else{
|
|
| 646 | + } else{
|
|
| 649 | 647 | if(isset($this->inputs[$key])){
|
| 650 | 648 | $keyMethod = $this->{$method}();
|
| 651 | 649 | $this->inputs[$key] = $keyMethod; |