@@ -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 |
@@ -5,7 +5,7 @@ |
||
5 | 5 | |
6 | 6 | class User extends Eloquent |
7 | 7 | { |
8 | - protected $hidden = ['id','password','token']; |
|
8 | + protected $hidden = ['id', 'password', 'token']; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * User constructor. |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * @var array |
34 | 34 | */ |
35 | - public $commandRule=['name','client']; |
|
35 | + public $commandRule = ['name', 'client']; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * @method create |
@@ -56,35 +56,35 @@ discard block |
||
56 | 56 | |
57 | 57 | $this->argument['managerTraitNamespace'] = Utils::getNamespace($this->directory['clientNameDir'].'/'.$name.'Trait.php'); |
58 | 58 | |
59 | - if(!file_exists($manager = $this->directory['clientNameDir'].'/'.$name.'Manager.php')){ |
|
59 | + if (!file_exists($manager = $this->directory['clientNameDir'].'/'.$name.'Manager.php')) { |
|
60 | 60 | $this->touch['client/manager'] = $manager; |
61 | 61 | $this->touch['client/managertrait'] = $this->directory['clientNameDir'].'/'.$name.'Trait.php'; |
62 | 62 | |
63 | 63 | } |
64 | 64 | |
65 | - if(isset($this->argument['trait'])){ |
|
65 | + if (isset($this->argument['trait'])) { |
|
66 | 66 | $this->argument['name'] = $this->argument['trait']; |
67 | 67 | |
68 | - if(!file_exists($managerCustomTrait = $this->directory['clientNameDir'].'/'.$this->argument['trait'].'Trait.php')){ |
|
68 | + if (!file_exists($managerCustomTrait = $this->directory['clientNameDir'].'/'.$this->argument['trait'].'Trait.php')) { |
|
69 | 69 | $this->touch['client/managercustomtrait'] = $managerCustomTrait; |
70 | 70 | } |
71 | 71 | |
72 | 72 | $this->argument['managerTraitNamespace'] = Utils::getNamespace($managerCustomTrait); |
73 | 73 | } |
74 | 74 | |
75 | - if(!file_exists($this->directory['clientNameCreate'].'/Client.php')){ |
|
75 | + if (!file_exists($this->directory['clientNameCreate'].'/Client.php')) { |
|
76 | 76 | $this->touch['client/client'] = $this->directory['clientNameCreate'].'/Client.php'; |
77 | 77 | $this->touch['client/clientGenerator'] = $this->directory['clientNameCreate'].'/ClientGenerator.php'; |
78 | 78 | } |
79 | 79 | |
80 | 80 | $clientSourceNamespace = Utils::getNamespace($this->directory['clientSource'].'/'.$client.'.php'); |
81 | 81 | |
82 | - if(!file_exists($clientSourceName = $this->directory['clientSource'].'/'.$client.'.php')){ |
|
82 | + if (!file_exists($clientSourceName = $this->directory['clientSource'].'/'.$client.'.php')) { |
|
83 | 83 | $this->touch['client/source'] = $clientSourceName.''; |
84 | 84 | } |
85 | 85 | |
86 | 86 | |
87 | - if(!file_exists($this->directory['clientNameCreate'].'/ClientProvider.php')){ |
|
87 | + if (!file_exists($this->directory['clientNameCreate'].'/ClientProvider.php')) { |
|
88 | 88 | $this->touch['client/clientProvider'] = $this->directory['clientNameCreate'].'/ClientProvider.php'; |
89 | 89 | } |
90 | 90 | |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | |
99 | 99 | $nameGeneratorNamespace = Utils::getNamespace($managerPath = $this->directory['clientNameDir'].''.DIRECTORY_SEPARATOR.''.$nameManager.'.php'); |
100 | 100 | |
101 | - $generator = new Generator(path()->version(),'ClientManager'); |
|
101 | + $generator = new Generator(path()->version(), 'ClientManager'); |
|
102 | 102 | |
103 | 103 | $clientManager = app()->namespace()->version().'\\ClientManager'; |
104 | 104 | |
105 | 105 | $clientManagerResolve = new $clientManager; |
106 | 106 | |
107 | - if(!method_exists($clientManagerResolve,strtolower($name))){ |
|
107 | + if (!method_exists($clientManagerResolve, strtolower($name))) { |
|
108 | 108 | |
109 | 109 | $generator->createMethod([ |
110 | 110 | strtolower($name) |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | |
136 | 136 | } |
137 | 137 | |
138 | - $nameGenerator = new Generator($this->directory['clientNameDir'],$name.'Manager'); |
|
138 | + $nameGenerator = new Generator($this->directory['clientNameDir'], $name.'Manager'); |
|
139 | 139 | |
140 | 140 | $nameGeneratorNamespaceResolve = new $nameGeneratorNamespace; |
141 | 141 | |
142 | - if(!method_exists($nameGeneratorNamespaceResolve,strtolower($client))){ |
|
142 | + if (!method_exists($nameGeneratorNamespaceResolve, strtolower($client))) { |
|
143 | 143 | |
144 | 144 | $nameGenerator->createMethod([ |
145 | 145 | strtolower($client) |
@@ -219,8 +219,7 @@ |
||
219 | 219 | $table = $this->config['guard'][$this->guard]['deviceTokenRegister']; |
220 | 220 | |
221 | 221 | app()->register('authenticateDeviceTokenTable',$table); |
222 | - } |
|
223 | - else{ |
|
222 | + } else{ |
|
224 | 223 | app()->register('authenticateDeviceTokenTable','device_tokens'); |
225 | 224 | } |
226 | 225 |
@@ -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 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | { |
50 | 50 | $this->config = config('authenticate'); |
51 | 51 | |
52 | - if(!is_null($config = $this->provider('configuration'))){ |
|
52 | + if (!is_null($config = $this->provider('configuration'))) { |
|
53 | 53 | $this->config['guard'][$this->guard] = $config($this->config['guard'][$this->guard]); |
54 | 54 | } |
55 | 55 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function getAddToWhere() |
65 | 65 | { |
66 | - if(isset($this->config['guard'][$this->guard]['addToWhere'])){ |
|
66 | + if (isset($this->config['guard'][$this->guard]['addToWhere'])) { |
|
67 | 67 | return $this->config['guard'][$this->guard]['addToWhere']; |
68 | 68 | } |
69 | 69 | return null; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function getConfigToken() |
78 | 78 | { |
79 | - if(isset($this->config['guard'][$this->guard]['token'])){ |
|
79 | + if (isset($this->config['guard'][$this->guard]['token'])) { |
|
80 | 80 | return $this->config['guard'][$this->guard]['token']; |
81 | 81 | } |
82 | 82 | return null; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function provider($key) |
172 | 172 | { |
173 | - if(app()->has('authenticate.'.$key) && is_callable($provider = app()->get('authenticate.'.$key))){ |
|
173 | + if (app()->has('authenticate.'.$key) && is_callable($provider = app()->get('authenticate.'.$key))) { |
|
174 | 174 | return $provider; |
175 | 175 | } |
176 | 176 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | { |
210 | 210 | $table = $this->config['guard'][$this->guard]['table']; |
211 | 211 | |
212 | - app()->register('authenticateTable',$table); |
|
212 | + app()->register('authenticateTable', $table); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -219,13 +219,13 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public function deviceTokenTable() |
221 | 221 | { |
222 | - if(isset($this->config['guard'][$this->guard]['deviceTokenRegister'])){ |
|
222 | + if (isset($this->config['guard'][$this->guard]['deviceTokenRegister'])) { |
|
223 | 223 | $table = $this->config['guard'][$this->guard]['deviceTokenRegister']; |
224 | 224 | |
225 | - app()->register('authenticateDeviceTokenTable',$table); |
|
225 | + app()->register('authenticateDeviceTokenTable', $table); |
|
226 | 226 | } |
227 | - else{ |
|
228 | - app()->register('authenticateDeviceTokenTable','device_tokens'); |
|
227 | + else { |
|
228 | + app()->register('authenticateDeviceTokenTable', 'device_tokens'); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | } |
@@ -8,7 +8,7 @@ |
||
8 | 8 | /** |
9 | 9 | * @var array |
10 | 10 | */ |
11 | - protected $fillable = ['user_id','token','token_integer','device_agent','device_agent_integer','expire']; |
|
11 | + protected $fillable = ['user_id', 'token', 'token_integer', 'device_agent', 'device_agent_integer', 'expire']; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * User constructor. |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @param callable $callback |
30 | 30 | * @return mixed |
31 | 31 | */ |
32 | - public function exclude($middleware,callable $callback) |
|
32 | + public function exclude($middleware, callable $callback) |
|
33 | 33 | { |
34 | 34 | $this->result = true; |
35 | 35 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | //if there is exclude method |
43 | 43 | //in service middleware class |
44 | - if($this->existMethod()){ |
|
44 | + if ($this->existMethod()) { |
|
45 | 45 | |
46 | 46 | //call exclude method |
47 | 47 | /** |
@@ -50,24 +50,24 @@ discard block |
||
50 | 50 | $serviceMiddleware = $middleware['class']; |
51 | 51 | $excludes = $serviceMiddleware->exclude(); |
52 | 52 | |
53 | - foreach ($excludes as $excludeKey=>$excludeVal){ |
|
54 | - $this->excludeProcess($excludeKey,$excludeVal); |
|
53 | + foreach ($excludes as $excludeKey=>$excludeVal) { |
|
54 | + $this->excludeProcess($excludeKey, $excludeVal); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | 58 | //return true |
59 | - return Utils::returnCallback($this->result,$callback); |
|
59 | + return Utils::returnCallback($this->result, $callback); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | 63 | * @param $excludeKey |
64 | 64 | * @param $excludeVal |
65 | 65 | */ |
66 | - private function excludeProcess($excludeKey,$excludeVal) |
|
66 | + private function excludeProcess($excludeKey, $excludeVal) |
|
67 | 67 | { |
68 | - $this->excludeForAll($excludeKey,$excludeVal,function() use ($excludeKey,$excludeVal){ |
|
68 | + $this->excludeForAll($excludeKey, $excludeVal, function() use ($excludeKey, $excludeVal){ |
|
69 | 69 | |
70 | - if($excludeKey == $this->excludeList['middleware']['middlewareName']){ |
|
70 | + if ($excludeKey==$this->excludeList['middleware']['middlewareName']) { |
|
71 | 71 | $this->result = true; |
72 | 72 | $this->inArrayExclude($excludeVal); |
73 | 73 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | */ |
81 | 81 | private function existMethod() |
82 | 82 | { |
83 | - return Utils::existMethod($this->excludeList['middleware']['class'],'exclude'); |
|
83 | + return Utils::existMethod($this->excludeList['middleware']['class'], 'exclude'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -88,8 +88,8 @@ discard block |
||
88 | 88 | */ |
89 | 89 | private function inArrayExclude($exclude) |
90 | 90 | { |
91 | - foreach($exclude as $item){ |
|
92 | - if(in_array($item,$this->middleware['odds'])){ |
|
91 | + foreach ($exclude as $item) { |
|
92 | + if (in_array($item, $this->middleware['odds'])) { |
|
93 | 93 | $this->result = false; |
94 | 94 | } |
95 | 95 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @param callable $callback |
102 | 102 | * @return mixed |
103 | 103 | */ |
104 | - private function excludeForAll($excludeKey,$excludeVal,callable $callback) |
|
104 | + private function excludeForAll($excludeKey, $excludeVal, callable $callback) |
|
105 | 105 | { |
106 | 106 | return ($excludeKey=="all") ? $this->inArrayExclude($excludeVal) : call_user_func($callback); |
107 | 107 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * @var $type |
17 | 17 | */ |
18 | - public $type='project'; |
|
18 | + public $type = 'project'; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @var array |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * @var $commandRule |
34 | 34 | */ |
35 | - public $commandRule=[]; |
|
35 | + public $commandRule = []; |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * @method create |
@@ -47,17 +47,17 @@ discard block |
||
47 | 47 | $this->directory['projectDir'] = $this->projectPath(); |
48 | 48 | $this->argument['exceptionNamespace'] = app()->namespace()->exception(); |
49 | 49 | $this->argument['resourcePath'] = app()->path()->appResourche(); |
50 | - $this->argument['testNamespace'] = app()->namespace()->tests(); |
|
50 | + $this->argument['testNamespace'] = app()->namespace()->tests(); |
|
51 | 51 | |
52 | - $recursiveDefaultDirectory = explode("\\",$this->argument['project']); |
|
52 | + $recursiveDefaultDirectory = explode("\\", $this->argument['project']); |
|
53 | 53 | $this->argument['applicationName'] = pos($recursiveDefaultDirectory); |
54 | 54 | $recursiveDefaultDirectory[] = 'V1'; |
55 | 55 | $recursiveDefaultDirectoryList = []; |
56 | 56 | |
57 | - foreach (array_slice($recursiveDefaultDirectory,1) as $defaultDirectory){ |
|
57 | + foreach (array_slice($recursiveDefaultDirectory, 1) as $defaultDirectory) { |
|
58 | 58 | |
59 | - $recursiveDefaultDirectoryList[]=$defaultDirectory; |
|
60 | - $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/",$recursiveDefaultDirectoryList); |
|
59 | + $recursiveDefaultDirectoryList[] = $defaultDirectory; |
|
60 | + $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/", $recursiveDefaultDirectoryList); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | //$this->directory['optionalDir'] = $this->optional(); |
@@ -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'; |
@@ -121,16 +121,16 @@ discard block |
||
121 | 121 | $this->touch['resource/index'] = $this->resource().'/index.html'; |
122 | 122 | $this->touch['resource/index'] = $this->resource().'/'.StaticPathModel::$cache.'/index.html'; |
123 | 123 | $this->touch['stub/index'] = $this->stub().'/index.html'; |
124 | - $this->touch['stub/cccrudapp'] = $this->directory['stubControllerCreateCrudFileDir'] .'/app.stub'; |
|
125 | - $this->touch['stub/cccrudconf'] = $this->directory['stubControllerCreateCrudFileDir'] .'/conf.stub'; |
|
126 | - $this->touch['stub/cccrudcontrollerfilecrud'] = $this->directory['stubControllerCreateCrudFileDir'] .'/controllerfilecrud.stub'; |
|
127 | - $this->touch['stub/cccruddeveloper'] = $this->directory['stubControllerCreateCrudFileDir'] .'/developer.stub'; |
|
128 | - $this->touch['stub/cccruddoc'] = $this->directory['stubControllerCreateCrudFileDir'] .'/doc.stub'; |
|
129 | - $this->touch['stub/cccruddummy'] = $this->directory['stubControllerCreateCrudFileDir'] .'/dummy.stub'; |
|
130 | - $this->touch['stub/cccrudroute'] = $this->directory['stubControllerCreateCrudFileDir'] .'/routecrud.stub'; |
|
131 | - $this->touch['stub/cccrudpolicy'] = $this->directory['stubControllerCreateCrudFileDir'] .'/policy.stub'; |
|
132 | - $this->touch['stub/cccrudreadme'] = $this->directory['stubControllerCreateCrudFileDir'] .'/readme.stub'; |
|
133 | - $this->touch['stub/cccrudresourceindex'] = $this->directory['stubControllerCreateCrudFileDir'] .'/resourceIndex.stub'; |
|
124 | + $this->touch['stub/cccrudapp'] = $this->directory['stubControllerCreateCrudFileDir'].'/app.stub'; |
|
125 | + $this->touch['stub/cccrudconf'] = $this->directory['stubControllerCreateCrudFileDir'].'/conf.stub'; |
|
126 | + $this->touch['stub/cccrudcontrollerfilecrud'] = $this->directory['stubControllerCreateCrudFileDir'].'/controllerfilecrud.stub'; |
|
127 | + $this->touch['stub/cccruddeveloper'] = $this->directory['stubControllerCreateCrudFileDir'].'/developer.stub'; |
|
128 | + $this->touch['stub/cccruddoc'] = $this->directory['stubControllerCreateCrudFileDir'].'/doc.stub'; |
|
129 | + $this->touch['stub/cccruddummy'] = $this->directory['stubControllerCreateCrudFileDir'].'/dummy.stub'; |
|
130 | + $this->touch['stub/cccrudroute'] = $this->directory['stubControllerCreateCrudFileDir'].'/routecrud.stub'; |
|
131 | + $this->touch['stub/cccrudpolicy'] = $this->directory['stubControllerCreateCrudFileDir'].'/policy.stub'; |
|
132 | + $this->touch['stub/cccrudreadme'] = $this->directory['stubControllerCreateCrudFileDir'].'/readme.stub'; |
|
133 | + $this->touch['stub/cccrudresourceindex'] = $this->directory['stubControllerCreateCrudFileDir'].'/resourceIndex.stub'; |
|
134 | 134 | $this->touch['config/hateoas'] = $this->config().'/Hateoas.php'; |
135 | 135 | //$this->touch['config/response'] = $this->config().'/Response.php'; |
136 | 136 | $this->touch['config/redis'] = $this->config().'/Redis.php'; |
@@ -154,9 +154,9 @@ discard block |
||
154 | 154 | $this->touch['app/gitignore'] = $this->projectPath().'/.gitignore'; |
155 | 155 | $this->touch['app/composer'] = $this->projectPath().'/composer.json'; |
156 | 156 | $this->touch['test/index'] = $this->storage().'/index.html'; |
157 | - $this->touch['exception/authenticate'] = $this->directory['exceptionDir'] .'/AuthenticateException.php'; |
|
158 | - $this->touch['exception/noinput'] = $this->directory['exceptionDir'] .'/NoInputException.php'; |
|
159 | - $this->touch['helpers/general'] = $this->directory['helperDir'] .'/General.php'; |
|
157 | + $this->touch['exception/authenticate'] = $this->directory['exceptionDir'].'/AuthenticateException.php'; |
|
158 | + $this->touch['exception/noinput'] = $this->directory['exceptionDir'].'/NoInputException.php'; |
|
159 | + $this->touch['helpers/general'] = $this->directory['helperDir'].'/General.php'; |
|
160 | 160 | |
161 | 161 | //set project touch |
162 | 162 | $this->file->touch($this); |