@@ -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 | |
@@ -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 |