Passed
Push — master ( 62e080...3b1a44 )
by Php Easy Api
03:07
created
src/resta/Exception/ExceptionTrace.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
      * @param null $name
15 15
      * @param array $params
16 16
      */
17
-    public function __construct($app,$name=null,$params=array())
17
+    public function __construct($app, $name = null, $params = array())
18 18
     {
19 19
         parent::__construct($app);
20 20
 
21 21
         // we help the user to pull a special message from
22 22
         // the translate section to be specified by the user for the exception.
23
-        $this->exceptionTranslate($name,$params);
23
+        $this->exceptionTranslate($name, $params);
24 24
 
25 25
         // for real file path with
26 26
         // debug backtrace method are doing follow.
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
      * @param $name
34 34
      * @param array $params
35 35
      */
36
-    private function exceptionTranslate($name,$params=array())
36
+    private function exceptionTranslate($name, $params = array())
37 37
     {
38
-        if($name!==null){
39
-            if(count($params)){
40
-                $this->app->register('exceptionTranslateParams',$name,$params);
38
+        if ($name!==null) {
39
+            if (count($params)) {
40
+                $this->app->register('exceptionTranslateParams', $name, $params);
41 41
             }
42
-            $this->app->register('exceptionTranslate',$name);
42
+            $this->app->register('exceptionTranslate', $name);
43 43
         }
44 44
     }
45 45
 
@@ -50,23 +50,23 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function debugBackTrace()
52 52
     {
53
-        foreach (debug_backtrace() as $key=>$value){
53
+        foreach (debug_backtrace() as $key=>$value) {
54 54
 
55
-            if(isset(debug_backtrace()[$key],debug_backtrace()[$key]['file']))
55
+            if (isset(debug_backtrace()[$key], debug_backtrace()[$key]['file']))
56 56
             {
57
-                $this->app->register('exceptionFile',debug_backtrace()[$key]['file']);
58
-                $this->app->register('exceptionLine',debug_backtrace()[$key]['line']);
57
+                $this->app->register('exceptionFile', debug_backtrace()[$key]['file']);
58
+                $this->app->register('exceptionLine', debug_backtrace()[$key]['line']);
59 59
             }
60 60
 
61 61
             Dependencies::loadBootstrapperNeedsForException();
62 62
 
63
-            if(isset($value['file']) && isset(core()->urlComponent)){
64
-                if(preg_match('@'.core()->urlComponent['project'].'|boot|providers@',$value['file'])){
63
+            if (isset($value['file']) && isset(core()->urlComponent)) {
64
+                if (preg_match('@'.core()->urlComponent['project'].'|boot|providers@', $value['file'])) {
65 65
 
66 66
                     $this->app->terminate('exceptionFile');
67 67
                     $this->app->terminate('exceptionLine');
68
-                    $this->app->register('exceptionFile',$value['file']);
69
-                    $this->app->register('exceptionLine',$value['line']);
68
+                    $this->app->register('exceptionFile', $value['file']);
69
+                    $this->app->register('exceptionLine', $value['line']);
70 70
 
71 71
                     break;
72 72
                 }
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
 
87 87
         // first, you are looking for an exception
88 88
         // in the application directory class.
89
-        if(Utils::isNamespaceExists($nameNamespace)){
89
+        if (Utils::isNamespaceExists($nameNamespace)) {
90 90
             $callNamespace = new $nameNamespace;
91 91
         }
92
-        else{
92
+        else {
93 93
 
94 94
             // if you do not have an exception in the application directory,
95 95
             // this time we are looking for an exception in the core directory.
96 96
             $nameNamespace = __NAMESPACE__.'\\'.$nameException;
97
-            if(Utils::isNamespaceExists($nameNamespace)){
97
+            if (Utils::isNamespaceExists($nameNamespace)) {
98 98
                 $callNamespace = new $nameNamespace;
99 99
             }
100 100
         }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         // if the callNamespace variable does not exist,
103 103
         // the exception is not found.
104 104
         // and no action is taken.
105
-        if(!isset($callNamespace)) return;
105
+        if (!isset($callNamespace)) return;
106 106
 
107 107
         // we will set the information about the exception trace,
108 108
         // and then bind it specifically to the event method.
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
 
115 115
 
116 116
         // we register the custom exception trace value with the global kernel object.
117
-        $this->app->register('exceptiontrace',$customExceptionTrace);
117
+        $this->app->register('exceptiontrace', $customExceptionTrace);
118 118
 
119 119
         //If the developer wants to execute an event when calling a special exception,
120 120
         //we process the event method.
121
-        if(method_exists($callNamespace,'event')){
121
+        if (method_exists($callNamespace, 'event')) {
122 122
             $callNamespace->event($customExceptionTrace);
123 123
         }
124 124
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -88,8 +88,7 @@  discard block
 block discarded – undo
88 88
         // in the application directory class.
89 89
         if(Utils::isNamespaceExists($nameNamespace)){
90 90
             $callNamespace = new $nameNamespace;
91
-        }
92
-        else{
91
+        } else{
93 92
 
94 93
             // if you do not have an exception in the application directory,
95 94
             // this time we are looking for an exception in the core directory.
@@ -102,7 +101,9 @@  discard block
 block discarded – undo
102 101
         // if the callNamespace variable does not exist,
103 102
         // the exception is not found.
104 103
         // and no action is taken.
105
-        if(!isset($callNamespace)) return;
104
+        if(!isset($callNamespace)) {
105
+            return;
106
+        }
106 107
 
107 108
         // we will set the information about the exception trace,
108 109
         // and then bind it specifically to the event method.
Please login to merge, or discard this patch.