@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public function create() |
36 | 36 | { |
37 | 37 | |
38 | - if(!file_exists(app()->path()->tests())){ |
|
38 | + if (!file_exists(app()->path()->tests())) { |
|
39 | 39 | $this->directory['test'] = app()->path()->tests(); |
40 | 40 | $this->file->makeDirectory($this); |
41 | 41 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $this->argument['testNamespace'] = ucfirst($this->argument['test']).'Test'; |
45 | 45 | $this->argument['projectName'] = strtolower($this->projectName()); |
46 | 46 | |
47 | - $this->touch['test/test']= app()->path()->tests().'/'.$this->argument['testNamespace'].'.php'; |
|
47 | + $this->touch['test/test'] = app()->path()->tests().'/'.$this->argument['testNamespace'].'.php'; |
|
48 | 48 | |
49 | 49 | |
50 | 50 | $this->file->touch($this); |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | |
64 | 64 | $array = $xml->toArray(); |
65 | 65 | |
66 | - $new = (new PhpUnitManager($array))->add(strtolower($this->projectName()),'directory', |
|
67 | - str_replace(root.''.DIRECTORY_SEPARATOR,"",app()->path()->tests())); |
|
66 | + $new = (new PhpUnitManager($array))->add(strtolower($this->projectName()), 'directory', |
|
67 | + str_replace(root.''.DIRECTORY_SEPARATOR, "", app()->path()->tests())); |
|
68 | 68 | |
69 | 69 | $newDataXml = $xml->toXml($new); |
70 | 70 | |
71 | - app()->get('fileSystem')->writeFile($phpunit,$newDataXml); |
|
71 | + app()->get('fileSystem')->writeFile($phpunit, $newDataXml); |
|
72 | 72 | |
73 | 73 | echo $this->classical(' > phpunit.xml file has been updated'); |
74 | 74 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function run() |
80 | 80 | { |
81 | - $process = new Process(['vendor'.DIRECTORY_SEPARATOR.'bin'.DIRECTORY_SEPARATOR.'phpunit','--group',strtolower($this->projectName())]); |
|
81 | + $process = new Process(['vendor'.DIRECTORY_SEPARATOR.'bin'.DIRECTORY_SEPARATOR.'phpunit', '--group', strtolower($this->projectName())]); |
|
82 | 82 | $process->setTty(true); |
83 | 83 | |
84 | 84 | try { |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | public function get() |
35 | 35 | { |
36 | 36 | // The config process class should not be null. |
37 | - if(self::$configProcessInstance!==null){ |
|
37 | + if (self::$configProcessInstance!==null) { |
|
38 | 38 | |
39 | 39 | //get config variables |
40 | 40 | $config = self::$config; |
41 | 41 | |
42 | 42 | // offset config variables to config process class |
43 | - self::$configProcessInstance->offsetSet('config',$config); |
|
43 | + self::$configProcessInstance->offsetSet('config', $config); |
|
44 | 44 | |
45 | 45 | //get config variable from config process class |
46 | 46 | return self::$configProcessInstance->get(); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param null|string $config |
76 | 76 | * @return Config |
77 | 77 | */ |
78 | - public static function macro($config=null) |
|
78 | + public static function macro($config = null) |
|
79 | 79 | { |
80 | 80 | /** @var Macro $macro */ |
81 | 81 | $macro = app()->get('macro'); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * @param null $config |
89 | 89 | * @return Config |
90 | 90 | */ |
91 | - public static function make($config=null) |
|
91 | + public static function make($config = null) |
|
92 | 92 | { |
93 | 93 | self::$config = $config; |
94 | 94 | self::$configProcessInstance = app()->resolve(ConfigProcess::class); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @param array $data |
102 | 102 | * @return bool|mixed |
103 | 103 | */ |
104 | - public function set($data=array()) |
|
104 | + public function set($data = array()) |
|
105 | 105 | { |
106 | 106 | // receive the necessary config settings. |
107 | 107 | $configPath = path()->config(); |
@@ -109,12 +109,12 @@ discard block |
||
109 | 109 | $setConfigPath = $configPath.''.DIRECTORY_SEPARATOR.''.ucfirst($configArray).'.php'; |
110 | 110 | $getConfigWrap = Arr::wrap(config($configArray)); |
111 | 111 | |
112 | - foreach ($data as $value){ |
|
112 | + foreach ($data as $value) { |
|
113 | 113 | |
114 | 114 | // we check the config value not to be rewritten. |
115 | - if(!in_array($value,$getConfigWrap)){ |
|
116 | - $setData = '<?php return '.var_export(array_merge($getConfigWrap,$data), true).';'; |
|
117 | - return app()->resolve(FileProcess::class)->dumpFile($setConfigPath,$setData); |
|
115 | + if (!in_array($value, $getConfigWrap)) { |
|
116 | + $setData = '<?php return '.var_export(array_merge($getConfigWrap, $data), true).';'; |
|
117 | + return app()->resolve(FileProcess::class)->dumpFile($setConfigPath, $setData); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | } |
@@ -14,9 +14,9 @@ |
||
14 | 14 | * |
15 | 15 | * @param null|string $path |
16 | 16 | */ |
17 | - public static function setPath($path=null) |
|
17 | + public static function setPath($path = null) |
|
18 | 18 | { |
19 | - if(!is_null($path)){ |
|
19 | + if (!is_null($path)) { |
|
20 | 20 | self::$requestPath = $path; |
21 | 21 | } |
22 | 22 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param bool $static |
34 | 34 | * @return bool |
35 | 35 | */ |
36 | - protected function checkMacroConditions($static=false) |
|
36 | + protected function checkMacroConditions($static = false) |
|
37 | 37 | { |
38 | 38 | return is_string($this->macro) && |
39 | 39 | Utils::isNamespaceExists($this->macro) && |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | * @param bool $static |
47 | 47 | * @return bool |
48 | 48 | */ |
49 | - protected function checkMacroInstanceOf($static=false) |
|
49 | + protected function checkMacroInstanceOf($static = false) |
|
50 | 50 | { |
51 | - if($static){ |
|
51 | + if ($static) { |
|
52 | 52 | return true; |
53 | 53 | } |
54 | 54 | return $this->app->resolve($this->macro) instanceof MacroAbleContracts; |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | * @param callable $callback |
62 | 62 | * @return mixed |
63 | 63 | */ |
64 | - public function get($method,callable $callback) |
|
64 | + public function get($method, callable $callback) |
|
65 | 65 | { |
66 | - if($this->isMacro){ |
|
66 | + if ($this->isMacro) { |
|
67 | 67 | |
68 | - if(method_exists($resolve = $this->app->resolve($this->macro),$method)){ |
|
68 | + if (method_exists($resolve = $this->app->resolve($this->macro), $method)) { |
|
69 | 69 | return $resolve->macro($this->class); |
70 | 70 | } |
71 | 71 | } |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | * @param $class |
90 | 90 | * @return $this |
91 | 91 | */ |
92 | - public function isMacro($class,$static=false) |
|
92 | + public function isMacro($class, $static = false) |
|
93 | 93 | { |
94 | 94 | // if the macro class is a valid object, |
95 | 95 | // then this macro will return a boolean value if it has the specified methode. |
96 | - if($this->checkMacroConditions($static)){ |
|
96 | + if ($this->checkMacroConditions($static)) { |
|
97 | 97 | |
98 | 98 | $this->isMacro = true; |
99 | 99 | $this->class = $class; |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | * @param $method |
122 | 122 | * @return mixed |
123 | 123 | */ |
124 | - public function with($macro,$concrete,$method=null) |
|
124 | + public function with($macro, $concrete, $method = null) |
|
125 | 125 | { |
126 | - if($this->macro === null){ |
|
127 | - return $this($macro)->isMacro($concrete)->get($method,function() use($concrete){ |
|
126 | + if ($this->macro===null) { |
|
127 | + return $this($macro)->isMacro($concrete)->get($method, function() use($concrete){ |
|
128 | 128 | return $concrete; |
129 | 129 | }); |
130 | 130 | } |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | * @param $method |
139 | 139 | * @return mixed |
140 | 140 | */ |
141 | - public function withStatic($macro,$concrete) |
|
141 | + public function withStatic($macro, $concrete) |
|
142 | 142 | { |
143 | - return $this($macro)->isMacro($concrete,true)->get(null,is_callable($concrete) ? |
|
143 | + return $this($macro)->isMacro($concrete, true)->get(null, is_callable($concrete) ? |
|
144 | 144 | $concrete : function() use($concrete){ |
145 | 145 | return $concrete; |
146 | 146 | }); |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | * @param null|string $macro |
153 | 153 | * @return $this |
154 | 154 | */ |
155 | - public function __invoke($macro=null) |
|
155 | + public function __invoke($macro = null) |
|
156 | 156 | { |
157 | - if($macro!==null){ |
|
157 | + if ($macro!==null) { |
|
158 | 158 | $this->macro = $macro; |
159 | 159 | } |
160 | 160 | return $this; |
@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | /** |
11 | 11 | * @param array $data |
12 | 12 | */ |
13 | - public function exception($data=array()) |
|
13 | + public function exception($data = array()) |
|
14 | 14 | { |
15 | - if(!isset($data['project']) and !isset($data['version'])){ |
|
15 | + if (!isset($data['project']) and !isset($data['version'])) { |
|
16 | 16 | exception()->notFoundException('No Project or Version'); |
17 | 17 | } |
18 | 18 | |
@@ -21,17 +21,17 @@ discard block |
||
21 | 21 | |
22 | 22 | //If there is no project on the url |
23 | 23 | //we throw an exception |
24 | - if($data['project']===null OR !file_exists($appPath)){ |
|
24 | + if ($data['project']===null OR !file_exists($appPath)) { |
|
25 | 25 | exception()->notFoundException('No Project'); |
26 | 26 | } |
27 | 27 | |
28 | - if(!in_array($data['version'],UrlVersionIdentifier::supportedVersions())){ |
|
28 | + if (!in_array($data['version'], UrlVersionIdentifier::supportedVersions())) { |
|
29 | 29 | throw new DomainException('Version Number is not supported'); |
30 | 30 | } |
31 | 31 | |
32 | 32 | //If there is no endpoint on the url |
33 | 33 | //we throw an exception |
34 | - if($data['endpoint']===null){ |
|
34 | + if ($data['endpoint']===null) { |
|
35 | 35 | exception()->notFoundException('No Endpoint'); |
36 | 36 | } |
37 | 37 | } |
@@ -99,8 +99,7 @@ discard block |
||
99 | 99 | // in the application directory class. |
100 | 100 | if(Utils::isNamespaceExists($nameNamespace)){ |
101 | 101 | $callNamespace = new $nameNamespace; |
102 | - } |
|
103 | - else{ |
|
102 | + } else{ |
|
104 | 103 | |
105 | 104 | // if you do not have an exception in the application directory, |
106 | 105 | // this time we are looking for an exception in the core directory. |
@@ -133,8 +132,7 @@ discard block |
||
133 | 132 | //throw exception |
134 | 133 | if($msg===null){ |
135 | 134 | throw new $callNamespace; |
136 | - } |
|
137 | - else{ |
|
135 | + } else{ |
|
138 | 136 | throw new $callNamespace($msg); |
139 | 137 | } |
140 | 138 |
@@ -16,13 +16,13 @@ discard block |
||
16 | 16 | * @param null|string $name |
17 | 17 | * @param array $params |
18 | 18 | */ |
19 | - public function __construct($app,$name=null,$params=array()) |
|
19 | + public function __construct($app, $name = null, $params = array()) |
|
20 | 20 | { |
21 | 21 | parent::__construct($app); |
22 | 22 | |
23 | 23 | // we help the user to pull a special message from |
24 | 24 | // the translate section to be specified by the user for the exception. |
25 | - $this->exceptionTranslate($name,$params); |
|
25 | + $this->exceptionTranslate($name, $params); |
|
26 | 26 | |
27 | 27 | // for real file path with |
28 | 28 | // debug backtrace method are doing follow. |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | * @param $name |
36 | 36 | * @param array $params |
37 | 37 | */ |
38 | - private function exceptionTranslate($name,$params=array()) |
|
38 | + private function exceptionTranslate($name, $params = array()) |
|
39 | 39 | { |
40 | - if($name!==null){ |
|
41 | - if(count($params)){ |
|
42 | - $this->app->register('exceptionTranslateParams',$name,$params); |
|
40 | + if ($name!==null) { |
|
41 | + if (count($params)) { |
|
42 | + $this->app->register('exceptionTranslateParams', $name, $params); |
|
43 | 43 | } |
44 | - $this->app->register('exceptionTranslate',$name); |
|
44 | + $this->app->register('exceptionTranslate', $name); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
@@ -52,23 +52,23 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function debugBackTrace() |
54 | 54 | { |
55 | - foreach (debug_backtrace() as $key=>$value){ |
|
55 | + foreach (debug_backtrace() as $key=>$value) { |
|
56 | 56 | |
57 | - if(isset(debug_backtrace()[$key],debug_backtrace()[$key]['file'])) |
|
57 | + if (isset(debug_backtrace()[$key], debug_backtrace()[$key]['file'])) |
|
58 | 58 | { |
59 | - $this->app->register('exceptionFile',debug_backtrace()[$key]['file']); |
|
60 | - $this->app->register('exceptionLine',debug_backtrace()[$key]['line']); |
|
59 | + $this->app->register('exceptionFile', debug_backtrace()[$key]['file']); |
|
60 | + $this->app->register('exceptionLine', debug_backtrace()[$key]['line']); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | Dependencies::loadBootstrapperNeedsForException(); |
64 | 64 | |
65 | - if(isset($value['file']) && isset(core()->urlComponent)){ |
|
66 | - if(preg_match('@'.core()->urlComponent['project'].'|boot|providers@',$value['file'])){ |
|
65 | + if (isset($value['file']) && isset(core()->urlComponent)) { |
|
66 | + if (preg_match('@'.core()->urlComponent['project'].'|boot|providers@', $value['file'])) { |
|
67 | 67 | |
68 | 68 | $this->app->terminate('exceptionFile'); |
69 | 69 | $this->app->terminate('exceptionLine'); |
70 | - $this->app->register('exceptionFile',$value['file']); |
|
71 | - $this->app->register('exceptionLine',$value['line']); |
|
70 | + $this->app->register('exceptionFile', $value['file']); |
|
71 | + $this->app->register('exceptionLine', $value['line']); |
|
72 | 72 | |
73 | 73 | break; |
74 | 74 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function __get($name) |
83 | 83 | { |
84 | - $this->customException($name,null,debug_backtrace()); |
|
84 | + $this->customException($name, null, debug_backtrace()); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @param null|string $msg |
92 | 92 | * @param array $trace |
93 | 93 | */ |
94 | - public function customException($name,$msg=null,$trace=array()) |
|
94 | + public function customException($name, $msg = null, $trace = array()) |
|
95 | 95 | { |
96 | 96 | //We use the magic method for the exception and |
97 | 97 | //call the exception class in the application to get the instance. |
@@ -100,22 +100,22 @@ discard block |
||
100 | 100 | |
101 | 101 | // first, you are looking for an exception |
102 | 102 | // in the application directory class. |
103 | - if(Utils::isNamespaceExists($nameNamespace)){ |
|
103 | + if (Utils::isNamespaceExists($nameNamespace)) { |
|
104 | 104 | $callNamespace = new $nameNamespace; |
105 | 105 | } |
106 | - else{ |
|
106 | + else { |
|
107 | 107 | |
108 | 108 | // if you do not have an exception in the application directory, |
109 | 109 | // this time we are looking for an exception in the core directory. |
110 | 110 | $nameNamespace = __NAMESPACE__.'\\'.$nameException; |
111 | - if(Utils::isNamespaceExists($nameNamespace)){ |
|
111 | + if (Utils::isNamespaceExists($nameNamespace)) { |
|
112 | 112 | $callNamespace = new $nameNamespace; |
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | - if(isset($callNamespace)){ |
|
116 | + if (isset($callNamespace)) { |
|
117 | 117 | |
118 | - $traceForCustom = Utils::removeTrace($trace,self::removeExceptionFileItems); |
|
118 | + $traceForCustom = Utils::removeTrace($trace, self::removeExceptionFileItems); |
|
119 | 119 | |
120 | 120 | // we will set the information about the exception trace, |
121 | 121 | // and then bind it specifically to the event method. |
@@ -127,19 +127,19 @@ discard block |
||
127 | 127 | |
128 | 128 | |
129 | 129 | // we register the custom exception trace value with the global kernel object. |
130 | - $this->app->register('exceptiontrace',$customExceptionTrace); |
|
130 | + $this->app->register('exceptiontrace', $customExceptionTrace); |
|
131 | 131 | |
132 | 132 | //If the developer wants to execute an event when calling a special exception, |
133 | 133 | //we process the event method. |
134 | - if(method_exists($callNamespace,'event')){ |
|
134 | + if (method_exists($callNamespace, 'event')) { |
|
135 | 135 | $callNamespace->event($customExceptionTrace); |
136 | 136 | } |
137 | 137 | |
138 | 138 | //throw exception |
139 | - if($msg===null){ |
|
139 | + if ($msg===null) { |
|
140 | 140 | throw new $callNamespace; |
141 | 141 | } |
142 | - else{ |
|
142 | + else { |
|
143 | 143 | throw new $callNamespace($msg); |
144 | 144 | } |
145 | 145 | |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | * @param $name |
153 | 153 | * @param array $arguments |
154 | 154 | */ |
155 | - public function __call($name, $arguments=array()) |
|
155 | + public function __call($name, $arguments = array()) |
|
156 | 156 | { |
157 | - $this->customException($name,current($arguments),debug_backtrace()); |
|
157 | + $this->customException($name, current($arguments), debug_backtrace()); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | \ No newline at end of file |
@@ -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 |
@@ -45,15 +45,15 @@ discard block |
||
45 | 45 | $this->directory['projectDir'] = $this->projectPath(); |
46 | 46 | $this->argument['exceptionNamespace'] = app()->namespace()->exception(); |
47 | 47 | |
48 | - $recursiveDefaultDirectory = explode("\\",$this->argument['project']); |
|
48 | + $recursiveDefaultDirectory = explode("\\", $this->argument['project']); |
|
49 | 49 | $this->argument['applicationName'] = pos($recursiveDefaultDirectory); |
50 | 50 | $recursiveDefaultDirectory[] = 'V1'; |
51 | 51 | $recursiveDefaultDirectoryList = []; |
52 | 52 | |
53 | - foreach (array_slice($recursiveDefaultDirectory,1) as $defaultDirectory){ |
|
53 | + foreach (array_slice($recursiveDefaultDirectory, 1) as $defaultDirectory) { |
|
54 | 54 | |
55 | - $recursiveDefaultDirectoryList[]=$defaultDirectory; |
|
56 | - $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/",$recursiveDefaultDirectoryList); |
|
55 | + $recursiveDefaultDirectoryList[] = $defaultDirectory; |
|
56 | + $this->directory[$defaultDirectory.'Path'] = $this->projectPath().''.implode("/", $recursiveDefaultDirectoryList); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | //$this->directory['optionalDir'] = $this->optional(); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | //$this->directory['sourceDir'] = $this->sourceDir(); |
80 | 80 | //$this->directory['sourceSupportDir'] = $this->sourceSupportDir(); |
81 | 81 | //$this->directory['sourceSupportTraitDir'] = $this->sourceSupportDir().'/Traits'; |
82 | - $this->directory['exceptionDir'] = app()->path()->exception(); |
|
82 | + $this->directory['exceptionDir'] = app()->path()->exception(); |
|
83 | 83 | |
84 | 84 | //set project directory |
85 | 85 | $this->file->makeDirectory($this); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $this->touch['app/gitignore'] = $this->projectPath().'/.gitignore'; |
131 | 131 | $this->touch['app/composer'] = $this->projectPath().'/composer.json'; |
132 | 132 | $this->touch['test/index'] = $this->storage().'/index.html'; |
133 | - $this->touch['exception/authenticate'] = $this->directory['exceptionDir'] .'/AuthenticateException.php'; |
|
133 | + $this->touch['exception/authenticate'] = $this->directory['exceptionDir'].'/AuthenticateException.php'; |
|
134 | 134 | |
135 | 135 | //set project touch |
136 | 136 | $this->file->touch($this); |
@@ -22,14 +22,14 @@ discard block |
||
22 | 22 | * @param ApplicationContracts $app |
23 | 23 | * @param array $result |
24 | 24 | */ |
25 | - public function __construct(ApplicationContracts $app,$result=array()) |
|
25 | + public function __construct(ApplicationContracts $app, $result = array()) |
|
26 | 26 | { |
27 | 27 | parent::__construct($app); |
28 | 28 | |
29 | 29 | $this->result = $result; |
30 | 30 | |
31 | - foreach($this->extender as $item){ |
|
32 | - if(method_exists($this,$item)){ |
|
31 | + foreach ($this->extender as $item) { |
|
32 | + if (method_exists($this, $item)) { |
|
33 | 33 | $this->{$item}(); |
34 | 34 | } |
35 | 35 | } |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | { |
45 | 45 | // we will look at the requestExpected container value to show |
46 | 46 | // the expected values for the request object in the exception output. |
47 | - if(app()->has('requestExpected') && config('app.requestWithError')===true){ |
|
48 | - if($requestExpected = app()->get('requestExpected')){ |
|
47 | + if (app()->has('requestExpected') && config('app.requestWithError')===true) { |
|
48 | + if ($requestExpected = app()->get('requestExpected')) { |
|
49 | 49 | $this->result['request']['expected'] = $requestExpected; |
50 | 50 | } |
51 | 51 | } |
@@ -48,34 +48,34 @@ discard block |
||
48 | 48 | { |
49 | 49 | $exception = $this->exception; |
50 | 50 | |
51 | - if(isset(core()->exceptiontrace)) |
|
51 | + if (isset(core()->exceptiontrace)) |
|
52 | 52 | { |
53 | 53 | $this->data['status'] = (int)core()->exceptiontrace['callNamespace']->getCode(); |
54 | 54 | } |
55 | 55 | else { |
56 | 56 | |
57 | - $this->data['status']=(int)$exception::exceptionTypeCodes($this->data['errType']); |
|
57 | + $this->data['status'] = (int)$exception::exceptionTypeCodes($this->data['errType']); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | $this->app->terminate('responseSuccess'); |
61 | 61 | $this->app->terminate('responseStatus'); |
62 | - $this->app->register('responseSuccess',(bool)false); |
|
63 | - $this->app->register('responseStatus',$this->data['status']); |
|
62 | + $this->app->register('responseSuccess', (bool)false); |
|
63 | + $this->app->register('responseStatus', $this->data['status']); |
|
64 | 64 | |
65 | 65 | |
66 | - $optionalException = str_replace("\\","\\\\",$this->app->namespace()->exception()); |
|
66 | + $optionalException = str_replace("\\", "\\\\", $this->app->namespace()->exception()); |
|
67 | 67 | |
68 | - if(preg_match('@'.$optionalException.'@is',$this->data['errType'])){ |
|
68 | + if (preg_match('@'.$optionalException.'@is', $this->data['errType'])) { |
|
69 | 69 | |
70 | 70 | //linux test |
71 | 71 | $trace = $this->data['errContext']['trace']; |
72 | - if(preg_match('@Stack trace:\n#0(.*)\n#1@is',$trace,$traceArray)){ |
|
72 | + if (preg_match('@Stack trace:\n#0(.*)\n#1@is', $trace, $traceArray)) { |
|
73 | 73 | |
74 | - $traceFile = str_replace(root,'',$traceArray[1]); |
|
74 | + $traceFile = str_replace(root, '', $traceArray[1]); |
|
75 | 75 | |
76 | - if(preg_match('@(.*)\((\d+)\)@is',$traceFile,$traceResolve)){ |
|
77 | - $this->data['errFile']=$traceResolve[1]; |
|
78 | - $this->data['errLine']=(int)$traceResolve[2]; |
|
76 | + if (preg_match('@(.*)\((\d+)\)@is', $traceFile, $traceResolve)) { |
|
77 | + $this->data['errFile'] = $traceResolve[1]; |
|
78 | + $this->data['errLine'] = (int)$traceResolve[2]; |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
@@ -83,15 +83,15 @@ discard block |
||
83 | 83 | $this->data['errType'] = class_basename($this->data['errType']); |
84 | 84 | } |
85 | 85 | |
86 | - if(is_array($meta = config('response.meta'))){ |
|
86 | + if (is_array($meta = config('response.meta'))) { |
|
87 | 87 | |
88 | 88 | //set as the success object is false |
89 | 89 | $this->data['appExceptionSuccess'] = []; |
90 | 90 | } |
91 | - else{ |
|
91 | + else { |
|
92 | 92 | |
93 | 93 | //set as the success object is false |
94 | - $this->data['appExceptionSuccess'] = ['success'=>(bool)false,'status'=>$this->data['status']]; |
|
94 | + $this->data['appExceptionSuccess'] = ['success'=>(bool)false, 'status'=>$this->data['status']]; |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | //This function can be used for defining your own way of handling errors during runtime, |
114 | 114 | //for example in applications in which you need to do cleanup of data/files when a critical error happens, |
115 | 115 | //or when you need to trigger an error under certain conditions (using trigger_error()). |
116 | - set_error_handler([$this,'setErrorHandler']); |
|
116 | + set_error_handler([$this, 'setErrorHandler']); |
|
117 | 117 | |
118 | 118 | //Registers a callback to be executed after script execution finishes or exit() is called. |
119 | 119 | //Multiple calls to register_shutdown_function() can be made, and each will be called in the same order as |
120 | 120 | //they were registered. If you call exit() within one registered shutdown function, |
121 | 121 | //processing will stop completely and no other registered shutdown functions will be called. |
122 | - register_shutdown_function([$this,'fatalErrorShutdownHandler']); |
|
122 | + register_shutdown_function([$this, 'fatalErrorShutdownHandler']); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @param null|string $errLine |
132 | 132 | * @param null|string $errContext |
133 | 133 | */ |
134 | - public function setErrorHandler($errNo=null, $errStr=null, $errFile=null, $errLine=null, $errContext=null) |
|
134 | + public function setErrorHandler($errNo = null, $errStr = null, $errFile = null, $errLine = null, $errContext = null) |
|
135 | 135 | { |
136 | 136 | // in case of a deficiency, |
137 | 137 | // we need to boot our general needs to be needed for the exception. |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | //get lang message for exception |
159 | 159 | $this->getLangMessageForException(); |
160 | 160 | |
161 | - if(property_exists(core(),'exceptiontrace')){ |
|
161 | + if (property_exists(core(), 'exceptiontrace')) { |
|
162 | 162 | |
163 | 163 | $customExceptionTrace = core()->exceptiontrace; |
164 | 164 | $this->data['errFile'] = $customExceptionTrace['file']; |
@@ -167,38 +167,37 @@ discard block |
||
167 | 167 | |
168 | 168 | $environment = $this->getEnvironmentStatus(); |
169 | 169 | |
170 | - $vendorDirectory = str_replace(root.''.DIRECTORY_SEPARATOR.'','',$this->data['errFile']); |
|
170 | + $vendorDirectory = str_replace(root.''.DIRECTORY_SEPARATOR.'', '', $this->data['errFile']); |
|
171 | 171 | |
172 | - if(Str::startsWith($vendorDirectory,'vendor') |
|
173 | - && Str::startsWith($vendorDirectory,'vendor/php-resta')===false) |
|
172 | + if (Str::startsWith($vendorDirectory, 'vendor') |
|
173 | + && Str::startsWith($vendorDirectory, 'vendor/php-resta')===false) |
|
174 | 174 | { |
175 | 175 | $externalMessage = ($environment==="production") ? |
176 | - 'An unexpected external error has occurred' : |
|
177 | - $this->data['errStrReal']; |
|
176 | + 'An unexpected external error has occurred' : $this->data['errStrReal']; |
|
178 | 177 | |
179 | - $this->result = $this->getAppException($environment,$externalMessage); |
|
178 | + $this->result = $this->getAppException($environment, $externalMessage); |
|
180 | 179 | |
181 | 180 | |
182 | 181 | //Get or Set the HTTP response code |
183 | 182 | http_response_code(500); |
184 | 183 | $this->app->terminate('responseStatus'); |
185 | - $this->app->register('responseStatus',500); |
|
184 | + $this->app->register('responseStatus', 500); |
|
186 | 185 | |
187 | 186 | |
188 | 187 | } |
189 | - else{ |
|
188 | + else { |
|
190 | 189 | |
191 | - $this->result = $this->getAppException($environment,$this->data['errStrReal']); |
|
190 | + $this->result = $this->getAppException($environment, $this->data['errStrReal']); |
|
192 | 191 | |
193 | 192 | //Get or Set the HTTP response code |
194 | 193 | http_response_code($this->data['status']); |
195 | 194 | } |
196 | 195 | |
197 | 196 | |
198 | - if($environment==="production"){ |
|
197 | + if ($environment==="production") { |
|
199 | 198 | |
200 | - $productionLogMessage = $this->getAppException('local',$this->data['errStrReal']); |
|
201 | - $this->app->register('productionLogMessage',core()->out->outputFormatter($productionLogMessage)); |
|
199 | + $productionLogMessage = $this->getAppException('local', $this->data['errStrReal']); |
|
200 | + $this->app->register('productionLogMessage', core()->out->outputFormatter($productionLogMessage)); |
|
202 | 201 | } |
203 | 202 | |
204 | 203 | // exception extender The exception information |
@@ -211,11 +210,11 @@ discard block |
||
211 | 210 | |
212 | 211 | $restaOutHandle = null; |
213 | 212 | |
214 | - if(!defined('responseApp')){ |
|
215 | - $restaOutHandle=core()->out->handle(); |
|
213 | + if (!defined('responseApp')) { |
|
214 | + $restaOutHandle = core()->out->handle(); |
|
216 | 215 | } |
217 | 216 | |
218 | - if($restaOutHandle===null){ |
|
217 | + if ($restaOutHandle===null) { |
|
219 | 218 | |
220 | 219 | //header set and symfony response call |
221 | 220 | header('Content-type:application/json;charset=utf-8'); |
@@ -223,7 +222,7 @@ discard block |
||
223 | 222 | echo json_encode(core()->out->outputFormatter($this->result)); |
224 | 223 | exit(); |
225 | 224 | } |
226 | - else{ |
|
225 | + else { |
|
227 | 226 | echo $restaOutHandle; |
228 | 227 | exit(); |
229 | 228 | } |
@@ -233,7 +232,7 @@ discard block |
||
233 | 232 | * @param $environment |
234 | 233 | * @return mixed |
235 | 234 | */ |
236 | - private function getAppException($environment,$message) |
|
235 | + private function getAppException($environment, $message) |
|
237 | 236 | { |
238 | 237 | return $this->data['appExceptionSuccess']+$this->data['exception']::$environment( |
239 | 238 | $this->data['errNo'], |
@@ -268,13 +267,13 @@ discard block |
||
268 | 267 | |
269 | 268 | $this->inStackTrace($last_error); |
270 | 269 | |
271 | - if(!is_null($last_error)){ |
|
270 | + if (!is_null($last_error)) { |
|
272 | 271 | |
273 | - if(!defined('methodName')){ |
|
274 | - define('methodName',null); |
|
272 | + if (!defined('methodName')) { |
|
273 | + define('methodName', null); |
|
275 | 274 | } |
276 | 275 | |
277 | - if(isset(core()->exceptionFile)){ |
|
276 | + if (isset(core()->exceptionFile)) { |
|
278 | 277 | $last_error['file'] = core()->exceptionFile; |
279 | 278 | $last_error['line'] = core()->exceptionLine; |
280 | 279 | } |
@@ -294,12 +293,12 @@ discard block |
||
294 | 293 | */ |
295 | 294 | public function inStackTrace($error) |
296 | 295 | { |
297 | - if(isset(core()->urlComponent)){ |
|
298 | - if(!preg_match('@'.core()->urlComponent['project'].'@',$error['file']) && !isset(core()->exceptionFile)){ |
|
299 | - if(preg_match('@ in\s(.*?)\n@is',$error['message'],$result)){ |
|
300 | - $errorMessage = explode(":",$result[1]); |
|
301 | - $this->app->register('exceptionFile',$errorMessage[0]); |
|
302 | - $this->app->register('exceptionLine',$errorMessage[1]); |
|
296 | + if (isset(core()->urlComponent)) { |
|
297 | + if (!preg_match('@'.core()->urlComponent['project'].'@', $error['file']) && !isset(core()->exceptionFile)) { |
|
298 | + if (preg_match('@ in\s(.*?)\n@is', $error['message'], $result)) { |
|
299 | + $errorMessage = explode(":", $result[1]); |
|
300 | + $this->app->register('exceptionFile', $errorMessage[0]); |
|
301 | + $this->app->register('exceptionLine', $errorMessage[1]); |
|
303 | 302 | } |
304 | 303 | } |
305 | 304 | } |
@@ -312,48 +311,48 @@ discard block |
||
312 | 311 | { |
313 | 312 | $clone = clone $this; |
314 | 313 | |
315 | - if(property_exists(core(),'exceptionTranslate')){ |
|
314 | + if (property_exists(core(), 'exceptionTranslate')) { |
|
316 | 315 | |
317 | - $langMessage=trans('exception.'.core()->exceptionTranslate); |
|
316 | + $langMessage = trans('exception.'.core()->exceptionTranslate); |
|
318 | 317 | |
319 | - if(!is_null($langMessage) && property_exists(core(),'exceptionTranslateParams')){ |
|
318 | + if (!is_null($langMessage) && property_exists(core(), 'exceptionTranslateParams')) { |
|
320 | 319 | |
321 | - if(count(core()->exceptionTranslateParams[core()->exceptionTranslate])){ |
|
322 | - foreach (core()->exceptionTranslateParams[core()->exceptionTranslate] as $key=>$value){ |
|
323 | - $langMessage=preg_replace('@\('.$key.'\)@is',$value,$langMessage); |
|
320 | + if (count(core()->exceptionTranslateParams[core()->exceptionTranslate])) { |
|
321 | + foreach (core()->exceptionTranslateParams[core()->exceptionTranslate] as $key=>$value) { |
|
322 | + $langMessage = preg_replace('@\('.$key.'\)@is', $value, $langMessage); |
|
324 | 323 | } |
325 | 324 | } |
326 | 325 | } |
327 | 326 | |
328 | - if($langMessage!==null){ |
|
329 | - $this->data['errStrReal']=$langMessage; |
|
327 | + if ($langMessage!==null) { |
|
328 | + $this->data['errStrReal'] = $langMessage; |
|
330 | 329 | } |
331 | 330 | } |
332 | 331 | |
333 | - if(class_exists($this->data['errorClassNamespace']) |
|
332 | + if (class_exists($this->data['errorClassNamespace']) |
|
334 | 333 | && |
335 | - (Str::startsWith($this->data['errorClassNamespace'],'App') |
|
336 | - || Str::startsWith($this->data['errorClassNamespace'],__NAMESPACE__))){ |
|
334 | + (Str::startsWith($this->data['errorClassNamespace'], 'App') |
|
335 | + || Str::startsWith($this->data['errorClassNamespace'], __NAMESPACE__))) { |
|
337 | 336 | |
338 | 337 | ClosureDispatcher::bind($this->data['errorClassNamespace'])->call(function() use ($clone) { |
339 | - if(property_exists($this,'lang')){ |
|
340 | - $clone->lang=$this->lang; |
|
338 | + if (property_exists($this, 'lang')) { |
|
339 | + $clone->lang = $this->lang; |
|
341 | 340 | } |
342 | 341 | }); |
343 | 342 | } |
344 | 343 | |
345 | - $this->data['lang']=$lang=$clone->lang; |
|
344 | + $this->data['lang'] = $lang = $clone->lang; |
|
346 | 345 | |
347 | - if($lang!==null){ |
|
348 | - $langMessage=trans('exception.'.$lang); |
|
346 | + if ($lang!==null) { |
|
347 | + $langMessage = trans('exception.'.$lang); |
|
349 | 348 | } |
350 | - else{ |
|
351 | - $langMessage=null; |
|
349 | + else { |
|
350 | + $langMessage = null; |
|
352 | 351 | } |
353 | 352 | |
354 | 353 | |
355 | - if($langMessage!==null){ |
|
356 | - $this->data['errStrReal']=$langMessage; |
|
354 | + if ($langMessage!==null) { |
|
355 | + $this->data['errStrReal'] = $langMessage; |
|
357 | 356 | } |
358 | 357 | } |
359 | 358 | |
@@ -366,22 +365,22 @@ discard block |
||
366 | 365 | { |
367 | 366 | // catch exception via preg match |
368 | 367 | // and then clear the Uncaught statement from inside. |
369 | - if(preg_match('@(.*?):@is',$this->data['errStrReal'],$errArr)){ |
|
368 | + if (preg_match('@(.*?):@is', $this->data['errStrReal'], $errArr)) { |
|
370 | 369 | |
371 | - $this->data['errType']=trim(str_replace('Uncaught','',$errArr[1])); |
|
372 | - $this->data['errorClassNamespace']=$this->data['errType']; |
|
370 | + $this->data['errType'] = trim(str_replace('Uncaught', '', $errArr[1])); |
|
371 | + $this->data['errorClassNamespace'] = $this->data['errType']; |
|
373 | 372 | } |
374 | 373 | |
375 | - if(preg_match('@Uncaught@is',$this->data['errStrReal']) |
|
376 | - && preg_match('@(.*?):(.*?)\sin\s@is',$this->data['errStrReal'],$errStrRealArray)){ |
|
377 | - $this->data['errStrReal']=trim($errStrRealArray[2]); |
|
374 | + if (preg_match('@Uncaught@is', $this->data['errStrReal']) |
|
375 | + && preg_match('@(.*?):(.*?)\sin\s@is', $this->data['errStrReal'], $errStrRealArray)) { |
|
376 | + $this->data['errStrReal'] = trim($errStrRealArray[2]); |
|
378 | 377 | } |
379 | 378 | |
380 | - if($this->data['errType']==="Undefined"){ |
|
381 | - $this->data['errStrReal']=$this->data['errStrReal']; |
|
379 | + if ($this->data['errType']==="Undefined") { |
|
380 | + $this->data['errStrReal'] = $this->data['errStrReal']; |
|
382 | 381 | } |
383 | - else{ |
|
384 | - $this->data['errContext']['trace']=$this->data['errStrReal']; |
|
382 | + else { |
|
383 | + $this->data['errContext']['trace'] = $this->data['errStrReal']; |
|
385 | 384 | } |
386 | 385 | } |
387 | 386 |
@@ -51,8 +51,7 @@ discard block |
||
51 | 51 | if(isset(core()->exceptiontrace)) |
52 | 52 | { |
53 | 53 | $this->data['status'] = (int)core()->exceptiontrace['callNamespace']->getCode(); |
54 | - } |
|
55 | - else { |
|
54 | + } else { |
|
56 | 55 | |
57 | 56 | $this->data['status']=(int)$exception::exceptionTypeCodes($this->data['errType']); |
58 | 57 | } |
@@ -87,8 +86,7 @@ discard block |
||
87 | 86 | |
88 | 87 | //set as the success object is false |
89 | 88 | $this->data['appExceptionSuccess'] = []; |
90 | - } |
|
91 | - else{ |
|
89 | + } else{ |
|
92 | 90 | |
93 | 91 | //set as the success object is false |
94 | 92 | $this->data['appExceptionSuccess'] = ['success'=>(bool)false,'status'=>$this->data['status']]; |
@@ -185,8 +183,7 @@ discard block |
||
185 | 183 | $this->app->register('responseStatus',500); |
186 | 184 | |
187 | 185 | |
188 | - } |
|
189 | - else{ |
|
186 | + } else{ |
|
190 | 187 | |
191 | 188 | $this->result = $this->getAppException($environment,$this->data['errStrReal']); |
192 | 189 | |
@@ -222,8 +219,7 @@ discard block |
||
222 | 219 | |
223 | 220 | echo json_encode(core()->out->outputFormatter($this->result)); |
224 | 221 | exit(); |
225 | - } |
|
226 | - else{ |
|
222 | + } else{ |
|
227 | 223 | echo $restaOutHandle; |
228 | 224 | exit(); |
229 | 225 | } |
@@ -346,8 +342,7 @@ discard block |
||
346 | 342 | |
347 | 343 | if($lang!==null){ |
348 | 344 | $langMessage=trans('exception.'.$lang); |
349 | - } |
|
350 | - else{ |
|
345 | + } else{ |
|
351 | 346 | $langMessage=null; |
352 | 347 | } |
353 | 348 | |
@@ -379,8 +374,7 @@ discard block |
||
379 | 374 | |
380 | 375 | if($this->data['errType']==="Undefined"){ |
381 | 376 | $this->data['errStrReal']=$this->data['errStrReal']; |
382 | - } |
|
383 | - else{ |
|
377 | + } else{ |
|
384 | 378 | $this->data['errContext']['trace']=$this->data['errStrReal']; |
385 | 379 | } |
386 | 380 | } |