Completed
Push — 4.0 ( 8ab097...4b479b )
by Marco
03:24
created
src/Comodojo/Dispatcher/Request/Headers.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,13 +41,13 @@
 block discarded – undo
41 41
      */
42 42
     private static function getHeaders() {
43 43
 
44
-        if ( function_exists('getallheaders') ) return getallheaders();
44
+        if (function_exists('getallheaders')) return getallheaders();
45 45
 
46 46
         $headers = array();
47 47
 
48
-        foreach ( $_SERVER as $name => $value ) {
48
+        foreach ($_SERVER as $name => $value) {
49 49
 
50
-            if ( substr($name, 0, 5) == 'HTTP_' ) {
50
+            if (substr($name, 0, 5) == 'HTTP_') {
51 51
 
52 52
                 $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
53 53
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Request/Post.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 
47 47
     private static function getParameters() {
48 48
 
49
-        switch( $_SERVER['REQUEST_METHOD'] ) {
49
+        switch ($_SERVER['REQUEST_METHOD']) {
50 50
 
51 51
             case 'POST':
52 52
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Request/Query.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 
47 47
     private static function getParameters() {
48 48
 
49
-        switch( $_SERVER['REQUEST_METHOD'] ) {
49
+        switch ($_SERVER['REQUEST_METHOD']) {
50 50
 
51 51
             case 'POST':
52 52
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Components/Configuration.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
     protected $attributes = array();
29 29
 
30
-    public function __construct( $configuration = array() ) {
30
+    public function __construct($configuration = array()) {
31 31
 
32 32
         $this->attributes = array_merge($this->attributes, $configuration);
33 33
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 
36 36
     final public function get($property = null) {
37 37
 
38
-        if ( is_null($property) ) {
38
+        if (is_null($property)) {
39 39
 
40 40
             return $this->attributes;
41 41
 
@@ -91,13 +91,13 @@  discard block
 block discarded – undo
91 91
 
92 92
     final public function delete($property = null) {
93 93
 
94
-        if ( is_null($property) ) {
94
+        if (is_null($property)) {
95 95
 
96 96
             $this->attributes = array();
97 97
 
98 98
             return true;
99 99
 
100
-        } else if ( $this->isDefined($property) ) {
100
+        } else if ($this->isDefined($property)) {
101 101
 
102 102
             unset($this->attributes[$property]);
103 103
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Components/Headers.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 
30 30
     public function get($header = null) {
31 31
 
32
-        if ( is_null($header) ) return $this->headers;
32
+        if (is_null($header)) return $this->headers;
33 33
 
34
-        else if ( array_key_exists($header, $this->headers) ) return $this->headers[$header];
34
+        else if (array_key_exists($header, $this->headers)) return $this->headers[$header];
35 35
 
36 36
         else return null;
37 37
 
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
 
40 40
     public function getAsString($header = null) {
41 41
 
42
-        if ( is_null($header) ) {
42
+        if (is_null($header)) {
43 43
 
44
-            return array_map( function($header, $value) {
44
+            return array_map(function($header, $value) {
45 45
                 return (string)($header.':'.$value);
46 46
             },
47 47
             $this->headers);
48 48
 
49
-        } else if ( array_key_exists($header, $this->headers) ) {
49
+        } else if (array_key_exists($header, $this->headers)) {
50 50
 
51 51
             return (string)($header.':'.$this->headers[$header]);
52 52
 
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 
55 55
     }
56 56
 
57
-    public function set($header, $value=null) {
57
+    public function set($header, $value = null) {
58 58
 
59
-        if ( is_null($value) ) {
59
+        if (is_null($value)) {
60 60
 
61 61
             $header = explode(":", $header);
62 62
 
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 
75 75
     public function delete($header = null) {
76 76
 
77
-        if ( is_null($header) ) {
77
+        if (is_null($header)) {
78 78
 
79 79
             $this->headers = array();
80 80
 
81 81
             return true;
82 82
 
83
-        } else if ( array_key_exists($header, $this->headers) ) {
83
+        } else if (array_key_exists($header, $this->headers)) {
84 84
 
85 85
             unset($this->headers[$header]);
86 86
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Components/Timestamp.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
 
36 36
     final public function setTimestamp($time = null) {
37 37
 
38
-        if ( is_float($time) ) $this->timestamp = $time;
38
+        if (is_float($time)) $this->timestamp = $time;
39 39
 
40 40
         else $this->timestamp = microtime(true);
41 41
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Components/Parameters.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
 
28 28
     protected $parameters = array();
29 29
 
30
-    final public function get($parameter=null, $index=null) {
30
+    final public function get($parameter = null, $index = null) {
31 31
 
32
-        if ( is_null($parameter) ) return $this->parameters;
32
+        if (is_null($parameter)) return $this->parameters;
33 33
 
34
-        else if ( array_key_exists($parameter, $this->parameters) ) {
34
+        else if (array_key_exists($parameter, $this->parameters)) {
35 35
             
36 36
             $value = $this->parameters[$parameter];
37 37
             
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
 
70 70
     final public function delete($parameter = null) {
71 71
 
72
-        if ( is_null($parameter) ) {
72
+        if (is_null($parameter)) {
73 73
 
74 74
             $this->parameters = array();
75 75
 
76 76
             return true;
77 77
 
78
-        } else if ( array_key_exists($parameter, $this->parameters) ) {
78
+        } else if (array_key_exists($parameter, $this->parameters)) {
79 79
 
80 80
             unset($this->parameters[$parameter]);
81 81
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Router/Parser.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
                  */
74 74
                 foreach ($decoded as $key => $string) {
75 75
 
76
-                    $this->logger->debug("PARAMETER KEY: " . $key);
76
+                    $this->logger->debug("PARAMETER KEY: ".$key);
77 77
 
78
-                    $this->logger->debug("PARAMETER STRING: " . $string);
78
+                    $this->logger->debug("PARAMETER STRING: ".$string);
79 79
                     
80 80
                     /* The key and the regex of every paramater is passed to the 'param'
81 81
                      * method which will build an appropriate regular expression and will understand 
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
                      */
84 84
                     $param_regex .= $this->param($key, $string, $param_required, $value);
85 85
 
86
-                    $this->logger->debug("PARAMETER REGEX: " . $param_regex);
86
+                    $this->logger->debug("PARAMETER REGEX: ".$param_regex);
87 87
 
88 88
                 }
89 89
                 // Once the parameter is analyzed, the result is passed to the next iteration
90 90
                 return $this->read(
91 91
                     $folders,
92 92
                     $value,
93
-                    $regex.'(?:\/'.$param_regex.')'. (($param_required)?'{1}':'?')
93
+                    $regex.'(?:\/'.$param_regex.')'.(($param_required) ? '{1}' : '?')
94 94
                 );
95 95
 
96 96
             } else {
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
          * If the field is required, the regular expression is completed with a '{1}' (which make it compulsory),
156 156
          * otherwise a '?' is added.
157 157
          */
158
-        return '(?P<' . $key . '>' . $string . ')' . (($field_required)?'{1}':'?');
158
+        return '(?P<'.$key.'>'.$string.')'.(($field_required) ? '{1}' : '?');
159 159
 
160 160
     }
161 161
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Components/EventsManager.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
         $callable = $this->convertToListener($class, $event);
49 49
 
50
-        if ( $callable === false ) return null;
50
+        if ($callable === false) return null;
51 51
 
52 52
         return $this->addListener($event, $callable, $priority);
53 53
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
         $callable = $this->convertToListener($class, $event);
59 59
 
60
-        if ( $callable === false ) return null;
60
+        if ($callable === false) return null;
61 61
 
62 62
         return $this->addOneTimeListener($event, $callable, $priority);
63 63
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
     protected function convertToListener($class, $event) {
67 67
 
68
-        if ( !class_exists($class) ) {
68
+        if (!class_exists($class)) {
69 69
 
70 70
             $this->logger->error("Cannot subscribe class $class to event $event: cannot find class");
71 71
 
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
 
92 92
     public function load($plugins) {
93 93
 
94
-        if ( !empty($plugins) ) {
94
+        if (!empty($plugins)) {
95 95
 
96
-            foreach( $plugins as $name => $plugin ) {
96
+            foreach ($plugins as $name => $plugin) {
97 97
 
98
-                if ( !isset($plugin['class']) || !isset($plugin["event"]) ) {
98
+                if (!isset($plugin['class']) || !isset($plugin["event"])) {
99 99
 
100 100
                     $this->logger->error("Invalid plugin definition", $plugin);
101 101
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                 $priority = isset($plugin['priority']) ? $plugin['priority'] : 0;
107 107
                 $onetime = isset($plugin['onetime']) ? $plugin['onetime'] : 0;
108 108
 
109
-                if ( $onetime ) $this->subscribeOnce($plugin['event'], $plugin['class'], $priority);
109
+                if ($onetime) $this->subscribeOnce($plugin['event'], $plugin['class'], $priority);
110 110
                 else $this->subscribe($plugin['event'], $plugin['class'], $priority);
111 111
 
112 112
             }
Please login to merge, or discard this patch.