@@ -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");');
|
|
| 106 | - files()->append($routePath,PHP_EOL.'Route::namespace(\''.$controller.'\')->delete("/'.strtolower($this->argument['file']).'","'.$this->argument['file'].'Controller@delete");');
|
|
| 103 | + files()->append($routePath, PHP_EOL.'Route::namespace(\''.$controller.'\')->get("/'.strtolower($this->argument['file']).'","'.$this->argument['file'].'Controller@get");');
|
|
| 104 | + files()->append($routePath, PHP_EOL.'Route::namespace(\''.$controller.'\')->post("/'.strtolower($this->argument['file']).'","'.$this->argument['file'].'Controller@create");');
|
|
| 105 | + files()->append($routePath, PHP_EOL.'Route::namespace(\''.$controller.'\')->put("/'.strtolower($this->argument['file']).'","'.$this->argument['file'].'Controller@update");');
|
|
| 106 | + files()->append($routePath, PHP_EOL.'Route::namespace(\''.$controller.'\')->delete("/'.strtolower($this->argument['file']).'","'.$this->argument['file'].'Controller@delete");');
|
|
| 107 | 107 | |
| 108 | 108 | } |
| 109 | - else{
|
|
| 109 | + else {
|
|
| 110 | 110 | |
| 111 | - $this->touch['service/controllerfile'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].''. $this->argument['callClassPrefix'].'.php'; |
|
| 111 | + $this->touch['service/controllerfile'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].''.$this->argument['callClassPrefix'].'.php'; |
|
| 112 | 112 | |
| 113 | - $this->file->touch($this,[ |
|
| 113 | + $this->file->touch($this, [ |
|
| 114 | 114 | 'stub'=>'Controller_Create' |
| 115 | 115 | ]); |
| 116 | 116 | |
| 117 | - files()->append($routePath,PHP_EOL.'Route::namespace(\''.$controller.'\')->get("/'.strtolower($this->argument['file']).'","'.$this->argument['file'].'Controller@index");');
|
|
| 117 | + files()->append($routePath, PHP_EOL.'Route::namespace(\''.$controller.'\')->get("/'.strtolower($this->argument['file']).'","'.$this->argument['file'].'Controller@index");');
|
|
| 118 | 118 | |
| 119 | 119 | } |
| 120 | 120 | |
@@ -122,21 +122,21 @@ discard block |
||
| 122 | 122 | echo $this->classical(' > Controller called as "'.$this->argument['file'].'" has been successfully created in the '.$this->directory['endpoint'].'');
|
| 123 | 123 | |
| 124 | 124 | } |
| 125 | - else{
|
|
| 125 | + else {
|
|
| 126 | 126 | |
| 127 | 127 | // we process the processes related to file creation operations. |
| 128 | 128 | // and then create files related to the touch method of the file object as it is in the directory process. |
| 129 | 129 | |
| 130 | - if(isset($this->argument['type']) && $this->argument['type']=='Crud'){
|
|
| 130 | + if (isset($this->argument['type']) && $this->argument['type']=='Crud') {
|
|
| 131 | 131 | |
| 132 | 132 | $this->argument['file'] = $this->argument['serviceClass']; |
| 133 | 133 | |
| 134 | - $this->touch['service/controllerfilecrud'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''. $this->argument['callClassPrefix'].'.php'; |
|
| 134 | + $this->touch['service/controllerfilecrud'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''.$this->argument['callClassPrefix'].'.php'; |
|
| 135 | 135 | $this->touch['service/routecrud'] = $routePath; |
| 136 | 136 | |
| 137 | 137 | } |
| 138 | - else{
|
|
| 139 | - $this->touch['service/endpoint'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''. $this->argument['callClassPrefix'].'.php'; |
|
| 138 | + else {
|
|
| 139 | + $this->touch['service/endpoint'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''.$this->argument['callClassPrefix'].'.php'; |
|
| 140 | 140 | $this->touch['service/route'] = $routePath; |
| 141 | 141 | |
| 142 | 142 | } |
@@ -148,9 +148,9 @@ discard block |
||
| 148 | 148 | $this->touch['service/dummy'] = $this->directory['configuration'].''.DIRECTORY_SEPARATOR.'Dummy.yaml'; |
| 149 | 149 | $this->touch['service/doc'] = $this->directory['configuration'].''.DIRECTORY_SEPARATOR.'Doc.yaml'; |
| 150 | 150 | $this->touch['service/readme'] = $this->directory['endpoint'].''.DIRECTORY_SEPARATOR.'README.md'; |
| 151 | - $this->touch['service/policy'] = $this->directory['policy'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''. $this->argument['callClassPrefix'].'Policy.php'; |
|
| 151 | + $this->touch['service/policy'] = $this->directory['policy'].''.DIRECTORY_SEPARATOR.''.$this->argument['serviceClass'].''.$this->argument['callClassPrefix'].'Policy.php'; |
|
| 152 | 152 | |
| 153 | - $this->file->touch($this,[ |
|
| 153 | + $this->file->touch($this, [ |
|
| 154 | 154 | 'stub'=>'Controller_Create' |
| 155 | 155 | ]); |
| 156 | 156 | |
@@ -174,24 +174,24 @@ discard block |
||
| 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 | |
@@ -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 | //fire event before response output |
| 124 | 123 | $this->fireEvent('before');
|
@@ -133,7 +132,7 @@ discard block |
||
| 133 | 132 | // and run the handle method. |
| 134 | 133 | $result = app()->resolve($formatter)->{$this->getResponseKind()}($outPutter);
|
| 135 | 134 | |
| 136 | - $this->app->register('result',$result);
|
|
| 135 | + $this->app->register('result', $result);
|
|
| 137 | 136 | } |
| 138 | 137 | } |
| 139 | 138 | |
@@ -143,7 +142,7 @@ discard block |
||
| 143 | 142 | * @param array $data |
| 144 | 143 | * @return array |
| 145 | 144 | */ |
| 146 | - public function outputFormatter($data=array(),$outputter='json') |
|
| 145 | + public function outputFormatter($data = array(), $outputter = 'json') |
|
| 147 | 146 | {
|
| 148 | 147 | $dataCapsule = config('response.data');
|
| 149 | 148 | |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function __construct($app) |
| 17 | 17 | {
|
| 18 | - $this->app=$app; |
|
| 18 | + $this->app = $app; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | private function dataIncludedForPrinter($printer) |
| 20 | 20 | {
|
| 21 | - if(isset(core()->controllerWatch)){
|
|
| 21 | + if (isset(core()->controllerWatch)) {
|
|
| 22 | 22 | |
| 23 | 23 | $watch = core()->controllerWatch; |
| 24 | - return array_merge($printer,['watch'=>['memory'=>$watch['memory']]]); |
|
| 24 | + return array_merge($printer, ['watch'=>['memory'=>$watch['memory']]]); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | //return printer |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | protected function getOutPutter() |
| 43 | 43 | {
|
| 44 | - $output = is_array($eventOutput = $this->fireEvent('output',true))
|
|
| 44 | + $output = is_array($eventOutput = $this->fireEvent('output', true))
|
|
| 45 | 45 | ? $eventOutput |
| 46 | 46 | : $this->printer($this->getRouter()); |
| 47 | 47 | |
| 48 | - app()->register('output',$output);
|
|
| 48 | + app()->register('output', $output);
|
|
| 49 | 49 | |
| 50 | 50 | return $output; |
| 51 | 51 | } |
@@ -54,9 +54,9 @@ discard block |
||
| 54 | 54 | * @param array $data |
| 55 | 55 | * @return array |
| 56 | 56 | */ |
| 57 | - private function hateoasCapsule($data=array()) |
|
| 57 | + private function hateoasCapsule($data = array()) |
|
| 58 | 58 | {
|
| 59 | - return (config('app.hateoas')) ? array_merge($data,config('hateoas')) : $data;
|
|
| 59 | + return (config('app.hateoas')) ? array_merge($data, config('hateoas')) : $data;
|
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | * @param callable $callback |
| 73 | 73 | * @return mixed |
| 74 | 74 | */ |
| 75 | - private function noInExceptionHateoas($output,callable $callback) |
|
| 75 | + private function noInExceptionHateoas($output, callable $callback) |
|
| 76 | 76 | {
|
| 77 | - if(isset($output['success']) && false===$output['success']){
|
|
| 77 | + if (isset($output['success']) && false===$output['success']) {
|
|
| 78 | 78 | return $output; |
| 79 | 79 | } |
| 80 | 80 | return call_user_func($callback); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | {
|
| 102 | 102 | //if the system throws an exception, |
| 103 | 103 | //we subtract the hateoas extension from the output value. |
| 104 | - $this->printer = $this->noInExceptionHateoas($output,function() use ($output){
|
|
| 104 | + $this->printer = $this->noInExceptionHateoas($output, function() use ($output){
|
|
| 105 | 105 | |
| 106 | 106 | return array_merge( |
| 107 | 107 | $this->metaAdd(), |
@@ -115,12 +115,12 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | // If the log feature is available on the kernel, |
| 117 | 117 | // we run the logger process. |
| 118 | - if(isset(core()->log)){
|
|
| 118 | + if (isset(core()->log)) {
|
|
| 119 | 119 | |
| 120 | 120 | // we can run logging after checking |
| 121 | 121 | // the configuration for the logger process in the LoggerService class |
| 122 | 122 | // so that,If logging is not allowed in the main configuration file, we will not log. |
| 123 | - return core()->loggerService->checkLoggerConfiguration($this->printer,function($printer){
|
|
| 123 | + return core()->loggerService->checkLoggerConfiguration($this->printer, function($printer) {
|
|
| 124 | 124 | return $printer; |
| 125 | 125 | }); |
| 126 | 126 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * @var $type |
| 17 | 17 | */ |
| 18 | - public $type='model'; |
|
| 18 | + public $type = 'model'; |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * @var array |
@@ -32,17 +32,17 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * @var $commandRule |
| 34 | 34 | */ |
| 35 | - public $commandRule=['model','?table']; |
|
| 35 | + public $commandRule = ['model', '?table']; |
|
| 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 | 43 | $this->argument['file'] = $this->argument['model']; |
| 44 | 44 | |
| 45 | - if(!isset($this->argument['table'])){
|
|
| 45 | + if (!isset($this->argument['table'])) {
|
|
| 46 | 46 | $this->argument['table'] = $this->argument['file'].'s'; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | $this->directory['modelDir'] = app()->path()->model(); |
| 53 | 53 | $this->directory['builderDir'] = $this->directory['modelDir'].'/Builder'; |
| 54 | - $this->directory['builderAssistantDir'] = $this->directory['modelDir'].'/Builder/Assistant'; |
|
| 54 | + $this->directory['builderAssistantDir'] = $this->directory['modelDir'].'/Builder/Assistant'; |
|
| 55 | 55 | $this->directory['contract'] = $this->directory['modelDir'].'/Contract'; |
| 56 | 56 | $this->directory['helper'] = $this->directory['modelDir'].'/Helper'; |
| 57 | 57 | |
@@ -66,22 +66,22 @@ discard block |
||
| 66 | 66 | //model set |
| 67 | 67 | $this->touch['model/model'] = $this->directory['modelDir'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].'.php'; |
| 68 | 68 | $this->touch['model/builder'] = $this->directory['builderDir'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].'Builder.php'; |
| 69 | - $this->touch['model/builderasistant'] = $this->directory['builderAssistantDir'].''.DIRECTORY_SEPARATOR.'Builder.php'; |
|
| 69 | + $this->touch['model/builderasistant'] = $this->directory['builderAssistantDir'].''.DIRECTORY_SEPARATOR.'Builder.php'; |
|
| 70 | 70 | $this->touch['model/contract'] = $this->directory['contract'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].'Contract.php'; |
| 71 | 71 | |
| 72 | - if(!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Scope.php')){
|
|
| 72 | + if (!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Scope.php')) {
|
|
| 73 | 73 | $this->touch['model/scope'] = $this->directory['helper'].''.DIRECTORY_SEPARATOR.'Scope.php'; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if(!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Event.php')){
|
|
| 76 | + if (!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Event.php')) {
|
|
| 77 | 77 | $this->touch['model/event'] = $this->directory['helper'].''.DIRECTORY_SEPARATOR.'Event.php'; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if(!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'TableChanges.php')){
|
|
| 80 | + if (!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'TableChanges.php')) {
|
|
| 81 | 81 | $this->touch['model/tablechanges'] = $this->directory['helper'].''.DIRECTORY_SEPARATOR.'TableChanges.php'; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if(!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Constructor.php')){
|
|
| 84 | + if (!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Constructor.php')) {
|
|
| 85 | 85 | $this->touch['model/constructor'] = $this->directory['helper'].''.DIRECTORY_SEPARATOR.'Constructor.php'; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | $entityDir = $this->directory['modelDir'].''.DIRECTORY_SEPARATOR.'Entity'; |
| 91 | 91 | |
| 92 | - if(!file_exists($entityDir)){
|
|
| 92 | + if (!file_exists($entityDir)) {
|
|
| 93 | 93 | files()->makeDirectory($entityDir); |
| 94 | 94 | } |
| 95 | 95 | |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | $entityClass = $entityDir.''.DIRECTORY_SEPARATOR.''.$entityTableName.''.DIRECTORY_SEPARATOR.''.$entityTableName; |
| 99 | 99 | |
| 100 | 100 | |
| 101 | - $generator = new Generator($entityDir,'EntityMap'); |
|
| 101 | + $generator = new Generator($entityDir, 'EntityMap'); |
|
| 102 | 102 | |
| 103 | - if(!file_exists($entityDir.''.DIRECTORY_SEPARATOR.'EntityMap.php')){
|
|
| 103 | + if (!file_exists($entityDir.''.DIRECTORY_SEPARATOR.'EntityMap.php')) {
|
|
| 104 | 104 | |
| 105 | 105 | //$this->setAnnotations(); |
| 106 | 106 | $generator->createClass(); |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | $entityMapNamespaceResolve = new $entityMapNamespace; |
| 112 | 112 | |
| 113 | - if(!method_exists($entityMapNamespaceResolve,strtolower($this->argument['table']))){
|
|
| 113 | + if (!method_exists($entityMapNamespaceResolve, strtolower($this->argument['table']))) {
|
|
| 114 | 114 | |
| 115 | 115 | $generator->createClassUse([ |
| 116 | 116 | Utils::getNamespace($entityClass) |
@@ -140,15 +140,15 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | |
| 142 | 142 | //set builder map |
| 143 | - $generator = new Generator($this->directory['builderDir'],'BuilderMap'); |
|
| 143 | + $generator = new Generator($this->directory['builderDir'], 'BuilderMap'); |
|
| 144 | 144 | |
| 145 | - if(!file_exists($this->directory['builderDir'].''.DIRECTORY_SEPARATOR.'BuilderMap.php')){
|
|
| 145 | + if (!file_exists($this->directory['builderDir'].''.DIRECTORY_SEPARATOR.'BuilderMap.php')) {
|
|
| 146 | 146 | |
| 147 | 147 | $this->setAnnotations(); |
| 148 | 148 | $generator->createClass(); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - if(!file_exists($this->touch['model/model'])){
|
|
| 151 | + if (!file_exists($this->touch['model/model'])) {
|
|
| 152 | 152 | |
| 153 | 153 | $generator->createMethod([ |
| 154 | 154 | strtolower($this->argument['file']) |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | //set project touch |
| 172 | - $this->file->touch($this,[ |
|
| 172 | + $this->file->touch($this, [ |
|
| 173 | 173 | 'stub'=>'Model_Create' |
| 174 | 174 | ]); |
| 175 | 175 | |
@@ -180,11 +180,11 @@ discard block |
||
| 180 | 180 | /** |
| 181 | 181 | * @return bool |
| 182 | 182 | */ |
| 183 | - private function setAnnotations(){
|
|
| 183 | + private function setAnnotations() {
|
|
| 184 | 184 | |
| 185 | 185 | $entityMap = app()->path()->model().''.DIRECTORY_SEPARATOR.'Entity'.DIRECTORY_SEPARATOR.'EntityMap.php'; |
| 186 | 186 | |
| 187 | - if(file_exists($entityMap)){
|
|
| 187 | + if (file_exists($entityMap)) {
|
|
| 188 | 188 | |
| 189 | 189 | Utils::changeClass(path()->serviceAnnotations().'.php', |
| 190 | 190 | [ |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * @param callable|null $func |
| 13 | 13 | * @return string |
| 14 | 14 | */ |
| 15 | - public function getNamespaceForAutoService($instance,callable $func = null) |
|
| 15 | + public function getNamespaceForAutoService($instance, callable $func = null) |
|
| 16 | 16 | {
|
| 17 | 17 | //get namespace for auto service |
| 18 | 18 | $autoServiceNamespace = $instance->autoService(); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $configAutoServices = config('autoservices');
|
| 23 | 23 | |
| 24 | 24 | //auto service is invoked if auto service is allowed for any class yada config. |
| 25 | - if(class_exists($autoServiceNamespace) && isset($configAutoServices[strtolower(endpoint)])){
|
|
| 25 | + if (class_exists($autoServiceNamespace) && isset($configAutoServices[strtolower(endpoint)])) {
|
|
| 26 | 26 | return $autoServiceNamespace; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -349,8 +349,7 @@ discard block |
||
| 349 | 349 | $this->inputs[$generator] = $this->{$generatorMethodName}();
|
| 350 | 350 | $this->generatorList[] = $generator; |
| 351 | 351 | } |
| 352 | - } |
|
| 353 | - else {
|
|
| 352 | + } else {
|
|
| 354 | 353 | |
| 355 | 354 | if($this->checkProperties('auto_generators_dont_overwrite')
|
| 356 | 355 | && in_array($generator,$this->getAutoGeneratorsDontOverwrite())){
|
@@ -603,8 +602,7 @@ discard block |
||
| 603 | 602 | $keyMethod = $this->{$method}();
|
| 604 | 603 | $this->inputs[$key] = $keyMethod; |
| 605 | 604 | } |
| 606 | - } |
|
| 607 | - else{
|
|
| 605 | + } else{
|
|
| 608 | 606 | if(isset($this->inputs[$key])){
|
| 609 | 607 | $keyMethod = $this->{$method}();
|
| 610 | 608 | $this->inputs[$key] = $keyMethod; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @throws ReflectionExceptionAlias |
| 71 | 71 | */ |
| 72 | - public function __construct($clientData=null) |
|
| 72 | + public function __construct($clientData = null) |
|
| 73 | 73 | {
|
| 74 | 74 | //reflection process |
| 75 | 75 | $this->reflection = app()['reflection']($this); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $this->setClientName(); |
| 79 | 79 | |
| 80 | 80 | //get http method via request http manager class |
| 81 | - $this->requestHttp = app()->resolve(ClientHttpManager::class,['client'=>$this]); |
|
| 81 | + $this->requestHttp = app()->resolve(ClientHttpManager::class, ['client'=>$this]); |
|
| 82 | 82 | |
| 83 | 83 | //get request client data |
| 84 | 84 | $this->clientData = ($clientData===null) ? $this->requestHttp->resolve() : $clientData; |
@@ -95,9 +95,9 @@ discard block |
||
| 95 | 95 | private function autoValidate($validate) |
| 96 | 96 | {
|
| 97 | 97 | //we get the values to auto-validate. |
| 98 | - foreach ($this->{$validate} as $object=>$datas){
|
|
| 98 | + foreach ($this->{$validate} as $object=>$datas) {
|
|
| 99 | 99 | |
| 100 | - if(false===Utils::isNamespaceExists($object)){
|
|
| 100 | + if (false===Utils::isNamespaceExists($object)) {
|
|
| 101 | 101 | return; |
| 102 | 102 | } |
| 103 | 103 | |
@@ -107,30 +107,30 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | // we get the index values, |
| 109 | 109 | // which are called methods of the auto-validate value that represents the class. |
| 110 | - foreach ($datas as $dataKey=>$data){
|
|
| 110 | + foreach ($datas as $dataKey=>$data) {
|
|
| 111 | 111 | |
| 112 | 112 | // if the methods of the auto-validate class resolved by the container resolve method apply, |
| 113 | 113 | // the process of auto-validate automatic implementation will be completed. |
| 114 | - if(method_exists($getObjectInstance,$dataKey) && is_array($data)){
|
|
| 115 | - foreach ($data as $dataItem){
|
|
| 116 | - if(isset($this->origin[$dataItem])){
|
|
| 117 | - $getObjectInstance->{$dataKey}($this->origin[$dataItem],$this,$dataItem);
|
|
| 114 | + if (method_exists($getObjectInstance, $dataKey) && is_array($data)) {
|
|
| 115 | + foreach ($data as $dataItem) {
|
|
| 116 | + if (isset($this->origin[$dataItem])) {
|
|
| 117 | + $getObjectInstance->{$dataKey}($this->origin[$dataItem], $this, $dataItem);
|
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if(method_exists($this,$afterMethod = 'after'.ucfirst($dataKey))){
|
|
| 121 | - $this->{$afterMethod}($this,$dataItem);
|
|
| 120 | + if (method_exists($this, $afterMethod = 'after'.ucfirst($dataKey))) {
|
|
| 121 | + $this->{$afterMethod}($this, $dataItem);
|
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | // if the methods of the auto-validate class resolved by the container resolve method apply, |
| 127 | 127 | // the process of auto-validate automatic implementation will be completed. |
| 128 | - if(is_numeric($dataKey) && method_exists($getObjectInstance,$data) && isset($this->origin[$data])){
|
|
| 129 | - if(!is_array($this->origin[$data])){
|
|
| 128 | + if (is_numeric($dataKey) && method_exists($getObjectInstance, $data) && isset($this->origin[$data])) {
|
|
| 129 | + if (!is_array($this->origin[$data])) {
|
|
| 130 | 130 | $this->origin[$data] = array($this->origin[$data]); |
| 131 | 131 | } |
| 132 | - foreach ($this->origin[$data] as $originData){
|
|
| 133 | - $getObjectInstance->{$data}($originData,$this,$data);
|
|
| 132 | + foreach ($this->origin[$data] as $originData) {
|
|
| 133 | + $getObjectInstance->{$data}($originData, $this, $data);
|
|
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -145,39 +145,39 @@ discard block |
||
| 145 | 145 | private function capsule() |
| 146 | 146 | {
|
| 147 | 147 | //a process can be added to the capsule array using the method. |
| 148 | - if(method_exists($this,'capsuleMethod')){
|
|
| 149 | - $this->capsule = array_merge($this->capsule,$this->capsuleMethod()); |
|
| 148 | + if (method_exists($this, 'capsuleMethod')) {
|
|
| 149 | + $this->capsule = array_merge($this->capsule, $this->capsuleMethod()); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | // expected method is executed. |
| 153 | 153 | // this method is a must for http method values to be found in this property. |
| 154 | - if($this->checkProperties('capsule')){
|
|
| 154 | + if ($this->checkProperties('capsule')) {
|
|
| 155 | 155 | |
| 156 | - if(property_exists($this,'auto_capsule') && is_array($this->auto_capsule)){
|
|
| 157 | - $this->capsule = array_merge($this->capsule,$this->auto_capsule); |
|
| 156 | + if (property_exists($this, 'auto_capsule') && is_array($this->auto_capsule)) {
|
|
| 157 | + $this->capsule = array_merge($this->capsule, $this->auto_capsule); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - if($this->checkProperties('groups')){
|
|
| 161 | - $this->capsule = array_merge($this->capsule,$this->groups); |
|
| 160 | + if ($this->checkProperties('groups')) {
|
|
| 161 | + $this->capsule = array_merge($this->capsule, $this->groups); |
|
| 162 | 162 | |
| 163 | 163 | foreach ($this->capsule as $item) {
|
| 164 | - $groupProcess = $this->groupsProcess($item,true); |
|
| 165 | - if(is_array($groupProcess)){
|
|
| 164 | + $groupProcess = $this->groupsProcess($item, true); |
|
| 165 | + if (is_array($groupProcess)) {
|
|
| 166 | 166 | $defaultInputs = $this->inputs; |
| 167 | - $this->inputs = array_merge($this->inputs,$groupProcess); |
|
| 167 | + $this->inputs = array_merge($this->inputs, $groupProcess); |
|
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - foreach($this->inputs as $input=>$value){
|
|
| 172 | + foreach ($this->inputs as $input=>$value) {
|
|
| 173 | 173 | |
| 174 | - if($this->checkProperties('capsule') && !in_array($input,$this->capsule)){
|
|
| 175 | - exception('clientCapsule',['key'=>$input])
|
|
| 174 | + if ($this->checkProperties('capsule') && !in_array($input, $this->capsule)) {
|
|
| 175 | + exception('clientCapsule', ['key'=>$input])
|
|
| 176 | 176 | ->overflow('The '.$input.' value cannot be sent.');
|
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - if(isset($defaultInputs)){
|
|
| 180 | + if (isset($defaultInputs)) {
|
|
| 181 | 181 | $this->inputs = $defaultInputs; |
| 182 | 182 | } |
| 183 | 183 | } |
@@ -195,15 +195,15 @@ discard block |
||
| 195 | 195 | |
| 196 | 196 | // Determines which HTTP method |
| 197 | 197 | // the request object will be exposed to. |
| 198 | - if($this->checkProperties('http')){
|
|
| 198 | + if ($this->checkProperties('http')) {
|
|
| 199 | 199 | |
| 200 | 200 | // if the current http method does not exist |
| 201 | 201 | // in the http object, the exception will be thrown. |
| 202 | - if(!in_array($method,$this->http)){
|
|
| 202 | + if (!in_array($method, $this->http)) {
|
|
| 203 | 203 | |
| 204 | 204 | //exception batMethodCall |
| 205 | 205 | exception()->badMethodCall( |
| 206 | - 'Invalid http method process for '.basename($this).'.That is accepted http methods ['.implode(",",$this->http).'] ');
|
|
| 206 | + 'Invalid http method process for '.basename($this).'.That is accepted http methods ['.implode(",", $this->http).'] ');
|
|
| 207 | 207 | } |
| 208 | 208 | } |
| 209 | 209 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | {
|
| 219 | 219 | // from the properties of the object properties to |
| 220 | 220 | // the existing variables, control the array and at least one element. |
| 221 | - return (property_exists($this,$properties) |
|
| 221 | + return (property_exists($this, $properties) |
|
| 222 | 222 | && is_array($this->{$properties}) && count($this->{$properties})) ? true : false;
|
| 223 | 223 | } |
| 224 | 224 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | {
|
| 232 | 232 | // we are saving the expected values for the request in container. |
| 233 | 233 | // this record can be returned in exception information. |
| 234 | - app()->register('requestExpected',$this->expected);
|
|
| 234 | + app()->register('requestExpected', $this->expected);
|
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /** |
@@ -243,15 +243,15 @@ discard block |
||
| 243 | 243 | public function except($except) |
| 244 | 244 | {
|
| 245 | 245 | // the except parameter is a callable value. |
| 246 | - if(is_callable($except)){
|
|
| 247 | - $call = call_user_func_array($except,[$this]); |
|
| 246 | + if (is_callable($except)) {
|
|
| 247 | + $call = call_user_func_array($except, [$this]); |
|
| 248 | 248 | $except = $call; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // except with the except exceptions property |
| 252 | 252 | // and then assigning them to the inputs property. |
| 253 | - $this->except = array_merge($this->except,$except); |
|
| 254 | - $this->inputs = array_diff_key($this->inputs,array_flip($this->except)); |
|
| 253 | + $this->except = array_merge($this->except, $except); |
|
| 254 | + $this->inputs = array_diff_key($this->inputs, array_flip($this->except)); |
|
| 255 | 255 | |
| 256 | 256 | return $this; |
| 257 | 257 | } |
@@ -265,32 +265,32 @@ discard block |
||
| 265 | 265 | {
|
| 266 | 266 | // expected method is executed. |
| 267 | 267 | // this method is a must for http method values to be found in this property. |
| 268 | - if($this->checkProperties('expected')){
|
|
| 268 | + if ($this->checkProperties('expected')) {
|
|
| 269 | 269 | |
| 270 | 270 | // if the expected values are not found in the inputs array, |
| 271 | 271 | // the exception will be thrown. |
| 272 | - foreach ($this->expected as $expected){
|
|
| 272 | + foreach ($this->expected as $expected) {
|
|
| 273 | 273 | |
| 274 | 274 | $expectedValues = []; |
| 275 | 275 | |
| 276 | 276 | // mandatory expected data for each key can be separated by | operator. |
| 277 | 277 | // this is evaluated as "or". |
| 278 | - foreach($expectedData = explode("|",$expected) as $inputs){
|
|
| 278 | + foreach ($expectedData = explode("|", $expected) as $inputs) {
|
|
| 279 | 279 | |
| 280 | 280 | // we should do key control for group format. |
| 281 | 281 | // this process will allow us to perform key control for 2D array correctly. |
| 282 | 282 | $this->groupsProcess($inputs); |
| 283 | 283 | |
| 284 | - if(!isset($this->inputs[$inputs])){
|
|
| 284 | + if (!isset($this->inputs[$inputs])) {
|
|
| 285 | 285 | $expectedValues[$inputs] = $inputs; |
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | // if the expectedData and expectedValues |
| 290 | 290 | // array are numerically equal to the expected key, the exception is thrown. |
| 291 | - if(count($expectedData)===count($expectedValues)){
|
|
| 292 | - exception('clientExpected',['key'=>$expected])
|
|
| 293 | - ->unexpectedValue('You absolutely have to send the value '.implode(" or ",$expectedValues).' for request object');
|
|
| 291 | + if (count($expectedData)===count($expectedValues)) {
|
|
| 292 | + exception('clientExpected', ['key'=>$expected])
|
|
| 293 | + ->unexpectedValue('You absolutely have to send the value '.implode(" or ", $expectedValues).' for request object');
|
|
| 294 | 294 | } |
| 295 | 295 | } |
| 296 | 296 | } |
@@ -305,17 +305,17 @@ discard block |
||
| 305 | 305 | {
|
| 306 | 306 | // check the presence of the generator object |
| 307 | 307 | // and operate the generator over this object. |
| 308 | - if($this->checkProperties('auto_generators')){
|
|
| 308 | + if ($this->checkProperties('auto_generators')) {
|
|
| 309 | 309 | $generators = $this->getAutoGenerators(); |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | // check the presence of the generator object |
| 313 | 313 | // and operate the generator over this object. |
| 314 | - if($this->checkProperties('generators')){
|
|
| 315 | - $generators = array_merge(isset($generators) ? $generators: [],$this->getGenerators()); |
|
| 314 | + if ($this->checkProperties('generators')) {
|
|
| 315 | + $generators = array_merge(isset($generators) ? $generators : [], $this->getGenerators()); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - if(isset($generators)){
|
|
| 318 | + if (isset($generators)) {
|
|
| 319 | 319 | $this->generatorMethod($generators); |
| 320 | 320 | } |
| 321 | 321 | } |
@@ -330,21 +330,21 @@ discard block |
||
| 330 | 330 | private function generatorMethod($generators) |
| 331 | 331 | {
|
| 332 | 332 | //generator array object |
| 333 | - foreach ($generators as $generator){
|
|
| 333 | + foreach ($generators as $generator) {
|
|
| 334 | 334 | |
| 335 | 335 | //generator method name |
| 336 | 336 | $generatorMethodName = $generator.'Generator'; |
| 337 | 337 | |
| 338 | 338 | // if the generator method is present, |
| 339 | 339 | // the fake value is assigned. |
| 340 | - if(method_exists($this,$generatorMethodName)){
|
|
| 340 | + if (method_exists($this, $generatorMethodName)) {
|
|
| 341 | 341 | |
| 342 | 342 | //fake registration |
| 343 | - if(!isset($this->inputs[$generator])){
|
|
| 343 | + if (!isset($this->inputs[$generator])) {
|
|
| 344 | 344 | |
| 345 | 345 | $generatorMethodNameResult = $this->{$generatorMethodName}();
|
| 346 | 346 | |
| 347 | - if(!is_null($generatorMethodNameResult)){
|
|
| 347 | + if (!is_null($generatorMethodNameResult)) {
|
|
| 348 | 348 | $this->{$generator} = $this->{$generatorMethodName}();
|
| 349 | 349 | $this->inputs[$generator] = $this->{$generatorMethodName}();
|
| 350 | 350 | $this->generatorList[] = $generator; |
@@ -352,15 +352,15 @@ discard block |
||
| 352 | 352 | } |
| 353 | 353 | else {
|
| 354 | 354 | |
| 355 | - if($this->checkProperties('auto_generators_dont_overwrite')
|
|
| 356 | - && in_array($generator,$this->getAutoGeneratorsDontOverwrite())){
|
|
| 355 | + if ($this->checkProperties('auto_generators_dont_overwrite')
|
|
| 356 | + && in_array($generator, $this->getAutoGeneratorsDontOverwrite())) {
|
|
| 357 | 357 | $this->{$generator} = $this->{$generatorMethodName}();
|
| 358 | 358 | $this->inputs[$generator] = $this->{$generatorMethodName}();
|
| 359 | 359 | $this->generatorList[] = $generator; |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - if($this->checkProperties('generators_dont_overwrite')
|
|
| 363 | - && in_array($generator,$this->getGeneratorsDontOverwrite())){
|
|
| 362 | + if ($this->checkProperties('generators_dont_overwrite')
|
|
| 363 | + && in_array($generator, $this->getGeneratorsDontOverwrite())) {
|
|
| 364 | 364 | $this->{$generator} = $this->{$generatorMethodName}();
|
| 365 | 365 | $this->inputs[$generator] = $this->{$generatorMethodName}();
|
| 366 | 366 | $this->generatorList[] = $generator; |
@@ -391,28 +391,28 @@ discard block |
||
| 391 | 391 | * @param null $callback |
| 392 | 392 | * @return mixed|void |
| 393 | 393 | */ |
| 394 | - public function groupsProcess($key=null,$callback=null) |
|
| 394 | + public function groupsProcess($key = null, $callback = null) |
|
| 395 | 395 | {
|
| 396 | - if(property_exists($this,'groups') && is_array($this->groups)){
|
|
| 396 | + if (property_exists($this, 'groups') && is_array($this->groups)) {
|
|
| 397 | 397 | |
| 398 | 398 | $clientObjects = $this->getClientObjects(); |
| 399 | 399 | |
| 400 | - foreach ($this->groups as $group){
|
|
| 400 | + foreach ($this->groups as $group) {
|
|
| 401 | 401 | |
| 402 | - if(true === $callback){
|
|
| 403 | - if(isset($clientObjects['origin'][$key])){
|
|
| 402 | + if (true===$callback) {
|
|
| 403 | + if (isset($clientObjects['origin'][$key])) {
|
|
| 404 | 404 | return $clientObjects['origin'][$key]; |
| 405 | 405 | } |
| 406 | 406 | return []; |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | - if(isset($clientObjects['origin'][$group][$key])){
|
|
| 409 | + if (isset($clientObjects['origin'][$group][$key])) {
|
|
| 410 | 410 | |
| 411 | 411 | $this->{$key} = $clientObjects['origin'][$group][$key];
|
| 412 | 412 | $this->inputs[$key] = $this->{$key};
|
| 413 | 413 | |
| 414 | - if(is_callable($callback)){
|
|
| 415 | - call_user_func_array($callback,[$key]); |
|
| 414 | + if (is_callable($callback)) {
|
|
| 415 | + call_user_func_array($callback, [$key]); |
|
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | 418 | } |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | //that coming with the post. |
| 438 | 438 | $this->initClient(); |
| 439 | 439 | |
| 440 | - if(method_exists($this,'eventBefore')){
|
|
| 440 | + if (method_exists($this, 'eventBefore')) {
|
|
| 441 | 441 | $this->eventBefore(); |
| 442 | 442 | } |
| 443 | 443 | |
@@ -469,11 +469,11 @@ discard block |
||
| 469 | 469 | // are subtracted from all input values. |
| 470 | 470 | $this->requestExcept(); |
| 471 | 471 | |
| 472 | - if(app()->has('clientRequestInputs')){
|
|
| 472 | + if (app()->has('clientRequestInputs')) {
|
|
| 473 | 473 | app()->terminate('clientRequestInputs');
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - app()->register('clientRequestInputs',$this->inputs);
|
|
| 476 | + app()->register('clientRequestInputs', $this->inputs);
|
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /** |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | {
|
| 486 | 486 | // we use the http method to write |
| 487 | 487 | // the values to the inputs and origin properties. |
| 488 | - foreach($this->clientData as $key=>$value){
|
|
| 488 | + foreach ($this->clientData as $key=>$value) {
|
|
| 489 | 489 | |
| 490 | 490 | //inputs and origin properties |
| 491 | 491 | $this->inputs[$key] = $value; |
@@ -501,9 +501,9 @@ discard block |
||
| 501 | 501 | */ |
| 502 | 502 | private function requestExcept() |
| 503 | 503 | {
|
| 504 | - if(property_exists($this,'requestExcept') && is_array($this->requestExcept)){
|
|
| 505 | - foreach ($this->requestExcept as $item){
|
|
| 506 | - if(isset($this->inputs[$item])){
|
|
| 504 | + if (property_exists($this, 'requestExcept') && is_array($this->requestExcept)) {
|
|
| 505 | + foreach ($this->requestExcept as $item) {
|
|
| 506 | + if (isset($this->inputs[$item])) {
|
|
| 507 | 507 | unset($this->inputs[$item]); |
| 508 | 508 | } |
| 509 | 509 | } |
@@ -516,16 +516,16 @@ discard block |
||
| 516 | 516 | * @param null|string $clientName |
| 517 | 517 | * @return void|mixed |
| 518 | 518 | */ |
| 519 | - public function setClientName($clientName=null) |
|
| 519 | + public function setClientName($clientName = null) |
|
| 520 | 520 | {
|
| 521 | - if(!is_null($clientName) && is_string($clientName)){
|
|
| 521 | + if (!is_null($clientName) && is_string($clientName)) {
|
|
| 522 | 522 | return $this->clientName = $clientName; |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | - if(!is_null(Utils::trace(0)) && isset(Utils::trace(0)['object'])){
|
|
| 525 | + if (!is_null(Utils::trace(0)) && isset(Utils::trace(0)['object'])) {
|
|
| 526 | 526 | $backTrace = Utils::trace(0)['object']; |
| 527 | 527 | |
| 528 | - if(property_exists($backTrace,'clientName')){
|
|
| 528 | + if (property_exists($backTrace, 'clientName')) {
|
|
| 529 | 529 | $this->clientName = $backTrace->clientName; |
| 530 | 530 | } |
| 531 | 531 | } |
@@ -542,16 +542,16 @@ discard block |
||
| 542 | 542 | |
| 543 | 543 | // we update the input values after |
| 544 | 544 | // we receive and check the saved objects. |
| 545 | - foreach ($clientObjects as $key=>$value){
|
|
| 545 | + foreach ($clientObjects as $key=>$value) {
|
|
| 546 | 546 | |
| 547 | 547 | // we should do key control for group format. |
| 548 | 548 | // this process will allow us to perform key control for 2D array correctly. |
| 549 | - $this->groupsProcess($key,function($key){
|
|
| 549 | + $this->groupsProcess($key, function($key) {
|
|
| 550 | 550 | $this->registerRequestInputs($key); |
| 551 | 551 | unset($this->inputs[$key]); |
| 552 | 552 | }); |
| 553 | 553 | |
| 554 | - if(!in_array($key,$this->generatorList) && isset($clientObjects['origin'][$key])){
|
|
| 554 | + if (!in_array($key, $this->generatorList) && isset($clientObjects['origin'][$key])) {
|
|
| 555 | 555 | |
| 556 | 556 | $this->{$key} = $clientObjects['origin'][$key];
|
| 557 | 557 | $this->inputs[$key] = $this->{$key};
|
@@ -579,11 +579,11 @@ discard block |
||
| 579 | 579 | |
| 580 | 580 | // the request update to be performed using |
| 581 | 581 | // the method name to be used with the http method. |
| 582 | - $this->setRequestInputs($requestMethod,$key); |
|
| 582 | + $this->setRequestInputs($requestMethod, $key); |
|
| 583 | 583 | |
| 584 | 584 | // the request update to be performed using |
| 585 | 585 | // the method name to be used without the http method. |
| 586 | - $this->setRequestInputs($key,$key); |
|
| 586 | + $this->setRequestInputs($key, $key); |
|
| 587 | 587 | } |
| 588 | 588 | |
| 589 | 589 | /** |
@@ -594,28 +594,28 @@ discard block |
||
| 594 | 594 | * |
| 595 | 595 | * @throws ReflectionExceptionAlias |
| 596 | 596 | */ |
| 597 | - private function setRequestInputs($method,$key) |
|
| 597 | + private function setRequestInputs($method, $key) |
|
| 598 | 598 | {
|
| 599 | - if(!in_array($key,$this->generatorList) && method_exists($this,$method) && $this->reflection->reflectionMethodParams($method)->isProtected){
|
|
| 599 | + if (!in_array($key, $this->generatorList) && method_exists($this, $method) && $this->reflection->reflectionMethodParams($method)->isProtected) {
|
|
| 600 | 600 | |
| 601 | 601 | //check annotations for method |
| 602 | - $annotation = app()->resolve(ClientAnnotationManager::class,['request'=>$this]); |
|
| 603 | - $annotation->annotation($method,$key); |
|
| 602 | + $annotation = app()->resolve(ClientAnnotationManager::class, ['request'=>$this]); |
|
| 603 | + $annotation->annotation($method, $key); |
|
| 604 | 604 | |
| 605 | - if(isset($this->inputs[$key]) && is_array($this->inputs[$key])){
|
|
| 605 | + if (isset($this->inputs[$key]) && is_array($this->inputs[$key])) {
|
|
| 606 | 606 | |
| 607 | 607 | $inputKeys = $this->inputs[$key]; |
| 608 | 608 | |
| 609 | 609 | $this->inputs[$key] = []; |
| 610 | - foreach ($inputKeys as $ikey=>$input){
|
|
| 610 | + foreach ($inputKeys as $ikey=>$input) {
|
|
| 611 | 611 | |
| 612 | 612 | $this->{$key}[$ikey] = $input;
|
| 613 | 613 | $keyMethod = $this->{$method}();
|
| 614 | 614 | $this->inputs[$key] = $keyMethod; |
| 615 | 615 | } |
| 616 | 616 | } |
| 617 | - else{
|
|
| 618 | - if(isset($this->inputs[$key])){
|
|
| 617 | + else {
|
|
| 618 | + if (isset($this->inputs[$key])) {
|
|
| 619 | 619 | $keyMethod = $this->{$method}();
|
| 620 | 620 | $this->inputs[$key] = $keyMethod; |
| 621 | 621 | } |
@@ -634,8 +634,8 @@ discard block |
||
| 634 | 634 | // the auto object validate property is the property |
| 635 | 635 | // where all of your request values are automatically validated. |
| 636 | 636 | /** @noinspection PhpParamsInspection */ |
| 637 | - if(property_exists($this,'autoObjectValidate') |
|
| 638 | - && is_array($this->autoObjectValidate) && count($this->autoObjectValidate)){
|
|
| 637 | + if (property_exists($this, 'autoObjectValidate') |
|
| 638 | + && is_array($this->autoObjectValidate) && count($this->autoObjectValidate)) {
|
|
| 639 | 639 | $this->autoValidate('autoObjectValidate');
|
| 640 | 640 | } |
| 641 | 641 | } |
@@ -141,8 +141,7 @@ discard block |
||
| 141 | 141 | |
| 142 | 142 | if(!is_null($provider = $this->auth->provider($credential))){
|
| 143 | 143 | $query->where($credential,$provider($credentialValue)); |
| 144 | - } |
|
| 145 | - else{
|
|
| 144 | + } else{
|
|
| 146 | 145 | $query->where($credential,$credentialValue); |
| 147 | 146 | } |
| 148 | 147 | } |
@@ -180,8 +179,7 @@ discard block |
||
| 180 | 179 | if(!$update){
|
| 181 | 180 | $this->auth->params['status'] = 0; |
| 182 | 181 | $this->auth->params['exception'] = 'update'; |
| 183 | - } |
|
| 184 | - else{
|
|
| 182 | + } else{
|
|
| 185 | 183 | if(!is_null($after = $this->auth->provider('after'))){
|
| 186 | 184 | if(false === $after($this->auth->params['builder']->first())){
|
| 187 | 185 | $this->auth->params['status'] = 0; |
@@ -216,8 +214,7 @@ discard block |
||
| 216 | 214 | 'device_agent_integer' => crc32(md5($_SERVER['HTTP_USER_AGENT'])), |
| 217 | 215 | 'expire' => $this->auth->getExpire(), |
| 218 | 216 | ]); |
| 219 | - } |
|
| 220 | - else{
|
|
| 217 | + } else{
|
|
| 221 | 218 | |
| 222 | 219 | return DeviceToken::where('user_id',$this->auth->params['authId'])
|
| 223 | 220 | ->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT'])))
|
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | {
|
| 52 | 52 | $userId = $manager->getAuth()->params['userId']; |
| 53 | 53 | |
| 54 | - return DeviceToken::where('user_id',$userId)->get();
|
|
| 54 | + return DeviceToken::where('user_id', $userId)->get();
|
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | return DeviceToken::where(function($query) use($token) {
|
| 65 | 65 | |
| 66 | 66 | //where query for token |
| 67 | - $query->where('token_integer',crc32(md5($token)));
|
|
| 68 | - $query->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT'])));
|
|
| 67 | + $query->where('token_integer', crc32(md5($token)));
|
|
| 68 | + $query->where('device_agent_integer', crc32(md5($_SERVER['HTTP_USER_AGENT'])));
|
|
| 69 | 69 | }); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | return DeviceToken::where(function($query) use($token) {
|
| 80 | 80 | |
| 81 | 81 | //where query for token |
| 82 | - $query->where('token_integer',crc32(md5($token)));
|
|
| 83 | - $query->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT'])));
|
|
| 82 | + $query->where('token_integer', crc32(md5($token)));
|
|
| 83 | + $query->where('device_agent_integer', crc32(md5($_SERVER['HTTP_USER_AGENT'])));
|
|
| 84 | 84 | |
| 85 | 85 | }); |
| 86 | 86 | } |
@@ -91,23 +91,23 @@ discard block |
||
| 91 | 91 | * @param null|object $query |
| 92 | 92 | * @return mixed |
| 93 | 93 | */ |
| 94 | - protected function checkPasswordVerify($query=null) |
|
| 94 | + protected function checkPasswordVerify($query = null) |
|
| 95 | 95 | {
|
| 96 | - if(is_null($query) && isset($this->credentials['password'])){
|
|
| 97 | - if(!is_null($password = $this->auth->provider('password'))
|
|
| 98 | - && $password($this->credentials['password'])=='verify'){
|
|
| 96 | + if (is_null($query) && isset($this->credentials['password'])) {
|
|
| 97 | + if (!is_null($password = $this->auth->provider('password'))
|
|
| 98 | + && $password($this->credentials['password'])=='verify') {
|
|
| 99 | 99 | |
| 100 | 100 | $this->password = $this->credentials['password']; |
| 101 | 101 | $this->passwordVerify = true; |
| 102 | - $this->credentials = Arr::removeKey($this->credentials,['password']); |
|
| 102 | + $this->credentials = Arr::removeKey($this->credentials, ['password']); |
|
| 103 | 103 | |
| 104 | 104 | return null; |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - if(is_object($query) && $query->count()){
|
|
| 108 | + if (is_object($query) && $query->count()) {
|
|
| 109 | 109 | $password = $query->first()->password; |
| 110 | - if(password_verify($this->password,$password)){
|
|
| 110 | + if (password_verify($this->password, $password)) {
|
|
| 111 | 111 | return $query; |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -137,24 +137,24 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | // with the callback method (eloquent model) |
| 139 | 139 | // we write the where clause. |
| 140 | - foreach ($this->credentials as $credential=>$credentialValue){
|
|
| 140 | + foreach ($this->credentials as $credential=>$credentialValue) {
|
|
| 141 | 141 | |
| 142 | - if(!is_null($provider = $this->auth->provider($credential))){
|
|
| 143 | - $query->where($credential,$provider($credentialValue)); |
|
| 142 | + if (!is_null($provider = $this->auth->provider($credential))) {
|
|
| 143 | + $query->where($credential, $provider($credentialValue)); |
|
| 144 | 144 | } |
| 145 | - else{
|
|
| 146 | - $query->where($credential,$credentialValue); |
|
| 145 | + else {
|
|
| 146 | + $query->where($credential, $credentialValue); |
|
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | // for the authenticate query, |
| 151 | 151 | // the user can add additional queries by the service provider. |
| 152 | - if(!is_null($addQuery = $this->auth->provider('addQuery'))){
|
|
| 152 | + if (!is_null($addQuery = $this->auth->provider('addQuery'))) {
|
|
| 153 | 153 | $addQuery($query); |
| 154 | 154 | } |
| 155 | 155 | }); |
| 156 | 156 | |
| 157 | - if(false === $this->passwordVerify){
|
|
| 157 | + if (false===$this->passwordVerify) {
|
|
| 158 | 158 | return $query; |
| 159 | 159 | } |
| 160 | 160 | |
@@ -164,10 +164,10 @@ discard block |
||
| 164 | 164 | /** |
| 165 | 165 | * @return void|mixed |
| 166 | 166 | */ |
| 167 | - protected function updateToken($token=null) |
|
| 167 | + protected function updateToken($token = null) |
|
| 168 | 168 | {
|
| 169 | 169 | //if query status value is true |
| 170 | - if($this->auth->params['status']){
|
|
| 170 | + if ($this->auth->params['status']) {
|
|
| 171 | 171 | |
| 172 | 172 | // we go to the method that produces |
| 173 | 173 | // the classical token value and get the token value. |
@@ -177,13 +177,13 @@ discard block |
||
| 177 | 177 | // if there is no update, we reset the status value to 0. |
| 178 | 178 | $update = $this->auth->params['builder']->update(['token'=>$this->auth->params['token']]); |
| 179 | 179 | |
| 180 | - if(!$update){
|
|
| 180 | + if (!$update) {
|
|
| 181 | 181 | $this->auth->params['status'] = 0; |
| 182 | 182 | $this->auth->params['exception'] = 'update'; |
| 183 | 183 | } |
| 184 | - else{
|
|
| 185 | - if(!is_null($after = $this->auth->provider('after'))){
|
|
| 186 | - if(false === $after($this->auth->params['builder']->first())){
|
|
| 184 | + else {
|
|
| 185 | + if (!is_null($after = $this->auth->provider('after'))) {
|
|
| 186 | + if (false===$after($this->auth->params['builder']->first())) {
|
|
| 187 | 187 | $this->auth->params['status'] = 0; |
| 188 | 188 | $this->auth->params['exception'] = 'update'; |
| 189 | 189 | } |
@@ -203,14 +203,14 @@ discard block |
||
| 203 | 203 | {
|
| 204 | 204 | $token_integer = null; |
| 205 | 205 | |
| 206 | - if(isset($this->auth->params['token'])){
|
|
| 206 | + if (isset($this->auth->params['token'])) {
|
|
| 207 | 207 | $token_integer = crc32(md5($this->auth->params['token'])); |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - if(!is_null($token_integer)){
|
|
| 210 | + if (!is_null($token_integer)) {
|
|
| 211 | 211 | |
| 212 | - if(DeviceToken::where('user_id',$this->auth->params['authId'])
|
|
| 213 | - ->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT'])))->count()==0){
|
|
| 212 | + if (DeviceToken::where('user_id', $this->auth->params['authId'])
|
|
| 213 | + ->where('device_agent_integer', crc32(md5($_SERVER['HTTP_USER_AGENT'])))->count()==0) {
|
|
| 214 | 214 | |
| 215 | 215 | return DeviceToken::create([ |
| 216 | 216 | 'user_id' => $this->auth->params['authId'], |
@@ -221,10 +221,10 @@ discard block |
||
| 221 | 221 | 'expire' => $this->auth->getExpire(), |
| 222 | 222 | ]); |
| 223 | 223 | } |
| 224 | - else{
|
|
| 224 | + else {
|
|
| 225 | 225 | |
| 226 | - return DeviceToken::where('user_id',$this->auth->params['authId'])
|
|
| 227 | - ->where('device_agent_integer',crc32(md5($_SERVER['HTTP_USER_AGENT'])))
|
|
| 226 | + return DeviceToken::where('user_id', $this->auth->params['authId'])
|
|
| 227 | + ->where('device_agent_integer', crc32(md5($_SERVER['HTTP_USER_AGENT'])))
|
|
| 228 | 228 | ->update([ |
| 229 | 229 | 'token' => $this->auth->params['token'], |
| 230 | 230 | 'token_integer' => $token_integer |
@@ -244,11 +244,11 @@ discard block |
||
| 244 | 244 | {
|
| 245 | 245 | $token_integer = crc32(md5($this->auth->getTokenSentByUser())); |
| 246 | 246 | |
| 247 | - if(!is_null($token_integer)){
|
|
| 247 | + if (!is_null($token_integer)) {
|
|
| 248 | 248 | |
| 249 | - DeviceToken::where('token_integer',$token_integer)->delete();
|
|
| 249 | + DeviceToken::where('token_integer', $token_integer)->delete();
|
|
| 250 | 250 | |
| 251 | - return (DeviceToken::where('token_integer',$token_integer)->count()) ? false : true;
|
|
| 251 | + return (DeviceToken::where('token_integer', $token_integer)->count()) ? false : true;
|
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | {
|
| 25 | 25 | // if the status value is true, |
| 26 | 26 | // we send output generated from the token value. |
| 27 | - if($this->checkStatus()){
|
|
| 27 | + if ($this->checkStatus()) {
|
|
| 28 | 28 | $this->setAuthenticateSuccess(true); |
| 29 | 29 | return true; |
| 30 | 30 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | {
|
| 41 | 41 | // if the status value is true, |
| 42 | 42 | // we send output generated from the token value. |
| 43 | - if($this->checkStatus()){
|
|
| 43 | + if ($this->checkStatus()) {
|
|
| 44 | 44 | return true; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -53,11 +53,11 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | protected function getResult() |
| 55 | 55 | {
|
| 56 | - $result= []; |
|
| 56 | + $result = []; |
|
| 57 | 57 | |
| 58 | 58 | // if the status value is true, |
| 59 | 59 | // we send output generated from the token value. |
| 60 | - if($this->checkStatus()){
|
|
| 60 | + if ($this->checkStatus()) {
|
|
| 61 | 61 | $result['message'] = 'token success'; |
| 62 | 62 | $result['token'] = $this->params['token']; |
| 63 | 63 | $result['user'] = $this->params['data']; |
@@ -79,12 +79,12 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @param bool $value |
| 81 | 81 | */ |
| 82 | - private function setAuthenticateSuccess($value=true) |
|
| 82 | + private function setAuthenticateSuccess($value = true) |
|
| 83 | 83 | {
|
| 84 | - if(app()->has('authenticateSuccess')){
|
|
| 84 | + if (app()->has('authenticateSuccess')) {
|
|
| 85 | 85 | app()->terminate('authenticateSuccess');
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - app()->register('authenticateSuccess',$value);
|
|
| 88 | + app()->register('authenticateSuccess', $value);
|
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | \ No newline at end of file |