@@ -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,7 +126,7 @@ 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 | 131 | } |
| 133 | 132 | |
@@ -137,7 +136,7 @@ discard block |
||
| 137 | 136 | * @param array $data |
| 138 | 137 | * @return array |
| 139 | 138 | */ |
| 140 | - public function outputFormatter($data=array(),$outputter='json') |
|
| 139 | + public function outputFormatter($data = array(), $outputter = 'json') |
|
| 141 | 140 | {
|
| 142 | 141 | $dataCapsule = config('response.data');
|
| 143 | 142 | |
@@ -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 |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | * @param array $data |
| 49 | 49 | * @return array |
| 50 | 50 | */ |
| 51 | - private function hateoasCapsule($data=array()) |
|
| 51 | + private function hateoasCapsule($data = array()) |
|
| 52 | 52 | {
|
| 53 | - return (config('app.hateoas')) ? array_merge($data,config('hateoas')) : $data;
|
|
| 53 | + return (config('app.hateoas')) ? array_merge($data, config('hateoas')) : $data;
|
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | * @param callable $callback |
| 67 | 67 | * @return mixed |
| 68 | 68 | */ |
| 69 | - private function noInExceptionHateoas($output,callable $callback) |
|
| 69 | + private function noInExceptionHateoas($output, callable $callback) |
|
| 70 | 70 | {
|
| 71 | - if(isset($output['success']) && false===$output['success']){
|
|
| 71 | + if (isset($output['success']) && false===$output['success']) {
|
|
| 72 | 72 | return $output; |
| 73 | 73 | } |
| 74 | 74 | return call_user_func($callback); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | {
|
| 96 | 96 | //if the system throws an exception, |
| 97 | 97 | //we subtract the hateoas extension from the output value. |
| 98 | - $this->printer = $this->noInExceptionHateoas($output,function() use ($output){
|
|
| 98 | + $this->printer = $this->noInExceptionHateoas($output, function() use ($output){
|
|
| 99 | 99 | |
| 100 | 100 | return array_merge( |
| 101 | 101 | $this->metaAdd(), |
@@ -109,12 +109,12 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | // If the log feature is available on the kernel, |
| 111 | 111 | // we run the logger process. |
| 112 | - if(isset(core()->log)){
|
|
| 112 | + if (isset(core()->log)) {
|
|
| 113 | 113 | |
| 114 | 114 | // we can run logging after checking |
| 115 | 115 | // the configuration for the logger process in the LoggerService class |
| 116 | 116 | // so that,If logging is not allowed in the main configuration file, we will not log. |
| 117 | - return core()->loggerService->checkLoggerConfiguration($this->printer,function($printer){
|
|
| 117 | + return core()->loggerService->checkLoggerConfiguration($this->printer, function($printer) {
|
|
| 118 | 118 | return $printer; |
| 119 | 119 | }); |
| 120 | 120 | } |
@@ -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,9 +69,9 @@ 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 | - $this->fireEvent('after',true);
|
|
| 74 | + $this->fireEvent('after', true);
|
|
| 75 | 75 | |
| 76 | 76 | return $controller; |
| 77 | 77 | } |
@@ -84,12 +84,12 @@ discard block |
||
| 84 | 84 | private function getCallBindController() |
| 85 | 85 | {
|
| 86 | 86 | //we finally process the method of the class invoked by the user as a process and prepare it for the response |
| 87 | - return app()->resolve(RouteWatch::class)->watch(function(){
|
|
| 87 | + return app()->resolve(RouteWatch::class)->watch(function() {
|
|
| 88 | 88 | |
| 89 | 89 | // if the method in the instance object exists, |
| 90 | 90 | // this method is executed to produce the output. |
| 91 | - if(method_exists($this->app['instanceController'],$this->app['method'])){
|
|
| 92 | - return $this->app['di']($this->app['instanceController'],$this->app['method']); |
|
| 91 | + if (method_exists($this->app['instanceController'], $this->app['method'])) {
|
|
| 92 | + return $this->app['di']($this->app['instanceController'], $this->app['method']); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | //throw exception as unsuccessful |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | public function handle() |
| 109 | 109 | {
|
| 110 | - $this->app->register('routerResult',$this->callController());
|
|
| 110 | + $this->app->register('routerResult', $this->callController());
|
|
| 111 | 111 | |
| 112 | 112 | //we call our services as controller |
| 113 | 113 | return $this->app['routerResult']; |
@@ -124,8 +124,8 @@ discard block |
||
| 124 | 124 | $namespace = $this->getControllerNamespace(); |
| 125 | 125 | |
| 126 | 126 | //utils make bind via dependency injection named as service container |
| 127 | - $this->app->register('serviceConf',$this->app['fileSystem']->callFile(StaticPathModel::getServiceConf()));
|
|
| 128 | - $this->app->register('instanceController',$this->app->resolve($namespace));
|
|
| 127 | + $this->app->register('serviceConf', $this->app['fileSystem']->callFile(StaticPathModel::getServiceConf()));
|
|
| 128 | + $this->app->register('instanceController', $this->app->resolve($namespace));
|
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | // based on the serviceConf variable, |
| 144 | 144 | // we are doing parameter bindings in the method context in the routeParameters array key. |
| 145 | - $this->app->register('serviceConf','routeParameters',[$method=>$parameters]);
|
|
| 145 | + $this->app->register('serviceConf', 'routeParameters', [$method=>$parameters]);
|
|
| 146 | 146 | |
| 147 | 147 | } |
| 148 | 148 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | public function setMethodNameViaDefine($methodName) |
| 156 | 156 | {
|
| 157 | - define('methodName',strtolower($methodName));
|
|
| 157 | + define('methodName', strtolower($methodName));
|
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $fromRoutes = Route::getRouteResolve(); |
| 186 | 186 | $method = $fromRoutes['method'] ?? $method; |
| 187 | 187 | |
| 188 | - $this->app->register('method',$method);
|
|
| 188 | + $this->app->register('method', $method);
|
|
| 189 | 189 | $this->app->register('routeParameters', $this->routeParametersAssign($this->resolveMethod($method)));
|
| 190 | 190 | |
| 191 | 191 | } |
@@ -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. |