@@ -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 |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @param null|string $msg |
| 29 | 29 | */ |
| 30 | - public function invalidArgument($msg=null) |
|
| 30 | + public function invalidArgument($msg = null) |
|
| 31 | 31 | {
|
| 32 | 32 | throw new InvalidArgumentException($msg); |
| 33 | 33 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @param null|string $msg |
| 39 | 39 | */ |
| 40 | - public function badFunctionCall($msg=null) |
|
| 40 | + public function badFunctionCall($msg = null) |
|
| 41 | 41 | {
|
| 42 | 42 | throw new BadFunctionCallException($msg); |
| 43 | 43 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * |
| 48 | 48 | * @param null|string $msg |
| 49 | 49 | */ |
| 50 | - public function badMethodCall($msg=null) |
|
| 50 | + public function badMethodCall($msg = null) |
|
| 51 | 51 | {
|
| 52 | 52 | throw new BadMethodCallException($msg); |
| 53 | 53 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @param null|string $msg |
| 59 | 59 | */ |
| 60 | - public function domain($msg=null) |
|
| 60 | + public function domain($msg = null) |
|
| 61 | 61 | {
|
| 62 | 62 | throw new DomainException($msg); |
| 63 | 63 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @param null|string $msg |
| 69 | 69 | */ |
| 70 | - public function length($msg=null) |
|
| 70 | + public function length($msg = null) |
|
| 71 | 71 | {
|
| 72 | 72 | throw new LengthException($msg); |
| 73 | 73 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | * |
| 78 | 78 | * @param null|string $msg |
| 79 | 79 | */ |
| 80 | - public function logic($msg=null) |
|
| 80 | + public function logic($msg = null) |
|
| 81 | 81 | {
|
| 82 | 82 | throw new LogicException($msg); |
| 83 | 83 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @return null |
| 90 | 90 | * |
| 91 | 91 | */ |
| 92 | - public function notFoundException($msg=null) |
|
| 92 | + public function notFoundException($msg = null) |
|
| 93 | 93 | {
|
| 94 | 94 | return $this->notFound($msg); |
| 95 | 95 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @return mixed|void |
| 102 | 102 | * |
| 103 | 103 | */ |
| 104 | - public function fileNotFoundException($msg=null) |
|
| 104 | + public function fileNotFoundException($msg = null) |
|
| 105 | 105 | {
|
| 106 | 106 | return $this->fileNotFound($msg); |
| 107 | 107 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * |
| 112 | 112 | * @param null|string $msg |
| 113 | 113 | */ |
| 114 | - public function outOfRange($msg=null) |
|
| 114 | + public function outOfRange($msg = null) |
|
| 115 | 115 | {
|
| 116 | 116 | throw new OutOfRangeException($msg); |
| 117 | 117 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * |
| 122 | 122 | * @param null|string $msg |
| 123 | 123 | */ |
| 124 | - public function overflow($msg=null) |
|
| 124 | + public function overflow($msg = null) |
|
| 125 | 125 | {
|
| 126 | 126 | throw new OverflowException($msg); |
| 127 | 127 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * |
| 132 | 132 | * @param null|string $msg |
| 133 | 133 | */ |
| 134 | - public function range($msg=null) |
|
| 134 | + public function range($msg = null) |
|
| 135 | 135 | {
|
| 136 | 136 | throw new RangeException($msg); |
| 137 | 137 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | * |
| 142 | 142 | * @param null|string $msg |
| 143 | 143 | */ |
| 144 | - public function runtime($msg=null) |
|
| 144 | + public function runtime($msg = null) |
|
| 145 | 145 | {
|
| 146 | 146 | throw new RuntimeException($msg); |
| 147 | 147 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * |
| 152 | 152 | * @param null|string $msg |
| 153 | 153 | */ |
| 154 | - public function underflow($msg=null) |
|
| 154 | + public function underflow($msg = null) |
|
| 155 | 155 | {
|
| 156 | 156 | throw new UnderflowException($msg); |
| 157 | 157 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * |
| 162 | 162 | * @param null|string $msg |
| 163 | 163 | */ |
| 164 | - public function unexpectedValue($msg=null) |
|
| 164 | + public function unexpectedValue($msg = null) |
|
| 165 | 165 | {
|
| 166 | 166 | throw new UnexpectedValueException($msg); |
| 167 | 167 | } |