@@ -33,13 +33,13 @@ discard block |
||
| 33 | 33 | $kernelConfig = []; |
| 34 | 34 | |
| 35 | 35 | //we are getting the config data from the kernel object.. |
| 36 | - if(isset(core()->appConfig)){
|
|
| 36 | + if (isset(core()->appConfig)) {
|
|
| 37 | 37 | $kernelConfig = core()->appConfig; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | // if the config variable is not sent, |
| 41 | 41 | // we print the kernel config data directly. |
| 42 | - if(null===$this->config) {
|
|
| 42 | + if (null===$this->config) {
|
|
| 43 | 43 | return (count($kernelConfig)) ? $kernelConfig : null; |
| 44 | 44 | } |
| 45 | 45 | |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | $this->configList = Str::stringToArray($this->config); |
| 49 | 49 | |
| 50 | 50 | //if the config object exists in the kernel, start the process. |
| 51 | - if(isset($kernelConfig[$config = current($this->configList)])){
|
|
| 51 | + if (isset($kernelConfig[$config = current($this->configList)])) {
|
|
| 52 | 52 | |
| 53 | 53 | // get config data |
| 54 | 54 | // we process and rotate on point basis. |
| 55 | - $configData = $this->getConfigData($kernelConfig,$config); |
|
| 55 | + $configData = $this->getConfigData($kernelConfig, $config); |
|
| 56 | 56 | return $this->configProcessResult($configData); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -66,14 +66,14 @@ discard block |
||
| 66 | 66 | private function configProcessResult($config) |
| 67 | 67 | {
|
| 68 | 68 | //config data if dotted. |
| 69 | - if(count($this->configList)){
|
|
| 69 | + if (count($this->configList)) {
|
|
| 70 | 70 | |
| 71 | 71 | array_shift($this->configList); |
| 72 | 72 | $configdotted = $config; |
| 73 | 73 | |
| 74 | 74 | //we apply the dotted-knit config dataset as nested. |
| 75 | - foreach ($this->configList as $key=>$value){
|
|
| 76 | - $configdotted = Arr::isset($configdotted,$value); |
|
| 75 | + foreach ($this->configList as $key=>$value) {
|
|
| 76 | + $configdotted = Arr::isset($configdotted, $value); |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
@@ -90,22 +90,22 @@ discard block |
||
| 90 | 90 | * @throws \DI\DependencyException |
| 91 | 91 | * @throws \DI\NotFoundException |
| 92 | 92 | */ |
| 93 | - private function getConfigData($kernelConfig,$config) |
|
| 93 | + private function getConfigData($kernelConfig, $config) |
|
| 94 | 94 | {
|
| 95 | 95 | //if the config data is a class instance, we get it as an object. |
| 96 | - if(Utils::isNamespaceExists($configFile = $kernelConfig[$config]['namespace'])){
|
|
| 96 | + if (Utils::isNamespaceExists($configFile = $kernelConfig[$config]['namespace'])) {
|
|
| 97 | 97 | $configData = app()->resolve($configFile)->handle(); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | //if the config data is just an array. |
| 101 | - if(!isset($configData) && file_exists($configFile=$kernelConfig[$config]['file'])){
|
|
| 101 | + if (!isset($configData) && file_exists($configFile = $kernelConfig[$config]['file'])) {
|
|
| 102 | 102 | $configData = require($configFile); |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | // if there is data key in the kernelConfig array |
| 106 | 106 | // this is not the file data, |
| 107 | 107 | // a loading that contains a hand-written array. |
| 108 | - if(isset($kernelConfig[$config]['data'])) {
|
|
| 108 | + if (isset($kernelConfig[$config]['data'])) {
|
|
| 109 | 109 | return $kernelConfig[$config]['data']; |
| 110 | 110 | } |
| 111 | 111 | |
@@ -35,21 +35,21 @@ |
||
| 35 | 35 | * @param $bind |
| 36 | 36 | * @return mixed|string |
| 37 | 37 | */ |
| 38 | - public function controller($endpoint=null,$bind=array()) |
|
| 38 | + public function controller($endpoint = null, $bind = array()) |
|
| 39 | 39 | {
|
| 40 | - $call=Utils::getNamespace($this->appCall()); |
|
| 40 | + $call = Utils::getNamespace($this->appCall()); |
|
| 41 | 41 | |
| 42 | - if($endpoint===null) return $call; |
|
| 42 | + if ($endpoint===null) return $call; |
|
| 43 | 43 | |
| 44 | 44 | $bundleName = $call.'\\'.ucfirst($endpoint).''.StaticPathList::$controllerBundleName.''; |
| 45 | 45 | |
| 46 | - $endpointCall=$bundleName.'\\'.ucfirst($endpoint).''.StaticPathModel::$callClassPrefix; |
|
| 46 | + $endpointCall = $bundleName.'\\'.ucfirst($endpoint).''.StaticPathModel::$callClassPrefix; |
|
| 47 | 47 | |
| 48 | - if($bind===true) return $endpointCall; |
|
| 48 | + if ($bind===true) return $endpointCall; |
|
| 49 | 49 | |
| 50 | - if($bind=="bundle") return $bundleName; |
|
| 50 | + if ($bind=="bundle") return $bundleName; |
|
| 51 | 51 | |
| 52 | - return app()->resolve($endpointCall,$bind); |
|
| 52 | + return app()->resolve($endpointCall, $bind); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -39,15 +39,21 @@ |
||
| 39 | 39 | {
|
| 40 | 40 | $call=Utils::getNamespace($this->appCall()); |
| 41 | 41 | |
| 42 | - if($endpoint===null) return $call; |
|
| 42 | + if($endpoint===null) {
|
|
| 43 | + return $call; |
|
| 44 | + } |
|
| 43 | 45 | |
| 44 | 46 | $bundleName = $call.'\\'.ucfirst($endpoint).''.StaticPathList::$controllerBundleName.''; |
| 45 | 47 | |
| 46 | 48 | $endpointCall=$bundleName.'\\'.ucfirst($endpoint).''.StaticPathModel::$callClassPrefix; |
| 47 | 49 | |
| 48 | - if($bind===true) return $endpointCall; |
|
| 50 | + if($bind===true) {
|
|
| 51 | + return $endpointCall; |
|
| 52 | + } |
|
| 49 | 53 | |
| 50 | - if($bind=="bundle") return $bundleName; |
|
| 54 | + if($bind=="bundle") {
|
|
| 55 | + return $bundleName; |
|
| 56 | + } |
|
| 51 | 57 | |
| 52 | 58 | return app()->resolve($endpointCall,$bind); |
| 53 | 59 | } |
@@ -11,14 +11,14 @@ discard block |
||
| 11 | 11 | * @param null $group |
| 12 | 12 | * @return mixed|string |
| 13 | 13 | */ |
| 14 | - public static function projectPrefix($group=null) |
|
| 14 | + public static function projectPrefix($group = null) |
|
| 15 | 15 | {
|
| 16 | - if($group!==null){
|
|
| 16 | + if ($group!==null) {
|
|
| 17 | 17 | return self::$projectPrefix.''.DIRECTORY_SEPARATOR.''.$group; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - if(defined('group')){
|
|
| 21 | - return str_replace("\\","/",group);
|
|
| 20 | + if (defined('group')) {
|
|
| 21 | + return str_replace("\\", "/", group);
|
|
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | * @param $path |
| 28 | 28 | * @return mixed |
| 29 | 29 | */ |
| 30 | - public static function projectPath($prefix,$path) |
|
| 30 | + public static function projectPath($prefix, $path) |
|
| 31 | 31 | {
|
| 32 | - return str_replace($prefix.'',"",$path); |
|
| 32 | + return str_replace($prefix.'', "", $path); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | public static function appPath() |
| 59 | 59 | {
|
| 60 | 60 | //get app path for application |
| 61 | - return self::$appPath=root.''.DIRECTORY_SEPARATOR.''.self::$appDefine.'/app'; |
|
| 61 | + return self::$appPath = root.''.DIRECTORY_SEPARATOR.''.self::$appDefine.'/app'; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -75,10 +75,10 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public static function getAppStorage() |
| 77 | 77 | {
|
| 78 | - if(!defined('app')) define('app',null);
|
|
| 78 | + if (!defined('app')) define('app', null);
|
|
| 79 | 79 | |
| 80 | 80 | //get app path for application |
| 81 | - return self::projectPath(self::projectPrefix(),self::appPath().''.DIRECTORY_SEPARATOR.''.self::slashToBackSlash(app).''.self::$storage); |
|
| 81 | + return self::projectPath(self::projectPrefix(), self::appPath().''.DIRECTORY_SEPARATOR.''.self::slashToBackSlash(app).''.self::$storage); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -95,13 +95,13 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public static function getEnvironmentFile() |
| 97 | 97 | {
|
| 98 | - if(defined('app')){
|
|
| 98 | + if (defined('app')) {
|
|
| 99 | 99 | |
| 100 | - $appProject=explode("\\",app);
|
|
| 101 | - $app=str_replace("\\","",app);
|
|
| 102 | - $environmentFile=self::appPath().''.DIRECTORY_SEPARATOR.''.strtolower($app).'.yaml'; |
|
| 100 | + $appProject = explode("\\", app);
|
|
| 101 | + $app = str_replace("\\", "", app);
|
|
| 102 | + $environmentFile = self::appPath().''.DIRECTORY_SEPARATOR.''.strtolower($app).'.yaml'; |
|
| 103 | 103 | |
| 104 | - if(file_exists($environmentFile)){
|
|
| 104 | + if (file_exists($environmentFile)) {
|
|
| 105 | 105 | //get app path for application |
| 106 | 106 | return $environmentFile; |
| 107 | 107 | } |
@@ -116,11 +116,11 @@ discard block |
||
| 116 | 116 | * @param bool $path |
| 117 | 117 | * @return string |
| 118 | 118 | */ |
| 119 | - public static function appVersionRoot($app=null,$path=false) |
|
| 119 | + public static function appVersionRoot($app = null, $path = false) |
|
| 120 | 120 | {
|
| 121 | - $app=($app!==null) ? $app : (defined('app')) ? app : null;
|
|
| 121 | + $app = ($app!==null) ? $app : (defined('app')) ? app : null;
|
|
| 122 | 122 | |
| 123 | - if($path){
|
|
| 123 | + if ($path) {
|
|
| 124 | 124 | |
| 125 | 125 | return self::appPath().''.DIRECTORY_SEPARATOR.''.self::slashToBackSlash($app).''.DIRECTORY_SEPARATOR.''.UrlVersionIdentifier::version().''; |
| 126 | 126 | } |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | public static function getServiceConf() |
| 142 | 142 | {
|
| 143 | - if(defined('endpoint')){
|
|
| 144 | - return path()->controller(endpoint,true).''.DIRECTORY_SEPARATOR.''.StaticPathModel::$configurationInController.'/ServiceConf.php'; |
|
| 143 | + if (defined('endpoint')) {
|
|
| 144 | + return path()->controller(endpoint, true).''.DIRECTORY_SEPARATOR.''.StaticPathModel::$configurationInController.'/ServiceConf.php'; |
|
| 145 | 145 | } |
| 146 | 146 | return []; |
| 147 | 147 | } |
@@ -158,10 +158,10 @@ discard block |
||
| 158 | 158 | * @param bool $namespace |
| 159 | 159 | * @return string |
| 160 | 160 | */ |
| 161 | - public static function appConfig($namespace=false) |
|
| 161 | + public static function appConfig($namespace = false) |
|
| 162 | 162 | {
|
| 163 | 163 | //get app config path for application |
| 164 | - if(false===$namespace){
|
|
| 164 | + if (false===$namespace) {
|
|
| 165 | 165 | return self::appPath().''.DIRECTORY_SEPARATOR.''.self::slashToBackSlash(app).''.DIRECTORY_SEPARATOR.''.UrlVersionIdentifier::version().''.DIRECTORY_SEPARATOR.''.self::$config; |
| 166 | 166 | } |
| 167 | 167 | return self::$autoloadNamespace.'\\'.app.'\\'.UrlVersionIdentifier::version().'\\'.self::$config; |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | {
|
| 175 | 175 | //get http header |
| 176 | 176 | /*** @var $httpHeaders \Store\Config\HttpHeaders */ |
| 177 | - $httpHeaders=self::$store.'\Config\HttpHeaders'; |
|
| 177 | + $httpHeaders = self::$store.'\Config\HttpHeaders'; |
|
| 178 | 178 | |
| 179 | 179 | //return http headers |
| 180 | 180 | return $httpHeaders::$httpHeaders; |
@@ -193,10 +193,10 @@ discard block |
||
| 193 | 193 | * @param bool $path |
| 194 | 194 | * @return string |
| 195 | 195 | */ |
| 196 | - public static function appAnnotation($app=null,$path=false) |
|
| 196 | + public static function appAnnotation($app = null, $path = false) |
|
| 197 | 197 | {
|
| 198 | - if($path){
|
|
| 199 | - return self::appVersionRoot($app,true).'/ServiceAnnotationsManager.php'; |
|
| 198 | + if ($path) {
|
|
| 199 | + return self::appVersionRoot($app, true).'/ServiceAnnotationsManager.php'; |
|
| 200 | 200 | } |
| 201 | 201 | return self::appVersionRoot($app).'\\ServiceAnnotationsManager'; |
| 202 | 202 | } |
@@ -213,11 +213,11 @@ discard block |
||
| 213 | 213 | * @param null $app |
| 214 | 214 | * @return string |
| 215 | 215 | */ |
| 216 | - public static function appMiddlewarePath($app=null) |
|
| 216 | + public static function appMiddlewarePath($app = null) |
|
| 217 | 217 | {
|
| 218 | - if($app!==null){
|
|
| 219 | - if(!defined('app')){
|
|
| 220 | - define('app',$app);
|
|
| 218 | + if ($app!==null) {
|
|
| 219 | + if (!defined('app')) {
|
|
| 220 | + define('app', $app);
|
|
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | return self::$autoloadNamespace.'\\'.app.'\\'.UrlVersionIdentifier::version().'\\'.self::$middleware; |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | * @param null $app |
| 228 | 228 | * @return string |
| 229 | 229 | */ |
| 230 | - public static function appSourceEndpoint($app=null) |
|
| 230 | + public static function appSourceEndpoint($app = null) |
|
| 231 | 231 | {
|
| 232 | 232 | return self::appVersionRoot($app).'\\'.self::$optional.'\\'.self::$sourcePath.'\Endpoint'; |
| 233 | 233 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @param null $app |
| 237 | 237 | * @return string |
| 238 | 238 | */ |
| 239 | - public static function appBuilder($app=null) |
|
| 239 | + public static function appBuilder($app = null) |
|
| 240 | 240 | {
|
| 241 | 241 | return self::appVersionRoot($app).'\\'.self::$model.'\\'.self::$builder; |
| 242 | 242 | } |
@@ -279,6 +279,6 @@ discard block |
||
| 279 | 279 | */ |
| 280 | 280 | private static function slashToBackSlash($data) |
| 281 | 281 | {
|
| 282 | - return str_replace("\\","/",$data);
|
|
| 282 | + return str_replace("\\", "/", $data);
|
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | \ No newline at end of file |
@@ -75,7 +75,9 @@ |
||
| 75 | 75 | */ |
| 76 | 76 | public static function getAppStorage() |
| 77 | 77 | {
|
| 78 | - if(!defined('app')) define('app',null);
|
|
| 78 | + if(!defined('app')) {
|
|
| 79 | + define('app',null);
|
|
| 80 | + } |
|
| 79 | 81 | |
| 80 | 82 | //get app path for application |
| 81 | 83 | return self::projectPath(self::projectPrefix(),self::appPath().''.DIRECTORY_SEPARATOR.''.self::slashToBackSlash(app).''.self::$storage); |
@@ -183,8 +183,7 @@ |
||
| 183 | 183 | {
|
| 184 | 184 | if($locale===null){
|
| 185 | 185 | $faker=Factory::create(); |
| 186 | - } |
|
| 187 | - else{
|
|
| 186 | + } else{
|
|
| 188 | 187 | $faker=Factory::create($locale); |
| 189 | 188 | } |
| 190 | 189 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | function applicationKey() |
| 50 | 50 | {
|
| 51 | - if(property_exists($kernel=app()->kernel(),'applicationKey')){
|
|
| 51 | + if (property_exists($kernel = app()->kernel(), 'applicationKey')) {
|
|
| 52 | 52 | return $kernel->applicationKey; |
| 53 | 53 | } |
| 54 | 54 | return null; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | function bundleName() |
| 83 | 83 | {
|
| 84 | - if(defined('endpoint')){
|
|
| 84 | + if (defined('endpoint')) {
|
|
| 85 | 85 | |
| 86 | 86 | return endpoint.''.StaticPathList::$controllerBundleName; |
| 87 | 87 | } |
@@ -96,11 +96,11 @@ discard block |
||
| 96 | 96 | * @param null $default |
| 97 | 97 | * @return mixed|null |
| 98 | 98 | */ |
| 99 | - function config($config=null,$default=null) |
|
| 99 | + function config($config = null, $default = null) |
|
| 100 | 100 | {
|
| 101 | 101 | $configResult = app()->config($config); |
| 102 | 102 | |
| 103 | - if($configResult === null && $default!==null){
|
|
| 103 | + if ($configResult===null && $default!==null) {
|
|
| 104 | 104 | return $default; |
| 105 | 105 | } |
| 106 | 106 | |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | * @param $bind array |
| 116 | 116 | * @return mixed |
| 117 | 117 | */ |
| 118 | - function container($class,$bind=array()) |
|
| 118 | + function container($class, $bind = array()) |
|
| 119 | 119 | {
|
| 120 | - return app()->singleton()->appClass->container(appInstance(),$class,$bind); |
|
| 120 | + return app()->singleton()->appClass->container(appInstance(), $class, $bind); |
|
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | |
@@ -177,10 +177,10 @@ discard block |
||
| 177 | 177 | * @param array $params |
| 178 | 178 | * @return ExceptionContracts |
| 179 | 179 | */ |
| 180 | - function exception($name=null,$params=array()) |
|
| 180 | + function exception($name = null, $params = array()) |
|
| 181 | 181 | {
|
| 182 | - $exceptionManager=ExceptionManager::class; |
|
| 183 | - return app()->resolve($exceptionManager,['name'=>$name,'params'=>$params]); |
|
| 182 | + $exceptionManager = ExceptionManager::class; |
|
| 183 | + return app()->resolve($exceptionManager, ['name'=>$name, 'params'=>$params]); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
@@ -190,13 +190,13 @@ discard block |
||
| 190 | 190 | * @param null $locale |
| 191 | 191 | * @return Generator |
| 192 | 192 | */ |
| 193 | - function faker($locale=null) |
|
| 193 | + function faker($locale = null) |
|
| 194 | 194 | {
|
| 195 | - if($locale===null){
|
|
| 196 | - $faker=Factory::create(); |
|
| 195 | + if ($locale===null) {
|
|
| 196 | + $faker = Factory::create(); |
|
| 197 | 197 | } |
| 198 | - else{
|
|
| 199 | - $faker=Factory::create($locale); |
|
| 198 | + else {
|
|
| 199 | + $faker = Factory::create($locale); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | return $faker; |
@@ -207,8 +207,8 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | function fingerPrint() |
| 209 | 209 | {
|
| 210 | - return md5(sha1(implode("|",[
|
|
| 211 | - request()->getClientIp(),$_SERVER['HTTP_USER_AGENT'],applicationKey() |
|
| 210 | + return md5(sha1(implode("|", [
|
|
| 211 | + request()->getClientIp(), $_SERVER['HTTP_USER_AGENT'], applicationKey() |
|
| 212 | 212 | ]))); |
| 213 | 213 | } |
| 214 | 214 | } |
@@ -228,10 +228,10 @@ discard block |
||
| 228 | 228 | * @param null $default |
| 229 | 229 | * @return null |
| 230 | 230 | */ |
| 231 | - function get($param=null,$default=null) |
|
| 231 | + function get($param = null, $default = null) |
|
| 232 | 232 | {
|
| 233 | 233 | //symfony request query object |
| 234 | - $get=core()->get; |
|
| 234 | + $get = core()->get; |
|
| 235 | 235 | |
| 236 | 236 | return ($param===null) ? $get : (isset($get[$param]) ? $get[$param] : $default); |
| 237 | 237 | } |
@@ -244,14 +244,14 @@ discard block |
||
| 244 | 244 | * @param null $default |
| 245 | 245 | * @return array |
| 246 | 246 | */ |
| 247 | - function headers($param=null,$default=null) |
|
| 247 | + function headers($param = null, $default = null) |
|
| 248 | 248 | {
|
| 249 | - $list=[]; |
|
| 249 | + $list = []; |
|
| 250 | 250 | |
| 251 | 251 | //We only get the objects in the list name to match the header objects |
| 252 | 252 | //that come with the request path to the objects sent by the client |
| 253 | 253 | foreach (request()->headers->all() as $key=>$value) {
|
| 254 | - $list[$key]=$value; |
|
| 254 | + $list[$key] = $value; |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | //return header list |
@@ -276,9 +276,9 @@ discard block |
||
| 276 | 276 | * @param $file null |
| 277 | 277 | * @return LoggerHandler |
| 278 | 278 | */ |
| 279 | - function logger($file=null) |
|
| 279 | + function logger($file = null) |
|
| 280 | 280 | {
|
| 281 | - return app()->resolve(LoggerHandler::class,['file'=>$file]); |
|
| 281 | + return app()->resolve(LoggerHandler::class, ['file'=>$file]); |
|
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | */ |
| 301 | 301 | function response() |
| 302 | 302 | {
|
| 303 | - $object=debug_backtrace()[1]['object']; |
|
| 303 | + $object = debug_backtrace()[1]['object']; |
|
| 304 | 304 | return new ResponseOutManager($object); |
| 305 | 305 | } |
| 306 | 306 | } |
@@ -315,9 +315,9 @@ discard block |
||
| 315 | 315 | * @throws \DI\DependencyException |
| 316 | 316 | * @throws \DI\NotFoundException |
| 317 | 317 | */ |
| 318 | - function resolve($class,$bind=array()) |
|
| 318 | + function resolve($class, $bind = array()) |
|
| 319 | 319 | {
|
| 320 | - return app()->resolve($class,$bind); |
|
| 320 | + return app()->resolve($class, $bind); |
|
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | 323 | |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | */ |
| 329 | 329 | function policy() |
| 330 | 330 | {
|
| 331 | - $policyPath = implode('/',[
|
|
| 331 | + $policyPath = implode('/', [
|
|
| 332 | 332 | Route::getRouteControllerNamespace(), |
| 333 | 333 | 'Policy', |
| 334 | 334 | Route::getRouteControllerClass().'Policy' |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | |
| 337 | 337 | $policyNamespace = Utils::getNamespace($policyPath); |
| 338 | 338 | |
| 339 | - if(Utils::isNamespaceExists($policyNamespace)){
|
|
| 339 | + if (Utils::isNamespaceExists($policyNamespace)) {
|
|
| 340 | 340 | return app()->resolve(Utils::getNamespace($policyPath)); |
| 341 | 341 | } |
| 342 | 342 | |
@@ -351,10 +351,10 @@ discard block |
||
| 351 | 351 | * @param $key |
| 352 | 352 | * @return mixed |
| 353 | 353 | */ |
| 354 | - function route($key=null) |
|
| 354 | + function route($key = null) |
|
| 355 | 355 | {
|
| 356 | - if(is_null($key)){
|
|
| 357 | - return array_map(function($route){
|
|
| 356 | + if (is_null($key)) {
|
|
| 357 | + return array_map(function($route) {
|
|
| 358 | 358 | return strtolower($route); |
| 359 | 359 | },app()->singleton()->appClass->route($key)); |
| 360 | 360 | } |
@@ -382,10 +382,10 @@ discard block |
||
| 382 | 382 | * @param null $default |
| 383 | 383 | * @return mixed |
| 384 | 384 | */ |
| 385 | - function post($param=null,$default=null) |
|
| 385 | + function post($param = null, $default = null) |
|
| 386 | 386 | {
|
| 387 | 387 | //symfony request query object |
| 388 | - $post=core()->post; |
|
| 388 | + $post = core()->post; |
|
| 389 | 389 | |
| 390 | 390 | return ($param===null) ? $post : (isset($post[$param]) ? $post[$param] : $default); |
| 391 | 391 | } |
@@ -416,8 +416,8 @@ discard block |
||
| 416 | 416 | * @param array $select |
| 417 | 417 | * @return mixed |
| 418 | 418 | */ |
| 419 | - function trans($lang,$select=array()) |
|
| 419 | + function trans($lang, $select = array()) |
|
| 420 | 420 | {
|
| 421 | - return app()->singleton()->appClass->translator($lang,$select); |
|
| 421 | + return app()->singleton()->appClass->translator($lang, $select); |
|
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | \ No newline at end of file |
@@ -18,12 +18,12 @@ discard block |
||
| 18 | 18 | // We get instance for customBooter class |
| 19 | 19 | // we get our object-protected boot lists |
| 20 | 20 | // directly in the application class with the help of public access method. |
| 21 | - $customBooter = $app->resolve(CustomBooter::class,['boot'=>end($booter)]); |
|
| 21 | + $customBooter = $app->resolve(CustomBooter::class, ['boot'=>end($booter)]); |
|
| 22 | 22 | $boot = ($customBooter)->customBootstrappers($booter); |
| 23 | 23 | |
| 24 | 24 | // and as a result we now use |
| 25 | 25 | //the instance properties of our boot lists to include our implementation. |
| 26 | - $app->resolve(FinalBooting::class,['boot'=>$boot]); |
|
| 26 | + $app->resolve(FinalBooting::class, ['boot'=>$boot]); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | /** |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | * @param callable $callback |
| 32 | 32 | * @return mixed |
| 33 | 33 | */ |
| 34 | - public static function setBootFire($kernel=array(),callable $callback) |
|
| 34 | + public static function setBootFire($kernel = array(), callable $callback) |
|
| 35 | 35 | {
|
| 36 | 36 | //The boot method to be executed can be specified by the user. |
| 37 | 37 | //We use this method to know how to customize it. |
| 38 | - return call_user_func_array($callback,[self::setParametersForKernelCallback($kernel)]); |
|
| 38 | + return call_user_func_array($callback, [self::setParametersForKernelCallback($kernel)]); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -34,8 +34,7 @@ |
||
| 34 | 34 | // if not available, only the core is executed. |
| 35 | 35 | if(file_exists(app()->path()->storeDir())){
|
| 36 | 36 | $this->app->register('isAvailableStore',true);
|
| 37 | - } |
|
| 38 | - else{
|
|
| 37 | + } else{
|
|
| 39 | 38 | $this->app->register('isAvailableStore',false);
|
| 40 | 39 | } |
| 41 | 40 | } |
@@ -139,12 +139,12 @@ |
||
| 139 | 139 | if(Utils::isNamespaceExists($requestService)){
|
| 140 | 140 | |
| 141 | 141 | Request::setFactory(function(array $query = array(), |
| 142 | - array $request = array(), |
|
| 143 | - array $attributes = array(), |
|
| 144 | - array $cookies = array(), |
|
| 145 | - array $files = array(), |
|
| 146 | - array $server = array(), |
|
| 147 | - $content = null) use ($requestService) |
|
| 142 | + array $request = array(), |
|
| 143 | + array $attributes = array(), |
|
| 144 | + array $cookies = array(), |
|
| 145 | + array $files = array(), |
|
| 146 | + array $server = array(), |
|
| 147 | + $content = null) use ($requestService) |
|
| 148 | 148 | {
|
| 149 | 149 | return new $requestService($query, |
| 150 | 150 | $request, |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | // if the store directory is available, |
| 31 | 31 | // then the application process continues. |
| 32 | 32 | // if not available, only the core is executed. |
| 33 | - if(file_exists(app()->path()->storeDir())){
|
|
| 34 | - $this->app->register('isAvailableStore',true);
|
|
| 33 | + if (file_exists(app()->path()->storeDir())) {
|
|
| 34 | + $this->app->register('isAvailableStore', true);
|
|
| 35 | 35 | } |
| 36 | - else{
|
|
| 37 | - $this->app->register('isAvailableStore',false);
|
|
| 36 | + else {
|
|
| 37 | + $this->app->register('isAvailableStore', false);
|
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | {
|
| 49 | 49 | //we can use this method to move an instance of the application class with the kernel object |
| 50 | 50 | //and easily resolve an encrypted instance of all the kernel variables in our helper class. |
| 51 | - ClassAliasGroup::setAlias(App::class,'application'); |
|
| 51 | + ClassAliasGroup::setAlias(App::class, 'application'); |
|
| 52 | 52 | |
| 53 | 53 | //set base instances |
| 54 | 54 | $this->setBaseInstances(); |
| 55 | 55 | |
| 56 | 56 | //we define the general application instance object. |
| 57 | - define('appInstance',(base64_encode(serialize($this->app))));
|
|
| 57 | + define('appInstance', (base64_encode(serialize($this->app))));
|
|
| 58 | 58 | |
| 59 | 59 | //main loader for application |
| 60 | 60 | $this->mainLoader(); |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | // this function can be used for defining your own way of handling errors during runtime, |
| 70 | 70 | // for example in applications in which you need to do cleanup of data/files when a critical error happens, |
| 71 | 71 | // or when you need to trigger an error under certain conditions (using trigger_error()). |
| 72 | - if($this->app['isAvailableStore']){
|
|
| 73 | - $this->app->make('exception',function(){
|
|
| 72 | + if ($this->app['isAvailableStore']) {
|
|
| 73 | + $this->app->make('exception', function() {
|
|
| 74 | 74 | return ErrorProvider::class; |
| 75 | 75 | }); |
| 76 | 76 | } |
@@ -85,33 +85,33 @@ discard block |
||
| 85 | 85 | {
|
| 86 | 86 | // for revision records, |
| 87 | 87 | // the master key is assigned as revision. |
| 88 | - $this->app->register('revision',[]);
|
|
| 88 | + $this->app->register('revision', []);
|
|
| 89 | 89 | |
| 90 | 90 | //we're saving the directory where kernel files are running to the kernel object. |
| 91 | - $this->app->register('corePath',str_replace('Foundation','',__DIR__.''));
|
|
| 91 | + $this->app->register('corePath', str_replace('Foundation', '', __DIR__.''));
|
|
| 92 | 92 | |
| 93 | 93 | //For the application, we create the object that the register method, |
| 94 | 94 | // which is the container center, is connected to by the kernel object register method. |
| 95 | - $this->app->register('container',$this->app);
|
|
| 95 | + $this->app->register('container', $this->app);
|
|
| 96 | 96 | |
| 97 | 97 | // We are saving the application class to |
| 98 | 98 | // the container object for the appClass value. |
| 99 | - $this->app->register('appClass',new App());
|
|
| 99 | + $this->app->register('appClass', new App());
|
|
| 100 | 100 | |
| 101 | 101 | //set closure bind instance for application |
| 102 | - $this->app->register('appClosureInstance',ClosureDispatcher::bind(app()));
|
|
| 102 | + $this->app->register('appClosureInstance', ClosureDispatcher::bind(app()));
|
|
| 103 | 103 | |
| 104 | 104 | //set closure bind instance for bootLoader class |
| 105 | - $this->app->register('closureBootLoader',ClosureDispatcher::bind($this->app['bootLoader']));
|
|
| 105 | + $this->app->register('closureBootLoader', ClosureDispatcher::bind($this->app['bootLoader']));
|
|
| 106 | 106 | |
| 107 | 107 | //set register for macro |
| 108 | - $this->app->register('macro',$this->app->resolve(Macro::class));
|
|
| 108 | + $this->app->register('macro', $this->app->resolve(Macro::class));
|
|
| 109 | 109 | |
| 110 | 110 | //set register for macro |
| 111 | - $this->app->register('pipeline',new Pipeline());
|
|
| 111 | + $this->app->register('pipeline', new Pipeline());
|
|
| 112 | 112 | |
| 113 | - $this->app->register('di',function($instance,$method){
|
|
| 114 | - return DIContainerManager::callBind([$instance,$method],$this->app->applicationProviderBinding($this->app)); |
|
| 113 | + $this->app->register('di', function($instance, $method) {
|
|
| 114 | + return DIContainerManager::callBind([$instance, $method], $this->app->applicationProviderBinding($this->app)); |
|
| 115 | 115 | }); |
| 116 | 116 | |
| 117 | 117 | } |
@@ -126,10 +126,10 @@ discard block |
||
| 126 | 126 | //register as instance application object |
| 127 | 127 | // and container instance resolve |
| 128 | 128 | //set core instance value |
| 129 | - $this->app->instance('container',$this->app->singleton());
|
|
| 130 | - $this->app->instance('bootLoader',$this->app->resolve(BootLoader::class));
|
|
| 131 | - $this->app->instance('containerInstanceResolve',ContainerInstanceResolver::class);
|
|
| 132 | - $this->app->instance('reflection',ReflectionProcess::class);
|
|
| 129 | + $this->app->instance('container', $this->app->singleton());
|
|
| 130 | + $this->app->instance('bootLoader', $this->app->resolve(BootLoader::class));
|
|
| 131 | + $this->app->instance('containerInstanceResolve', ContainerInstanceResolver::class);
|
|
| 132 | + $this->app->instance('reflection', ReflectionProcess::class);
|
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -138,19 +138,19 @@ discard block |
||
| 138 | 138 | private function setGlobalAccessor() |
| 139 | 139 | {
|
| 140 | 140 | //get response success and status |
| 141 | - $this->app->register('instanceController',null);
|
|
| 142 | - $this->app->register('responseSuccess',true);
|
|
| 143 | - $this->app->register('responseStatus',200);
|
|
| 144 | - $this->app->register('responseType','json');
|
|
| 141 | + $this->app->register('instanceController', null);
|
|
| 142 | + $this->app->register('responseSuccess', true);
|
|
| 143 | + $this->app->register('responseStatus', 200);
|
|
| 144 | + $this->app->register('responseType', 'json');
|
|
| 145 | 145 | |
| 146 | 146 | //we first load the response class as a singleton object to allow you to send output anywhere |
| 147 | - $this->app->register('out',$this->app->resolve(ResponseProvider::class));
|
|
| 147 | + $this->app->register('out', $this->app->resolve(ResponseProvider::class));
|
|
| 148 | 148 | |
| 149 | 149 | $requestService = "Store\Services\RequestService"; |
| 150 | 150 | |
| 151 | 151 | //The HttpFoundation component defines an object-oriented layer for the HTTP specification. |
| 152 | 152 | //The HttpFoundation component replaces these default PHP global variables and functions by an object-oriented layer |
| 153 | - if(Utils::isNamespaceExists($requestService)){
|
|
| 153 | + if (Utils::isNamespaceExists($requestService)) {
|
|
| 154 | 154 | |
| 155 | 155 | Request::setFactory(function(array $query = array(), |
| 156 | 156 | array $request = array(), |
@@ -172,16 +172,16 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | |
| 174 | 174 | //After registering the symfony request method, we also save the get and post methods for user convenience. |
| 175 | - $this->app->register('request',Request::createFromGlobals());
|
|
| 176 | - $this->app->register('get',core()->request->query->all());
|
|
| 177 | - $this->app->register('post',core()->request->request->all());
|
|
| 175 | + $this->app->register('request', Request::createFromGlobals());
|
|
| 176 | + $this->app->register('get', core()->request->query->all());
|
|
| 177 | + $this->app->register('post', core()->request->request->all());
|
|
| 178 | 178 | |
| 179 | 179 | //We determine with the kernel object which HTTP method the requested from the client |
| 180 | - $this->app->register('httpMethod',ucfirst(strtolower(core()->request->getRealMethod())));
|
|
| 180 | + $this->app->register('httpMethod', ucfirst(strtolower(core()->request->getRealMethod())));
|
|
| 181 | 181 | |
| 182 | - define('httpMethod',strtoupper(core()->httpMethod));
|
|
| 182 | + define('httpMethod', strtoupper(core()->httpMethod));
|
|
| 183 | 183 | |
| 184 | - $this->app->register('fileSystem',new FileProcess());
|
|
| 184 | + $this->app->register('fileSystem', new FileProcess());
|
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | } |
| 188 | 188 | \ No newline at end of file |
@@ -117,8 +117,7 @@ |
||
| 117 | 117 | //the value corresponding to the bind value for the global object is assigned and |
| 118 | 118 | //the resolve method is called for the dependency method. |
| 119 | 119 | $this->app->register('serviceContainer',$object,$concrete);
|
| 120 | - } |
|
| 121 | - else{
|
|
| 120 | + } else{
|
|
| 122 | 121 | |
| 123 | 122 | // the service container objects are saved only once. |
| 124 | 123 | // Overflow exception is thrown on multiple records. |
@@ -12,12 +12,12 @@ discard block |
||
| 12 | 12 | * @param $callback |
| 13 | 13 | * @return void |
| 14 | 14 | */ |
| 15 | - public function consoleShared($object,$callback) |
|
| 15 | + public function consoleShared($object, $callback) |
|
| 16 | 16 | {
|
| 17 | 17 | //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound. |
| 18 | 18 | //The work to be done here is to bind the classes to be included in the console share privately. |
| 19 | - if($this->app->console()){
|
|
| 20 | - $this->app->register('consoleShared',$object,$this->getConcrete($callback));
|
|
| 19 | + if ($this->app->console()) {
|
|
| 20 | + $this->app->register('consoleShared', $object, $this->getConcrete($callback));
|
|
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | public function container() |
| 28 | 28 | {
|
| 29 | 29 | //We are initializing the array property for the service container object. |
| 30 | - if(!isset($this->app['serviceContainer'])){
|
|
| 31 | - $this->app->register('serviceContainer',[]);
|
|
| 30 | + if (!isset($this->app['serviceContainer'])) {
|
|
| 31 | + $this->app->register('serviceContainer', []);
|
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
@@ -48,22 +48,22 @@ discard block |
||
| 48 | 48 | * @param $concrete |
| 49 | 49 | * @return void |
| 50 | 50 | */ |
| 51 | - private function setKernel($object,$concrete) |
|
| 51 | + private function setKernel($object, $concrete) |
|
| 52 | 52 | {
|
| 53 | 53 | //We check that the concrete object |
| 54 | 54 | //is an object that can be retrieved. |
| 55 | - if(!isset($this->app[$object]) && class_exists($concrete)){
|
|
| 55 | + if (!isset($this->app[$object]) && class_exists($concrete)) {
|
|
| 56 | 56 | |
| 57 | 57 | //get concrete instance |
| 58 | 58 | $concreteInstance = $this->app->resolve($concrete); |
| 59 | 59 | |
| 60 | 60 | //the value corresponding to the bind value for the global object is assigned and |
| 61 | 61 | //the resolve method is called for the dependency injection. |
| 62 | - $this->app->register($object,$concreteInstance); |
|
| 62 | + $this->app->register($object, $concreteInstance); |
|
| 63 | 63 | |
| 64 | 64 | // this method is executed if the concrete instance contains the handle method. |
| 65 | 65 | // if no handle method is included, the concrete instance is returned directly. |
| 66 | - (method_exists($concreteInstance,'handle')) |
|
| 66 | + (method_exists($concreteInstance, 'handle')) |
|
| 67 | 67 | ? $concreteInstance->handle() |
| 68 | 68 | : $concreteInstance; |
| 69 | 69 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @param null|string $value |
| 77 | 77 | * @return void |
| 78 | 78 | */ |
| 79 | - public function setKernelObject($object,$concrete,$value=null) |
|
| 79 | + public function setKernelObject($object, $concrete, $value = null) |
|
| 80 | 80 | {
|
| 81 | 81 | //if a pre loader class wants to have before kernel values, |
| 82 | 82 | //it must return a callback to the bind method |
@@ -84,22 +84,22 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | //the value is directly assigned to the kernel object. |
| 86 | 86 | //The value is moved throughout the application in the kernel of the application object. |
| 87 | - if(is_null($value)){
|
|
| 88 | - $this->setKernel($object,$concrete); |
|
| 87 | + if (is_null($value)) {
|
|
| 88 | + $this->setKernel($object, $concrete); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | //The service container value is moved differently from the value directly assigned to the kernel object. |
| 92 | 92 | //The application container is booted directly with the service container custom class |
| 93 | 93 | //in the version section of the your application. |
| 94 | - if($value==="serviceContainer"){
|
|
| 95 | - $this->setServiceContainer($object,$concrete); |
|
| 94 | + if ($value==="serviceContainer") {
|
|
| 95 | + $this->setServiceContainer($object, $concrete); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | // we will resolve the value of concrete according to whether it is an object. |
| 99 | 99 | $detectorBindings = (is_object($concrete)) ? $concrete : Utils::resolverClass($concrete); |
| 100 | 100 | |
| 101 | 101 | //we register the bound object to the kernel bindings property. |
| 102 | - $this->app->register('bindings',$object,$detectorBindings);
|
|
| 102 | + $this->app->register('bindings', $object, $detectorBindings);
|
|
| 103 | 103 | |
| 104 | 104 | } |
| 105 | 105 | |
@@ -108,17 +108,17 @@ discard block |
||
| 108 | 108 | * @param $concrete |
| 109 | 109 | * @return void |
| 110 | 110 | */ |
| 111 | - private function setServiceContainer($object,$concrete) |
|
| 111 | + private function setServiceContainer($object, $concrete) |
|
| 112 | 112 | {
|
| 113 | 113 | //We check that the concrete object |
| 114 | 114 | //is an object that can be retrieved. |
| 115 | - if(isset($this->app['serviceContainer']) && !isset($this->app['serviceContainer'][$object])){
|
|
| 115 | + if (isset($this->app['serviceContainer']) && !isset($this->app['serviceContainer'][$object])) {
|
|
| 116 | 116 | |
| 117 | 117 | //the value corresponding to the bind value for the global object is assigned and |
| 118 | 118 | //the resolve method is called for the dependency method. |
| 119 | - $this->app->register('serviceContainer',$object,$concrete);
|
|
| 119 | + $this->app->register('serviceContainer', $object, $concrete);
|
|
| 120 | 120 | } |
| 121 | - else{
|
|
| 121 | + else {
|
|
| 122 | 122 | |
| 123 | 123 | // the service container objects are saved only once. |
| 124 | 124 | // Overflow exception is thrown on multiple records. |
@@ -18,21 +18,21 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @throws \ReflectionException |
| 20 | 20 | */ |
| 21 | - public function call($class,$param,callable $callback) |
|
| 21 | + public function call($class, $param, callable $callback) |
|
| 22 | 22 | {
|
| 23 | 23 | // We use the reflection class to solve |
| 24 | 24 | // the parameters of the class's methods. |
| 25 | - $param = $this->reflectionMethodParameters($class,$param); |
|
| 25 | + $param = $this->reflectionMethodParameters($class, $param); |
|
| 26 | 26 | |
| 27 | 27 | // the results of a number of processes will be given |
| 28 | 28 | // before the container pipeline method is given. |
| 29 | 29 | return $this->app->resolve(ContainerPipelineResolve::class)->handle( |
| 30 | - function() use($class,$param,$callback) |
|
| 30 | + function() use($class, $param, $callback) |
|
| 31 | 31 | {
|
| 32 | 32 | // as a result |
| 33 | 33 | // we return the resolved class to the callback class |
| 34 | - $params = (object)['class'=>$class,'param'=>$param]; |
|
| 35 | - return call_user_func_array($callback,[$params]); |
|
| 34 | + $params = (object)['class'=>$class, 'param'=>$param]; |
|
| 35 | + return call_user_func_array($callback, [$params]); |
|
| 36 | 36 | }); |
| 37 | 37 | |
| 38 | 38 | } |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | * @param $parameter |
| 45 | 45 | * @return array |
| 46 | 46 | */ |
| 47 | - private function checkParameterForContainer($containers,$parameter) |
|
| 47 | + private function checkParameterForContainer($containers, $parameter) |
|
| 48 | 48 | {
|
| 49 | 49 | // if the parameter is an object and |
| 50 | 50 | // this object is a service container object |
| 51 | 51 | // then the parameter will bind. |
| 52 | - if($parameter->getType()!==null && isset($containers[$parameter->getType()->getName()])){
|
|
| 52 | + if ($parameter->getType()!==null && isset($containers[$parameter->getType()->getName()])) {
|
|
| 53 | 53 | |
| 54 | 54 | // Unpack the container object and |
| 55 | 55 | // bind it to the param variable. |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | return [$parameterName=>$parameterResolve]; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if($parameter->getType()!== NULL && Utils::isNamespaceExists($parameter->getType()->getName())){
|
|
| 71 | + if ($parameter->getType()!==NULL && Utils::isNamespaceExists($parameter->getType()->getName())) {
|
|
| 72 | 72 | |
| 73 | 73 | // Unpack the container object and |
| 74 | 74 | // bind it to the param variable. |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | private function getReflectionMethod($class) |
| 93 | 93 | {
|
| 94 | - [$class,$method] = [$class[0],$class[1]]; |
|
| 94 | + [$class, $method] = [$class[0], $class[1]]; |
|
| 95 | 95 | |
| 96 | 96 | return $this->app['reflection']($class)->reflectionMethodParams($method); |
| 97 | 97 | } |
@@ -105,12 +105,12 @@ discard block |
||
| 105 | 105 | * |
| 106 | 106 | * @throws \ReflectionException |
| 107 | 107 | */ |
| 108 | - private function reflectionMethodParameters($class,$param) |
|
| 108 | + private function reflectionMethodParameters($class, $param) |
|
| 109 | 109 | {
|
| 110 | 110 | $containers = []; |
| 111 | 111 | |
| 112 | 112 | //get service container objects. |
| 113 | - if(isset($this->app['serviceContainer'])){
|
|
| 113 | + if (isset($this->app['serviceContainer'])) {
|
|
| 114 | 114 | $containers = $this->app['serviceContainer']; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -122,22 +122,22 @@ discard block |
||
| 122 | 122 | // we provide the user with the container method document and take action. |
| 123 | 123 | // thus, we help the methods to have a cleaner code structure. |
| 124 | 124 | $this->app->resolve(ContainerMethodDocumentResolver::class, |
| 125 | - ['document'=>$reflection->document,'class'=>$class]); |
|
| 125 | + ['document'=>$reflection->document, 'class'=>$class]); |
|
| 126 | 126 | |
| 127 | 127 | // we group the parameters into type and |
| 128 | 128 | // name and bind them with the necessary logic. |
| 129 | - foreach ($parameters as $parameter){
|
|
| 129 | + foreach ($parameters as $parameter) {
|
|
| 130 | 130 | |
| 131 | 131 | // if the parameter is an object and |
| 132 | 132 | // this object is a service container object |
| 133 | 133 | // then the parameter will bind. |
| 134 | - $checkParameterForContainer = $this->checkParameterForContainer($containers,$parameter); |
|
| 135 | - $paramMerge = array_merge($param,$checkParameterForContainer); |
|
| 134 | + $checkParameterForContainer = $this->checkParameterForContainer($containers, $parameter); |
|
| 135 | + $paramMerge = array_merge($param, $checkParameterForContainer); |
|
| 136 | 136 | |
| 137 | 137 | // we do some useful logic bind for user benefit. |
| 138 | - $param = app()->resolve(GraceContainer::class,[ |
|
| 138 | + $param = app()->resolve(GraceContainer::class, [ |
|
| 139 | 139 | 'reflection' => $reflection->reflection |
| 140 | - ])->graceContainerBuilder($parameter,$paramMerge); |
|
| 140 | + ])->graceContainerBuilder($parameter, $paramMerge); |
|
| 141 | 141 | |
| 142 | 142 | } |
| 143 | 143 | |
@@ -87,7 +87,9 @@ discard block |
||
| 87 | 87 | //If the console object returns true, |
| 88 | 88 | //we do not cancel binding operations |
| 89 | 89 | //We are getting what applies to console with consoleKernelObject. |
| 90 | - if($sync===false) return $this->consoleKernelObjectChecker($object,$callback); |
|
| 90 | + if($sync===false) {
|
|
| 91 | + return $this->consoleKernelObjectChecker($object,$callback); |
|
| 92 | + } |
|
| 91 | 93 | |
| 92 | 94 | //the value corresponding to the bind value for the global object is assigned and |
| 93 | 95 | //the resolve method is called for the dependency injection. |
@@ -133,7 +135,9 @@ discard block |
||
| 133 | 135 | //If the console object returns true, |
| 134 | 136 | //we do not cancel binding operations |
| 135 | 137 | //We are getting what applies to console with consoleKernelObject. |
| 136 | - if($this->console() AND $isCallableForCallback) return $this->consoleKernelObject($object,$callback,$container); |
|
| 138 | + if($this->console() AND $isCallableForCallback) {
|
|
| 139 | + return $this->consoleKernelObject($object,$callback,$container); |
|
| 140 | + } |
|
| 137 | 141 | |
| 138 | 142 | //If the application is not a console operation, we re-bind to existing methods synchronously. |
| 139 | 143 | return ($container) ? $this->containerBuild($object,$callback,true) : $this->build($object,$callback,true); |
@@ -167,7 +171,9 @@ discard block |
||
| 167 | 171 | //If the console object returns true, |
| 168 | 172 | //we do not cancel binding operations |
| 169 | 173 | //We are getting what applies to console with consoleKernelObject. |
| 170 | - if($sync===false) return $this->consoleKernelObjectChecker($object,$callback,true); |
|
| 174 | + if($sync===false) {
|
|
| 175 | + return $this->consoleKernelObjectChecker($object,$callback,true); |
|
| 176 | + } |
|
| 171 | 177 | |
| 172 | 178 | //Since the objects that come to the build method are objects from the container method, |
| 173 | 179 | //we need to automatically create a kernel object named serviceContainer in this method. |
@@ -211,8 +217,7 @@ discard block |
||
| 211 | 217 | foreach (explode(".",$abstract) as $item){
|
| 212 | 218 | if(isset($container[$item])){
|
| 213 | 219 | $container = $container[$item]; |
| 214 | - } |
|
| 215 | - else{
|
|
| 220 | + } else{
|
|
| 216 | 221 | return null; |
| 217 | 222 | } |
| 218 | 223 | } |
@@ -246,8 +251,7 @@ discard block |
||
| 246 | 251 | // the control result is transferred to the bools array. |
| 247 | 252 | $container = $container[$item]; |
| 248 | 253 | $bools[] = is_null($container) ? false : true; |
| 249 | - } |
|
| 250 | - else{
|
|
| 254 | + } else{
|
|
| 251 | 255 | |
| 252 | 256 | // if the container array corresponds to a string, |
| 253 | 257 | // the bools array is filled with the isset control directly. |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | use Resta\Console\ConsoleBindings; |
| 8 | 8 | use Resta\Contracts\ContainerContracts; |
| 9 | 9 | |
| 10 | -class Container implements ContainerContracts,\ArrayAccess |
|
| 10 | +class Container implements ContainerContracts, \ArrayAccess |
|
| 11 | 11 | {
|
| 12 | 12 | /** |
| 13 | 13 | * @var bool |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | * @param array $bind |
| 50 | 50 | * @return array |
| 51 | 51 | */ |
| 52 | - public function applicationProviderBinding($make,$bind=array()) |
|
| 52 | + public function applicationProviderBinding($make, $bind = array()) |
|
| 53 | 53 | {
|
| 54 | 54 | //service container is an automatic application provider |
| 55 | 55 | //that we can bind to the special class di in the dependency condition. |
| 56 | 56 | //This method is automatically added to the classes resolved by the entire make bind method. |
| 57 | - return array_merge($bind,['app'=>$make]); |
|
| 57 | + return array_merge($bind, ['app'=>$make]); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -65,12 +65,12 @@ discard block |
||
| 65 | 65 | * @throws DependencyException |
| 66 | 66 | * @throws NotFoundException |
| 67 | 67 | */ |
| 68 | - public function bind($object=null,$callback=null) |
|
| 68 | + public function bind($object = null, $callback = null) |
|
| 69 | 69 | {
|
| 70 | 70 | //If the bind method does not have parameters object and callback, the value is directly assigned to the kernel object. |
| 71 | 71 | //Otherwise, when the bind object and callback are sent, the closure class inherits |
| 72 | 72 | //the applicationProvider object and the resolve method is called |
| 73 | - return $this->make($object,$callback,'container'); |
|
| 73 | + return $this->make($object, $callback, 'container'); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -82,16 +82,16 @@ discard block |
||
| 82 | 82 | * @throws DependencyException |
| 83 | 83 | * @throws NotFoundException |
| 84 | 84 | */ |
| 85 | - private function build($object,$callback,$sync=false) |
|
| 85 | + private function build($object, $callback, $sync = false) |
|
| 86 | 86 | {
|
| 87 | 87 | //If the console object returns true, |
| 88 | 88 | //we do not cancel binding operations |
| 89 | 89 | //We are getting what applies to console with consoleKernelObject. |
| 90 | - if($sync===false) return $this->consoleKernelObjectChecker($object,$callback); |
|
| 90 | + if ($sync===false) return $this->consoleKernelObjectChecker($object, $callback); |
|
| 91 | 91 | |
| 92 | 92 | //the value corresponding to the bind value for the global object is assigned and |
| 93 | 93 | //the resolve method is called for the dependency injection. |
| 94 | - $this->kernelAssigner()->setKernelObject($object,$callback); |
|
| 94 | + $this->kernelAssigner()->setKernelObject($object, $callback); |
|
| 95 | 95 | |
| 96 | 96 | //return kernel object |
| 97 | 97 | return $this->kernel(); |
@@ -106,11 +106,11 @@ discard block |
||
| 106 | 106 | * @throws DependencyException |
| 107 | 107 | * @throws NotFoundException |
| 108 | 108 | */ |
| 109 | - private function consoleKernelObject($object,$callback,$container=false) |
|
| 109 | + private function consoleKernelObject($object, $callback, $container = false) |
|
| 110 | 110 | {
|
| 111 | 111 | //we use the console bindings class to specify the classes to be preloaded in the console application. |
| 112 | 112 | //Thus, classes that can not be bound with http are called without closure in global loaders directory. |
| 113 | - $this->resolve(ConsoleBindings::class)->console($object,$callback,$container); |
|
| 113 | + $this->resolve(ConsoleBindings::class)->console($object, $callback, $container); |
|
| 114 | 114 | |
| 115 | 115 | //The console application must always return the kernel method. |
| 116 | 116 | return $this->kernel(); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @throws DependencyException |
| 126 | 126 | * @throws NotFoundException |
| 127 | 127 | */ |
| 128 | - private function consoleKernelObjectChecker($object,$callback,$container=false) |
|
| 128 | + private function consoleKernelObjectChecker($object, $callback, $container = false) |
|
| 129 | 129 | {
|
| 130 | 130 | //we check whether the callback value is a callable function. |
| 131 | 131 | $isCallableForCallback = is_callable($callback); |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | //If the console object returns true, |
| 134 | 134 | //we do not cancel binding operations |
| 135 | 135 | //We are getting what applies to console with consoleKernelObject. |
| 136 | - if($this->console() AND $isCallableForCallback) return $this->consoleKernelObject($object,$callback,$container); |
|
| 136 | + if ($this->console() AND $isCallableForCallback) return $this->consoleKernelObject($object, $callback, $container); |
|
| 137 | 137 | |
| 138 | 138 | //If the application is not a console operation, we re-bind to existing methods synchronously. |
| 139 | - return ($container) ? $this->containerBuild($object,$callback,true) : $this->build($object,$callback,true); |
|
| 139 | + return ($container) ? $this->containerBuild($object, $callback, true) : $this->build($object, $callback, true); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /** |
@@ -146,11 +146,11 @@ discard block |
||
| 146 | 146 | * @throws DependencyException |
| 147 | 147 | * @throws NotFoundException |
| 148 | 148 | */ |
| 149 | - private function consoleShared($object,$callback) |
|
| 149 | + private function consoleShared($object, $callback) |
|
| 150 | 150 | {
|
| 151 | 151 | //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound. |
| 152 | 152 | //The work to be done here is to bind the classes to be included in the console share privately. |
| 153 | - $this->kernelAssigner()->consoleShared($object,$callback); |
|
| 153 | + $this->kernelAssigner()->consoleShared($object, $callback); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /** |
@@ -162,12 +162,12 @@ discard block |
||
| 162 | 162 | * @throws DependencyException |
| 163 | 163 | * @throws NotFoundException |
| 164 | 164 | */ |
| 165 | - public function containerBuild($object,$callback,$sync=false) |
|
| 165 | + public function containerBuild($object, $callback, $sync = false) |
|
| 166 | 166 | {
|
| 167 | 167 | //If the console object returns true, |
| 168 | 168 | //we do not cancel binding operations |
| 169 | 169 | //We are getting what applies to console with consoleKernelObject. |
| 170 | - if($sync===false) return $this->consoleKernelObjectChecker($object,$callback,true); |
|
| 170 | + if ($sync===false) return $this->consoleKernelObjectChecker($object, $callback, true); |
|
| 171 | 171 | |
| 172 | 172 | //Since the objects that come to the build method are objects from the container method, |
| 173 | 173 | //we need to automatically create a kernel object named serviceContainer in this method. |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | //the value corresponding to the bind value for the global object is assigned and |
| 177 | 177 | //the resolve method is called for the dependency method. |
| 178 | - $this->kernelAssigner()->setKernelObject($object,$callback,'serviceContainer'); |
|
| 178 | + $this->kernelAssigner()->setKernelObject($object, $callback, 'serviceContainer'); |
|
| 179 | 179 | |
| 180 | 180 | //return kernel object |
| 181 | 181 | return $this->kernel(); |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | * @param $class |
| 186 | 186 | * @param $bind |
| 187 | 187 | */ |
| 188 | - private function contextualBindCleaner($class,$bind) |
|
| 188 | + private function contextualBindCleaner($class, $bind) |
|
| 189 | 189 | {
|
| 190 | 190 | //the context bind objects are checked again and the bind sequence submitted by |
| 191 | 191 | //the user is checked and forced to re-instantiate the object. |
| 192 | - if(isset(self::$instance[$class]) && self::$bindParams[$class]!==$bind){
|
|
| 192 | + if (isset(self::$instance[$class]) && self::$bindParams[$class]!==$bind) {
|
|
| 193 | 193 | unset(self::$instance[$class]); |
| 194 | 194 | unset(self::$bindParams[$class]); |
| 195 | 195 | } |
@@ -208,11 +208,11 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | // the has method can have a dotted string value so |
| 210 | 210 | // we need to be able to control the string or array within the container. |
| 211 | - foreach (explode(".",$abstract) as $item){
|
|
| 212 | - if(isset($container[$item])){
|
|
| 211 | + foreach (explode(".", $abstract) as $item) {
|
|
| 212 | + if (isset($container[$item])) {
|
|
| 213 | 213 | $container = $container[$item]; |
| 214 | 214 | } |
| 215 | - else{
|
|
| 215 | + else {
|
|
| 216 | 216 | return null; |
| 217 | 217 | } |
| 218 | 218 | } |
@@ -235,11 +235,11 @@ discard block |
||
| 235 | 235 | |
| 236 | 236 | // the has method can have a dotted string value so |
| 237 | 237 | // we need to be able to control the string or array within the container. |
| 238 | - foreach (explode(".",$abstract) as $item){
|
|
| 238 | + foreach (explode(".", $abstract) as $item) {
|
|
| 239 | 239 | |
| 240 | 240 | // this blog will work |
| 241 | 241 | // if the data in the container loop points to an array. |
| 242 | - if(!is_array($container)){
|
|
| 242 | + if (!is_array($container)) {
|
|
| 243 | 243 | |
| 244 | 244 | // we are querying the value of |
| 245 | 245 | // the items corresponding to the dotted value in the container. |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $container = $container[$item]; |
| 248 | 248 | $bools[] = is_null($container) ? false : true; |
| 249 | 249 | } |
| 250 | - else{
|
|
| 250 | + else {
|
|
| 251 | 251 | |
| 252 | 252 | // if the container array corresponds to a string, |
| 253 | 253 | // the bools array is filled with the isset control directly. |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | |
| 258 | 258 | // the method returns false if the bools sequence is false, |
| 259 | 259 | // otherwise it will return true. |
| 260 | - return in_array(false,$bools) ? false : true; |
|
| 260 | + return in_array(false, $bools) ? false : true; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | /** |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | * @throws DependencyException |
| 308 | 308 | * @throws NotFoundException |
| 309 | 309 | */ |
| 310 | - public function make($object=null,$callback=null,$container=false) |
|
| 310 | + public function make($object = null, $callback = null, $container = false) |
|
| 311 | 311 | {
|
| 312 | 312 | //we check whether the boolean value of the singleton variable used |
| 313 | 313 | //for booting does not reset every time the object variable to be assigned to the kernel variable is true |
@@ -315,8 +315,8 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound. |
| 317 | 317 | //The work to be done here is to bind the classes to be included in the console share privately. |
| 318 | - if($container){
|
|
| 319 | - $this->consoleShared($object,$callback); |
|
| 318 | + if ($container) {
|
|
| 319 | + $this->consoleShared($object, $callback); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | //If the third parameter passed to the bind method carries a container value, |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | //If the bind method does not have parameters object and callback, the value is directly assigned to the kernel object. |
| 327 | 327 | //Otherwise, when the bind object and callback are sent, the closure class inherits |
| 328 | 328 | //the applicationProvider object and the resolve method is called |
| 329 | - return ($object===null) ? $this->kernel() : $this->{$makeBuild}($object,$callback);
|
|
| 329 | + return ($object===null) ? $this->kernel() : $this->{$makeBuild}($object, $callback);
|
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | /** |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | */ |
| 347 | 347 | public function offsetGet($offset) {
|
| 348 | 348 | |
| 349 | - return $this->resolve($this->instances['containerInstanceResolve'],[ |
|
| 349 | + return $this->resolve($this->instances['containerInstanceResolve'], [ |
|
| 350 | 350 | 'instances' => $this->instances |
| 351 | 351 | ])->{$offset}();
|
| 352 | 352 | } |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | * @param null $concrete |
| 371 | 371 | * @return bool|mixed |
| 372 | 372 | */ |
| 373 | - public function register($key,$object,$concrete=null) |
|
| 373 | + public function register($key, $object, $concrete = null) |
|
| 374 | 374 | {
|
| 375 | 375 | // we assign the values ββrequired |
| 376 | 376 | // for register to the global value variable. |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | |
| 381 | 381 | // If there is an instance of the application class, |
| 382 | 382 | // the register method is saved both in this example and in the global. |
| 383 | - if(defined('appInstance')){
|
|
| 383 | + if (defined('appInstance')) {
|
|
| 384 | 384 | |
| 385 | 385 | // where we will assign both the global instance |
| 386 | 386 | // and the registered application object. |
@@ -399,19 +399,19 @@ discard block |
||
| 399 | 399 | * @param bool $withConcrete |
| 400 | 400 | * @return bool |
| 401 | 401 | */ |
| 402 | - private function registerProcess($instance,$withConcrete=false) |
|
| 402 | + private function registerProcess($instance, $withConcrete = false) |
|
| 403 | 403 | {
|
| 404 | 404 | // values recorded without concrete. |
| 405 | 405 | // or values deleted |
| 406 | - if(false===$withConcrete){
|
|
| 406 | + if (false===$withConcrete) {
|
|
| 407 | 407 | |
| 408 | 408 | //values registered without concrete |
| 409 | - $instance->{$this->values['key']}=$this->values['object'];
|
|
| 409 | + $instance->{$this->values['key']} = $this->values['object'];
|
|
| 410 | 410 | return false; |
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | //values registered with concrete |
| 414 | - $instance->{$this->values['key']}[$this->values['object']]=$this->values['concrete'];
|
|
| 414 | + $instance->{$this->values['key']}[$this->values['object']] = $this->values['concrete'];
|
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | /** |
@@ -422,22 +422,22 @@ discard block |
||
| 422 | 422 | * @throws DependencyException |
| 423 | 423 | * @throws NotFoundException |
| 424 | 424 | */ |
| 425 | - public function resolve($class,$bind=array()) |
|
| 425 | + public function resolve($class, $bind = array()) |
|
| 426 | 426 | {
|
| 427 | 427 | //the context bind objects are checked again and the bind sequence submitted by |
| 428 | 428 | //the user is checked and forced to re-instantiate the object. |
| 429 | - $this->contextualBindCleaner($class,$bind); |
|
| 429 | + $this->contextualBindCleaner($class, $bind); |
|
| 430 | 430 | |
| 431 | 431 | //We do an instance check to get the static instance values of |
| 432 | 432 | //the classes to be resolved with the make bind method. |
| 433 | - if(!isset(self::$instance[$class])){
|
|
| 433 | + if (!isset(self::$instance[$class])) {
|
|
| 434 | 434 | |
| 435 | 435 | //bind params object |
| 436 | 436 | self::$bindParams[$class] = $bind; |
| 437 | 437 | |
| 438 | 438 | //By singleton checking, we solve the dependency injection of the given class. |
| 439 | 439 | //Thus, each class can be called together with its dependency. |
| 440 | - self::$instance[$class] = DIContainerManager::make($class,$this->applicationProviderBinding($this,self::$bindParams[$class])); |
|
| 440 | + self::$instance[$class] = DIContainerManager::make($class, $this->applicationProviderBinding($this, self::$bindParams[$class])); |
|
| 441 | 441 | $this->singleton()->resolved[$class] = self::$instance[$class]; |
| 442 | 442 | |
| 443 | 443 | //return resolve class |
@@ -455,9 +455,9 @@ discard block |
||
| 455 | 455 | * @param $class |
| 456 | 456 | * @return mixed |
| 457 | 457 | */ |
| 458 | - public function resolved($class){
|
|
| 458 | + public function resolved($class) {
|
|
| 459 | 459 | |
| 460 | - if(isset($this['resolved'][$class])){
|
|
| 460 | + if (isset($this['resolved'][$class])) {
|
|
| 461 | 461 | return $this['resolved'][$class]; |
| 462 | 462 | } |
| 463 | 463 | |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | * @throws DependencyException |
| 473 | 473 | * @throws NotFoundException |
| 474 | 474 | */ |
| 475 | - public function share($object=null,$callback=null) |
|
| 475 | + public function share($object = null, $callback = null) |
|
| 476 | 476 | {
|
| 477 | 477 | //we check whether the boolean value of the singleton variable used |
| 478 | 478 | //for booting does not reset every time the object variable to be assigned to the kernel variable is true |
@@ -480,12 +480,12 @@ discard block |
||
| 480 | 480 | |
| 481 | 481 | //The console share is evaluated as a true variable to be assigned as the 3rd parameter in the classes to be bound. |
| 482 | 482 | //The work to be done here is to bind the classes to be included in the console share privately. |
| 483 | - $this->consoleShared($object,$callback); |
|
| 483 | + $this->consoleShared($object, $callback); |
|
| 484 | 484 | |
| 485 | 485 | //If the bind method does not have parameters object and callback, the value is directly assigned to the kernel object. |
| 486 | 486 | //Otherwise, when the bind object and callback are sent, the closure class inherits |
| 487 | 487 | //the applicationProvider object and the resolve method is called |
| 488 | - return ($object===null) ? $this->kernel() : $this->build($object,$callback); |
|
| 488 | + return ($object===null) ? $this->kernel() : $this->build($object, $callback); |
|
| 489 | 489 | |
| 490 | 490 | } |
| 491 | 491 | |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | */ |
| 506 | 506 | public function singleton() |
| 507 | 507 | {
|
| 508 | - if($this->singleton===false){
|
|
| 508 | + if ($this->singleton===false) {
|
|
| 509 | 509 | |
| 510 | 510 | //after first initializing, the singleton variable is set to true, |
| 511 | 511 | //and subsequent incoming classes can inherit the loaded object. |
@@ -526,12 +526,12 @@ discard block |
||
| 526 | 526 | // for application instance |
| 527 | 527 | // if the values ββto be saved are to be saved without the concrete, |
| 528 | 528 | // if it is an array. |
| 529 | - if($this->values['concrete']===null) {
|
|
| 529 | + if ($this->values['concrete']===null) {
|
|
| 530 | 530 | |
| 531 | 531 | // Without concrete, |
| 532 | 532 | // the saved value will be saved |
| 533 | 533 | // if the it does not exist in application instance. |
| 534 | - if(!isset($instance->{$this->values['key']})) {
|
|
| 534 | + if (!isset($instance->{$this->values['key']})) {
|
|
| 535 | 535 | $this->registerProcess($instance); |
| 536 | 536 | } |
| 537 | 537 | return false; |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | |
| 540 | 540 | // We send concrete values to be recorded with concrete as true. |
| 541 | 541 | // these values will be recorded as a array. |
| 542 | - $this->registerProcess($instance,true); |
|
| 542 | + $this->registerProcess($instance, true); |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | /** |
@@ -547,11 +547,11 @@ discard block |
||
| 547 | 547 | * @param null|string $object |
| 548 | 548 | * @return mixed |
| 549 | 549 | */ |
| 550 | - public function terminate($key,$object=null) |
|
| 550 | + public function terminate($key, $object = null) |
|
| 551 | 551 | {
|
| 552 | 552 | // object null is |
| 553 | 553 | // sent to just terminate a key. |
| 554 | - if($object===null){
|
|
| 554 | + if ($object===null) {
|
|
| 555 | 555 | unset(core()->{$key});
|
| 556 | 556 | unset($this->singleton()->{$key});
|
| 557 | 557 | return false; |