@@ -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 |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | * @param string $adapter |
| 43 | 43 | * @return RoleManager |
| 44 | 44 | */ |
| 45 | - public function setAdapter($adapter='Database') |
|
| 45 | + public function setAdapter($adapter = 'Database') |
|
| 46 | 46 | { |
| 47 | 47 | $this->adapter = $adapter; |
| 48 | 48 | |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | * @param string $adapter |
| 19 | 19 | * @return mixed |
| 20 | 20 | */ |
| 21 | - public function setAdapter($adapter='Database'); |
|
| 21 | + public function setAdapter($adapter = 'Database'); |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * @param $resource |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * @var $type |
| 16 | 16 | */ |
| 17 | - public $type='project'; |
|
| 17 | + public $type = 'project'; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @var array |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | /** |
| 32 | 32 | * @var $commandRule |
| 33 | 33 | */ |
| 34 | - public $commandRule=[]; |
|
| 34 | + public $commandRule = []; |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * @method create |
@@ -46,17 +46,17 @@ discard block |
||
| 46 | 46 | $this->directory['projectDir'] = $this->projectPath(); |
| 47 | 47 | $this->argument['exceptionNamespace'] = app()->namespace()->exception(); |
| 48 | 48 | $this->argument['resourcePath'] = app()->path()->appResourche(); |
| 49 | - $this->argument['testNamespace'] = app()->namespace()->tests(); |
|
| 49 | + $this->argument['testNamespace'] = app()->namespace()->tests(); |
|
| 50 | 50 | |
| 51 | - $recursiveDefaultDirectory = explode("\\",$this->argument['project']);
|
|
| 51 | + $recursiveDefaultDirectory = explode("\\", $this->argument['project']);
|
|
| 52 | 52 | $this->argument['applicationName'] = pos($recursiveDefaultDirectory); |
| 53 | 53 | $recursiveDefaultDirectory[] = 'V1'; |
| 54 | 54 | $recursiveDefaultDirectoryList = []; |
| 55 | 55 | |
| 56 | - foreach (array_slice($recursiveDefaultDirectory,1) as $defaultDirectory){
|
|
| 56 | + foreach (array_slice($recursiveDefaultDirectory, 1) as $defaultDirectory) {
|
|
| 57 | 57 | |
| 58 | - $recursiveDefaultDirectoryList[]=$defaultDirectory; |
|
| 59 | - $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/",$recursiveDefaultDirectoryList);
|
|
| 58 | + $recursiveDefaultDirectoryList[] = $defaultDirectory; |
|
| 59 | + $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/", $recursiveDefaultDirectoryList);
|
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | //$this->directory['optionalDir'] = $this->optional(); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | //$this->directory['sourceDir'] = $this->sourceDir(); |
| 83 | 83 | //$this->directory['sourceSupportDir'] = $this->sourceSupportDir(); |
| 84 | 84 | //$this->directory['sourceSupportTraitDir'] = $this->sourceSupportDir().'/Traits'; |
| 85 | - $this->directory['exceptionDir'] = app()->path()->exception(); |
|
| 85 | + $this->directory['exceptionDir'] = app()->path()->exception(); |
|
| 86 | 86 | |
| 87 | 87 | //set project directory |
| 88 | 88 | $this->file->makeDirectory($this); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $this->touch['kernel/app'] = $this->provider().'/AppServiceProvider.php'; |
| 97 | 97 | $this->touch['kernel/worker'] = $this->provider().'/WorkerServiceProvider.php'; |
| 98 | 98 | $this->touch['kernel/role'] = $this->provider().'/RoleServiceProvider.php'; |
| 99 | - $this->touch['test/testcase'] = $this->test().'/TestCase.php'; |
|
| 99 | + $this->touch['test/testcase'] = $this->test().'/TestCase.php'; |
|
| 100 | 100 | $this->touch['kernel/consoleevent'] = $this->provider().'/ConsoleEventServiceProvider.php'; |
| 101 | 101 | $this->touch['middleware/authenticate'] = $this->middleware().'/Authenticate.php'; |
| 102 | 102 | $this->touch['middleware/ratelimit'] = $this->middleware().'/RateLimit.php'; |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $this->touch['app/gitignore'] = $this->projectPath().'/.gitignore'; |
| 136 | 136 | $this->touch['app/composer'] = $this->projectPath().'/composer.json'; |
| 137 | 137 | $this->touch['test/index'] = $this->storage().'/index.html'; |
| 138 | - $this->touch['exception/authenticate'] = $this->directory['exceptionDir'] .'/AuthenticateException.php'; |
|
| 138 | + $this->touch['exception/authenticate'] = $this->directory['exceptionDir'].'/AuthenticateException.php'; |
|
| 139 | 139 | |
| 140 | 140 | //set project touch |
| 141 | 141 | $this->file->touch($this); |
@@ -39,12 +39,12 @@ discard block |
||
| 39 | 39 | private function getCallBindController() |
| 40 | 40 | {
|
| 41 | 41 | //we finally process the method of the class invoked by the user as a process and prepare it for the response |
| 42 | - return app()->resolve(RouteWatch::class)->watch(function(){
|
|
| 42 | + return app()->resolve(RouteWatch::class)->watch(function() {
|
|
| 43 | 43 | |
| 44 | 44 | // if the method in the instance object exists, |
| 45 | 45 | // this method is executed to produce the output. |
| 46 | - if(method_exists($this->app['instanceController'],$this->app['method'])){
|
|
| 47 | - return $this->app['di']($this->app['instanceController'],$this->app['method']); |
|
| 46 | + if (method_exists($this->app['instanceController'], $this->app['method'])) {
|
|
| 47 | + return $this->app['di']($this->app['instanceController'], $this->app['method']); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | //throw exception as unsuccessful |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function handle() |
| 64 | 64 | {
|
| 65 | - $this->app->register('routerResult',$this->callController());
|
|
| 65 | + $this->app->register('routerResult', $this->callController());
|
|
| 66 | 66 | |
| 67 | 67 | //we call our services as controller |
| 68 | 68 | return $this->app['routerResult']; |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | $namespace = $this->getControllerNamespace(); |
| 80 | 80 | |
| 81 | 81 | //utils make bind via dependency injection named as service container |
| 82 | - $this->app->register('serviceConf',$this->app['fileSystem']->callFile(StaticPathModel::getServiceConf()));
|
|
| 83 | - $this->app->register('instanceController',$this->app->resolve($namespace));
|
|
| 82 | + $this->app->register('serviceConf', $this->app['fileSystem']->callFile(StaticPathModel::getServiceConf()));
|
|
| 83 | + $this->app->register('instanceController', $this->app->resolve($namespace));
|
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | // based on the serviceConf variable, |
| 99 | 99 | // we are doing parameter bindings in the method context in the routeParameters array key. |
| 100 | - $this->app->register('serviceConf','routeParameters',[$method=>$parameters]);
|
|
| 100 | + $this->app->register('serviceConf', 'routeParameters', [$method=>$parameters]);
|
|
| 101 | 101 | |
| 102 | 102 | } |
| 103 | 103 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function setMethodNameViaDefine($methodName) |
| 111 | 111 | {
|
| 112 | - define('methodName',strtolower($methodName));
|
|
| 112 | + define('methodName', strtolower($methodName));
|
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $fromRoutes = Route::getRouteResolve(); |
| 141 | 141 | $method = $fromRoutes['method'] ?? $method; |
| 142 | 142 | |
| 143 | - $this->app->register('method',$method);
|
|
| 143 | + $this->app->register('method', $method);
|
|
| 144 | 144 | $this->app->register('routeParameters', $this->routeParametersAssign($this->resolveMethod($method)));
|
| 145 | 145 | |
| 146 | 146 | } |
@@ -43,13 +43,13 @@ discard block |
||
| 43 | 43 | * @param $urlRoute |
| 44 | 44 | * @return int|string |
| 45 | 45 | */ |
| 46 | - public static function checkArrayEqual($patterns,$urlRoute) |
|
| 46 | + public static function checkArrayEqual($patterns, $urlRoute) |
|
| 47 | 47 | {
|
| 48 | 48 | // calculates the equality difference between |
| 49 | 49 | // the route pattern and the urlRoute value. |
| 50 | - foreach ($patterns as $key=>$pattern){
|
|
| 50 | + foreach ($patterns as $key=>$pattern) {
|
|
| 51 | 51 | |
| 52 | - if(Utils::isArrayEqual($pattern,$urlRoute)){
|
|
| 52 | + if (Utils::isArrayEqual($pattern, $urlRoute)) {
|
|
| 53 | 53 | return $key; |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | {
|
| 69 | 69 | $route = self::getRouteResolve(); |
| 70 | 70 | |
| 71 | - if(isset($route['class'])){
|
|
| 71 | + if (isset($route['class'])) {
|
|
| 72 | 72 | return $route['class']; |
| 73 | 73 | } |
| 74 | 74 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | {
|
| 85 | 85 | $route = self::getRouteResolve(); |
| 86 | 86 | |
| 87 | - if(isset($route['controller'],$route['namespace'])){
|
|
| 87 | + if (isset($route['controller'], $route['namespace'])) {
|
|
| 88 | 88 | return $route['controller'].'/'.$route['namespace']; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -101,17 +101,17 @@ discard block |
||
| 101 | 101 | // get routes data and the resolving pattern |
| 102 | 102 | // Both are interrelated. |
| 103 | 103 | $routes = self::getRoutes(); |
| 104 | - $patternResolve = app()->resolve(RouteMatching::class,['route'=>new self()])->getPatternResolve(); |
|
| 104 | + $patternResolve = app()->resolve(RouteMatching::class, ['route'=>new self()])->getPatternResolve(); |
|
| 105 | 105 | |
| 106 | 106 | // we set the route variables for the route assistant. |
| 107 | 107 | self::updateRouteParameters($patternResolve); |
| 108 | 108 | |
| 109 | 109 | //if routes data is available in pattern resolve. |
| 110 | - if(isset($routes['data'][$patternResolve])){
|
|
| 110 | + if (isset($routes['data'][$patternResolve])) {
|
|
| 111 | 111 | |
| 112 | 112 | // if the incoming http value is |
| 113 | 113 | // the same as the real request method, the data is processed. |
| 114 | - if($routes['data'][$patternResolve]['http'] == strtolower(httpMethod)){
|
|
| 114 | + if ($routes['data'][$patternResolve]['http']==strtolower(httpMethod)) {
|
|
| 115 | 115 | |
| 116 | 116 | // we are set the solved pattern to a variable. |
| 117 | 117 | $resolve = $routes['data'][$patternResolve]; |
@@ -138,22 +138,22 @@ discard block |
||
| 138 | 138 | {
|
| 139 | 139 | $list = []; |
| 140 | 140 | |
| 141 | - if(isset(static::$routes['pattern'][$patternResolvedKey])){
|
|
| 141 | + if (isset(static::$routes['pattern'][$patternResolvedKey])) {
|
|
| 142 | 142 | |
| 143 | 143 | $routeParameters = static::$routes['pattern'][$patternResolvedKey]; |
| 144 | 144 | $route = route(); |
| 145 | 145 | |
| 146 | - foreach($routeParameters as $key=>$param){
|
|
| 146 | + foreach ($routeParameters as $key=>$param) {
|
|
| 147 | 147 | |
| 148 | - $param = Str::replaceWordArray(['{','}','?'],'',$param);
|
|
| 148 | + $param = Str::replaceWordArray(['{', '}', '?'], '', $param);
|
|
| 149 | 149 | |
| 150 | - if(isset($route[$key])){
|
|
| 150 | + if (isset($route[$key])) {
|
|
| 151 | 151 | $list[$param] = $route[$key]; |
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - app()->register('routeParams',$list);
|
|
| 156 | + app()->register('routeParams', $list);
|
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | {
|
| 166 | 166 | // we will record the path data for the route. |
| 167 | 167 | // We set the routeMapper variables and the route path. |
| 168 | - self::setPath(function(){
|
|
| 168 | + self::setPath(function() {
|
|
| 169 | 169 | |
| 170 | 170 | // we are sending |
| 171 | 171 | // the controller and routes.php path. |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | // in the paths data, |
| 179 | 179 | // we run the route mapper values and the route files one by one. |
| 180 | - foreach (self::$paths as $mapper=>$controller){
|
|
| 180 | + foreach (self::$paths as $mapper=>$controller) {
|
|
| 181 | 181 | core()->fileSystem->callFile($mapper); |
| 182 | 182 | } |
| 183 | 183 | } |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | {
|
| 192 | 192 | $routeDefinitor = call_user_func($callback); |
| 193 | 193 | |
| 194 | - if(isset($routeDefinitor['controllerPath']) && isset($routeDefinitor['routePath'])){
|
|
| 194 | + if (isset($routeDefinitor['controllerPath']) && isset($routeDefinitor['routePath'])) {
|
|
| 195 | 195 | |
| 196 | 196 | //the route paths to be saved to the mappers static property. |
| 197 | 197 | static::$mappers['routePaths'][] = $routeDefinitor['routePath']; |
@@ -199,22 +199,22 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | // if there is endpoint, |
| 201 | 201 | // then only that endpoint is transferred into the path |
| 202 | - if(defined('endpoint')){
|
|
| 202 | + if (defined('endpoint')) {
|
|
| 203 | 203 | |
| 204 | 204 | $routeName = endpoint.'Route.php'; |
| 205 | 205 | $routeMapper = $routeDefinitor['routePath'].''.DIRECTORY_SEPARATOR.''.$routeName; |
| 206 | 206 | |
| 207 | - if(file_exists($routeMapper) && !isset(static::$paths[$routeMapper])){
|
|
| 207 | + if (file_exists($routeMapper) && !isset(static::$paths[$routeMapper])) {
|
|
| 208 | 208 | static::$paths[$routeMapper] = $routeDefinitor['controllerPath']; |
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | - else{
|
|
| 211 | + else {
|
|
| 212 | 212 | |
| 213 | 213 | // if there is no endpoint, |
| 214 | 214 | // all files in the path of the route are transferred to path. |
| 215 | 215 | $allFilesInThatRoutePath = Utils::glob($routeDefinitor['routePath']); |
| 216 | 216 | |
| 217 | - foreach ($allFilesInThatRoutePath as $item){
|
|
| 217 | + foreach ($allFilesInThatRoutePath as $item) {
|
|
| 218 | 218 | static::$paths[$item] = $routeDefinitor['controllerPath']; |
| 219 | 219 | } |
| 220 | 220 | } |
@@ -228,13 +228,13 @@ discard block |
||
| 228 | 228 | * @param $function |
| 229 | 229 | * @param null $controller |
| 230 | 230 | */ |
| 231 | - public static function setRoute($params,$function,$controller=null) |
|
| 231 | + public static function setRoute($params, $function, $controller = null) |
|
| 232 | 232 | {
|
| 233 | - [$pattern,$route] = $params; |
|
| 234 | - [$class,$method] = explode("@",$route);
|
|
| 233 | + [$pattern, $route] = $params; |
|
| 234 | + [$class, $method] = explode("@", $route);
|
|
| 235 | 235 | |
| 236 | 236 | $patternList = array_values( |
| 237 | - array_filter(explode("/",$pattern),'strlen')
|
|
| 237 | + array_filter(explode("/", $pattern), 'strlen')
|
|
| 238 | 238 | ); |
| 239 | 239 | |
| 240 | 240 | static::$routes['pattern'][] = $patternList; |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | 'http' => $function, |
| 245 | 245 | 'controller' => $controller, |
| 246 | 246 | 'namespace' => static::$namespace, |
| 247 | - 'endpoint' => strtolower(str_replace(StaticPathList::$controllerBundleName,'',static::$namespace)) |
|
| 247 | + 'endpoint' => strtolower(str_replace(StaticPathList::$controllerBundleName, '', static::$namespace)) |
|
| 248 | 248 | ]; |
| 249 | 249 | } |
| 250 | 250 | |
@@ -254,11 +254,11 @@ discard block |
||
| 254 | 254 | * @param null $value |
| 255 | 255 | * @return bool |
| 256 | 256 | */ |
| 257 | - public static function isMatchVaribleRegexPattern($value=null) |
|
| 257 | + public static function isMatchVaribleRegexPattern($value = null) |
|
| 258 | 258 | {
|
| 259 | 259 | // determines if the variable that can be used |
| 260 | 260 | // in the route file meets the regex rule. |
| 261 | - return (preg_match('@\{(.*?)\}@is',$value)) ? true : false;
|
|
| 261 | + return (preg_match('@\{(.*?)\}@is', $value)) ? true : false;
|
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | |
@@ -268,11 +268,11 @@ discard block |
||
| 268 | 268 | * @param null $value |
| 269 | 269 | * @return bool |
| 270 | 270 | */ |
| 271 | - public static function isOptionalVaribleRegexPattern($value=null) |
|
| 271 | + public static function isOptionalVaribleRegexPattern($value = null) |
|
| 272 | 272 | {
|
| 273 | 273 | // determines if the variable that can be used |
| 274 | 274 | // in the route file meets the regex rule. |
| 275 | - return preg_match('@\{[a-z]+\?\}@is',$value) ? true : false;
|
|
| 275 | + return preg_match('@\{[a-z]+\?\}@is', $value) ? true : false;
|
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | |