@@ -11,12 +11,12 @@ discard block |
||
| 11 | 11 | /** |
| 12 | 12 | * @var array $bool |
| 13 | 13 | */ |
| 14 | - private static $bool=[]; |
|
| 14 | + private static $bool = []; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * @var array |
| 18 | 18 | */ |
| 19 | - private static $recursiveArray= []; |
|
| 19 | + private static $recursiveArray = []; |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * @return \DI\Container |
@@ -34,10 +34,10 @@ discard block |
||
| 34 | 34 | * @throws \DI\DependencyException |
| 35 | 35 | * @throws \DI\NotFoundException |
| 36 | 36 | */ |
| 37 | - public static function resolve($class=null) |
|
| 37 | + public static function resolve($class = null) |
|
| 38 | 38 | {
|
| 39 | 39 | //class resolve |
| 40 | - if($class!==null){
|
|
| 40 | + if ($class!==null) {
|
|
| 41 | 41 | $container = self::callBuild(); |
| 42 | 42 | return $container->get($class); |
| 43 | 43 | } |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | * @param bool $shift |
| 49 | 49 | * @return array |
| 50 | 50 | */ |
| 51 | - public static function upperCase($argument,$shift=true) |
|
| 51 | + public static function upperCase($argument, $shift = true) |
|
| 52 | 52 | {
|
| 53 | - if($shift){
|
|
| 53 | + if ($shift) {
|
|
| 54 | 54 | array_shift($argument); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - return array_map(function($argument){
|
|
| 57 | + return array_map(function($argument) {
|
|
| 58 | 58 | return ucfirst($argument); |
| 59 | 59 | },$argument); |
| 60 | 60 | } |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public static function strtolower($argument) |
| 80 | 80 | {
|
| 81 | - if(!is_array($argument)){
|
|
| 81 | + if (!is_array($argument)) {
|
|
| 82 | 82 | return strtolower($argument); |
| 83 | 83 | } |
| 84 | - return array_map(function($argument){
|
|
| 84 | + return array_map(function($argument) {
|
|
| 85 | 85 | return strtolower($argument); |
| 86 | 86 | },$argument); |
| 87 | 87 | } |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | * @param array $data |
| 91 | 91 | * @return string |
| 92 | 92 | */ |
| 93 | - public static function generatorNamespace($data=array()) |
|
| 93 | + public static function generatorNamespace($data = array()) |
|
| 94 | 94 | {
|
| 95 | - return str_replace('.php','',implode("\\",$data));
|
|
| 95 | + return str_replace('.php', '', implode("\\", $data));
|
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -100,16 +100,16 @@ discard block |
||
| 100 | 100 | * @param bool $extension |
| 101 | 101 | * @return mixed |
| 102 | 102 | */ |
| 103 | - public static function getPathFromNamespace($class,$extension=true) |
|
| 103 | + public static function getPathFromNamespace($class, $extension = true) |
|
| 104 | 104 | {
|
| 105 | - if($extension){
|
|
| 106 | - $default=root.'/'.str_replace("\\","/",$class).'.php';
|
|
| 105 | + if ($extension) {
|
|
| 106 | + $default = root.'/'.str_replace("\\", "/", $class).'.php';
|
|
| 107 | 107 | } |
| 108 | - else{
|
|
| 109 | - $default=root.'/'.str_replace("\\","/",$class).'';
|
|
| 108 | + else {
|
|
| 109 | + $default = root.'/'.str_replace("\\", "/", $class).'';
|
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - return str_replace("/App",'/src/app',$default);
|
|
| 112 | + return str_replace("/App", '/src/app', $default);
|
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | * @param $method |
| 127 | 127 | * @return bool |
| 128 | 128 | */ |
| 129 | - public static function existMethod($class,$method) |
|
| 129 | + public static function existMethod($class, $method) |
|
| 130 | 130 | {
|
| 131 | - return method_exists($class,$method); |
|
| 131 | + return method_exists($class, $method); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -136,9 +136,9 @@ discard block |
||
| 136 | 136 | * @param $second |
| 137 | 137 | * @return bool |
| 138 | 138 | */ |
| 139 | - public static function isArrayEqual($first,$second) |
|
| 139 | + public static function isArrayEqual($first, $second) |
|
| 140 | 140 | {
|
| 141 | - return (count( $first ) == count( $second ) && !array_diff( $first, $second )); |
|
| 141 | + return (count($first)==count($second) && !array_diff($first, $second)); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -155,17 +155,17 @@ discard block |
||
| 155 | 155 | * @param bool $filename |
| 156 | 156 | * @return array |
| 157 | 157 | */ |
| 158 | - public static function glob($path,$filename=false) |
|
| 158 | + public static function glob($path, $filename = false) |
|
| 159 | 159 | {
|
| 160 | 160 | $configList = []; |
| 161 | 161 | |
| 162 | 162 | foreach (glob($path.'/*.php') as $config) {
|
| 163 | 163 | |
| 164 | - $configArray=str_replace(".php","",explode("/",$config));
|
|
| 165 | - $configList[end($configArray)]=$config; |
|
| 164 | + $configArray = str_replace(".php", "", explode("/", $config));
|
|
| 165 | + $configList[end($configArray)] = $config; |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - if($filename===true){
|
|
| 168 | + if ($filename===true) {
|
|
| 169 | 169 | return array_keys($configList); |
| 170 | 170 | } |
| 171 | 171 | |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | * @param string $seperator |
| 195 | 195 | * @return mixed |
| 196 | 196 | */ |
| 197 | - public static function getJustClassName($namespace,$seperator="\\") |
|
| 197 | + public static function getJustClassName($namespace, $seperator = "\\") |
|
| 198 | 198 | {
|
| 199 | 199 | $path = explode($seperator, $namespace); |
| 200 | 200 | return array_pop($path); |
@@ -205,15 +205,15 @@ discard block |
||
| 205 | 205 | * @param array $param |
| 206 | 206 | * @return bool |
| 207 | 207 | */ |
| 208 | - public static function changeClass($class,$param=array()) |
|
| 208 | + public static function changeClass($class, $param = array()) |
|
| 209 | 209 | {
|
| 210 | - $executionPath=$class; |
|
| 210 | + $executionPath = $class; |
|
| 211 | 211 | $dt = fopen($executionPath, "r"); |
| 212 | 212 | $content = fread($dt, filesize($executionPath)); |
| 213 | 213 | fclose($dt); |
| 214 | 214 | |
| 215 | - foreach ($param as $key=>$value){
|
|
| 216 | - $content=str_replace($key,$value,$content); |
|
| 215 | + foreach ($param as $key=>$value) {
|
|
| 216 | + $content = str_replace($key, $value, $content); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | $dt = fopen($executionPath, "w"); |
@@ -228,9 +228,9 @@ discard block |
||
| 228 | 228 | * @param $callback |
| 229 | 229 | * @return mixed |
| 230 | 230 | */ |
| 231 | - public static function returnCallback($data,$callback) |
|
| 231 | + public static function returnCallback($data, $callback) |
|
| 232 | 232 | {
|
| 233 | - return call_user_func_array($callback,[$data]); |
|
| 233 | + return call_user_func_array($callback, [$data]); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
@@ -239,10 +239,10 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | public static function getNamespace($namespace) |
| 241 | 241 | {
|
| 242 | - $rootDelete=str_replace(root.''.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'','',$namespace); |
|
| 242 | + $rootDelete = str_replace(root.''.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'', '', $namespace); |
|
| 243 | 243 | |
| 244 | 244 | return 'App\\'.self::generatorNamespace( |
| 245 | - explode(''.DIRECTORY_SEPARATOR.'',$rootDelete)
|
|
| 245 | + explode(''.DIRECTORY_SEPARATOR.'', $rootDelete)
|
|
| 246 | 246 | ); |
| 247 | 247 | |
| 248 | 248 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | */ |
| 254 | 254 | public static function callbackProcess($callback) |
| 255 | 255 | {
|
| 256 | - return (is_callable($callback)) ? call_user_func_array($callback,[app()]) : $callback; |
|
| 256 | + return (is_callable($callback)) ? call_user_func_array($callback, [app()]) : $callback; |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /** |
@@ -261,29 +261,29 @@ discard block |
||
| 261 | 261 | * @param $array2 |
| 262 | 262 | * @return bool |
| 263 | 263 | */ |
| 264 | - public static function array_diff_key_recursive ($array1, $array2) |
|
| 264 | + public static function array_diff_key_recursive($array1, $array2) |
|
| 265 | 265 | {
|
| 266 | - if(count($array1)!==count($array2)) self::$bool[]=false; |
|
| 266 | + if (count($array1)!==count($array2)) self::$bool[] = false; |
|
| 267 | 267 | |
| 268 | - foreach ($array1 as $array1_key=>$array1_value){
|
|
| 268 | + foreach ($array1 as $array1_key=>$array1_value) {
|
|
| 269 | 269 | |
| 270 | - if(!is_array($array1_value)){
|
|
| 271 | - if(!array_key_exists($array1_key,$array2)) self::$bool[]=false; |
|
| 270 | + if (!is_array($array1_value)) {
|
|
| 271 | + if (!array_key_exists($array1_key, $array2)) self::$bool[] = false; |
|
| 272 | 272 | } |
| 273 | - else{
|
|
| 274 | - if(!array_key_exists($array1_key,$array2)) self::$bool[]=false; |
|
| 273 | + else {
|
|
| 274 | + if (!array_key_exists($array1_key, $array2)) self::$bool[] = false; |
|
| 275 | 275 | |
| 276 | - if(!isset($array2[$array1_key]) OR !is_array($array2[$array1_key])) $array2[$array1_key]=[]; |
|
| 276 | + if (!isset($array2[$array1_key]) OR !is_array($array2[$array1_key])) $array2[$array1_key] = []; |
|
| 277 | 277 | |
| 278 | - if(isset($array1_value[0])) $array1_value=$array1_value[0]; |
|
| 278 | + if (isset($array1_value[0])) $array1_value = $array1_value[0]; |
|
| 279 | 279 | |
| 280 | - if(isset($array2[$array1_key][0])) $array2[$array1_key]=$array2[$array1_key][0]; |
|
| 280 | + if (isset($array2[$array1_key][0])) $array2[$array1_key] = $array2[$array1_key][0]; |
|
| 281 | 281 | |
| 282 | - self::array_diff_key_recursive($array1_value,$array2[$array1_key]); |
|
| 282 | + self::array_diff_key_recursive($array1_value, $array2[$array1_key]); |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | - if(in_array(false,self::$bool)){
|
|
| 286 | + if (in_array(false, self::$bool)) {
|
|
| 287 | 287 | return false; |
| 288 | 288 | } |
| 289 | 289 | return true; |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | */ |
| 296 | 296 | public static function slashToBackSlash($data) |
| 297 | 297 | {
|
| 298 | - return str_replace("/","\\",$data);
|
|
| 298 | + return str_replace("/", "\\", $data);
|
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | /** |
@@ -303,11 +303,11 @@ discard block |
||
| 303 | 303 | * @param null $key |
| 304 | 304 | * @return null |
| 305 | 305 | */ |
| 306 | - public static function trace($debug=0,$key=null) |
|
| 306 | + public static function trace($debug = 0, $key = null) |
|
| 307 | 307 | {
|
| 308 | - $trace=debug_backtrace(); |
|
| 308 | + $trace = debug_backtrace(); |
|
| 309 | 309 | |
| 310 | - if($key===null){
|
|
| 310 | + if ($key===null) {
|
|
| 311 | 311 | return $trace[$debug] ?? null; |
| 312 | 312 | } |
| 313 | 313 | return $trace[$debug][$key] ?? null; |
@@ -322,13 +322,13 @@ discard block |
||
| 322 | 322 | public static function chmod_r($dir, $dirPermissions, $filePermissions) |
| 323 | 323 | {
|
| 324 | 324 | $dp = opendir($dir); |
| 325 | - while($file = readdir($dp)) {
|
|
| 326 | - if (($file == ".") || ($file == "..")) |
|
| 325 | + while ($file = readdir($dp)) {
|
|
| 326 | + if (($file==".") || ($file=="..")) |
|
| 327 | 327 | continue; |
| 328 | 328 | |
| 329 | 329 | $fullPath = $dir."/".$file; |
| 330 | 330 | |
| 331 | - if(is_dir($fullPath)) {
|
|
| 331 | + if (is_dir($fullPath)) {
|
|
| 332 | 332 | chmod($fullPath, $dirPermissions); |
| 333 | 333 | self::chmod_r($fullPath, $dirPermissions, $filePermissions); |
| 334 | 334 | } else {
|
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | */ |
| 345 | 345 | public static function getServiceConf() |
| 346 | 346 | {
|
| 347 | - if(property_exists(core(),'serviceConf') && defined('methodName')){
|
|
| 347 | + if (property_exists(core(), 'serviceConf') && defined('methodName')) {
|
|
| 348 | 348 | return core()->serviceConf; |
| 349 | 349 | } |
| 350 | 350 | return []; |
@@ -360,17 +360,17 @@ discard block |
||
| 360 | 360 | */ |
| 361 | 361 | public static function getAllFilesInDirectory($dir, $recursive = true, $basedir = '', $include_dirs = false) |
| 362 | 362 | {
|
| 363 | - if ($dir == '') {return array();} else {$results = array(); $subresults = array();}
|
|
| 364 | - if (!is_dir($dir)) {$dir = dirname($dir);} // so a files path can be sent
|
|
| 365 | - if ($basedir == '') {$basedir = realpath($dir).DIRECTORY_SEPARATOR;}
|
|
| 363 | + if ($dir=='') {return array(); } else {$results = array(); $subresults = array(); }
|
|
| 364 | + if (!is_dir($dir)) {$dir = dirname($dir); } // so a files path can be sent
|
|
| 365 | + if ($basedir=='') {$basedir = realpath($dir).DIRECTORY_SEPARATOR; }
|
|
| 366 | 366 | |
| 367 | 367 | $files = scandir($dir); |
| 368 | - foreach ($files as $key => $value){
|
|
| 369 | - if ( ($value != '.') && ($value != '..') ) {
|
|
| 368 | + foreach ($files as $key => $value) {
|
|
| 369 | + if (($value!='.') && ($value!='..')) {
|
|
| 370 | 370 | $path = realpath($dir.DIRECTORY_SEPARATOR.$value); |
| 371 | 371 | if (is_dir($path)) {
|
| 372 | 372 | // optionally include directories in file list |
| 373 | - if ($include_dirs) {$subresults[] = str_replace($basedir, '', $path);}
|
|
| 373 | + if ($include_dirs) {$subresults[] = str_replace($basedir, '', $path); }
|
|
| 374 | 374 | // optionally get file list for all subdirectories |
| 375 | 375 | if ($recursive) {
|
| 376 | 376 | $subdirresults = self::getAllFilesInDirectory($path, $recursive, $basedir, $include_dirs); |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | } |
| 384 | 384 | } |
| 385 | 385 | // merge the subarray to give the list of files then subdirectory files |
| 386 | - if (count($subresults) > 0) {$results = array_merge($subresults, $results);}
|
|
| 386 | + if (count($subresults)>0) {$results = array_merge($subresults, $results); }
|
|
| 387 | 387 | return $results; |
| 388 | 388 | } |
| 389 | 389 | |
@@ -392,18 +392,18 @@ discard block |
||
| 392 | 392 | * @param null $reelPath |
| 393 | 393 | * @return array |
| 394 | 394 | */ |
| 395 | - public static function getPathWithPhpExtension($files,$reelPath=null) |
|
| 395 | + public static function getPathWithPhpExtension($files, $reelPath = null) |
|
| 396 | 396 | {
|
| 397 | 397 | $pathWithPhpList = []; |
| 398 | 398 | |
| 399 | - foreach ($files as $file){
|
|
| 399 | + foreach ($files as $file) {
|
|
| 400 | 400 | |
| 401 | - if(preg_match('@(.*).php@is',$file,$pathWithPhp)){
|
|
| 401 | + if (preg_match('@(.*).php@is', $file, $pathWithPhp)) {
|
|
| 402 | 402 | |
| 403 | - if($reelPath===null){
|
|
| 403 | + if ($reelPath===null) {
|
|
| 404 | 404 | $pathWithPhpList[] = $pathWithPhp[0]; |
| 405 | 405 | } |
| 406 | - else{
|
|
| 406 | + else {
|
|
| 407 | 407 | $pathWithPhpList[] = $reelPath.'/'.$pathWithPhp[0]; |
| 408 | 408 | } |
| 409 | 409 | |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | */ |
| 437 | 437 | public static function resolverClass($class) |
| 438 | 438 | {
|
| 439 | - if(self::isNamespaceExists($class)){
|
|
| 439 | + if (self::isNamespaceExists($class)) {
|
|
| 440 | 440 | return app()->resolve($class); |
| 441 | 441 | } |
| 442 | 442 | |
@@ -448,8 +448,8 @@ discard block |
||
| 448 | 448 | */ |
| 449 | 449 | public static function getRequestPathInfo() |
| 450 | 450 | {
|
| 451 | - if(is_null(BootStaticManager::getRequestPath())){
|
|
| 452 | - return explode("/",request()->getPathInfo());
|
|
| 451 | + if (is_null(BootStaticManager::getRequestPath())) {
|
|
| 452 | + return explode("/", request()->getPathInfo());
|
|
| 453 | 453 | } |
| 454 | 454 | return BootStaticManager::getRequestPath(); |
| 455 | 455 | } |
@@ -459,13 +459,13 @@ discard block |
||
| 459 | 459 | * @param null $remove |
| 460 | 460 | * @return array |
| 461 | 461 | */ |
| 462 | - public static function removeTrace($trace,$remove=null) |
|
| 462 | + public static function removeTrace($trace, $remove = null) |
|
| 463 | 463 | {
|
| 464 | 464 | $list = []; |
| 465 | 465 | |
| 466 | - foreach($trace as $key=>$item){
|
|
| 466 | + foreach ($trace as $key=>$item) {
|
|
| 467 | 467 | |
| 468 | - if(isset($item['file']) && !preg_match('@'.$remove.'@',$item['file'])){
|
|
| 468 | + if (isset($item['file']) && !preg_match('@'.$remove.'@', $item['file'])) {
|
|
| 469 | 469 | $list[$key] = $item; |
| 470 | 470 | } |
| 471 | 471 | } |
@@ -16,13 +16,13 @@ discard block |
||
| 16 | 16 | * @param null $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 | |
@@ -154,6 +154,6 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | public function __call($name, $arguments) |
| 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 |