@@ -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 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | private static function builder($service) |
100 | 100 | { |
101 | 101 | //we are making a namespace assignment for the builder. |
102 | - $builder=app()->namespace()->builder().'\BuilderMap'; |
|
102 | + $builder = app()->namespace()->builder().'\BuilderMap'; |
|
103 | 103 | |
104 | 104 | //we are getting builder instance. |
105 | 105 | return app()->resolve($builder); |
@@ -127,16 +127,16 @@ discard block |
||
127 | 127 | * @param array $bind |
128 | 128 | * @return mixed |
129 | 129 | */ |
130 | - public function container($instance,$class,$bind=array()) |
|
130 | + public function container($instance, $class, $bind = array()) |
|
131 | 131 | { |
132 | - if(!property_exists($instance->container(),$class)){ |
|
132 | + if (!property_exists($instance->container(), $class)) { |
|
133 | 133 | throw new \InvalidArgumentException('container object false for ('.$class.') object'); |
134 | 134 | } |
135 | 135 | |
136 | - $container=$instance->container()->{$class}; |
|
136 | + $container = $instance->container()->{$class}; |
|
137 | 137 | |
138 | - if(!is_array($instance->container()->{$class}) AND Utils::isNamespaceExists($container)){ |
|
139 | - return $instance->resolve($container,$bind); |
|
138 | + if (!is_array($instance->container()->{$class}) AND Utils::isNamespaceExists($container)) { |
|
139 | + return $instance->resolve($container, $bind); |
|
140 | 140 | } |
141 | 141 | return $instance->container()->{$class}; |
142 | 142 | } |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function createAppInstance($object) |
148 | 148 | { |
149 | - if(!defined('appInstance')){ |
|
150 | - define('appInstance',(base64_encode(serialize($object)))); |
|
149 | + if (!defined('appInstance')) { |
|
150 | + define('appInstance', (base64_encode(serialize($object)))); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
@@ -155,9 +155,9 @@ discard block |
||
155 | 155 | * @param array $arg |
156 | 156 | * @return mixed |
157 | 157 | */ |
158 | - private static function date($arg=array()) |
|
158 | + private static function date($arg = array()) |
|
159 | 159 | { |
160 | - $locale = (count($arg)=="0") ? config('app.locale','en') : current($arg); |
|
160 | + $locale = (count($arg)=="0") ? config('app.locale', 'en') : current($arg); |
|
161 | 161 | |
162 | 162 | return app()->resolve(Date::class)->setLocale($locale); |
163 | 163 | } |
@@ -177,8 +177,8 @@ discard block |
||
177 | 177 | { |
178 | 178 | //we save an instance for the entire application |
179 | 179 | //and add it to the helper file to be accessed from anywhere in the application. |
180 | - if(!isset(self::$instance['appInstance'])){ |
|
181 | - self::$instance['appInstance']=unserialize(base64_decode(appInstance)); |
|
180 | + if (!isset(self::$instance['appInstance'])) { |
|
181 | + self::$instance['appInstance'] = unserialize(base64_decode(appInstance)); |
|
182 | 182 | return self::$instance['appInstance']; |
183 | 183 | } |
184 | 184 | return self::$instance['appInstance']; |
@@ -205,9 +205,9 @@ discard block |
||
205 | 205 | */ |
206 | 206 | private static function queue() |
207 | 207 | { |
208 | - if(!isset(self::$instance['queue'])){ |
|
208 | + if (!isset(self::$instance['queue'])) { |
|
209 | 209 | |
210 | - self::$instance['queue']=(new Queue()); |
|
210 | + self::$instance['queue'] = (new Queue()); |
|
211 | 211 | return self::$instance['queue']; |
212 | 212 | |
213 | 213 | } |
@@ -219,18 +219,18 @@ discard block |
||
219 | 219 | * @param bool $namespace |
220 | 220 | * @return string |
221 | 221 | */ |
222 | - public static function repository($service,$namespace=false) |
|
222 | + public static function repository($service, $namespace = false) |
|
223 | 223 | { |
224 | 224 | //I can get the repository name from the magic method as a salt repository, |
225 | 225 | //after which we will edit it as an adapter namespace. |
226 | - $repositoryName=ucfirst(preg_replace('@Repository@is','',$service)); |
|
226 | + $repositoryName = ucfirst(preg_replace('@Repository@is', '', $service)); |
|
227 | 227 | |
228 | 228 | //If we then configure the name of the simple repository to be an adapter |
229 | 229 | //then we will give the user an example of the adapter class in each repository call. |
230 | 230 | $repositoryAdapterName = $repositoryName.'Adapter'; |
231 | 231 | $repositoryNamespace = app()->namespace()->repository().'\\'.$repositoryName.'\\'.$repositoryAdapterName; |
232 | 232 | |
233 | - if($namespace) return $repositoryNamespace; |
|
233 | + if ($namespace) return $repositoryNamespace; |
|
234 | 234 | |
235 | 235 | //and eventually we conclude the adapter class of the repository package as an instance. |
236 | 236 | return app()->resolve($repositoryNamespace)->adapter(); |
@@ -241,17 +241,17 @@ discard block |
||
241 | 241 | * @param $arg |
242 | 242 | * @return mixed |
243 | 243 | */ |
244 | - private static function source($service,$arg) |
|
244 | + private static function source($service, $arg) |
|
245 | 245 | { |
246 | 246 | //get Source path |
247 | - $service=ucfirst($service); |
|
248 | - $getCalledClass=str_replace('\\'.class_basename($arg[0]),'',get_class($arg[0])); |
|
249 | - $getCalledClass=class_basename($getCalledClass); |
|
247 | + $service = ucfirst($service); |
|
248 | + $getCalledClass = str_replace('\\'.class_basename($arg[0]), '', get_class($arg[0])); |
|
249 | + $getCalledClass = class_basename($getCalledClass); |
|
250 | 250 | |
251 | - $service=str_replace($getCalledClass,'',$service); |
|
251 | + $service = str_replace($getCalledClass, '', $service); |
|
252 | 252 | |
253 | 253 | //run service for endpoint |
254 | - $serviceSource=StaticPathModel::appSourceEndpoint().'\\'.$getCalledClass.'\\'.$service.'\Main'; |
|
254 | + $serviceSource = StaticPathModel::appSourceEndpoint().'\\'.$getCalledClass.'\\'.$service.'\Main'; |
|
255 | 255 | return app()->resolve($serviceSource); |
256 | 256 | } |
257 | 257 | |
@@ -260,9 +260,9 @@ discard block |
||
260 | 260 | */ |
261 | 261 | public static function redis() |
262 | 262 | { |
263 | - if(!isset(self::$instance['redis'])){ |
|
263 | + if (!isset(self::$instance['redis'])) { |
|
264 | 264 | |
265 | - self::$instance['redis']=(new Redis())->client(); |
|
265 | + self::$instance['redis'] = (new Redis())->client(); |
|
266 | 266 | return self::$instance['redis']; |
267 | 267 | |
268 | 268 | } |
@@ -273,13 +273,13 @@ discard block |
||
273 | 273 | * @param null $param |
274 | 274 | * @return array|null|string |
275 | 275 | */ |
276 | - public function route($param=null) |
|
276 | + public function route($param = null) |
|
277 | 277 | { |
278 | - $kernel=self::getAppInstance()->kernel; |
|
278 | + $kernel = self::getAppInstance()->kernel; |
|
279 | 279 | |
280 | - $saltRouteParameters=$kernel->routeParameters; |
|
280 | + $saltRouteParameters = $kernel->routeParameters; |
|
281 | 281 | |
282 | - if($param===null){ |
|
282 | + if ($param===null) { |
|
283 | 283 | return $saltRouteParameters; |
284 | 284 | } |
285 | 285 | |
@@ -295,25 +295,25 @@ discard block |
||
295 | 295 | * @param array $select |
296 | 296 | * @return mixed|string |
297 | 297 | */ |
298 | - public function translator($data,$select=array()) |
|
298 | + public function translator($data, $select = array()) |
|
299 | 299 | { |
300 | 300 | $languageDir = path()->appLanguage(); |
301 | 301 | |
302 | - $lang=(new Lingua($languageDir)); |
|
302 | + $lang = (new Lingua($languageDir)); |
|
303 | 303 | |
304 | - if(self::app()->has('locale')){ |
|
304 | + if (self::app()->has('locale')) { |
|
305 | 305 | $defaultLocale = self::app()->get('locale'); |
306 | 306 | } |
307 | - else{ |
|
307 | + else { |
|
308 | 308 | $defaultLocale = config('app.locale'); |
309 | 309 | } |
310 | 310 | |
311 | - if(!file_exists($languageDir.''.DIRECTORY_SEPARATOR.''.$defaultLocale)){ |
|
311 | + if (!file_exists($languageDir.''.DIRECTORY_SEPARATOR.''.$defaultLocale)) { |
|
312 | 312 | $defaultLocale = config('app.fallback_locale'); |
313 | 313 | } |
314 | 314 | |
315 | - if(count($select)){ |
|
316 | - return $lang->include(['default'])->locale($defaultLocale)->get($data,$select); |
|
315 | + if (count($select)) { |
|
316 | + return $lang->include(['default'])->locale($defaultLocale)->get($data, $select); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | return $lang->include(['default'])->locale($defaultLocale)->get($data); |