@@ -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 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * @var $type |
16 | 16 | */ |
17 | - public $type='project'; |
|
17 | + public $type = 'project'; |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * @var array |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | /** |
32 | 32 | * @var $commandRule |
33 | 33 | */ |
34 | - public $commandRule=[]; |
|
34 | + public $commandRule = []; |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * @method create |
@@ -46,17 +46,17 @@ discard block |
||
46 | 46 | $this->directory['projectDir'] = $this->projectPath(); |
47 | 47 | $this->argument['exceptionNamespace'] = app()->namespace()->exception(); |
48 | 48 | $this->argument['resourcePath'] = app()->path()->appResourche(); |
49 | - $this->argument['testNamespace'] = app()->namespace()->tests(); |
|
49 | + $this->argument['testNamespace'] = app()->namespace()->tests(); |
|
50 | 50 | |
51 | - $recursiveDefaultDirectory = explode("\\",$this->argument['project']); |
|
51 | + $recursiveDefaultDirectory = explode("\\", $this->argument['project']); |
|
52 | 52 | $this->argument['applicationName'] = pos($recursiveDefaultDirectory); |
53 | 53 | $recursiveDefaultDirectory[] = 'V1'; |
54 | 54 | $recursiveDefaultDirectoryList = []; |
55 | 55 | |
56 | - foreach (array_slice($recursiveDefaultDirectory,1) as $defaultDirectory){ |
|
56 | + foreach (array_slice($recursiveDefaultDirectory, 1) as $defaultDirectory) { |
|
57 | 57 | |
58 | - $recursiveDefaultDirectoryList[]=$defaultDirectory; |
|
59 | - $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/",$recursiveDefaultDirectoryList); |
|
58 | + $recursiveDefaultDirectoryList[] = $defaultDirectory; |
|
59 | + $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/", $recursiveDefaultDirectoryList); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | //$this->directory['optionalDir'] = $this->optional(); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | //$this->directory['sourceDir'] = $this->sourceDir(); |
83 | 83 | //$this->directory['sourceSupportDir'] = $this->sourceSupportDir(); |
84 | 84 | //$this->directory['sourceSupportTraitDir'] = $this->sourceSupportDir().'/Traits'; |
85 | - $this->directory['exceptionDir'] = app()->path()->exception(); |
|
85 | + $this->directory['exceptionDir'] = app()->path()->exception(); |
|
86 | 86 | |
87 | 87 | //set project directory |
88 | 88 | $this->file->makeDirectory($this); |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | $this->touch['kernel/exception'] = $this->provider().'/ExceptionServiceProvider.php'; |
100 | 100 | $this->touch['kernel/response'] = $this->provider().'/ResponseServiceProvider.php'; |
101 | 101 | $this->touch['kernel/entity'] = $this->provider().'/EntityServiceProvider.php'; |
102 | - $this->touch['kernel/cache'] = $this->provider().'/CacheServiceProvider.php'; |
|
102 | + $this->touch['kernel/cache'] = $this->provider().'/CacheServiceProvider.php'; |
|
103 | 103 | $this->touch['kernel/authenticate'] = $this->provider().'/AuthenticateServiceProvider.php'; |
104 | 104 | $this->touch['kernel/role'] = $this->provider().'/RoleServiceProvider.php'; |
105 | 105 | $this->touch['kernel/track'] = $this->provider().'/TrackServiceProvider.php'; |
106 | - $this->touch['test/testcase'] = $this->test().'/TestCase.php'; |
|
106 | + $this->touch['test/testcase'] = $this->test().'/TestCase.php'; |
|
107 | 107 | $this->touch['kernel/consoleevent'] = $this->provider().'/ConsoleEventServiceProvider.php'; |
108 | 108 | $this->touch['middleware/authenticate'] = $this->middleware().'/Authenticate.php'; |
109 | 109 | $this->touch['middleware/ratelimit'] = $this->middleware().'/RateLimit.php'; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $this->touch['app/gitignore'] = $this->projectPath().'/.gitignore'; |
145 | 145 | $this->touch['app/composer'] = $this->projectPath().'/composer.json'; |
146 | 146 | $this->touch['test/index'] = $this->storage().'/index.html'; |
147 | - $this->touch['exception/authenticate'] = $this->directory['exceptionDir'] .'/AuthenticateException.php'; |
|
147 | + $this->touch['exception/authenticate'] = $this->directory['exceptionDir'].'/AuthenticateException.php'; |
|
148 | 148 | |
149 | 149 | //set project touch |
150 | 150 | $this->file->touch($this); |
@@ -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 | [ |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | { |
32 | 32 | $this->config(); |
33 | 33 | |
34 | - if($this->guard=="default"){ |
|
34 | + if ($this->guard=="default") { |
|
35 | 35 | $this->setAuthenticateNeeds(); |
36 | 36 | } |
37 | 37 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function getAddToWhere() |
59 | 59 | { |
60 | - if(isset($this->config['guard'][$this->guard]['addToWhere'])){ |
|
60 | + if (isset($this->config['guard'][$this->guard]['addToWhere'])) { |
|
61 | 61 | return $this->config['guard'][$this->guard]['addToWhere']; |
62 | 62 | } |
63 | 63 | return null; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function getConfigToken() |
72 | 72 | { |
73 | - if(isset($this->config['guard'][$this->guard]['token'])){ |
|
73 | + if (isset($this->config['guard'][$this->guard]['token'])) { |
|
74 | 74 | return $this->config['guard'][$this->guard]['token']; |
75 | 75 | } |
76 | 76 | return null; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public function provider($key) |
166 | 166 | { |
167 | - if(app()->has('authenticate.'.$key) && is_callable($provider = app()->get('authenticate.'.$key))){ |
|
167 | + if (app()->has('authenticate.'.$key) && is_callable($provider = app()->get('authenticate.'.$key))) { |
|
168 | 168 | return $provider; |
169 | 169 | } |
170 | 170 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | { |
204 | 204 | $table = $this->config['guard'][$this->guard]['table']; |
205 | 205 | |
206 | - app()->register('authenticateTable',$table); |
|
206 | + app()->register('authenticateTable', $table); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | } |
210 | 210 | \ No newline at end of file |