@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | * @method bindConsoleShared |
| 21 | 21 | * @return array |
| 22 | 22 | */ |
| 23 | - private function bindConsoleShared(){
|
|
| 23 | + private function bindConsoleShared() {
|
|
| 24 | 24 | |
| 25 | 25 | //We assign the values assigned to the console object to the bindings array. |
| 26 | 26 | //The console object represents the classes to be bound for the kernel object console. |
| 27 | 27 | //if the array returns false on an if condition, the array will be automatically detected as empty. |
| 28 | - if(isset($this->app['consoleShared']) and is_array($this->app['consoleShared'])){
|
|
| 28 | + if (isset($this->app['consoleShared']) and is_array($this->app['consoleShared'])) {
|
|
| 29 | 29 | return $this->app['consoleShared']; |
| 30 | 30 | } |
| 31 | 31 | return []; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * @param $container |
| 37 | 37 | * @return void |
| 38 | 38 | */ |
| 39 | - public function bindForAppCommand($object,$container){
|
|
| 39 | + public function bindForAppCommand($object, $container) {
|
|
| 40 | 40 | |
| 41 | 41 | //We need a definition of the application name from the data supplied with the console variables. |
| 42 | 42 | //The specified app variable is important to us in the command that is run in the application. |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | //we send the value to the bind method without callback after checking the bind object to be loaded for the console. |
| 55 | 55 | //This is the value found in the bindings variable. |
| 56 | 56 | //Thus, we get the binding objects required for the console independently of the http method installation. |
| 57 | - if(isset($this->bindings[$object])){
|
|
| 58 | - $this->app->{$appresolve}($object,$this->bindings[$object]);
|
|
| 57 | + if (isset($this->bindings[$object])) {
|
|
| 58 | + $this->app->{$appresolve}($object, $this->bindings[$object]);
|
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
@@ -64,25 +64,25 @@ discard block |
||
| 64 | 64 | * @param $callback |
| 65 | 65 | * @param $container |
| 66 | 66 | */ |
| 67 | - public function console($object,$callback,$container){
|
|
| 67 | + public function console($object, $callback, $container) {
|
|
| 68 | 68 | |
| 69 | 69 | //If the console argument is an operator that exists in the resta kernel, |
| 70 | 70 | //we run a callback method to check it. The bindings for the custom application commander will be run. |
| 71 | - $this->bindForAppCommand($object,$container); |
|
| 71 | + $this->bindForAppCommand($object, $container); |
|
| 72 | 72 | |
| 73 | 73 | //closure object |
| 74 | 74 | $callBackResolve = Utils::callbackProcess($callback); |
| 75 | 75 | |
| 76 | 76 | // if the callbackresolve variable represents a class, |
| 77 | 77 | // we directly register it's resolved status to the container object. |
| 78 | - if(Utils::isNamespaceExists($callBackResolve)){
|
|
| 79 | - $this->app->register($object,$this->app->resolve(Utils::callbackProcess($callback))); |
|
| 78 | + if (Utils::isNamespaceExists($callBackResolve)) {
|
|
| 79 | + $this->app->register($object, $this->app->resolve(Utils::callbackProcess($callback))); |
|
| 80 | 80 | } |
| 81 | - else{
|
|
| 81 | + else {
|
|
| 82 | 82 | |
| 83 | 83 | // if callbackresolve doesn't represent a class, |
| 84 | 84 | // we're register it's no resolved status. |
| 85 | - $this->app->register($object,Utils::callbackProcess($callback)); |
|
| 85 | + $this->app->register($object, Utils::callbackProcess($callback)); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | |
@@ -77,8 +77,7 @@ |
||
| 77 | 77 | // we directly register it's resolved status to the container object. |
| 78 | 78 | if(Utils::isNamespaceExists($callBackResolve)){
|
| 79 | 79 | $this->app->register($object,$this->app->resolve(Utils::callbackProcess($callback))); |
| 80 | - } |
|
| 81 | - else{
|
|
| 80 | + } else{
|
|
| 82 | 81 | |
| 83 | 82 | // if callbackresolve doesn't represent a class, |
| 84 | 83 | // we're register it's no resolved status. |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | function convert($string, $colored = true) |
| 218 | 218 | {
|
| 219 | 219 | static $conversions = array ( // static so the array doesn't get built |
| 220 | - // everytime |
|
| 220 | + // everytime |
|
| 221 | 221 | // %y - yellow, and so on... {{{
|
| 222 | 222 | '%y' => array('color' => 'yellow'),
|
| 223 | 223 | '%g' => array('color' => 'green' ),
|
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | $string = str_replace('%%', '% ', $string);
|
| 261 | 261 | foreach ($conversions as $key => $value) {
|
| 262 | 262 | $string = str_replace($key, Console_Color::color($value), |
| 263 | - $string); |
|
| 263 | + $string); |
|
| 264 | 264 | } |
| 265 | 265 | $string = str_replace('% ', '%', $string);
|
| 266 | 266 | |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | |
| 34 | 34 | |
| 35 | -$GLOBALS['_CONSOLE_COLOR_CODES'] = array ( |
|
| 35 | +$GLOBALS['_CONSOLE_COLOR_CODES'] = array( |
|
| 36 | 36 | 'color' => array( |
| 37 | 37 | 'black' => 30, |
| 38 | 38 | 'red' => 31, |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $color = @$color['color']; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - if ($color == 'reset') {
|
|
| 115 | + if ($color=='reset') {
|
|
| 116 | 116 | return "\033[0m"; |
| 117 | 117 | } |
| 118 | 118 | |
@@ -216,37 +216,37 @@ discard block |
||
| 216 | 216 | */ |
| 217 | 217 | function convert($string, $colored = true) |
| 218 | 218 | {
|
| 219 | - static $conversions = array ( // static so the array doesn't get built |
|
| 219 | + static $conversions = array( // static so the array doesn't get built |
|
| 220 | 220 | // everytime |
| 221 | 221 | // %y - yellow, and so on... {{{
|
| 222 | 222 | '%y' => array('color' => 'yellow'),
|
| 223 | - '%g' => array('color' => 'green' ),
|
|
| 224 | - '%b' => array('color' => 'blue' ),
|
|
| 225 | - '%r' => array('color' => 'red' ),
|
|
| 223 | + '%g' => array('color' => 'green'),
|
|
| 224 | + '%b' => array('color' => 'blue'),
|
|
| 225 | + '%r' => array('color' => 'red'),
|
|
| 226 | 226 | '%p' => array('color' => 'purple'),
|
| 227 | 227 | '%m' => array('color' => 'purple'),
|
| 228 | - '%c' => array('color' => 'cyan' ),
|
|
| 229 | - '%w' => array('color' => 'grey' ),
|
|
| 230 | - '%k' => array('color' => 'black' ),
|
|
| 231 | - '%n' => array('color' => 'reset' ),
|
|
| 232 | - '%Y' => array('color' => 'yellow', 'style' => 'light'),
|
|
| 233 | - '%G' => array('color' => 'green', 'style' => 'light'),
|
|
| 234 | - '%B' => array('color' => 'blue', 'style' => 'light'),
|
|
| 235 | - '%R' => array('color' => 'red', 'style' => 'light'),
|
|
| 236 | - '%P' => array('color' => 'purple', 'style' => 'light'),
|
|
| 237 | - '%M' => array('color' => 'purple', 'style' => 'light'),
|
|
| 238 | - '%C' => array('color' => 'cyan', 'style' => 'light'),
|
|
| 239 | - '%W' => array('color' => 'grey', 'style' => 'light'),
|
|
| 240 | - '%K' => array('color' => 'black', 'style' => 'light'),
|
|
| 241 | - '%N' => array('color' => 'reset', 'style' => 'light'),
|
|
| 228 | + '%c' => array('color' => 'cyan'),
|
|
| 229 | + '%w' => array('color' => 'grey'),
|
|
| 230 | + '%k' => array('color' => 'black'),
|
|
| 231 | + '%n' => array('color' => 'reset'),
|
|
| 232 | + '%Y' => array('color' => 'yellow', 'style' => 'light'),
|
|
| 233 | + '%G' => array('color' => 'green', 'style' => 'light'),
|
|
| 234 | + '%B' => array('color' => 'blue', 'style' => 'light'),
|
|
| 235 | + '%R' => array('color' => 'red', 'style' => 'light'),
|
|
| 236 | + '%P' => array('color' => 'purple', 'style' => 'light'),
|
|
| 237 | + '%M' => array('color' => 'purple', 'style' => 'light'),
|
|
| 238 | + '%C' => array('color' => 'cyan', 'style' => 'light'),
|
|
| 239 | + '%W' => array('color' => 'grey', 'style' => 'light'),
|
|
| 240 | + '%K' => array('color' => 'black', 'style' => 'light'),
|
|
| 241 | + '%N' => array('color' => 'reset', 'style' => 'light'),
|
|
| 242 | 242 | '%3' => array('background' => 'yellow'),
|
| 243 | - '%2' => array('background' => 'green' ),
|
|
| 244 | - '%4' => array('background' => 'blue' ),
|
|
| 245 | - '%1' => array('background' => 'red' ),
|
|
| 243 | + '%2' => array('background' => 'green'),
|
|
| 244 | + '%4' => array('background' => 'blue'),
|
|
| 245 | + '%1' => array('background' => 'red'),
|
|
| 246 | 246 | '%5' => array('background' => 'purple'),
|
| 247 | - '%6' => array('background' => 'cyan' ),
|
|
| 248 | - '%7' => array('background' => 'grey' ),
|
|
| 249 | - '%0' => array('background' => 'black' ),
|
|
| 247 | + '%6' => array('background' => 'cyan'),
|
|
| 248 | + '%7' => array('background' => 'grey'),
|
|
| 249 | + '%0' => array('background' => 'black'),
|
|
| 250 | 250 | // Don't use this, I can't stand flashing text |
| 251 | 251 | '%F' => array('style' => 'blink'),
|
| 252 | 252 | '%U' => array('style' => 'underline'),
|
@@ -66,7 +66,9 @@ |
||
| 66 | 66 | {
|
| 67 | 67 | $list = []; |
| 68 | 68 | |
| 69 | - if(!is_array($rules)) $rules = []; |
|
| 69 | + if(!is_array($rules)) {
|
|
| 70 | + $rules = []; |
|
| 71 | + } |
|
| 70 | 72 | |
| 71 | 73 | foreach ($rules as $key=>$rule){
|
| 72 | 74 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public function prepareCommander($commander) |
| 21 | 21 | {
|
| 22 | - $commander=$commander->call(function() use($commander){
|
|
| 22 | + $commander = $commander->call(function() use($commander){
|
|
| 23 | 23 | |
| 24 | 24 | return [ |
| 25 | 25 | 'commandRule' => $this->commandRule, |
@@ -37,16 +37,15 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | protected function resolveParameters($commander) |
| 39 | 39 | {
|
| 40 | - if(isset($commander['commandRule'][$commander['method']])){
|
|
| 41 | - $methodCommanderRule = $commander['commandRule'][$commander['method']]; |
|
| 40 | + if (isset($commander['commandRule'][$commander['method']])) {
|
|
| 41 | + $methodCommanderRule = $commander['commandRule'][$commander['method']]; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - $commandRule = (isset($methodCommanderRule)) ? $methodCommanderRule : |
|
| 45 | - $this->getDefaultCommandRules($commander['commandRule']); |
|
| 44 | + $commandRule = (isset($methodCommanderRule)) ? $methodCommanderRule : $this->getDefaultCommandRules($commander['commandRule']); |
|
| 46 | 45 | |
| 47 | - foreach ($commandRule as $key=>$value){
|
|
| 48 | - if(!preg_match('@\?.+@is',$value)){
|
|
| 49 | - if(!isset($commander['arguments'][$value]) OR $commander['arguments'][$value]==""){
|
|
| 46 | + foreach ($commandRule as $key=>$value) {
|
|
| 47 | + if (!preg_match('@\?.+@is', $value)) {
|
|
| 48 | + if (!isset($commander['arguments'][$value]) OR $commander['arguments'][$value]=="") {
|
|
| 50 | 49 | return [ |
| 51 | 50 | 'status'=>false, |
| 52 | 51 | 'argument'=>$value, |
@@ -68,12 +67,12 @@ discard block |
||
| 68 | 67 | {
|
| 69 | 68 | $list = []; |
| 70 | 69 | |
| 71 | - if(!is_array($rules)) $rules = []; |
|
| 70 | + if (!is_array($rules)) $rules = []; |
|
| 72 | 71 | |
| 73 | - foreach ($rules as $key=>$rule){
|
|
| 72 | + foreach ($rules as $key=>$rule) {
|
|
| 74 | 73 | |
| 75 | - if(!is_array($rules[$key])){
|
|
| 76 | - $list[$key]=$rule; |
|
| 74 | + if (!is_array($rules[$key])) {
|
|
| 75 | + $list[$key] = $rule; |
|
| 77 | 76 | } |
| 78 | 77 | } |
| 79 | 78 | |
@@ -12,15 +12,15 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | public function projectPath() |
| 14 | 14 | {
|
| 15 | - if($this->project===null){
|
|
| 15 | + if ($this->project===null) {
|
|
| 16 | 16 | throw new \InvalidArgumentException('Project name is invalid');
|
| 17 | 17 | } |
| 18 | - return StaticPathModel::projectPath(Str::slashToBackSlash(StaticPathList::$projectPrefixGroup),$this->project); |
|
| 18 | + return StaticPathModel::projectPath(Str::slashToBackSlash(StaticPathList::$projectPrefixGroup), $this->project); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - public function projectName(){
|
|
| 21 | + public function projectName() {
|
|
| 22 | 22 | |
| 23 | - $projectParse=explode("\\",$this->argument['project']);
|
|
| 23 | + $projectParse = explode("\\", $this->argument['project']);
|
|
| 24 | 24 | return current($projectParse); |
| 25 | 25 | } |
| 26 | 26 | /** |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | /** |
| 35 | 35 | * @return mixed |
| 36 | 36 | */ |
| 37 | - public function storage(){
|
|
| 37 | + public function storage() {
|
|
| 38 | 38 | |
| 39 | 39 | return $this->projectPath().''.StaticPathModel::$storage; |
| 40 | 40 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | /** |
| 43 | 43 | * @return mixed |
| 44 | 44 | */ |
| 45 | - public function version(){
|
|
| 45 | + public function version() {
|
|
| 46 | 46 | |
| 47 | 47 | return $this->project.'/'.UrlVersionIdentifier::version(); |
| 48 | 48 | } |
@@ -51,18 +51,18 @@ discard block |
||
| 51 | 51 | /** |
| 52 | 52 | * @return mixed |
| 53 | 53 | */ |
| 54 | - public function controller(){
|
|
| 54 | + public function controller() {
|
|
| 55 | 55 | |
| 56 | - $this->argument['controller']=StaticPathModel::$controller; |
|
| 56 | + $this->argument['controller'] = StaticPathModel::$controller; |
|
| 57 | 57 | return $this->version().'/'.$this->argument['controller']; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * @return mixed |
| 62 | 62 | */ |
| 63 | - public function platform(){
|
|
| 63 | + public function platform() {
|
|
| 64 | 64 | |
| 65 | - $this->argument['platform']=StaticPathModel::$platform; |
|
| 65 | + $this->argument['platform'] = StaticPathModel::$platform; |
|
| 66 | 66 | return $this->version().'/'.$this->argument['platform']; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | /** |
| 71 | 71 | * @return mixed |
| 72 | 72 | */ |
| 73 | - public function model(){
|
|
| 73 | + public function model() {
|
|
| 74 | 74 | |
| 75 | - $this->argument['model']=StaticPathModel::$model; |
|
| 75 | + $this->argument['model'] = StaticPathModel::$model; |
|
| 76 | 76 | return $this->version().'/'.StaticPathModel::$model; |
| 77 | 77 | } |
| 78 | 78 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | /** |
| 81 | 81 | * @return mixed |
| 82 | 82 | */ |
| 83 | - public function builder(){
|
|
| 83 | + public function builder() {
|
|
| 84 | 84 | |
| 85 | 85 | return $this->model().'/'.StaticPathModel::$builder; |
| 86 | 86 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | /** |
| 90 | 90 | * @return mixed |
| 91 | 91 | */ |
| 92 | - public function migration(){
|
|
| 92 | + public function migration() {
|
|
| 93 | 93 | |
| 94 | 94 | return $this->version().'/'.StaticPathModel::$migration; |
| 95 | 95 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | /** |
| 99 | 99 | * @return mixed |
| 100 | 100 | */ |
| 101 | - public function config(){
|
|
| 101 | + public function config() {
|
|
| 102 | 102 | |
| 103 | 103 | return $this->version().'/'.StaticPathModel::$config; |
| 104 | 104 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | /** |
| 107 | 107 | * @return mixed |
| 108 | 108 | */ |
| 109 | - public function test(){
|
|
| 109 | + public function test() {
|
|
| 110 | 110 | |
| 111 | 111 | return $this->projectPath().'/'.StaticPathModel::$test; |
| 112 | 112 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | /** |
| 116 | 116 | * @return mixed |
| 117 | 117 | */ |
| 118 | - public function optional(){
|
|
| 118 | + public function optional() {
|
|
| 119 | 119 | |
| 120 | 120 | return $this->version().'/'.StaticPathModel::$optional; |
| 121 | 121 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | /** |
| 124 | 124 | * @return mixed |
| 125 | 125 | */ |
| 126 | - public function events(){
|
|
| 126 | + public function events() {
|
|
| 127 | 127 | |
| 128 | 128 | return $this->optional().'/'.StaticPathModel::$events; |
| 129 | 129 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | /** |
| 132 | 132 | * @return mixed |
| 133 | 133 | */ |
| 134 | - public function listeners(){
|
|
| 134 | + public function listeners() {
|
|
| 135 | 135 | |
| 136 | 136 | return $this->optional().'/'.StaticPathModel::$listeners; |
| 137 | 137 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | /** |
| 141 | 141 | * @return mixed |
| 142 | 142 | */ |
| 143 | - public function sourceDir(){
|
|
| 143 | + public function sourceDir() {
|
|
| 144 | 144 | |
| 145 | 145 | return $this->optional().'/'.StaticPathModel::$sourcePath; |
| 146 | 146 | } |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | /** |
| 149 | 149 | * @return mixed |
| 150 | 150 | */ |
| 151 | - public function sourceEndpointDir(){
|
|
| 151 | + public function sourceEndpointDir() {
|
|
| 152 | 152 | |
| 153 | 153 | return $this->optional().'/'.StaticPathModel::$sourcePath.'/Endpoint'; |
| 154 | 154 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | /** |
| 158 | 158 | * @return mixed |
| 159 | 159 | */ |
| 160 | - public function sourceRequestDir(){
|
|
| 160 | + public function sourceRequestDir() {
|
|
| 161 | 161 | |
| 162 | 162 | return $this->optional().'/'.StaticPathModel::$sourceRequest; |
| 163 | 163 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | /** |
| 166 | 166 | * @return mixed |
| 167 | 167 | */ |
| 168 | - public function sourceSupportDir(){
|
|
| 168 | + public function sourceSupportDir() {
|
|
| 169 | 169 | |
| 170 | 170 | return $this->optional().'/'.StaticPathModel::$sourcePath.'/Support'; |
| 171 | 171 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | /** |
| 175 | 175 | * @return mixed |
| 176 | 176 | */ |
| 177 | - public function repository(){
|
|
| 177 | + public function repository() {
|
|
| 178 | 178 | |
| 179 | 179 | return path()->repository(); |
| 180 | 180 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | /** |
| 183 | 183 | * @return mixed |
| 184 | 184 | */ |
| 185 | - public function listener(){
|
|
| 185 | + public function listener() {
|
|
| 186 | 186 | |
| 187 | 187 | return $this->optional().'/'.StaticPathModel::$listener; |
| 188 | 188 | } |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | /** |
| 192 | 192 | * @return mixed |
| 193 | 193 | */ |
| 194 | - public function job(){
|
|
| 194 | + public function job() {
|
|
| 195 | 195 | |
| 196 | 196 | return $this->optional().'/'.StaticPathModel::$job; |
| 197 | 197 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | /** |
| 201 | 201 | * @return mixed |
| 202 | 202 | */ |
| 203 | - public function webservice(){
|
|
| 203 | + public function webservice() {
|
|
| 204 | 204 | |
| 205 | 205 | return $this->projectPath().'/'.StaticPathModel::$webservice; |
| 206 | 206 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | /** |
| 210 | 210 | * @return mixed |
| 211 | 211 | */ |
| 212 | - public function log(){
|
|
| 212 | + public function log() {
|
|
| 213 | 213 | |
| 214 | 214 | return $this->storage().'/'.StaticPathModel::$log; |
| 215 | 215 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | /** |
| 218 | 218 | * @return mixed |
| 219 | 219 | */ |
| 220 | - public function language(){
|
|
| 220 | + public function language() {
|
|
| 221 | 221 | |
| 222 | 222 | return $this->storage().'/'.StaticPathModel::$language; |
| 223 | 223 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | /** |
| 227 | 227 | * @return mixed |
| 228 | 228 | */ |
| 229 | - public function resource(){
|
|
| 229 | + public function resource() {
|
|
| 230 | 230 | |
| 231 | 231 | return $this->storage().'/'.StaticPathModel::$resource; |
| 232 | 232 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | /** |
| 236 | 236 | * @return mixed |
| 237 | 237 | */ |
| 238 | - public function session(){
|
|
| 238 | + public function session() {
|
|
| 239 | 239 | |
| 240 | 240 | return $this->storage().'/'.StaticPathModel::$session; |
| 241 | 241 | } |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | /** |
| 245 | 245 | * @return mixed |
| 246 | 246 | */ |
| 247 | - public function middleware(){
|
|
| 247 | + public function middleware() {
|
|
| 248 | 248 | |
| 249 | 249 | return $this->version().'/'.StaticPathModel::$middleware; |
| 250 | 250 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | /** |
| 253 | 253 | * @return mixed |
| 254 | 254 | */ |
| 255 | - public function factory(){
|
|
| 255 | + public function factory() {
|
|
| 256 | 256 | |
| 257 | 257 | return $this->version().'/'.StaticPathModel::$factory; |
| 258 | 258 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | /** |
| 262 | 262 | * @return mixed |
| 263 | 263 | */ |
| 264 | - public function node(){
|
|
| 264 | + public function node() {
|
|
| 265 | 265 | |
| 266 | 266 | return $this->kernel().'/'.StaticPathModel::$node; |
| 267 | 267 | } |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | /** |
| 271 | 271 | * @return mixed |
| 272 | 272 | */ |
| 273 | - public function once(){
|
|
| 273 | + public function once() {
|
|
| 274 | 274 | |
| 275 | 275 | return $this->kernel().'/'.StaticPathModel::$once; |
| 276 | 276 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | /** |
| 279 | 279 | * @return mixed |
| 280 | 280 | */ |
| 281 | - public function command(){
|
|
| 281 | + public function command() {
|
|
| 282 | 282 | |
| 283 | 283 | return $this->optional().'/'.StaticPathModel::$command; |
| 284 | 284 | } |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | /** |
| 288 | 288 | * @return mixed |
| 289 | 289 | */ |
| 290 | - public function stub(){
|
|
| 290 | + public function stub() {
|
|
| 291 | 291 | |
| 292 | 292 | return $this->kernel().'/'.StaticPathModel::$stub; |
| 293 | 293 | } |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | /** |
| 296 | 296 | * @return mixed |
| 297 | 297 | */ |
| 298 | - public function provider(){
|
|
| 298 | + public function provider() {
|
|
| 299 | 299 | |
| 300 | 300 | return $this->kernel().'/'.StaticPathModel::$provider; |
| 301 | 301 | } |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | /** |
| 305 | 305 | * @return mixed |
| 306 | 306 | */ |
| 307 | - public function autoService(){
|
|
| 307 | + public function autoService() {
|
|
| 308 | 308 | |
| 309 | 309 | return root.'/'.StaticPathModel::$appDefine.'/'.strtolower(StaticPathModel::$store).'/'.StaticPathModel::$autoService; |
| 310 | 310 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | use Resta\Contracts\ConfigProviderContracts; |
| 11 | 11 | use Resta\Foundation\PathManager\StaticPathList; |
| 12 | 12 | |
| 13 | -class ConfigProvider extends ApplicationProvider implements ConfigProviderContracts,HandleContracts |
|
| 13 | +class ConfigProvider extends ApplicationProvider implements ConfigProviderContracts, HandleContracts |
|
| 14 | 14 | {
|
| 15 | 15 | /** |
| 16 | 16 | * config provider handle |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public function handle() |
| 21 | 21 | {
|
| 22 | - define('config',true);
|
|
| 22 | + define('config', true);
|
|
| 23 | 23 | |
| 24 | 24 | //automatically add values to the configuration files. |
| 25 | 25 | $this->loadPreDefinedConfigurationFiles(); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | // Finally, we will set |
| 31 | 31 | // the application's timezone and encoding based on the configuration |
| 32 | - if(config('app')!==null){
|
|
| 32 | + if (config('app')!==null) {
|
|
| 33 | 33 | date_default_timezone_set(config('app.timezone'));
|
| 34 | 34 | mb_internal_encoding('UTF-8');
|
| 35 | 35 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | private function loadPreDefinedConfigurationFiles() |
| 44 | 44 | {
|
| 45 | - $this->app->loadConfig(function(){
|
|
| 45 | + $this->app->loadConfig(function() {
|
|
| 46 | 46 | return [ |
| 47 | 47 | 'Kernel' => path()->kernel().''.DIRECTORY_SEPARATOR.''.StaticPathList::$kernel.'.php', |
| 48 | 48 | 'Response' => path()->storeConfigDir().''.DIRECTORY_SEPARATOR.'Response.php', |
@@ -56,24 +56,24 @@ discard block |
||
| 56 | 56 | * @param array $files |
| 57 | 57 | * @return mixed|void |
| 58 | 58 | */ |
| 59 | - private function registerConfiguration($files=array()) |
|
| 59 | + private function registerConfiguration($files = array()) |
|
| 60 | 60 | {
|
| 61 | 61 | // we are saving all paths in |
| 62 | 62 | // the config directory of each application. |
| 63 | - foreach($files as $key=>$file){
|
|
| 63 | + foreach ($files as $key=>$file) {
|
|
| 64 | 64 | |
| 65 | - if(is_array($file)){
|
|
| 65 | + if (is_array($file)) {
|
|
| 66 | 66 | |
| 67 | - $this->app->register('appConfig',Str::lower($key),[
|
|
| 67 | + $this->app->register('appConfig', Str::lower($key), [
|
|
| 68 | 68 | 'namespace' => null, |
| 69 | 69 | 'file' => null, |
| 70 | 70 | 'data' => $file |
| 71 | 71 | ]); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - elseif(file_exists($file)){
|
|
| 74 | + elseif (file_exists($file)) {
|
|
| 75 | 75 | |
| 76 | - $this->app->register('appConfig',Str::lower($key),[
|
|
| 76 | + $this->app->register('appConfig', Str::lower($key), [
|
|
| 77 | 77 | 'namespace' =>Utils::getNamespace($file), |
| 78 | 78 | 'file' =>$file |
| 79 | 79 | ]); |
@@ -84,14 +84,14 @@ discard block |
||
| 84 | 84 | /** |
| 85 | 85 | * @param null $path |
| 86 | 86 | */ |
| 87 | - public function setConfig($path=null) |
|
| 87 | + public function setConfig($path = null) |
|
| 88 | 88 | {
|
| 89 | - if(!is_array($path)){
|
|
| 89 | + if (!is_array($path)) {
|
|
| 90 | 90 | |
| 91 | 91 | // path variable for parameter |
| 92 | 92 | // we run a glob function for all of the config files, |
| 93 | 93 | // where we pass namespace and paths to a kernel object and process them. |
| 94 | - $path = ($path === null) ? path()->config() : $path; |
|
| 94 | + $path = ($path===null) ? path()->config() : $path; |
|
| 95 | 95 | $configFiles = Utils::glob($path); |
| 96 | 96 | |
| 97 | 97 | } |
@@ -69,9 +69,7 @@ |
||
| 69 | 69 | 'file' => null, |
| 70 | 70 | 'data' => $file |
| 71 | 71 | ]); |
| 72 | - } |
|
| 73 | - |
|
| 74 | - elseif(file_exists($file)){
|
|
| 72 | + } elseif(file_exists($file)){
|
|
| 75 | 73 | |
| 76 | 74 | $this->app->register('appConfig',Str::lower($key),[
|
| 77 | 75 | 'namespace' =>Utils::getNamespace($file), |
@@ -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(),applicationKey() |
|
| 210 | + return md5(sha1(implode("|", [
|
|
| 211 | + request()->getClientIp(), 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|string |
| 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 |