Completed
Push — 4.0 ( 6e7e32...0ca36c )
by Marco
12:30
created
src/Comodojo/Dispatcher/Service/AbstractService.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 
95 95
         $supported_methods = $this->configuration()->get('dispatcher-supported-methods');
96 96
 
97
-        if ( method_exists($this, 'any') ) {
97
+        if (method_exists($this, 'any')) {
98 98
 
99 99
             return $supported_methods;
100 100
 
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 
103 103
         $implemented_methods = array();
104 104
 
105
-        foreach ( $supported_methods as $method ) {
105
+        foreach ($supported_methods as $method) {
106 106
 
107
-            if ( method_exists($this, strtolower($method)) ) array_push($implemented_methods,$method);
107
+            if (method_exists($this, strtolower($method))) array_push($implemented_methods, $method);
108 108
 
109 109
         }
110 110
 
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
      */
119 119
     final public function getMethod($method) {
120 120
 
121
-        if ( method_exists($this, strtolower($method)) ) {
121
+        if (method_exists($this, strtolower($method))) {
122 122
 
123 123
             return strtolower($method);
124 124
 
125
-        } else if ( method_exists($this, strtolower('any')) ) {
125
+        } else if (method_exists($this, strtolower('any'))) {
126 126
 
127 127
             return 'any';
128 128
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,9 @@
 block discarded – undo
104 104
 
105 105
         foreach ( $supported_methods as $method ) {
106 106
 
107
-            if ( method_exists($this, strtolower($method)) ) array_push($implemented_methods,$method);
107
+            if ( method_exists($this, strtolower($method)) ) {
108
+                array_push($implemented_methods,$method);
109
+            }
108 110
 
109 111
         }
110 112
 
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 2 patches
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.
Braces   +10 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,11 +29,13 @@  discard block
 block discarded – undo
29 29
 
30 30
     public function get($header = null) {
31 31
 
32
-        if ( is_null($header) ) return $this->headers;
33
-
34
-        else if ( array_key_exists($header, $this->headers) ) return $this->headers[$header];
35
-
36
-        else return null;
32
+        if ( is_null($header) ) {
33
+            return $this->headers;
34
+        } else if ( array_key_exists($header, $this->headers) ) {
35
+            return $this->headers[$header];
36
+        } else {
37
+            return null;
38
+        }
37 39
 
38 40
     }
39 41
 
@@ -50,7 +52,9 @@  discard block
 block discarded – undo
50 52
 
51 53
             return (string)($header.':'.$this->headers[$header]);
52 54
 
53
-        } else return null;
55
+        } else {
56
+            return null;
57
+        }
54 58
 
55 59
     }
56 60
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Components/Timestamp.php 2 patches
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.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,9 +35,11 @@
 block discarded – undo
35 35
 
36 36
     final public function setTimestamp($time = null) {
37 37
 
38
-        if ( is_float($time) ) $this->timestamp = $time;
39
-
40
-        else $this->timestamp = microtime(true);
38
+        if ( is_float($time) ) {
39
+            $this->timestamp = $time;
40
+        } else {
41
+            $this->timestamp = microtime(true);
42
+        }
41 43
 
42 44
         return $this;
43 45
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Components/DefaultConfiguration.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
         'encoding' => 'UTF-8',
31 31
         'disabled-status' => 503,
32 32
         'disabled-message' => 'Dispatcher offline',
33
-        'supported-methods' => array('GET','PUT','POST','DELETE','OPTIONS','HEAD')
33
+        'supported-methods' => array('GET', 'PUT', 'POST', 'DELETE', 'OPTIONS', 'HEAD')
34 34
     );
35 35
 
36 36
     public static function get() {
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 
48 48
     private static function urlGetAbsolute() {
49 49
 
50
-        $http = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '') . '://';
50
+        $http = 'http'.((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '').'://';
51 51
 
52 52
         $uri = preg_replace("/\/index.php(.*?)$/i", "", $_SERVER['PHP_SELF']);
53 53
 
54
-        return ( $http . $_SERVER['HTTP_HOST'] . $uri . "/" );
54
+        return ($http.$_SERVER['HTTP_HOST'].$uri."/");
55 55
 
56 56
     }
57 57
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Log/DispatcherLogger.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
 
46 46
         if (
47 47
             empty($log) ||
48
-            ( isset($log['enabled']) && $log['enabled'] === false ) ||
48
+            (isset($log['enabled']) && $log['enabled'] === false) ||
49 49
             empty($log['providers'])
50 50
         ) {
51 51
 
52 52
             $logger = new Logger('dispatcher');
53 53
 
54
-            $logger->pushHandler( new NullHandler( self::getLevel() ) );
54
+            $logger->pushHandler(new NullHandler(self::getLevel()));
55 55
 
56 56
         } else {
57 57
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
                 $handler = $this->getHandler($provider, $parameters);
65 65
 
66
-                if ( $handler instanceof HandlerInterface ) $logger->pushHandler($handler);
66
+                if ($handler instanceof HandlerInterface) $logger->pushHandler($handler);
67 67
 
68 68
             }
69 69
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
     protected function getHandler($provider, $parameters) {
92 92
 
93
-        switch ( strtolower($parameters['type']) ) {
93
+        switch (strtolower($parameters['type'])) {
94 94
 
95 95
             case 'streamhandler':
96 96
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
                 $file = $this->configuration->get('base-path').'/'.$target;
100 100
 
101
-                $level = self::getLevel( empty($parameters['level']) ? 'info' : $parameters['level'] );
101
+                $level = self::getLevel(empty($parameters['level']) ? 'info' : $parameters['level']);
102 102
 
103 103
                 $handler = new StreamHandler($file, $level);
104 104
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      */
123 123
     protected static function getLevel($level = null) {
124 124
 
125
-        switch ( strtoupper($level) ) {
125
+        switch (strtoupper($level)) {
126 126
 
127 127
             case 'INFO':
128 128
                 $logger_level = Logger::INFO;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,9 @@
 block discarded – undo
63 63
 
64 64
                 $handler = $this->getHandler($provider, $parameters);
65 65
 
66
-                if ( $handler instanceof HandlerInterface ) $logger->pushHandler($handler);
66
+                if ( $handler instanceof HandlerInterface ) {
67
+                    $logger->pushHandler($handler);
68
+                }
67 69
 
68 70
             }
69 71
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Events/EventsManager.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
     public function subscribe($event, $class, $method = null, $priority = 0) {
32 32
 
33
-        $callable = ( is_null($method) ) ? $class : array($class, $method);
33
+        $callable = (is_null($method)) ? $class : array($class, $method);
34 34
 
35 35
         return $this->addListener($event, $callable, $priority);
36 36
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
     public function subscribeOnce($event, $class, $method = null, $priority = 0) {
40 40
 
41
-        $callable = ( is_null($method) ) ? $class : array($class, $method);
41
+        $callable = (is_null($method)) ? $class : array($class, $method);
42 42
 
43 43
         return $this->addOneTimeListener($event, $callable, $priority);
44 44
 
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 
49 49
         $events = Yaml::parse($yaml);
50 50
 
51
-        if ( !empty($events) ) {
51
+        if (!empty($events)) {
52 52
 
53
-            foreach( $events as $name => $event ) {
53
+            foreach ($events as $name => $event) {
54 54
 
55
-                $callable = ( is_null($event['method']) ) ? $event["class"] : array($event["class"], $event["method"]);
55
+                $callable = (is_null($event['method'])) ? $event["class"] : array($event["class"], $event["method"]);
56 56
 
57 57
                 $this->addListener($event["event"], $callable, $event["priority"]);
58 58
 
Please login to merge, or discard this patch.
src/Comodojo/Dispatcher/Cache/DispatcherCache.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -46,25 +46,25 @@  discard block
 block discarded – undo
46 46
 
47 47
         $cache = $this->configuration->get('cache');
48 48
 
49
-        if ( empty($cache) ) {
49
+        if (empty($cache)) {
50 50
 
51 51
             $manager = new CacheManager(self::getAlgorithm(), $this->logger);
52 52
 
53 53
         } else {
54 54
 
55
-            $enabled = ( empty($cache['enabled']) || $cache['enabled'] === true ) ? true : false;
55
+            $enabled = (empty($cache['enabled']) || $cache['enabled'] === true) ? true : false;
56 56
 
57
-            $algorithm = self::getAlgorithm( empty($cache['algorithm']) ? null : $cache['algorithm']);
57
+            $algorithm = self::getAlgorithm(empty($cache['algorithm']) ? null : $cache['algorithm']);
58 58
 
59 59
             $manager = new CacheManager($algorithm, $this->logger);
60 60
 
61
-            if ( $enabled && !empty($cache['providers']) ) {
61
+            if ($enabled && !empty($cache['providers'])) {
62 62
 
63 63
                 foreach ($cache['providers'] as $provider => $parameters) {
64 64
 
65 65
                     $handler = $this->getHandler($provider, $parameters);
66 66
 
67
-                    if ( $handler instanceof CacheInterface ) $manager->addProvider($handler);
67
+                    if ($handler instanceof CacheInterface) $manager->addProvider($handler);
68 68
 
69 69
                 }
70 70
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
     protected function getHandler($provider, $parameters) {
93 93
 
94
-        switch ( strtolower($parameters['type']) ) {
94
+        switch (strtolower($parameters['type'])) {
95 95
 
96 96
             case 'filecache':
97 97
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      */
122 122
     protected static function getAlgorithm($algorithm = null) {
123 123
 
124
-        switch ( strtoupper($algorithm) ) {
124
+        switch (strtoupper($algorithm)) {
125 125
 
126 126
             case 'PICK_LAST':
127 127
                 $selected = CacheManager::PICK_LAST;
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,9 @@
 block discarded – undo
64 64
 
65 65
                     $handler = $this->getHandler($provider, $parameters);
66 66
 
67
-                    if ( $handler instanceof CacheInterface ) $manager->addProvider($handler);
67
+                    if ( $handler instanceof CacheInterface ) {
68
+                        $manager->addProvider($handler);
69
+                    }
68 70
 
69 71
                 }
70 72
 
Please login to merge, or discard this patch.