@@ -24,29 +24,29 @@ discard block |
||
24 | 24 | * @param $arg |
25 | 25 | * @return mixed |
26 | 26 | */ |
27 | - public static function annotationsLoaders($service,$arg) |
|
27 | + public static function annotationsLoaders($service, $arg) |
|
28 | 28 | { |
29 | 29 | //factory runner |
30 | - if($service=="factory"){ |
|
30 | + if ($service=="factory") { |
|
31 | 31 | return self::factory(); |
32 | 32 | } |
33 | 33 | //if $name starts with $needles for repository |
34 | - if(Str::endsWith($service,'Repository')){ |
|
34 | + if (Str::endsWith($service, 'Repository')) { |
|
35 | 35 | return self::repository($service); |
36 | 36 | } |
37 | 37 | |
38 | 38 | //if $name starts with $needles for source |
39 | - if(Str::endsWith($service,'Source')){ |
|
40 | - return self::source($service,$arg); |
|
39 | + if (Str::endsWith($service, 'Source')) { |
|
40 | + return self::source($service, $arg); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | //if $name starts with $needles for model |
44 | - if(Str::endsWith($service,'Builder')){ |
|
44 | + if (Str::endsWith($service, 'Builder')) { |
|
45 | 45 | return self::Builder(ucfirst($service)); |
46 | 46 | } |
47 | 47 | |
48 | 48 | |
49 | - if(method_exists(new self,$service)){ |
|
49 | + if (method_exists(new self, $service)) { |
|
50 | 50 | return self::$service($arg); |
51 | 51 | } |
52 | 52 | |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | private static function builder($service) |
76 | 76 | { |
77 | 77 | //we are making a namespace assignment for the builder. |
78 | - $builder=app()->namespace()->builder().'\BuilderMap'; |
|
78 | + $builder = app()->namespace()->builder().'\BuilderMap'; |
|
79 | 79 | |
80 | 80 | //we are getting builder instance. |
81 | 81 | return app()->resolve($builder); |
@@ -103,16 +103,16 @@ discard block |
||
103 | 103 | * @param array $bind |
104 | 104 | * @return mixed |
105 | 105 | */ |
106 | - public function container($instance,$class,$bind=array()) |
|
106 | + public function container($instance, $class, $bind = array()) |
|
107 | 107 | { |
108 | - if(!property_exists($instance->container(),$class)){ |
|
108 | + if (!property_exists($instance->container(), $class)) { |
|
109 | 109 | throw new \InvalidArgumentException('container object false for ('.$class.') object'); |
110 | 110 | } |
111 | 111 | |
112 | - $container=$instance->container()->{$class}; |
|
112 | + $container = $instance->container()->{$class}; |
|
113 | 113 | |
114 | - if(!is_array($instance->container()->{$class}) AND Utils::isNamespaceExists($container)){ |
|
115 | - return $instance->resolve($container,$bind); |
|
114 | + if (!is_array($instance->container()->{$class}) AND Utils::isNamespaceExists($container)) { |
|
115 | + return $instance->resolve($container, $bind); |
|
116 | 116 | } |
117 | 117 | return $instance->container()->{$class}; |
118 | 118 | } |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function createAppInstance($object) |
124 | 124 | { |
125 | - if(!defined('appInstance')){ |
|
126 | - define('appInstance',(base64_encode(serialize($object)))); |
|
125 | + if (!defined('appInstance')) { |
|
126 | + define('appInstance', (base64_encode(serialize($object)))); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
@@ -131,9 +131,9 @@ discard block |
||
131 | 131 | * @param array $arg |
132 | 132 | * @return mixed |
133 | 133 | */ |
134 | - private static function date($arg=array()) |
|
134 | + private static function date($arg = array()) |
|
135 | 135 | { |
136 | - $locale = (count($arg)=="0") ? config('app.locale','en') : current($arg); |
|
136 | + $locale = (count($arg)=="0") ? config('app.locale', 'en') : current($arg); |
|
137 | 137 | |
138 | 138 | return app()->resolve(Date::class)->setLocale($locale); |
139 | 139 | } |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | { |
154 | 154 | //we save an instance for the entire application |
155 | 155 | //and add it to the helper file to be accessed from anywhere in the application. |
156 | - if(!isset(self::$instance['appInstance'])){ |
|
157 | - self::$instance['appInstance']=unserialize(base64_decode(appInstance)); |
|
156 | + if (!isset(self::$instance['appInstance'])) { |
|
157 | + self::$instance['appInstance'] = unserialize(base64_decode(appInstance)); |
|
158 | 158 | return self::$instance['appInstance']; |
159 | 159 | } |
160 | 160 | return self::$instance['appInstance']; |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | */ |
182 | 182 | private static function queue() |
183 | 183 | { |
184 | - if(!isset(self::$instance['queue'])){ |
|
184 | + if (!isset(self::$instance['queue'])) { |
|
185 | 185 | |
186 | - self::$instance['queue']=(new Queue()); |
|
186 | + self::$instance['queue'] = (new Queue()); |
|
187 | 187 | return self::$instance['queue']; |
188 | 188 | |
189 | 189 | } |
@@ -195,18 +195,18 @@ discard block |
||
195 | 195 | * @param bool $namespace |
196 | 196 | * @return string |
197 | 197 | */ |
198 | - public static function repository($service,$namespace=false) |
|
198 | + public static function repository($service, $namespace = false) |
|
199 | 199 | { |
200 | 200 | //I can get the repository name from the magic method as a salt repository, |
201 | 201 | //after which we will edit it as an adapter namespace. |
202 | - $repositoryName=ucfirst(preg_replace('@Repository@is','',$service)); |
|
202 | + $repositoryName = ucfirst(preg_replace('@Repository@is', '', $service)); |
|
203 | 203 | |
204 | 204 | //If we then configure the name of the simple repository to be an adapter |
205 | 205 | //then we will give the user an example of the adapter class in each repository call. |
206 | 206 | $repositoryAdapterName = $repositoryName.'Adapter'; |
207 | 207 | $repositoryNamespace = app()->namespace()->repository().'\\'.$repositoryName.'\\'.$repositoryAdapterName; |
208 | 208 | |
209 | - if($namespace) return $repositoryNamespace; |
|
209 | + if ($namespace) return $repositoryNamespace; |
|
210 | 210 | |
211 | 211 | //and eventually we conclude the adapter class of the repository package as an instance. |
212 | 212 | return app()->resolve($repositoryNamespace)->adapter(); |
@@ -217,17 +217,17 @@ discard block |
||
217 | 217 | * @param $arg |
218 | 218 | * @return mixed |
219 | 219 | */ |
220 | - private static function source($service,$arg) |
|
220 | + private static function source($service, $arg) |
|
221 | 221 | { |
222 | 222 | //get Source path |
223 | - $service=ucfirst($service); |
|
224 | - $getCalledClass=str_replace('\\'.class_basename($arg[0]),'',get_class($arg[0])); |
|
225 | - $getCalledClass=class_basename($getCalledClass); |
|
223 | + $service = ucfirst($service); |
|
224 | + $getCalledClass = str_replace('\\'.class_basename($arg[0]), '', get_class($arg[0])); |
|
225 | + $getCalledClass = class_basename($getCalledClass); |
|
226 | 226 | |
227 | - $service=str_replace($getCalledClass,'',$service); |
|
227 | + $service = str_replace($getCalledClass, '', $service); |
|
228 | 228 | |
229 | 229 | //run service for endpoint |
230 | - $serviceSource=StaticPathModel::appSourceEndpoint().'\\'.$getCalledClass.'\\'.$service.'\Main'; |
|
230 | + $serviceSource = StaticPathModel::appSourceEndpoint().'\\'.$getCalledClass.'\\'.$service.'\Main'; |
|
231 | 231 | return app()->resolve($serviceSource); |
232 | 232 | } |
233 | 233 | |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public static function redis() |
238 | 238 | { |
239 | - if(!isset(self::$instance['redis'])){ |
|
239 | + if (!isset(self::$instance['redis'])) { |
|
240 | 240 | |
241 | - self::$instance['redis']=(new Redis())->client(); |
|
241 | + self::$instance['redis'] = (new Redis())->client(); |
|
242 | 242 | return self::$instance['redis']; |
243 | 243 | |
244 | 244 | } |
@@ -249,13 +249,13 @@ discard block |
||
249 | 249 | * @param null $param |
250 | 250 | * @return array|null|string |
251 | 251 | */ |
252 | - public function route($param=null) |
|
252 | + public function route($param = null) |
|
253 | 253 | { |
254 | - $kernel=self::getAppInstance()->kernel; |
|
254 | + $kernel = self::getAppInstance()->kernel; |
|
255 | 255 | |
256 | - $saltRouteParameters=$kernel->routeParameters; |
|
256 | + $saltRouteParameters = $kernel->routeParameters; |
|
257 | 257 | |
258 | - if($param===null){ |
|
258 | + if ($param===null) { |
|
259 | 259 | return $saltRouteParameters; |
260 | 260 | } |
261 | 261 | |
@@ -271,14 +271,14 @@ discard block |
||
271 | 271 | * @param array $select |
272 | 272 | * @return mixed|string |
273 | 273 | */ |
274 | - public function translator($data,$select=array()) |
|
274 | + public function translator($data, $select = array()) |
|
275 | 275 | { |
276 | - $lang=(new Lingua(path()->appLanguage())); |
|
276 | + $lang = (new Lingua(path()->appLanguage())); |
|
277 | 277 | |
278 | - $defaultLocale=config('app.locale'); |
|
278 | + $defaultLocale = config('app.locale'); |
|
279 | 279 | |
280 | - if(count($select)){ |
|
281 | - return $lang->include(['default'])->locale($defaultLocale)->get($data,$select); |
|
280 | + if (count($select)) { |
|
281 | + return $lang->include(['default'])->locale($defaultLocale)->get($data, $select); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | return $lang->include(['default'])->locale($defaultLocale)->get($data); |
@@ -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 | |
@@ -66,21 +66,21 @@ discard block |
||
66 | 66 | $this->touch['model/builder'] = $this->directory['builderDir'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].'Builder.php'; |
67 | 67 | $this->touch['model/contract'] = $this->directory['contract'].''.DIRECTORY_SEPARATOR.''.$this->argument['file'].'Contract.php'; |
68 | 68 | |
69 | - if(!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Scope.php')){ |
|
69 | + if (!file_exists($this->directory['helper'].''.DIRECTORY_SEPARATOR.'Scope.php')) { |
|
70 | 70 | $this->touch['model/scope'] = $this->directory['helper'].''.DIRECTORY_SEPARATOR.'Scope.php'; |
71 | 71 | } |
72 | 72 | |
73 | 73 | $tableMaps = $this->directory['modelDir'].''.DIRECTORY_SEPARATOR.'Map.php'; |
74 | 74 | |
75 | - $generator = new Generator($this->directory['builderDir'],'BuilderMap'); |
|
75 | + $generator = new Generator($this->directory['builderDir'], 'BuilderMap'); |
|
76 | 76 | |
77 | - if(!file_exists($this->directory['builderDir'].''.DIRECTORY_SEPARATOR.'BuilderMap.php')){ |
|
77 | + if (!file_exists($this->directory['builderDir'].''.DIRECTORY_SEPARATOR.'BuilderMap.php')) { |
|
78 | 78 | |
79 | 79 | $this->setAnnotations(); |
80 | 80 | $generator->createClass(); |
81 | 81 | } |
82 | 82 | |
83 | - if(!file_exists($this->touch['model/model'])){ |
|
83 | + if (!file_exists($this->touch['model/model'])) { |
|
84 | 84 | |
85 | 85 | $generator->createMethod([ |
86 | 86 | strtolower($this->argument['file']) |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | //set project touch |
104 | - $this->file->touch($this,[ |
|
104 | + $this->file->touch($this, [ |
|
105 | 105 | 'stub'=>'Model_Create' |
106 | 106 | ]); |
107 | 107 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | /** |
113 | 113 | * @return bool |
114 | 114 | */ |
115 | - private function setAnnotations(){ |
|
115 | + private function setAnnotations() { |
|
116 | 116 | |
117 | 117 | return Utils::changeClass(path()->serviceAnnotations().'.php', |
118 | 118 | ['Trait ServiceAnnotationsManager'=>'Trait ServiceAnnotationsManager'.PHP_EOL.' * @property \\'.app()->namespace()->builder().'\BuilderMap builder' |