@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | {
|
| 31 | 31 | // Use default autoload implementation |
| 32 | 32 | // Register given function as __autoload() implementation |
| 33 | - spl_autoload_register(function($class){
|
|
| 33 | + spl_autoload_register(function($class) {
|
|
| 34 | 34 | $this->getRegisterCallBackVar($class); |
| 35 | 35 | $this->registerCallBackFormatter(); |
| 36 | 36 | }); |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | private function getRegisterCallBackVar($class) :void |
| 46 | 46 | {
|
| 47 | - if(defined('root')){
|
|
| 47 | + if (defined('root')) {
|
|
| 48 | 48 | |
| 49 | 49 | $this->class = $class; |
| 50 | 50 | $this->classPath = root.''.DIRECTORY_SEPARATOR.''.$this->class.''.self::FileExtension; |
| 51 | - $this->classPath = str_replace("\\","/",$this->classPath);
|
|
| 51 | + $this->classPath = str_replace("\\", "/", $this->classPath);
|
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * return mixed |
| 59 | 59 | */ |
| 60 | - private function registerCallBackFormatter () |
|
| 60 | + private function registerCallBackFormatter() |
|
| 61 | 61 | {
|
| 62 | - $this->checkAliasClassFormatter($this->classPath,function() {
|
|
| 62 | + $this->checkAliasClassFormatter($this->classPath, function() {
|
|
| 63 | 63 | require($this->classPath); |
| 64 | 64 | }); |
| 65 | 65 | } |
@@ -71,16 +71,16 @@ discard block |
||
| 71 | 71 | * @param $callback |
| 72 | 72 | * @return mixed |
| 73 | 73 | */ |
| 74 | - private function checkAliasClassFormatter($class,$callback) |
|
| 74 | + private function checkAliasClassFormatter($class, $callback) |
|
| 75 | 75 | {
|
| 76 | 76 | $systemApp = []; |
| 77 | 77 | |
| 78 | - if(defined('app')){
|
|
| 78 | + if (defined('app')) {
|
|
| 79 | 79 | $systemApp = (new ClassAliasGroup())->handle(); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if(!file_exists($class)){
|
|
| 83 | - $this->getAliasClassFormatter($class,$systemApp); |
|
| 82 | + if (!file_exists($class)) {
|
|
| 83 | + $this->getAliasClassFormatter($class, $systemApp); |
|
| 84 | 84 | return false; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | * @param $class |
| 94 | 94 | * @param $systemApp |
| 95 | 95 | */ |
| 96 | - private function getAliasClassFormatter($class,$systemApp) |
|
| 96 | + private function getAliasClassFormatter($class, $systemApp) |
|
| 97 | 97 | {
|
| 98 | - $this->setAliasClassGroup($class,$systemApp); |
|
| 98 | + $this->setAliasClassGroup($class, $systemApp); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -104,14 +104,14 @@ discard block |
||
| 104 | 104 | * @param $class |
| 105 | 105 | * @param $systemApp |
| 106 | 106 | */ |
| 107 | - private function setAliasClassGroup($class,$systemApp) |
|
| 107 | + private function setAliasClassGroup($class, $systemApp) |
|
| 108 | 108 | {
|
| 109 | - $alias = str_replace(root.''.DIRECTORY_SEPARATOR.'','',$class); |
|
| 110 | - $alias = str_replace(self::FileExtension,'',$alias); |
|
| 109 | + $alias = str_replace(root.''.DIRECTORY_SEPARATOR.'', '', $class); |
|
| 110 | + $alias = str_replace(self::FileExtension, '', $alias); |
|
| 111 | 111 | |
| 112 | 112 | //set class_alias groups |
| 113 | - if(array_key_exists($alias,$systemApp)){
|
|
| 114 | - class_alias($systemApp[$alias],$alias); |
|
| 113 | + if (array_key_exists($alias, $systemApp)) {
|
|
| 114 | + class_alias($systemApp[$alias], $alias); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | } |
@@ -247,8 +247,7 @@ |
||
| 247 | 247 | tap($this['config'],function(ConfigProviderContracts $config) use($callback) {
|
| 248 | 248 | $config->setConfig(call_user_func($callback)); |
| 249 | 249 | }); |
| 250 | - } |
|
| 251 | - else{
|
|
| 250 | + } else{
|
|
| 252 | 251 | //set config instance exception for application |
| 253 | 252 | exception()->unexpectedValue('config instance is not loaded for application container');
|
| 254 | 253 | } |
@@ -48,12 +48,12 @@ discard block |
||
| 48 | 48 | * @param bool $console |
| 49 | 49 | * @param null $containerCacheFile |
| 50 | 50 | */ |
| 51 | - public function __construct($console=false,$containerCacheFile=null) |
|
| 51 | + public function __construct($console = false, $containerCacheFile = null) |
|
| 52 | 52 | {
|
| 53 | 53 | //get console status for cli |
| 54 | 54 | $this->console = (is_bool($console)) ? $console : true; |
| 55 | 55 | |
| 56 | - if(!is_null($containerCacheFile)){
|
|
| 56 | + if (!is_null($containerCacheFile)) {
|
|
| 57 | 57 | $this->containerCacheFile = $containerCacheFile; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | {
|
| 73 | 73 | // the booted objects are saved to the kernel. |
| 74 | 74 | // this method checks whether these objects are registered. |
| 75 | - return (isset($this['bindings'],$this['bindings'][$object])); |
|
| 75 | + return (isset($this['bindings'], $this['bindings'][$object])); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | // taking care of the differences between operating system |
| 89 | 89 | // and escaping arguments to prevent security issues. |
| 90 | 90 | // It replaces PHP functions like exec, passthru, shell_exec and system |
| 91 | - return $this->resolve(Command::class,['command'=>$command,'args'=>$arguments])->handle(); |
|
| 91 | + return $this->resolve(Command::class, ['command'=>$command, 'args'=>$arguments])->handle(); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function config($config) |
| 115 | 115 | {
|
| 116 | - if($this->checkBindings(__FUNCTION__)){
|
|
| 116 | + if ($this->checkBindings(__FUNCTION__)) {
|
|
| 117 | 117 | |
| 118 | 118 | /** @var Macro $macro */ |
| 119 | 119 | $macro = $this['macro']; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | // this includes the configuration macro class. |
| 122 | 122 | // therefore, you can expand your configuration settings from |
| 123 | 123 | // the application kernel identifier to the desired class. |
| 124 | - return $macro->withStatic(Config::macro(),function() use($config){
|
|
| 124 | + return $macro->withStatic(Config::macro(), function() use($config){
|
|
| 125 | 125 | return Config::make($config); |
| 126 | 126 | })->get(); |
| 127 | 127 | |
@@ -155,13 +155,13 @@ discard block |
||
| 155 | 155 | {
|
| 156 | 156 | // this is the method that allows container records |
| 157 | 157 | // to be written to a json file. |
| 158 | - if(!is_null($containerCacheFile = containerCacheFile())){
|
|
| 158 | + if (!is_null($containerCacheFile = containerCacheFile())) {
|
|
| 159 | 159 | return $containerCacheFile; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | // if the container json file is null |
| 163 | 163 | // then a registered container value is assigned. |
| 164 | - if(!is_null($this->containerCacheFile)){
|
|
| 164 | + if (!is_null($this->containerCacheFile)) {
|
|
| 165 | 165 | return $this->containerCacheFile; |
| 166 | 166 | } |
| 167 | 167 | |
@@ -186,9 +186,9 @@ discard block |
||
| 186 | 186 | * @param array $environment |
| 187 | 187 | * @return mixed|string |
| 188 | 188 | */ |
| 189 | - public function environment($environment=array()) |
|
| 189 | + public function environment($environment = array()) |
|
| 190 | 190 | {
|
| 191 | - if($this->checkBindings(__FUNCTION__)){
|
|
| 191 | + if ($this->checkBindings(__FUNCTION__)) {
|
|
| 192 | 192 | |
| 193 | 193 | $arguments = (isset(func_get_args()[0])) |
| 194 | 194 | ? func_get_args()[0] : func_get_args(); |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | $environmentContainer = $this['environment']; |
| 198 | 198 | |
| 199 | 199 | return $environmentContainer->environment( |
| 200 | - $arguments,$this['environmentVariables'] |
|
| 200 | + $arguments, $this['environmentVariables'] |
|
| 201 | 201 | ); |
| 202 | 202 | } |
| 203 | 203 | |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | public function isLocale() : bool |
| 230 | 230 | {
|
| 231 | 231 | //check environment for local |
| 232 | - return $this->environment() === 'local'; |
|
| 232 | + return $this->environment()==='local'; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | /** |
@@ -243,14 +243,14 @@ discard block |
||
| 243 | 243 | |
| 244 | 244 | // with the help of reflection instance, |
| 245 | 245 | // we get the kernel properties extended with the application object. |
| 246 | - foreach ($this['reflection']($this)->getProperties() as $property){
|
|
| 246 | + foreach ($this['reflection']($this)->getProperties() as $property) {
|
|
| 247 | 247 | $properties[] = $property->getName(); |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | // we get the names of |
| 251 | 251 | // the kernel properties ended with groups through the Collection class. |
| 252 | - [$groups] = Collection::make($properties)->partition(function($properties){
|
|
| 253 | - return Str::endsWith($properties,'Groups'); |
|
| 252 | + [$groups] = Collection::make($properties)->partition(function($properties) {
|
|
| 253 | + return Str::endsWith($properties, 'Groups'); |
|
| 254 | 254 | }); |
| 255 | 255 | |
| 256 | 256 | //as a result, kernel groups are being returned. |
@@ -267,8 +267,8 @@ discard block |
||
| 267 | 267 | $list = []; |
| 268 | 268 | |
| 269 | 269 | //get kernel group names with manifest method |
| 270 | - foreach ($this->kernelGroupKeys() as $groupKey){
|
|
| 271 | - $list = array_merge($list,$this->manifest($groupKey)); |
|
| 270 | + foreach ($this->kernelGroupKeys() as $groupKey) {
|
|
| 271 | + $list = array_merge($list, $this->manifest($groupKey)); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | return $list; |
@@ -284,14 +284,14 @@ discard block |
||
| 284 | 284 | {
|
| 285 | 285 | // it adds the values in path data specified |
| 286 | 286 | // by callback to the configuration values. |
| 287 | - if($this['config'] instanceof ConfigProviderContracts){
|
|
| 287 | + if ($this['config'] instanceof ConfigProviderContracts) {
|
|
| 288 | 288 | |
| 289 | 289 | //set your path for config loader |
| 290 | - tap($this['config'],function(ConfigProviderContracts $config) use($callback) {
|
|
| 290 | + tap($this['config'], function(ConfigProviderContracts $config) use($callback) {
|
|
| 291 | 291 | $config->setConfig(call_user_func($callback)); |
| 292 | 292 | }); |
| 293 | 293 | } |
| 294 | - else{
|
|
| 294 | + else {
|
|
| 295 | 295 | //set config instance exception for application |
| 296 | 296 | exception()->unexpectedValue('config instance is not loaded for application container');
|
| 297 | 297 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | * @param array $loaders |
| 304 | 304 | * @return mixed|void |
| 305 | 305 | */ |
| 306 | - public function loadIfNotExistBoot($loaders=array()) |
|
| 306 | + public function loadIfNotExistBoot($loaders = array()) |
|
| 307 | 307 | {
|
| 308 | 308 | //get kernel group list from application |
| 309 | 309 | $kernelGroupList = $this->kernelGroupList(); |
@@ -311,14 +311,14 @@ discard block |
||
| 311 | 311 | /** @var ClosureDispatcherContracts $closureBootLoader */ |
| 312 | 312 | $closureBootLoader = $this['closureBootLoader']; |
| 313 | 313 | |
| 314 | - foreach ($loaders as $loader){
|
|
| 314 | + foreach ($loaders as $loader) {
|
|
| 315 | 315 | |
| 316 | 316 | // if a service needs another boot service, |
| 317 | 317 | // the service is directly installed here and the service needs are resolved. |
| 318 | - if(isset($kernelGroupList[$loader]) && $this->checkBindings($loader)===false){
|
|
| 318 | + if (isset($kernelGroupList[$loader]) && $this->checkBindings($loader)===false) {
|
|
| 319 | 319 | |
| 320 | 320 | //with the boot loader kernel,we get the boot loader method. |
| 321 | - $closureBootLoader->call(function() use($loader,$kernelGroupList) {
|
|
| 321 | + $closureBootLoader->call(function() use($loader, $kernelGroupList) {
|
|
| 322 | 322 | |
| 323 | 323 | /** @var BootLoader $bootLoader */ |
| 324 | 324 | $bootLoader = $this; |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | $bootstrapper = $this['bootstrapper']; |
| 342 | 342 | |
| 343 | 343 | //kernel manifest bootstrapper |
| 344 | - return $bootstrapper->bootFire(null,$maker); |
|
| 344 | + return $bootstrapper->bootFire(null, $maker); |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | /** |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | public function runningInConsole() : bool |
| 353 | 353 | {
|
| 354 | 354 | //Determine if the application is running in the console. |
| 355 | - return php_sapi_name() === 'cli' || php_sapi_name() === 'phpdbg'; |
|
| 355 | + return php_sapi_name()==='cli' || php_sapi_name()==='phpdbg'; |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | /** |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | : []; |
| 369 | 369 | |
| 370 | 370 | //core kernel providers and project providers have been merged |
| 371 | - return array_merge($this->manifest('providers'),$providers);
|
|
| 371 | + return array_merge($this->manifest('providers'), $providers);
|
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | /** |
@@ -378,12 +378,12 @@ discard block |
||
| 378 | 378 | * @param string $path |
| 379 | 379 | * @return mixed|void |
| 380 | 380 | */ |
| 381 | - public function setPaths($name,$path) |
|
| 381 | + public function setPaths($name, $path) |
|
| 382 | 382 | {
|
| 383 | 383 | // save the globally identified paths to |
| 384 | 384 | // the global container object of the resta. |
| 385 | - if(file_exists($path)){
|
|
| 386 | - $this->register('paths',$name,$path);
|
|
| 385 | + if (file_exists($path)) {
|
|
| 386 | + $this->register('paths', $name, $path);
|
|
| 387 | 387 | } |
| 388 | 388 | } |
| 389 | 389 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | (new BaseRegister($this->app))->handle(); |
| 42 | 42 | |
| 43 | 43 | //we save the bootstrapper class in container. |
| 44 | - $this->app->register('bootstrapper',$this);
|
|
| 44 | + $this->app->register('bootstrapper', $this);
|
|
| 45 | 45 | |
| 46 | 46 | //call bootstrapper process |
| 47 | 47 | $this->callBootstrapperProcess(); |
@@ -59,11 +59,11 @@ discard block |
||
| 59 | 59 | {
|
| 60 | 60 | //The boot method to be executed can be specified by the user. |
| 61 | 61 | //We use this method to know how to customize it. |
| 62 | - BootFireCallback::setBootFire([$this->app,$bootstrapper],function($boot){
|
|
| 62 | + BootFireCallback::setBootFire([$this->app, $bootstrapper], function($boot) {
|
|
| 63 | 63 | |
| 64 | 64 | //kernel boots run and service container |
| 65 | 65 | //makeBuild for service Container |
| 66 | - $this->bootFire($boot,null); |
|
| 66 | + $this->bootFire($boot, null); |
|
| 67 | 67 | }); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -74,11 +74,11 @@ discard block |
||
| 74 | 74 | * @param string $maker |
| 75 | 75 | * @return mixed |
| 76 | 76 | */ |
| 77 | - public function bootFire($boot,$maker) |
|
| 77 | + public function bootFire($boot, $maker) |
|
| 78 | 78 | {
|
| 79 | 79 | // we can refer to this method |
| 80 | 80 | // because we can boot classes in the middleware or bootstrapper array. |
| 81 | - if(is_null($boot) && !is_null($maker)){
|
|
| 81 | + if (is_null($boot) && !is_null($maker)) {
|
|
| 82 | 82 | |
| 83 | 83 | /** @var KernelManifestManager $kernelManifestBind */ |
| 84 | 84 | $kernelManifestBind = $this->app->resolve(KernelManifestManager::class); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | // the boot method to be executed can be specified by the user. |
| 92 | 92 | // we use this method to know how to customize it. |
| 93 | - return forward_static_call_array([array_pop($boot),self::LOADBOOTSTRAPPERS],[$boot]); |
|
| 93 | + return forward_static_call_array([array_pop($boot), self::LOADBOOTSTRAPPERS], [$boot]); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -101,14 +101,14 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | private function bootstrapper(...$params) |
| 103 | 103 | {
|
| 104 | - [$group,$booting,$onion] = $params; |
|
| 104 | + [$group, $booting, $onion] = $params; |
|
| 105 | 105 | |
| 106 | - if($onion){
|
|
| 106 | + if ($onion) {
|
|
| 107 | 107 | |
| 108 | 108 | // we will implement a special onion method here and |
| 109 | 109 | // pass our bootstraper classes through this method. |
| 110 | 110 | // Our goal here is to implement the middleware layer correctly. |
| 111 | - $this->app->resolve(MiddlewareKernelProvider::class)->onionBoot([$group,$booting],function() use($group){
|
|
| 111 | + $this->app->resolve(MiddlewareKernelProvider::class)->onionBoot([$group, $booting], function() use($group){
|
|
| 112 | 112 | $this->boot($group); |
| 113 | 113 | }); |
| 114 | 114 | |
@@ -125,18 +125,18 @@ discard block |
||
| 125 | 125 | * |
| 126 | 126 | * @param array $customBootstrapers |
| 127 | 127 | */ |
| 128 | - public function callBootstrapperProcess($customBootstrapers=[]) |
|
| 128 | + public function callBootstrapperProcess($customBootstrapers = []) |
|
| 129 | 129 | {
|
| 130 | 130 | // here we check that a special bootstrappers list will work and we identify the onion identifier. |
| 131 | 131 | // we are peeling onion class by classifying onion class. |
| 132 | 132 | $this->getBootstrappersStack($customBootstrapers); |
| 133 | 133 | |
| 134 | 134 | //We run the bootstrap list by callback with the object specified for the content respectively. |
| 135 | - foreach($this->stack['getBootstrappers'] as $bootstrapper){
|
|
| 135 | + foreach ($this->stack['getBootstrappers'] as $bootstrapper) {
|
|
| 136 | 136 | |
| 137 | 137 | // if the callback data is different from the application kernel, |
| 138 | 138 | // we will pass it to the pusher control for a special use. |
| 139 | - call_user_func_array([$this,'bootstrapper'],[$bootstrapper,$this,$this->stack['onionIdentifier']]); |
|
| 139 | + call_user_func_array([$this, 'bootstrapper'], [$bootstrapper, $this, $this->stack['onionIdentifier']]); |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | private function peelings() |
| 163 | 163 | {
|
| 164 | 164 | //if there are peelings |
| 165 | - if(isset($this->app['peelings'])){
|
|
| 165 | + if (isset($this->app['peelings'])) {
|
|
| 166 | 166 | |
| 167 | 167 | // We send the peelings property to |
| 168 | 168 | // the bootstrapperPeelOnion class. |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * @param ApplicationContracts $app |
| 21 | 21 | * @param array $boot |
| 22 | 22 | */ |
| 23 | - public function __construct($app,$boot=array()) |
|
| 23 | + public function __construct($app, $boot = array()) |
|
| 24 | 24 | {
|
| 25 | 25 | parent::__construct($app); |
| 26 | 26 | |
@@ -35,21 +35,21 @@ discard block |
||
| 35 | 35 | * @param array $boots |
| 36 | 36 | * @param bool $defaultBoot |
| 37 | 37 | */ |
| 38 | - private function bootstrapper($boots=array(),$defaultBoot=true) |
|
| 38 | + private function bootstrapper($boots = array(), $defaultBoot = true) |
|
| 39 | 39 | {
|
| 40 | 40 | //boot loop make bind calling |
| 41 | - foreach ($boots as $bootstrapper){
|
|
| 41 | + foreach ($boots as $bootstrapper) {
|
|
| 42 | 42 | |
| 43 | 43 | // for the default boot, we overwrite the bootstrapper class's bootstrapper property |
| 44 | 44 | // and load it with the boot method. |
| 45 | - if($defaultBoot){
|
|
| 45 | + if ($defaultBoot) {
|
|
| 46 | 46 | $this->app->loadIfNotExistBoot([$bootstrapper]); |
| 47 | 47 | } |
| 48 | 48 | // we will use the classical method for classes |
| 49 | 49 | // that will not boot from the kernel. |
| 50 | - else{
|
|
| 51 | - if(Utils::isNamespaceExists($bootstrapper) |
|
| 52 | - && false===isset($this->app['resolve'][$bootstrapper])){
|
|
| 50 | + else {
|
|
| 51 | + if (Utils::isNamespaceExists($bootstrapper) |
|
| 52 | + && false===isset($this->app['resolve'][$bootstrapper])) {
|
|
| 53 | 53 | $this->app->resolve($bootstrapper)->boot(); |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | private function customBootManifest(callable $callback) |
| 66 | 66 | {
|
| 67 | 67 | //we make custom boot |
| 68 | - if(isset($this->boot['custom'])){
|
|
| 69 | - return call_user_func_array($callback,[$this->boot['custom']]); |
|
| 68 | + if (isset($this->boot['custom'])) {
|
|
| 69 | + return call_user_func_array($callback, [$this->boot['custom']]); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
@@ -81,8 +81,8 @@ discard block |
||
| 81 | 81 | $defaultBoot = Collection::make($this->boot)->except('custom')->all();
|
| 82 | 82 | |
| 83 | 83 | //custom boot according to manifest bootManager |
| 84 | - $this->customBootManifest(function($boot){
|
|
| 85 | - $this->bootstrapper((array)$boot,false); |
|
| 84 | + $this->customBootManifest(function($boot) {
|
|
| 85 | + $this->bootstrapper((array)$boot, false); |
|
| 86 | 86 | }); |
| 87 | 87 | |
| 88 | 88 | // and as a result we now use |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | * @param $key |
| 23 | 23 | * @return mixed |
| 24 | 24 | */ |
| 25 | - abstract function annotation($method,$key); |
|
| 25 | + abstract function annotation($method, $key); |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * get input values from request object |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @param $reflection |
| 54 | 54 | */ |
| 55 | - public function setReflection($reflection){
|
|
| 55 | + public function setReflection($reflection) {
|
|
| 56 | 56 | |
| 57 | 57 | $this->request = ClosureDispatcher::bind($reflection); |
| 58 | 58 | } |
@@ -69,8 +69,7 @@ discard block |
||
| 69 | 69 | //catch exception |
| 70 | 70 | exception($this->exceptionParams[$key]['name'],$keyParams) |
| 71 | 71 | ->unexpectedValue($key.' input value is not valid as format ('.$data.')');
|
| 72 | - } |
|
| 73 | - else{
|
|
| 72 | + } else{
|
|
| 74 | 73 | //catch exception |
| 75 | 74 | exception()->unexpectedValue($key.' input value is not valid as format ('.$data.')');
|
| 76 | 75 | } |
@@ -128,8 +127,7 @@ discard block |
||
| 128 | 127 | $this->catchException($key,$regex[1]); |
| 129 | 128 | } |
| 130 | 129 | } |
| 131 | - } |
|
| 132 | - else{
|
|
| 130 | + } else{
|
|
| 133 | 131 | |
| 134 | 132 | // we control the regex rule that evaluates when only string arrives. |
| 135 | 133 | if(!preg_match('@'.$regex[1].'@is',$this->inputs[$key])){
|
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * @param ApplicationContracts $app |
| 22 | 22 | * @param $request |
| 23 | 23 | */ |
| 24 | - public function __construct(ApplicationContracts $app,$request) |
|
| 24 | + public function __construct(ApplicationContracts $app, $request) |
|
| 25 | 25 | {
|
| 26 | 26 | parent::__construct($app); |
| 27 | 27 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @param $key |
| 38 | 38 | * @return mixed|void |
| 39 | 39 | */ |
| 40 | - public function annotation($method,$key) |
|
| 40 | + public function annotation($method, $key) |
|
| 41 | 41 | {
|
| 42 | 42 | //set annotation value with getting reflection |
| 43 | 43 | $reflection = $this->getReflection('reflection')->reflectionMethodParams($method);
|
@@ -62,18 +62,18 @@ discard block |
||
| 62 | 62 | * @param string $key |
| 63 | 63 | * @param null|string $data |
| 64 | 64 | */ |
| 65 | - private function catchException($key,$data) |
|
| 65 | + private function catchException($key, $data) |
|
| 66 | 66 | {
|
| 67 | - if(isset($this->exceptionParams[$key])){
|
|
| 67 | + if (isset($this->exceptionParams[$key])) {
|
|
| 68 | 68 | |
| 69 | 69 | //get key params for exception params |
| 70 | 70 | $keyParams = ($this->exceptionParams[$key]['params']) ?? []; |
| 71 | 71 | |
| 72 | 72 | //catch exception |
| 73 | - exception($this->exceptionParams[$key]['name'],$keyParams) |
|
| 73 | + exception($this->exceptionParams[$key]['name'], $keyParams) |
|
| 74 | 74 | ->unexpectedValue($key.' input value is not valid as format ('.$data.')');
|
| 75 | 75 | } |
| 76 | - else{
|
|
| 76 | + else {
|
|
| 77 | 77 | //catch exception |
| 78 | 78 | exception()->unexpectedValue($key.' input value is not valid as format ('.$data.')');
|
| 79 | 79 | } |
@@ -86,23 +86,23 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | private function getException($key) |
| 88 | 88 | {
|
| 89 | - if(preg_match('@exception\((.*?)\)\r\n@is',$this->annotation,$exception)){
|
|
| 89 | + if (preg_match('@exception\((.*?)\)\r\n@is', $this->annotation, $exception)) {
|
|
| 90 | 90 | |
| 91 | - $exceptionSpaceExplode = explode(" ",$exception[1]);
|
|
| 91 | + $exceptionSpaceExplode = explode(" ", $exception[1]);
|
|
| 92 | 92 | |
| 93 | - foreach ($exceptionSpaceExplode as $exceptions){
|
|
| 94 | - $exceptionsDotExplode = explode(":",$exceptions);
|
|
| 93 | + foreach ($exceptionSpaceExplode as $exceptions) {
|
|
| 94 | + $exceptionsDotExplode = explode(":", $exceptions);
|
|
| 95 | 95 | $this->exceptionParams[$key][$exceptionsDotExplode[0]] = $exceptionsDotExplode[1]; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if(isset($this->exceptionParams[$key]['params'])){
|
|
| 98 | + if (isset($this->exceptionParams[$key]['params'])) {
|
|
| 99 | 99 | |
| 100 | - $paramsCommaExplode = explode(",",$this->exceptionParams[$key]['params']);
|
|
| 100 | + $paramsCommaExplode = explode(",", $this->exceptionParams[$key]['params']);
|
|
| 101 | 101 | unset($this->exceptionParams[$key]['params']); |
| 102 | 102 | |
| 103 | - foreach ($paramsCommaExplode as $params){
|
|
| 104 | - $paramsEqualExplode = explode("=",$params);
|
|
| 105 | - if(isset($paramsEqualExplode[0]) && isset($paramsEqualExplode[1])){
|
|
| 103 | + foreach ($paramsCommaExplode as $params) {
|
|
| 104 | + $paramsEqualExplode = explode("=", $params);
|
|
| 105 | + if (isset($paramsEqualExplode[0]) && isset($paramsEqualExplode[1])) {
|
|
| 106 | 106 | $this->exceptionParams[$key]['params'][$paramsEqualExplode[0]] = $paramsEqualExplode[1]; |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -119,24 +119,24 @@ discard block |
||
| 119 | 119 | {
|
| 120 | 120 | // with the method based regex annotation, |
| 121 | 121 | // we check the rule definition for our requests. |
| 122 | - if(preg_match('@regex\((.*?)\)\r\n@is',$this->annotation,$regex)){
|
|
| 123 | - if(isset($this->inputs[$key])){
|
|
| 122 | + if (preg_match('@regex\((.*?)\)\r\n@is', $this->annotation, $regex)) {
|
|
| 123 | + if (isset($this->inputs[$key])) {
|
|
| 124 | 124 | |
| 125 | 125 | // for the definition of rules, |
| 126 | 126 | // our inputs can be array and in this case we offer array option for user comfort. |
| 127 | - if(is_array($this->inputs[$key])){
|
|
| 127 | + if (is_array($this->inputs[$key])) {
|
|
| 128 | 128 | |
| 129 | - foreach ($this->inputs[$key] as $this->inputsKey => $this->inputsValue){
|
|
| 130 | - if(!preg_match('@'.$regex[1].'@is',$this->inputsValue)){
|
|
| 131 | - $this->catchException($key,$regex[1]); |
|
| 129 | + foreach ($this->inputs[$key] as $this->inputsKey => $this->inputsValue) {
|
|
| 130 | + if (!preg_match('@'.$regex[1].'@is', $this->inputsValue)) {
|
|
| 131 | + $this->catchException($key, $regex[1]); |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | - else{
|
|
| 135 | + else {
|
|
| 136 | 136 | |
| 137 | 137 | // we control the regex rule that evaluates when only string arrives. |
| 138 | - if(!preg_match('@'.$regex[1].'@is',$this->inputs[$key])){
|
|
| 139 | - $this->catchException($key,$regex[1]); |
|
| 138 | + if (!preg_match('@'.$regex[1].'@is', $this->inputs[$key])) {
|
|
| 139 | + $this->catchException($key, $regex[1]); |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | } |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | private function getRemove($key) |
| 153 | 153 | {
|
| 154 | - if(preg_match('@remove\((.*?)\)\r\n@is',$this->annotation,$remove)){
|
|
| 155 | - if(isset($this->inputs[$key])){
|
|
| 156 | - if(preg_match('@'.$remove[1].'@is',$this->inputs[$key])){
|
|
| 154 | + if (preg_match('@remove\((.*?)\)\r\n@is', $this->annotation, $remove)) {
|
|
| 155 | + if (isset($this->inputs[$key])) {
|
|
| 156 | + if (preg_match('@'.$remove[1].'@is', $this->inputs[$key])) {
|
|
| 157 | 157 | unset($this->inputs[$key]); |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -167,16 +167,16 @@ discard block |
||
| 167 | 167 | */ |
| 168 | 168 | private function getRules($key) |
| 169 | 169 | {
|
| 170 | - if(preg_match('@rule\((.*?)\)\r\n@is',$this->annotation,$rule)){
|
|
| 170 | + if (preg_match('@rule\((.*?)\)\r\n@is', $this->annotation, $rule)) {
|
|
| 171 | 171 | |
| 172 | 172 | $requestRules = $this->getReflection('rules');
|
| 173 | 173 | |
| 174 | - $rules = explode(":",$rule[1]);
|
|
| 175 | - if(isset($this->inputs[$key])){
|
|
| 176 | - foreach($rules as $rule){
|
|
| 177 | - if(isset($requestRules[$rule])){
|
|
| 178 | - if(!preg_match('@'.$requestRules[$rule].'@',$this->inputs[$key])){
|
|
| 179 | - exception($rule,['key'=>$key]) |
|
| 174 | + $rules = explode(":", $rule[1]);
|
|
| 175 | + if (isset($this->inputs[$key])) {
|
|
| 176 | + foreach ($rules as $rule) {
|
|
| 177 | + if (isset($requestRules[$rule])) {
|
|
| 178 | + if (!preg_match('@'.$requestRules[$rule].'@', $this->inputs[$key])) {
|
|
| 179 | + exception($rule, ['key'=>$key]) |
|
| 180 | 180 | ->invalidArgument($key.' input value is not valid for '.$rule.' request rule'); |
| 181 | 181 | } |
| 182 | 182 | } |
@@ -237,8 +237,7 @@ discard block |
||
| 237 | 237 | if(!isset($this->inputs[$generator])){
|
| 238 | 238 | $this->{$generator} = $this->{$generatorMethodName}();
|
| 239 | 239 | $this->inputs[$generator] = $this->{$generatorMethodName}();
|
| 240 | - } |
|
| 241 | - else {
|
|
| 240 | + } else {
|
|
| 242 | 241 | |
| 243 | 242 | if($this->checkProperties('auto_generators_dont_overwrite')
|
| 244 | 243 | && in_array($generator,$this->getAutoGeneratorsDontOverwrite())){
|
@@ -395,8 +394,7 @@ discard block |
||
| 395 | 394 | $keyMethod = $this->{$method}();
|
| 396 | 395 | $this->inputs[$key][] = $keyMethod; |
| 397 | 396 | } |
| 398 | - } |
|
| 399 | - else{
|
|
| 397 | + } else{
|
|
| 400 | 398 | if(isset($this->inputs[$key])){
|
| 401 | 399 | $keyMethod = $this->{$method}();
|
| 402 | 400 | $this->inputs[$key] = $keyMethod; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * |
| 48 | 48 | * @throws ReflectionExceptionAlias |
| 49 | 49 | */ |
| 50 | - public function __construct($clientData=null) |
|
| 50 | + public function __construct($clientData = null) |
|
| 51 | 51 | {
|
| 52 | 52 | //reflection process |
| 53 | 53 | $this->reflection = app()['reflection']($this); |
@@ -70,25 +70,25 @@ discard block |
||
| 70 | 70 | private function autoValidate($validate) |
| 71 | 71 | {
|
| 72 | 72 | //we get the values to auto-validate. |
| 73 | - foreach ($this->{$validate} as $object=>$datas){
|
|
| 73 | + foreach ($this->{$validate} as $object=>$datas) {
|
|
| 74 | 74 | |
| 75 | 75 | // the auto-validate value must necessarily represent a class. |
| 76 | 76 | // otherwise auto-validate is not used. |
| 77 | - if(Utils::isNamespaceExists($object)){
|
|
| 77 | + if (Utils::isNamespaceExists($object)) {
|
|
| 78 | 78 | $getObjectInstance = app()->resolve($object); |
| 79 | 79 | |
| 80 | 80 | // we get the index values, |
| 81 | 81 | // which are called methods of the auto-validate value that represents the class. |
| 82 | - foreach ($datas as $dataKey=>$data){
|
|
| 82 | + foreach ($datas as $dataKey=>$data) {
|
|
| 83 | 83 | |
| 84 | 84 | // if the methods of the auto-validate class resolved by the container resolve method apply, |
| 85 | 85 | // the process of auto-validate automatic implementation will be completed. |
| 86 | - if(is_numeric($dataKey) && method_exists($getObjectInstance,$data)){
|
|
| 87 | - if(isset($this->origin[$data])){
|
|
| 88 | - if(!is_array($this->origin[$data])){
|
|
| 86 | + if (is_numeric($dataKey) && method_exists($getObjectInstance, $data)) {
|
|
| 87 | + if (isset($this->origin[$data])) {
|
|
| 88 | + if (!is_array($this->origin[$data])) {
|
|
| 89 | 89 | $this->origin[$data] = array($this->origin[$data]); |
| 90 | 90 | } |
| 91 | - foreach ($this->origin[$data] as $originData){
|
|
| 91 | + foreach ($this->origin[$data] as $originData) {
|
|
| 92 | 92 | $getObjectInstance->{$data}($originData);
|
| 93 | 93 | } |
| 94 | 94 | } |
@@ -107,15 +107,15 @@ discard block |
||
| 107 | 107 | {
|
| 108 | 108 | // expected method is executed. |
| 109 | 109 | // this method is a must for http method values to be found in this property. |
| 110 | - if($this->checkProperties('capsule')){
|
|
| 110 | + if ($this->checkProperties('capsule')) {
|
|
| 111 | 111 | |
| 112 | 112 | $caret = $this->capsuleCaret(); |
| 113 | 113 | |
| 114 | - foreach($this->inputs as $input=>$value){
|
|
| 114 | + foreach ($this->inputs as $input=>$value) {
|
|
| 115 | 115 | |
| 116 | - if(isset($caret[$input]) || ( |
|
| 117 | - $this->checkProperties('capsule') && !in_array($input,$this->capsule)
|
|
| 118 | - )){
|
|
| 116 | + if (isset($caret[$input]) || ( |
|
| 117 | + $this->checkProperties('capsule') && !in_array($input, $this->capsule)
|
|
| 118 | + )) {
|
|
| 119 | 119 | exception('capsuleRequestException')
|
| 120 | 120 | ->overflow('The '.$input.' value cannot be sent.');
|
| 121 | 121 | } |
@@ -132,15 +132,15 @@ discard block |
||
| 132 | 132 | {
|
| 133 | 133 | $caret = []; |
| 134 | 134 | |
| 135 | - foreach($this->inputs as $input=>$item){
|
|
| 136 | - if(in_array('@'.$input,$this->capsule)){
|
|
| 135 | + foreach ($this->inputs as $input=>$item) {
|
|
| 136 | + if (in_array('@'.$input, $this->capsule)) {
|
|
| 137 | 137 | $caret[$input] = $item; |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | foreach ($this->capsule as $item) {
|
| 142 | - if(preg_match('#@.*#is',$item)){
|
|
| 143 | - $this->capsule = array_diff($this->capsule,[$item]); |
|
| 142 | + if (preg_match('#@.*#is', $item)) {
|
|
| 143 | + $this->capsule = array_diff($this->capsule, [$item]); |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | |
@@ -159,15 +159,15 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | // Determines which HTTP method |
| 161 | 161 | // the request object will be exposed to. |
| 162 | - if($this->checkProperties('http')){
|
|
| 162 | + if ($this->checkProperties('http')) {
|
|
| 163 | 163 | |
| 164 | 164 | // if the current http method does not exist |
| 165 | 165 | // in the http object, the exception will be thrown. |
| 166 | - if(!in_array($method,$this->http)){
|
|
| 166 | + if (!in_array($method, $this->http)) {
|
|
| 167 | 167 | |
| 168 | 168 | //exception batMethodCall |
| 169 | 169 | exception()->badMethodCall( |
| 170 | - 'Invalid http method process for '.class_basename($this).'.That is accepted http methods ['.implode(",",$this->http).'] ');
|
|
| 170 | + 'Invalid http method process for '.class_basename($this).'.That is accepted http methods ['.implode(",", $this->http).'] ');
|
|
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | {
|
| 183 | 183 | // from the properties of the object properties to |
| 184 | 184 | // the existing variables, control the array and at least one element. |
| 185 | - return (property_exists($this,$properties) |
|
| 185 | + return (property_exists($this, $properties) |
|
| 186 | 186 | && is_array($this->{$properties}) && count($this->{$properties})) ? true : false;
|
| 187 | 187 | } |
| 188 | 188 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | {
|
| 196 | 196 | // we are saving the expected values for the request in container. |
| 197 | 197 | // this record can be returned in exception information. |
| 198 | - app()->register('requestExpected',$this->expected);
|
|
| 198 | + app()->register('requestExpected', $this->expected);
|
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -207,15 +207,15 @@ discard block |
||
| 207 | 207 | public function except($except) |
| 208 | 208 | {
|
| 209 | 209 | // the except parameter is a callable value. |
| 210 | - if(is_callable($except)){
|
|
| 211 | - $call = call_user_func_array($except,[$this]); |
|
| 210 | + if (is_callable($except)) {
|
|
| 211 | + $call = call_user_func_array($except, [$this]); |
|
| 212 | 212 | $except = $call; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | // except with the except exceptions property |
| 216 | 216 | // and then assigning them to the inputs property. |
| 217 | - $this->except = array_merge($this->except,$except); |
|
| 218 | - $this->inputs = array_diff_key($this->inputs,array_flip($this->except)); |
|
| 217 | + $this->except = array_merge($this->except, $except); |
|
| 218 | + $this->inputs = array_diff_key($this->inputs, array_flip($this->except)); |
|
| 219 | 219 | |
| 220 | 220 | return $this; |
| 221 | 221 | } |
@@ -229,27 +229,27 @@ discard block |
||
| 229 | 229 | {
|
| 230 | 230 | // expected method is executed. |
| 231 | 231 | // this method is a must for http method values to be found in this property. |
| 232 | - if($this->checkProperties('expected')){
|
|
| 232 | + if ($this->checkProperties('expected')) {
|
|
| 233 | 233 | |
| 234 | 234 | // if the expected values are not found in the inputs array, |
| 235 | 235 | // the exception will be thrown. |
| 236 | - foreach ($this->expected as $expected){
|
|
| 236 | + foreach ($this->expected as $expected) {
|
|
| 237 | 237 | |
| 238 | 238 | $expectedValues = []; |
| 239 | 239 | |
| 240 | 240 | // mandatory expected data for each key can be separated by | operator. |
| 241 | 241 | // this is evaluated as "or". |
| 242 | - foreach($expectedData = explode("|",$expected) as $inputs){
|
|
| 243 | - if(!isset($this->inputs[$inputs])){
|
|
| 242 | + foreach ($expectedData = explode("|", $expected) as $inputs) {
|
|
| 243 | + if (!isset($this->inputs[$inputs])) {
|
|
| 244 | 244 | $expectedValues[] = $inputs; |
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | // if the expectedData and expectedValues |
| 249 | 249 | // array are numerically equal to the expected key, the exception is thrown. |
| 250 | - if(count($expectedData)===count($expectedValues)){
|
|
| 250 | + if (count($expectedData)===count($expectedValues)) {
|
|
| 251 | 251 | exception($expected) |
| 252 | - ->unexpectedValue('You absolutely have to send the value '.implode(" or ",$expectedValues).' for request object');
|
|
| 252 | + ->unexpectedValue('You absolutely have to send the value '.implode(" or ", $expectedValues).' for request object');
|
|
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | } |
@@ -264,17 +264,17 @@ discard block |
||
| 264 | 264 | {
|
| 265 | 265 | // check the presence of the generator object |
| 266 | 266 | // and operate the generator over this object. |
| 267 | - if($this->checkProperties('auto_generators')){
|
|
| 267 | + if ($this->checkProperties('auto_generators')) {
|
|
| 268 | 268 | $generators = $this->getAutoGenerators(); |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | // check the presence of the generator object |
| 272 | 272 | // and operate the generator over this object. |
| 273 | - if($this->checkProperties('generators')){
|
|
| 274 | - $generators = array_merge(isset($generators) ? $generators: [],$this->getGenerators()); |
|
| 273 | + if ($this->checkProperties('generators')) {
|
|
| 274 | + $generators = array_merge(isset($generators) ? $generators : [], $this->getGenerators()); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - if(isset($generators)){
|
|
| 277 | + if (isset($generators)) {
|
|
| 278 | 278 | $this->generatorMethod($generators); |
| 279 | 279 | } |
| 280 | 280 | } |
@@ -289,30 +289,30 @@ discard block |
||
| 289 | 289 | private function generatorMethod($generators) |
| 290 | 290 | {
|
| 291 | 291 | //generator array object |
| 292 | - foreach ($generators as $generator){
|
|
| 292 | + foreach ($generators as $generator) {
|
|
| 293 | 293 | |
| 294 | 294 | //generator method name |
| 295 | 295 | $generatorMethodName = $generator.'Generator'; |
| 296 | 296 | |
| 297 | 297 | // if the generator method is present, |
| 298 | 298 | // the fake value is assigned. |
| 299 | - if(method_exists($this,$generatorMethodName)){
|
|
| 299 | + if (method_exists($this, $generatorMethodName)) {
|
|
| 300 | 300 | |
| 301 | 301 | //fake registration |
| 302 | - if(!isset($this->inputs[$generator])){
|
|
| 302 | + if (!isset($this->inputs[$generator])) {
|
|
| 303 | 303 | $this->{$generator} = $this->{$generatorMethodName}();
|
| 304 | 304 | $this->inputs[$generator] = $this->{$generatorMethodName}();
|
| 305 | 305 | } |
| 306 | 306 | else {
|
| 307 | 307 | |
| 308 | - if($this->checkProperties('auto_generators_dont_overwrite')
|
|
| 309 | - && in_array($generator,$this->getAutoGeneratorsDontOverwrite())){
|
|
| 308 | + if ($this->checkProperties('auto_generators_dont_overwrite')
|
|
| 309 | + && in_array($generator, $this->getAutoGeneratorsDontOverwrite())) {
|
|
| 310 | 310 | $this->{$generator} = $this->{$generatorMethodName}();
|
| 311 | 311 | $this->inputs[$generator] = $this->{$generatorMethodName}();
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - if($this->checkProperties('generators_dont_overwrite')
|
|
| 315 | - && in_array($generator,$this->getGeneratorsDontOverwrite())){
|
|
| 314 | + if ($this->checkProperties('generators_dont_overwrite')
|
|
| 315 | + && in_array($generator, $this->getGeneratorsDontOverwrite())) {
|
|
| 316 | 316 | $this->{$generator} = $this->{$generatorMethodName}();
|
| 317 | 317 | $this->inputs[$generator] = $this->{$generatorMethodName}();
|
| 318 | 318 | } |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | {
|
| 360 | 360 | // we use the http method to write |
| 361 | 361 | // the values to the inputs and origin properties. |
| 362 | - foreach($this->clientData as $key=>$value){
|
|
| 362 | + foreach ($this->clientData as $key=>$value) {
|
|
| 363 | 363 | |
| 364 | 364 | //inputs and origin properties |
| 365 | 365 | $this->inputs[$key] = $value; |
@@ -406,9 +406,9 @@ discard block |
||
| 406 | 406 | |
| 407 | 407 | // we update the input values after |
| 408 | 408 | // we receive and check the saved objects. |
| 409 | - foreach ($clientObjects as $key=>$value){
|
|
| 409 | + foreach ($clientObjects as $key=>$value) {
|
|
| 410 | 410 | |
| 411 | - if(isset($clientObjects['origin'][$key])){
|
|
| 411 | + if (isset($clientObjects['origin'][$key])) {
|
|
| 412 | 412 | |
| 413 | 413 | $this->{$key} = $clientObjects['origin'][$key];
|
| 414 | 414 | $this->inputs[$key] = $this->{$key};
|
@@ -435,11 +435,11 @@ discard block |
||
| 435 | 435 | |
| 436 | 436 | // the request update to be performed using |
| 437 | 437 | // the method name to be used with the http method. |
| 438 | - $this->setRequestInputs($requestMethod,$key); |
|
| 438 | + $this->setRequestInputs($requestMethod, $key); |
|
| 439 | 439 | |
| 440 | 440 | // the request update to be performed using |
| 441 | 441 | // the method name to be used without the http method. |
| 442 | - $this->setRequestInputs($key,$key); |
|
| 442 | + $this->setRequestInputs($key, $key); |
|
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | /** |
@@ -450,28 +450,28 @@ discard block |
||
| 450 | 450 | * |
| 451 | 451 | * @throws ReflectionExceptionAlias |
| 452 | 452 | */ |
| 453 | - private function setRequestInputs($method,$key) |
|
| 453 | + private function setRequestInputs($method, $key) |
|
| 454 | 454 | {
|
| 455 | - if(method_exists($this,$method) && $this->reflection->reflectionMethodParams($method)->isProtected){
|
|
| 455 | + if (method_exists($this, $method) && $this->reflection->reflectionMethodParams($method)->isProtected) {
|
|
| 456 | 456 | |
| 457 | 457 | //check annotations for method |
| 458 | - $annotation = app()->resolve(RequestAnnotationManager::class,['request'=>$this]); |
|
| 459 | - $annotation->annotation($method,$key); |
|
| 458 | + $annotation = app()->resolve(RequestAnnotationManager::class, ['request'=>$this]); |
|
| 459 | + $annotation->annotation($method, $key); |
|
| 460 | 460 | |
| 461 | - if(isset($this->inputs[$key]) && is_array($this->inputs[$key])){
|
|
| 461 | + if (isset($this->inputs[$key]) && is_array($this->inputs[$key])) {
|
|
| 462 | 462 | |
| 463 | 463 | $inputKeys = $this->inputs[$key]; |
| 464 | 464 | |
| 465 | 465 | $this->inputs[$key] = []; |
| 466 | - foreach ($inputKeys as $input){
|
|
| 466 | + foreach ($inputKeys as $input) {
|
|
| 467 | 467 | |
| 468 | 468 | $this->{$key} = $input;
|
| 469 | 469 | $keyMethod = $this->{$method}();
|
| 470 | 470 | $this->inputs[$key][] = $keyMethod; |
| 471 | 471 | } |
| 472 | 472 | } |
| 473 | - else{
|
|
| 474 | - if(isset($this->inputs[$key])){
|
|
| 473 | + else {
|
|
| 474 | + if (isset($this->inputs[$key])) {
|
|
| 475 | 475 | $keyMethod = $this->{$method}();
|
| 476 | 476 | $this->inputs[$key] = $keyMethod; |
| 477 | 477 | } |
@@ -489,8 +489,8 @@ discard block |
||
| 489 | 489 | {
|
| 490 | 490 | // the auto object validate property is the property |
| 491 | 491 | // where all of your request values are automatically validated. |
| 492 | - if(property_exists($this,'autoObjectValidate') |
|
| 493 | - && is_array($this->autoObjectValidate) && count($this->autoObjectValidate)){
|
|
| 492 | + if (property_exists($this, 'autoObjectValidate') |
|
| 493 | + && is_array($this->autoObjectValidate) && count($this->autoObjectValidate)) {
|
|
| 494 | 494 | $this->autoValidate('autoObjectValidate');
|
| 495 | 495 | } |
| 496 | 496 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | protected function getAutoGenerators() |
| 33 | 33 | {
|
| 34 | - if(property_exists($this,'auto_generators')){
|
|
| 34 | + if (property_exists($this, 'auto_generators')) {
|
|
| 35 | 35 | return $this->auto_generators; |
| 36 | 36 | } |
| 37 | 37 | return []; |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | protected function getAutoGeneratorsDontOverwrite() |
| 47 | 47 | {
|
| 48 | - if(property_exists($this,'auto_generators_dont_overwrite')){
|
|
| 48 | + if (property_exists($this, 'auto_generators_dont_overwrite')) {
|
|
| 49 | 49 | return $this->auto_generators_dont_overwrite; |
| 50 | 50 | } |
| 51 | 51 | return []; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | protected function getClientObjects() |
| 61 | 61 | {
|
| 62 | - return array_diff_key($this->getObjects(),['inputs'=>[]]); |
|
| 62 | + return array_diff_key($this->getObjects(), ['inputs'=>[]]); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | protected function getGenerators() |
| 71 | 71 | {
|
| 72 | - if(property_exists($this,'generators')){
|
|
| 72 | + if (property_exists($this, 'generators')) {
|
|
| 73 | 73 | return $this->generators; |
| 74 | 74 | } |
| 75 | 75 | return []; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | protected function getGeneratorsDontOverwrite() |
| 85 | 85 | {
|
| 86 | - if(property_exists($this,'generators_dont_overwrite')){
|
|
| 86 | + if (property_exists($this, 'generators_dont_overwrite')) {
|
|
| 87 | 87 | return $this->generators_dont_overwrite; |
| 88 | 88 | } |
| 89 | 89 | return []; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * @var array |
| 34 | 34 | */ |
| 35 | - public $commandRule=['helper']; |
|
| 35 | + public $commandRule = ['helper']; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @return mixed |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | public function create() |
| 41 | 41 | {
|
| 42 | 42 | |
| 43 | - if(!file_exists(app()->path()->helpers())){
|
|
| 44 | - $this->directory['helper'] = app()->path()->helpers(); |
|
| 43 | + if (!file_exists(app()->path()->helpers())) {
|
|
| 44 | + $this->directory['helper'] = app()->path()->helpers(); |
|
| 45 | 45 | $this->file->makeDirectory($this); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - $this->touch['helpers/general']= app()->path()->helpers().'/'.ucfirst($this->argument['helper']).'.php'; |
|
| 48 | + $this->touch['helpers/general'] = app()->path()->helpers().'/'.ucfirst($this->argument['helper']).'.php'; |
|
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | $this->file->touch($this); |