@@ -9,6 +9,6 @@ |
||
9 | 9 | * @param array $indexes |
10 | 10 | * @return mixed |
11 | 11 | */ |
12 | - public function indexes($index_name,$indexes=array()); |
|
12 | + public function indexes($index_name, $indexes = array()); |
|
13 | 13 | } |
14 | 14 |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | private function getWizardAlterInstance($group) |
92 | 92 | { |
93 | - $this->setAlterType('group',$group); |
|
93 | + $this->setAlterType('group', $group); |
|
94 | 94 | |
95 | 95 | return new WizardAlter($this); |
96 | 96 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | private function dropWizardAlterInstance($group) |
103 | 103 | { |
104 | - $this->setAlterType('group',$group); |
|
104 | + $this->setAlterType('group', $group); |
|
105 | 105 | |
106 | 106 | return $this; |
107 | 107 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | private function dropKeyWizardAlterInstance($group) |
114 | 114 | { |
115 | - $this->setAlterType('group',$group); |
|
115 | + $this->setAlterType('group', $group); |
|
116 | 116 | |
117 | 117 | return $this; |
118 | 118 | } |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | */ |
124 | 124 | private function addIndexWizardAlterInstance($group) |
125 | 125 | { |
126 | - $this->setAlterType('group',$group); |
|
126 | + $this->setAlterType('group', $group); |
|
127 | 127 | |
128 | 128 | return $this; |
129 | 129 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | private function addUniqueWizardAlterInstance($group) |
136 | 136 | { |
137 | - $this->setAlterType('group',$group); |
|
137 | + $this->setAlterType('group', $group); |
|
138 | 138 | |
139 | 139 | return $this; |
140 | 140 | } |
@@ -14,44 +14,44 @@ discard block |
||
14 | 14 | */ |
15 | 15 | public function processHandler() |
16 | 16 | { |
17 | - return $this->errorHandler(function(){ |
|
17 | + return $this->errorHandler(function() { |
|
18 | 18 | |
19 | 19 | $results = []; |
20 | 20 | |
21 | - foreach ($this->list as $table =>$datas){ |
|
21 | + foreach ($this->list as $table =>$datas) { |
|
22 | 22 | |
23 | - foreach ($datas as $data){ |
|
23 | + foreach ($datas as $data) { |
|
24 | 24 | |
25 | - $query = $this->queryBuilder($table,$data); |
|
25 | + $query = $this->queryBuilder($table, $data); |
|
26 | 26 | |
27 | 27 | $query = $query->handle(); |
28 | 28 | |
29 | - if($query===false){ |
|
29 | + if ($query===false) { |
|
30 | 30 | $results[] = []; |
31 | 31 | } |
32 | - else{ |
|
33 | - $status =($query['result']!==false) ? true : false; |
|
32 | + else { |
|
33 | + $status = ($query['result']!==false) ? true : false; |
|
34 | 34 | |
35 | - if($status){ |
|
35 | + if ($status) { |
|
36 | 36 | |
37 | - $this->schema->getConnection()->registerMigration($table,$data->getFile()); |
|
37 | + $this->schema->getConnection()->registerMigration($table, $data->getFile()); |
|
38 | 38 | |
39 | - if(app()->isLocale()){ |
|
39 | + if (app()->isLocale()) { |
|
40 | 40 | |
41 | 41 | $this->schema->getConnection()->generateEntity($table); |
42 | 42 | |
43 | - if(substr($table,-1)=='s'){ |
|
44 | - app()->command('model create','model:'.strtolower(substr($table,0,-1)).' table:'.$table.' entity:'.$table); |
|
43 | + if (substr($table, -1)=='s') { |
|
44 | + app()->command('model create', 'model:'.strtolower(substr($table, 0, -1)).' table:'.$table.' entity:'.$table); |
|
45 | 45 | } |
46 | - else{ |
|
47 | - app()->command('model create','model:'.strtolower($table).' table:'.$table.' entity:'.$table); |
|
46 | + else { |
|
47 | + app()->command('model create', 'model:'.strtolower($table).' table:'.$table.' entity:'.$table); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | 51 | |
52 | 52 | } |
53 | 53 | |
54 | - $results[]= [ |
|
54 | + $results[] = [ |
|
55 | 55 | 'success'=>$status, |
56 | 56 | 'file'=>$data->getFile(), |
57 | 57 | 'table'=>$table, |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | { |
82 | 82 | $alterBinds = $object->getAlterBinds(); |
83 | 83 | |
84 | - if(!is_null($alterBinds) && count($alterBinds)>1){ |
|
84 | + if (!is_null($alterBinds) && count($alterBinds)>1) { |
|
85 | 85 | exception()->runtime('Only one command can be applied to alter groups'); |
86 | 86 | } |
87 | 87 | |
88 | - if(count($object->getError())){ |
|
88 | + if (count($object->getError())) { |
|
89 | 89 | exception()->runtime(''.$object->getFile().' -> '.$object->getError()[0].''); |
90 | 90 | } |
91 | 91 |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | if($query===false){ |
30 | 30 | $results[] = []; |
31 | - } |
|
32 | - else{ |
|
31 | + } else{ |
|
33 | 32 | $status =($query['result']!==false) ? true : false; |
34 | 33 | |
35 | 34 | if($status){ |
@@ -42,8 +41,7 @@ discard block |
||
42 | 41 | |
43 | 42 | if(substr($table,-1)=='s'){ |
44 | 43 | app()->command('model create','model:'.strtolower(substr($table,0,-1)).' table:'.$table.' entity:'.$table); |
45 | - } |
|
46 | - else{ |
|
44 | + } else{ |
|
47 | 45 | app()->command('model create','model:'.strtolower($table).' table:'.$table.' entity:'.$table); |
48 | 46 | } |
49 | 47 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | public static function permissionMake($routeName) |
18 | 18 | { |
19 | - $permission = static::where('route_name',$routeName)->where('role_id',auth()->user()->role_id); |
|
19 | + $permission = static::where('route_name', $routeName)->where('role_id', auth()->user()->role_id); |
|
20 | 20 | |
21 | 21 | return ($permission->count()) ? true : false; |
22 | 22 | } |
@@ -16,17 +16,17 @@ |
||
16 | 16 | */ |
17 | 17 | public static function roleMake($role) |
18 | 18 | { |
19 | - $roleCriteria = explode(':',$role); |
|
19 | + $roleCriteria = explode(':', $role); |
|
20 | 20 | |
21 | - if(isset($roleCriteria[1])){ |
|
22 | - $role = static::where('name',$roleCriteria[0])-> |
|
23 | - where('status',1)->where('is_deleted',0)->where('role_state',$roleCriteria[1])->first(); |
|
21 | + if (isset($roleCriteria[1])) { |
|
22 | + $role = static::where('name', $roleCriteria[0])-> |
|
23 | + where('status', 1)->where('is_deleted', 0)->where('role_state', $roleCriteria[1])->first(); |
|
24 | 24 | |
25 | - if(is_null($role)){ |
|
25 | + if (is_null($role)) { |
|
26 | 26 | exception('roleDefinitorException')->runtime('roleDefinitorException'); |
27 | 27 | } |
28 | 28 | |
29 | - if(auth()->user()->role_id == $role->id){ |
|
29 | + if (auth()->user()->role_id==$role->id) { |
|
30 | 30 | return true; |
31 | 31 | } |
32 | 32 |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | $permission = $this->getPermission(); |
65 | 65 | $role = $this->getRole(); |
66 | 66 | |
67 | - if(is_null($this->role)){ |
|
67 | + if (is_null($this->role)) { |
|
68 | 68 | return $permission::permissionMake($this->routeName); |
69 | 69 | } |
70 | - else{ |
|
70 | + else { |
|
71 | 71 | return $role::roleMake($this->role); |
72 | 72 | } |
73 | 73 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param string $adapter |
105 | 105 | * @return RoleManager |
106 | 106 | */ |
107 | - public function setAdapter($adapter='Database') |
|
107 | + public function setAdapter($adapter = 'Database') |
|
108 | 108 | { |
109 | 109 | $this->adapter = $adapter; |
110 | 110 |
@@ -66,8 +66,7 @@ |
||
66 | 66 | |
67 | 67 | if(is_null($this->role)){ |
68 | 68 | return $permission::permissionMake($this->routeName); |
69 | - } |
|
70 | - else{ |
|
69 | + } else{ |
|
71 | 70 | return $role::roleMake($this->role); |
72 | 71 | } |
73 | 72 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @var $type |
15 | 15 | */ |
16 | - public $type='token'; |
|
16 | + public $type = 'token'; |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @var array |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * @var $commandRule |
32 | 32 | */ |
33 | - public $commandRule=['key']; |
|
33 | + public $commandRule = ['key']; |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * @return void |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $resolveClientApiToken = app()->resolve($clientApiToken); |
42 | 42 | |
43 | 43 | // |
44 | - $key= lcfirst($this->argument['key']); |
|
44 | + $key = lcfirst($this->argument['key']); |
|
45 | 45 | |
46 | 46 | echo $this->info($resolveClientApiToken->createToken($key)); |
47 | 47 | } |
@@ -51,8 +51,7 @@ discard block |
||
51 | 51 | $itemList = explode('=',$item); |
52 | 52 | if(isset($this->output[$itemList[0]]) && $this->output[$itemList[0]]==$itemList[1]){ |
53 | 53 | $filterResult[] = true; |
54 | - } |
|
55 | - else{ |
|
54 | + } else{ |
|
56 | 55 | $filterResult[] = false; |
57 | 56 | } |
58 | 57 | } |
@@ -65,8 +64,7 @@ discard block |
||
65 | 64 | echo ''.$this->output['trackNumber'].' - SUCCESS:'; |
66 | 65 | echo PHP_EOL; |
67 | 66 | echo 'Request Success : true'; |
68 | - } |
|
69 | - else{ |
|
67 | + } else{ |
|
70 | 68 | |
71 | 69 | echo ''.$this->output['trackNumber'].' - ERROR:'; |
72 | 70 | echo PHP_EOL; |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | * @param $output |
24 | 24 | * @param $arguments |
25 | 25 | */ |
26 | - public function __construct(ApplicationContracts $app,$output,$arguments) |
|
26 | + public function __construct(ApplicationContracts $app, $output, $arguments) |
|
27 | 27 | { |
28 | 28 | parent::__construct($app); |
29 | 29 | |
30 | - if(!$this->app->runningInConsole()){ |
|
30 | + if (!$this->app->runningInConsole()) { |
|
31 | 31 | exception()->runtime('Console application is missing'); |
32 | 32 | } |
33 | 33 | |
@@ -60,31 +60,31 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function handle($callback) |
62 | 62 | { |
63 | - if(isset($this->arguments['filter'])){ |
|
63 | + if (isset($this->arguments['filter'])) { |
|
64 | 64 | |
65 | 65 | $filterResult = []; |
66 | 66 | $filter = lcfirst($this->arguments['filter']); |
67 | 67 | |
68 | - foreach (explode('+',$filter) as $item){ |
|
69 | - $itemList = explode('=',$item); |
|
70 | - if(isset($this->output[$itemList[0]]) && $this->output[$itemList[0]]==$itemList[1]){ |
|
68 | + foreach (explode('+', $filter) as $item) { |
|
69 | + $itemList = explode('=', $item); |
|
70 | + if (isset($this->output[$itemList[0]]) && $this->output[$itemList[0]]==$itemList[1]) { |
|
71 | 71 | $filterResult[] = true; |
72 | 72 | } |
73 | - else{ |
|
73 | + else { |
|
74 | 74 | $filterResult[] = false; |
75 | 75 | } |
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | - if(!isset($filterResult) || (isset($filterResult) && is_array($filterResult) && !in_array(false,$filterResult))){ |
|
79 | + if (!isset($filterResult) || (isset($filterResult) && is_array($filterResult) && !in_array(false, $filterResult))) { |
|
80 | 80 | |
81 | - if($this->output['meta']['success']) |
|
81 | + if ($this->output['meta']['success']) |
|
82 | 82 | { |
83 | 83 | echo ''.$this->output['trackNumber'].' - SUCCESS:'; |
84 | 84 | echo PHP_EOL; |
85 | 85 | echo 'Request Success : true'; |
86 | 86 | } |
87 | - else{ |
|
87 | + else { |
|
88 | 88 | |
89 | 89 | echo ''.$this->output['trackNumber'].' - ERROR:'; |
90 | 90 | echo PHP_EOL; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | echo PHP_EOL; |
104 | 104 | $requestClientIp = (isset($this->output['clientIp'])) ? $this->output['clientIp'] : null; |
105 | - echo 'Client Ip: '.$requestClientIp ; |
|
105 | + echo 'Client Ip: '.$requestClientIp; |
|
106 | 106 | |
107 | 107 | echo PHP_EOL; |
108 | 108 | $requestEndpoint = (isset($this->output['requestUrl'])) ? $this->output['requestUrl'] : null; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | echo 'Client Key: '.$requestClientKey; |
127 | 127 | |
128 | 128 | echo PHP_EOL; |
129 | - if(is_callable($callback)){ |
|
129 | + if (is_callable($callback)) { |
|
130 | 130 | echo $callback($this); |
131 | 131 | } |
132 | 132 |
@@ -23,21 +23,21 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @throws \ReflectionException |
25 | 25 | */ |
26 | - public function call($class,$param,callable $callback) |
|
26 | + public function call($class, $param, callable $callback) |
|
27 | 27 | { |
28 | 28 | // We use the reflection class to solve |
29 | 29 | // the parameters of the class's methods. |
30 | - $param = $this->reflectionMethodParameters($class,$param); |
|
30 | + $param = $this->reflectionMethodParameters($class, $param); |
|
31 | 31 | |
32 | 32 | // the results of a number of processes will be given |
33 | 33 | // before the container pipeline method is given. |
34 | 34 | return $this->app->resolve(ContainerPipelineResolve::class)->handle( |
35 | - function() use($class,$param,$callback) |
|
35 | + function() use($class, $param, $callback) |
|
36 | 36 | { |
37 | 37 | // as a result |
38 | 38 | // we return the resolved class to the callback class |
39 | - $params = (object)['class'=>$class,'param'=>$param]; |
|
40 | - return call_user_func_array($callback,[$params]); |
|
39 | + $params = (object)['class'=>$class, 'param'=>$param]; |
|
40 | + return call_user_func_array($callback, [$params]); |
|
41 | 41 | }); |
42 | 42 | |
43 | 43 | } |
@@ -49,16 +49,16 @@ discard block |
||
49 | 49 | * @param $parameter |
50 | 50 | * @return array |
51 | 51 | */ |
52 | - private function checkParameterForContainer($containers,$parameter) |
|
52 | + private function checkParameterForContainer($containers, $parameter) |
|
53 | 53 | { |
54 | 54 | $containerParameterNameValue = false; |
55 | 55 | |
56 | - if(isset($containers[$parameter->getType()->getName()])){ |
|
56 | + if (isset($containers[$parameter->getType()->getName()])) { |
|
57 | 57 | $parameterNameResolve = $parameter->getType()->getName(); |
58 | 58 | $containerParameterNameValue = true; |
59 | 59 | } |
60 | 60 | |
61 | - if(!$containerParameterNameValue && isset($containers[$parameter->getName()])){ |
|
61 | + if (!$containerParameterNameValue && isset($containers[$parameter->getName()])) { |
|
62 | 62 | $parameterNameResolve = $parameter->getName(); |
63 | 63 | $containerParameterNameValue = true; |
64 | 64 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | // if the parameter is an object and |
67 | 67 | // this object is a service container object |
68 | 68 | // then the parameter will bind. |
69 | - if($parameter->getType()!==null && $containerParameterNameValue){ |
|
69 | + if ($parameter->getType()!==null && $containerParameterNameValue) { |
|
70 | 70 | |
71 | 71 | // Unpack the container object and |
72 | 72 | // bind it to the param variable. |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | return [$parameterName=>$parameterResolve]; |
86 | 86 | } |
87 | 87 | |
88 | - if($parameter->getType()!== NULL && Utils::isNamespaceExists($parameterNameResolve)){ |
|
88 | + if ($parameter->getType()!==NULL && Utils::isNamespaceExists($parameterNameResolve)) { |
|
89 | 89 | |
90 | 90 | // Unpack the container object and |
91 | 91 | // bind it to the param variable. |
@@ -108,12 +108,12 @@ discard block |
||
108 | 108 | */ |
109 | 109 | private function getReflectionMethod($class) |
110 | 110 | { |
111 | - if(!isset($class[0],$class[1])){ |
|
111 | + if (!isset($class[0], $class[1])) { |
|
112 | 112 | exception('containerResolvingMissing') |
113 | 113 | ->runtime('Container class resolving is missing'); |
114 | 114 | } |
115 | 115 | |
116 | - [$class,$method] = [$class[0],$class[1]]; |
|
116 | + [$class, $method] = [$class[0], $class[1]]; |
|
117 | 117 | |
118 | 118 | return $this->instanceReflection($this->app['reflection']($class)) |
119 | 119 | ->reflectionMethodParams($method); |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * @param $instance |
126 | 126 | * @return object|null |
127 | 127 | */ |
128 | - public function instanceReflection($instance=null) |
|
128 | + public function instanceReflection($instance = null) |
|
129 | 129 | { |
130 | - if(is_object($instance) && is_null(static::$reflectionInstance)){ |
|
130 | + if (is_object($instance) && is_null(static::$reflectionInstance)) { |
|
131 | 131 | static::$reflectionInstance = $instance; |
132 | 132 | } |
133 | 133 | |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | * |
144 | 144 | * @throws \ReflectionException |
145 | 145 | */ |
146 | - private function reflectionMethodParameters($class,$param) |
|
146 | + private function reflectionMethodParameters($class, $param) |
|
147 | 147 | { |
148 | 148 | $containers = []; |
149 | 149 | |
150 | 150 | //get service container objects. |
151 | - if(isset($this->app['serviceContainer'])){ |
|
151 | + if (isset($this->app['serviceContainer'])) { |
|
152 | 152 | $containers = $this->app['serviceContainer']; |
153 | 153 | } |
154 | 154 | |
@@ -161,23 +161,23 @@ discard block |
||
161 | 161 | // we provide the user with the container method document and take action. |
162 | 162 | // thus, we help the methods to have a cleaner code structure. |
163 | 163 | $this->app->resolve(ContainerMethodDocumentResolver::class, |
164 | - ['reflection'=>$this->instanceReflection(),'class'=>$class]); |
|
164 | + ['reflection'=>$this->instanceReflection(), 'class'=>$class]); |
|
165 | 165 | |
166 | 166 | // we group the parameters into type and |
167 | 167 | // name and bind them with the necessary logic. |
168 | - foreach ($parameters as $parameter){ |
|
168 | + foreach ($parameters as $parameter) { |
|
169 | 169 | |
170 | 170 | // if the parameter is an object and |
171 | 171 | // this object is a service container object |
172 | 172 | // then the parameter will bind. |
173 | - $checkParameterForContainer = $this->checkParameterForContainer($containers,$parameter); |
|
173 | + $checkParameterForContainer = $this->checkParameterForContainer($containers, $parameter); |
|
174 | 174 | |
175 | - $paramMerge = array_merge($param,$checkParameterForContainer); |
|
175 | + $paramMerge = array_merge($param, $checkParameterForContainer); |
|
176 | 176 | |
177 | 177 | // we do some useful logic bind for user benefit. |
178 | - $param = app()->resolve(GraceContainer::class,[ |
|
178 | + $param = app()->resolve(GraceContainer::class, [ |
|
179 | 179 | 'reflection' => $reflection->reflection |
180 | - ])->graceContainerBuilder($parameter,$paramMerge); |
|
180 | + ])->graceContainerBuilder($parameter, $paramMerge); |
|
181 | 181 | |
182 | 182 | } |
183 | 183 |