Completed
Push — 4.0 ( b7ae43...1bebd1 )
by Marco
16:17
created
src/Debug.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,15 +38,15 @@
 block discarded – undo
38 38
 
39 39
         $name = defined('DISPATCHER_LOG_NAME') ? DISPATCHER_LOG_NAME : 'dispatcher-default';
40 40
 
41
-        $level = $this->getLevel( defined('DISPATCHER_LOG_LEVEL') ? DISPATCHER_LOG_LEVEL : 'DEBUG' );
41
+        $level = $this->getLevel(defined('DISPATCHER_LOG_LEVEL') ? DISPATCHER_LOG_LEVEL : 'DEBUG');
42 42
 
43 43
         $target = defined('DISPATCHER_LOG_TARGET') ? DISPATCHER_LOG_TARGET : null;
44 44
 
45 45
         $this->logger = new Logger($name);
46 46
 
47
-        if ( $enabled ) {
47
+        if ($enabled) {
48 48
 
49
-            $handler = is_null($target) ? new ErrorLogHandler() : new StreamHandler( defined('DISPATCHER_LOG_FOLDER') ? DISPATCHER_LOG_FOLDER.$target : $target, $level);
49
+            $handler = is_null($target) ? new ErrorLogHandler() : new StreamHandler(defined('DISPATCHER_LOG_FOLDER') ? DISPATCHER_LOG_FOLDER.$target : $target, $level);
50 50
 
51 51
         }
52 52
         else {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@
 block discarded – undo
48 48
 
49 49
             $handler = is_null($target) ? new ErrorLogHandler() : new StreamHandler( defined('DISPATCHER_LOG_FOLDER') ? DISPATCHER_LOG_FOLDER.$target : $target, $level);
50 50
 
51
-        }
52
-        else {
51
+        } else {
53 52
 
54 53
             $handler = new NullHandler($level);
55 54
 
Please login to merge, or discard this patch.
src/XML.php 3 patches
Braces   +28 added lines, -15 removed lines patch added patch discarded remove patch
@@ -210,7 +210,9 @@  discard block
 block discarded – undo
210 210
         
211 211
         $xml = $this->ObjectXML->asXML();
212 212
 
213
-        if ( $xml === false ) throw new XMLException("Error formatting object");
213
+        if ( $xml === false ) {
214
+            throw new XMLException("Error formatting object");
215
+        }
214 216
         
215 217
         return $xml;
216 218
         
@@ -231,7 +233,9 @@  discard block
 block discarded – undo
231 233
         
232 234
         $parser_structs = xml_parse_into_struct($this->parser, $xml, $this->struct, $index);
233 235
         
234
-        if ( $parser_structs === 0 ) throw new XMLException("Failed to parse xml data into structs");
236
+        if ( $parser_structs === 0 ) {
237
+            throw new XMLException("Failed to parse xml data into structs");
238
+        }
235 239
         
236 240
         $this->counter = count($this->struct);
237 241
 
@@ -350,11 +354,15 @@  discard block
 block discarded – undo
350 354
         
351 355
         if ( !isset($target[$key]) ) {
352 356
             
353
-            if ($child != "") $target[$key] = $child;
354
-
355
-            if ($attributes != "") foreach($attributes as $akey => $avalue) $target[$key][$akey] = $avalue;
357
+            if ($child != "") {
358
+                $target[$key] = $child;
359
+            }
356 360
 
357
-            else if ( $value != "" ) $target[$key] = $value;
361
+            if ($attributes != "") {
362
+                foreach($attributes as $akey => $avalue) $target[$key][$akey] = $avalue;
363
+            } else if ( $value != "" ) {
364
+                $target[$key] = $value;
365
+            }
358 366
             
359 367
         } else {
360 368
 
@@ -365,18 +373,21 @@  discard block
 block discarded – undo
365 373
                 $target[$key][0] = $oldval;
366 374
                 $index=1;
367 375
 
368
-            }
369
-            else {
376
+            } else {
370 377
 
371 378
                 $index = count($target[$key]);
372 379
 
373 380
             }
374 381
 
375
-            if ( $child != "" ) $target[$key][$index] = $child;
376
-
377
-            if ( $attributes != "" ) foreach($attributes as $akey => $avalue) $target[$key][$index][$akey] = $avalue;
382
+            if ( $child != "" ) {
383
+                $target[$key][$index] = $child;
384
+            }
378 385
 
379
-            elseif ( $value != "" ) $target[$key][$index] = $value;
386
+            if ( $attributes != "" ) {
387
+                foreach($attributes as $akey => $avalue) $target[$key][$index][$akey] = $avalue;
388
+            } elseif ( $value != "" ) {
389
+                $target[$key][$index] = $value;
390
+            }
380 391
         }
381 392
 
382 393
         return $target;
@@ -393,9 +404,11 @@  discard block
 block discarded – undo
393 404
 
394 405
         foreach ($data as $key => $value) {
395 406
 
396
-            if ( is_array($value) ) $this->pushElement($ObjectXML->addChild(is_numeric($key) ? 'KEY_'.$key : $key), $value);
397
-
398
-            else $ObjectXML->addChild(is_numeric($key) ? 'KEY_'.$key : $key, mb_convert_encoding($value, $this->encoding));
407
+            if ( is_array($value) ) {
408
+                $this->pushElement($ObjectXML->addChild(is_numeric($key) ? 'KEY_'.$key : $key), $value);
409
+            } else {
410
+                $ObjectXML->addChild(is_numeric($key) ? 'KEY_'.$key : $key, mb_convert_encoding($value, $this->encoding));
411
+            }
399 412
 
400 413
         }
401 414
 
Please login to merge, or discard this patch.
Doc Comments   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      *
117 117
      * @param bool $bool
118 118
      *
119
-     * @return Object $this
119
+     * @return XML $this
120 120
      */
121 121
     final public function setIncludeHeader($bool) {
122 122
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      *
132 132
      * @param int $int
133 133
      *
134
-     * @return Object $this
134
+     * @return XML $this
135 135
      */
136 136
     final public function setCaseFolding($int) {
137 137
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      *
147 147
      * @param int $int
148 148
      *
149
-     * @return Object $this
149
+     * @return XML $this
150 150
      */
151 151
     final public function setSkipWhite($int) {
152 152
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
      *
162 162
      * @param string $encoding
163 163
      *
164
-     * @return Object $this
164
+     * @return XML $this
165 165
      */
166 166
     final public function setEncoding($encoding) {
167 167
 
@@ -219,6 +219,7 @@  discard block
 block discarded – undo
219 219
     /**
220 220
      * encode XML string into array
221 221
      *
222
+     * @param string $xml
222 223
      * @return array
223 224
      */
224 225
     public function decode($xml, $encoding=null) {
@@ -306,6 +307,7 @@  discard block
 block discarded – undo
306 307
     /**
307 308
      * Get element childs (if any)
308 309
      *
310
+     * @param integer $i
309 311
      * @return array
310 312
      */
311 313
     private function getChilds(&$i) {
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
      */
203 203
     public function encode($data) {
204 204
 
205
-        $structure = ($this->includeHeader ? $this->getHeader() : "") . $this->getParent();
205
+        $structure = ($this->includeHeader ? $this->getHeader() : "").$this->getParent();
206 206
 
207 207
         $this->ObjectXML = new SimpleXMLElement($structure);
208 208
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 
211 211
         $xml = $this->ObjectXML->asXML();
212 212
 
213
-        if ( $xml === false ) throw new XMLException("Error formatting object");
213
+        if ($xml === false) throw new XMLException("Error formatting object");
214 214
 
215 215
         return $xml;
216 216
 
@@ -221,17 +221,17 @@  discard block
 block discarded – undo
221 221
      *
222 222
      * @return array
223 223
      */
224
-    public function decode($xml, $encoding=null) {
224
+    public function decode($xml, $encoding = null) {
225 225
 
226 226
         $this->parser = is_null($encoding) ? xml_parser_create() : xml_parser_create($encoding);
227 227
 
228
-        xml_parser_set_option($this->parser,XML_OPTION_TARGET_ENCODING,$this->encoding);
229
-        xml_parser_set_option($this->parser,XML_OPTION_CASE_FOLDING,$this->caseFolding);
230
-        xml_parser_set_option($this->parser,XML_OPTION_SKIP_WHITE,$this->skipWhite);
228
+        xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, $this->encoding);
229
+        xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, $this->caseFolding);
230
+        xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, $this->skipWhite);
231 231
 
232 232
         $parser_structs = xml_parse_into_struct($this->parser, $xml, $this->struct, $index);
233 233
 
234
-        if ( $parser_structs === 0 ) throw new XMLException("Failed to parse xml data into structs");
234
+        if ($parser_structs === 0) throw new XMLException("Failed to parse xml data into structs");
235 235
 
236 236
         $this->counter = count($this->struct);
237 237
 
@@ -251,9 +251,9 @@  discard block
 block discarded – undo
251 251
      */
252 252
     private function sanitizeKeys($input, $key) {
253 253
 
254
-        $key_value = explode("_",$this->struct[$key]["tag"]);
254
+        $key_value = explode("_", $this->struct[$key]["tag"]);
255 255
 
256
-        if ( sizeof($key_value) == 2 AND $key_value[0] == "KEY" AND is_numeric($key_value[1]) ) {
256
+        if (sizeof($key_value) == 2 AND $key_value[0] == "KEY" AND is_numeric($key_value[1])) {
257 257
 
258 258
             $this->struct[$key]["tag"] = intval($key_value[1]);
259 259
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
      */
267 267
     private function free() {
268 268
 
269
-        if( isset($this->parser) AND @is_resource($this->parser) ) {
269
+        if (isset($this->parser) AND @is_resource($this->parser)) {
270 270
 
271 271
             xml_parser_free($this->parser);
272 272
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 
321 321
             $value = isset($this->struct[$i]["value"]) ? $this->struct[$i]["value"] : "";
322 322
 
323
-            switch($this->struct[$i]["type"]) {
323
+            switch ($this->struct[$i]["type"]) {
324 324
 
325 325
                 case "open":
326 326
                 $child = $this->getChilds($i);
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
      */
349 349
     private function addNode($target, $key, $attributes, $child, $value) {
350 350
 
351
-        if ( !isset($target[$key]) ) {
351
+        if (!isset($target[$key])) {
352 352
 
353 353
             if ($child != "") $target[$key] = $child;
354 354
 
355
-            if ($attributes != "") foreach($attributes as $akey => $avalue) $target[$key][$akey] = $avalue;
355
+            if ($attributes != "") foreach ($attributes as $akey => $avalue) $target[$key][$akey] = $avalue;
356 356
 
357
-            else if ( $value != "" ) $target[$key] = $value;
357
+            else if ($value != "") $target[$key] = $value;
358 358
 
359 359
         } else {
360 360
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
                 $oldval = $target[$key];
364 364
                 $target[$key] = array();
365 365
                 $target[$key][0] = $oldval;
366
-                $index=1;
366
+                $index = 1;
367 367
 
368 368
             }
369 369
             else {
@@ -372,11 +372,11 @@  discard block
 block discarded – undo
372 372
 
373 373
             }
374 374
 
375
-            if ( $child != "" ) $target[$key][$index] = $child;
375
+            if ($child != "") $target[$key][$index] = $child;
376 376
 
377
-            if ( $attributes != "" ) foreach($attributes as $akey => $avalue) $target[$key][$index][$akey] = $avalue;
377
+            if ($attributes != "") foreach ($attributes as $akey => $avalue) $target[$key][$index][$akey] = $avalue;
378 378
 
379
-            elseif ( $value != "" ) $target[$key][$index] = $value;
379
+            elseif ($value != "") $target[$key][$index] = $value;
380 380
         }
381 381
 
382 382
         return $target;
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 
394 394
         foreach ($data as $key => $value) {
395 395
 
396
-            if ( is_array($value) ) $this->pushElement($ObjectXML->addChild(is_numeric($key) ? 'KEY_'.$key : $key), $value);
396
+            if (is_array($value)) $this->pushElement($ObjectXML->addChild(is_numeric($key) ? 'KEY_'.$key : $key), $value);
397 397
 
398 398
             else $ObjectXML->addChild(is_numeric($key) ? 'KEY_'.$key : $key, mb_convert_encoding($value, $this->encoding));
399 399
 
Please login to merge, or discard this patch.
src/Deserialization.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
      *
39 39
      * @return  array
40 40
      */
41
-    final public function fromJson($data, $raw=false) {
41
+    final public function fromJson($data, $raw = false) {
42 42
 
43
-        if ( !is_string($data) ) throw new Exception("Invalid data for JSON deserialization");
43
+        if (!is_string($data)) throw new Exception("Invalid data for JSON deserialization");
44 44
 
45 45
         return json_decode($data, !$raw);
46 46
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     final public function fromXml($data) {
57 57
 
58
-        if ( !is_string($data) ) throw new Exception("Invalid data for XML deserialization");
58
+        if (!is_string($data)) throw new Exception("Invalid data for XML deserialization");
59 59
 
60 60
         $xmlEngine = new XML();
61 61
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     final public function fromYaml($data) {
74 74
 
75
-        if ( !is_string($data) ) throw new Exception("Invalid data for YAML deserialization");
75
+        if (!is_string($data)) throw new Exception("Invalid data for YAML deserialization");
76 76
 
77 77
         return \Spyc::YAMLLoadString($data);
78 78
 
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
      */
88 88
     final public function fromExport($data) {
89 89
 
90
-        if ( !is_string($data) ) throw new Exception("Invalid data for EXPORT deserialization");
90
+        if (!is_string($data)) throw new Exception("Invalid data for EXPORT deserialization");
91 91
 
92 92
         return unserialize($data);
93 93
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@  discard block
 block discarded – undo
40 40
      */
41 41
     final public function fromJson($data, $raw=false) {
42 42
 
43
-        if ( !is_string($data) ) throw new Exception("Invalid data for JSON deserialization");
43
+        if ( !is_string($data) ) {
44
+            throw new Exception("Invalid data for JSON deserialization");
45
+        }
44 46
 
45 47
         return json_decode($data, !$raw);
46 48
 
@@ -55,7 +57,9 @@  discard block
 block discarded – undo
55 57
      */
56 58
     final public function fromXml($data) {
57 59
 
58
-        if ( !is_string($data) ) throw new Exception("Invalid data for XML deserialization");
60
+        if ( !is_string($data) ) {
61
+            throw new Exception("Invalid data for XML deserialization");
62
+        }
59 63
 
60 64
         $xmlEngine = new XML();
61 65
 
@@ -72,7 +76,9 @@  discard block
 block discarded – undo
72 76
      */
73 77
     final public function fromYaml($data) {
74 78
 
75
-        if ( !is_string($data) ) throw new Exception("Invalid data for YAML deserialization");
79
+        if ( !is_string($data) ) {
80
+            throw new Exception("Invalid data for YAML deserialization");
81
+        }
76 82
 
77 83
         return \Spyc::YAMLLoadString($data);
78 84
 
@@ -87,7 +93,9 @@  discard block
 block discarded – undo
87 93
      */
88 94
     final public function fromExport($data) {
89 95
 
90
-        if ( !is_string($data) ) throw new Exception("Invalid data for EXPORT deserialization");
96
+        if ( !is_string($data) ) {
97
+            throw new Exception("Invalid data for EXPORT deserialization");
98
+        }
91 99
 
92 100
         return unserialize($data);
93 101
 
Please login to merge, or discard this patch.
src/Events.php 3 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
      *
69 69
      * @return  Object  $this
70 70
      */
71
-    final public function add($event, $callback, $method=null) {
71
+    final public function add($event, $callback, $method = null) {
72 72
 
73
-        if ( is_null($method) ) {
73
+        if (is_null($method)) {
74 74
 
75
-            if ( isset($this->hooks[$event]) ) array_push($this->hooks[$event], $callback);
75
+            if (isset($this->hooks[$event])) array_push($this->hooks[$event], $callback);
76 76
 
77 77
             else $this->hooks[$event] = Array($callback);
78 78
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
         else {
82 82
 
83
-            if ( isset($this->hooks[$event]) ) array_push($this->hooks[$event], Array($callback, $method));
83
+            if (isset($this->hooks[$event])) array_push($this->hooks[$event], Array($callback, $method));
84 84
 
85 85
             else $this->hooks[$event] = Array(Array($callback, $method));
86 86
 
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
      *
103 103
      * @return  bool
104 104
      */
105
-    final public function remove($event, $callback=null) {
105
+    final public function remove($event, $callback = null) {
106 106
 
107
-        if ( is_null($callback) AND isset($this->hooks[$event]) ) {
107
+        if (is_null($callback) AND isset($this->hooks[$event])) {
108 108
 
109 109
             unset($this->hooks[$event]);
110 110
 
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
 
113 113
         }
114 114
 
115
-        else if ( isset($this->hooks[$event]) ) {
115
+        else if (isset($this->hooks[$event])) {
116 116
 
117 117
             foreach ($this->hooks[$event] as $key => $hook) {
118 118
 
119
-                if ( is_array($hook) ) {
119
+                if (is_array($hook)) {
120 120
 
121
-                    if ( $hook[0] == $callback ) {
121
+                    if ($hook[0] == $callback) {
122 122
 
123 123
                         unset($this->hooks[$event][$key]);
124 124
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
                 }
130 130
                 else {
131 131
 
132
-                    if ( $hook == $callback ) {
132
+                    if ($hook == $callback) {
133 133
 
134 134
                         unset($this->hooks[$event][$key]);
135 135
 
@@ -166,15 +166,15 @@  discard block
 block discarded – undo
166 166
 
167 167
         $value = $data;
168 168
 
169
-        if ( isset($this->hooks[$event]) ) {
169
+        if (isset($this->hooks[$event])) {
170 170
 
171
-            foreach($this->hooks[$event] as $callback) {
171
+            foreach ($this->hooks[$event] as $callback) {
172 172
 
173 173
                 $return_value = null;
174 174
 
175
-                if ( is_array($callback) ) {
175
+                if (is_array($callback)) {
176 176
 
177
-                    if ( is_callable(Array($callback[0], $callback[1])) ) {
177
+                    if (is_callable(Array($callback[0], $callback[1]))) {
178 178
 
179 179
                         try {
180 180
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
                 }
211 211
                 else {
212 212
 
213
-                    if ( is_callable($callback) ) {
213
+                    if (is_callable($callback)) {
214 214
 
215 215
                         try {
216 216
 
Please login to merge, or discard this patch.
Braces   +18 added lines, -22 removed lines patch added patch discarded remove patch
@@ -72,17 +72,19 @@  discard block
 block discarded – undo
72 72
 
73 73
         if ( is_null($method) ) {
74 74
 
75
-            if ( isset($this->hooks[$event]) ) array_push($this->hooks[$event], $callback);
76
-
77
-            else $this->hooks[$event] = Array($callback);
78
-
79
-        }
80
-
81
-        else {
75
+            if ( isset($this->hooks[$event]) ) {
76
+                array_push($this->hooks[$event], $callback);
77
+            } else {
78
+                $this->hooks[$event] = Array($callback);
79
+            }
82 80
 
83
-            if ( isset($this->hooks[$event]) ) array_push($this->hooks[$event], Array($callback, $method));
81
+        } else {
84 82
 
85
-            else $this->hooks[$event] = Array(Array($callback, $method));
83
+            if ( isset($this->hooks[$event]) ) {
84
+                array_push($this->hooks[$event], Array($callback, $method));
85
+            } else {
86
+                $this->hooks[$event] = Array(Array($callback, $method));
87
+            }
86 88
 
87 89
         }
88 90
 
@@ -110,9 +112,7 @@  discard block
 block discarded – undo
110 112
 
111 113
             return true;
112 114
 
113
-        }
114
-
115
-        else if ( isset($this->hooks[$event]) ) {
115
+        } else if ( isset($this->hooks[$event]) ) {
116 116
 
117 117
             foreach ($this->hooks[$event] as $key => $hook) {
118 118
 
@@ -126,8 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
                     }
128 128
 
129
-                }
130
-                else {
129
+                } else {
131 130
 
132 131
                     if ( $hook == $callback ) {
133 132
 
@@ -143,10 +142,10 @@  discard block
 block discarded – undo
143 142
 
144 143
             return false;
145 144
 
145
+        } else {
146
+            return false;
146 147
         }
147 148
 
148
-        else return false;
149
-
150 149
     }
151 150
 
152 151
     /**
@@ -194,8 +193,7 @@  discard block
 block discarded – undo
194 193
 
195 194
                         }
196 195
 
197
-                    }
198
-                    else {
196
+                    } else {
199 197
 
200 198
                         $this->logger->warning('Skipping not-callable hook', array(
201 199
                             'EVENT'    => $event,
@@ -207,8 +205,7 @@  discard block
 block discarded – undo
207 205
 
208 206
                     }
209 207
 
210
-                }
211
-                else {
208
+                } else {
212 209
 
213 210
                     if ( is_callable($callback) ) {
214 211
 
@@ -229,8 +226,7 @@  discard block
 block discarded – undo
229 226
 
230 227
                         }
231 228
 
232
-                    }
233
-                    else {
229
+                    } else {
234 230
 
235 231
                         $this->logger->warning('Skipping not-callable hook', array(
236 232
                             'EVENT'    => $event,
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
      * @param   string  $callback   Callback (or callback class)
67 67
      * @param   string  $method     (optional) callback method
68 68
      *
69
-     * @return  Object  $this
69
+     * @return  Events  $this
70 70
      */
71 71
     final public function add($event, $callback, $method=null) {
72 72
 
Please login to merge, or discard this patch.
src/Components/Configuration.php 3 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -22,43 +22,43 @@
 block discarded – undo
22 22
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 23
  */
24 24
 
25
- // define('DISPATCHER_LOG_ENABLED', false);
26
- //
27
- // define('DISPATCHER_LOG_NAME', 'dispatcher');
28
- //
29
- // define('DISPATCHER_LOG_TARGET', null);
30
- //
31
- // define('DISPATCHER_LOG_LEVEL', 'ERROR');
32
- //
33
- // define("DISPATCHER_REAL_PATH", realpath(dirname(__FILE__)."/../")."/");
34
- //
35
- // define("DISPATCHER_BASEURL","");
36
- //
37
- // define ('DISPATCHER_ENABLED', true);
38
- //
39
- // define ('DISPATCHER_USE_REWRITE', true);
40
- //
41
- // define('DISPATCHER_AUTO_ROUTE', false);
42
- //
43
- // define('DISPATCHER_CACHE_ENABLED', true);
44
- //
45
- // define('DISPATCHER_CACHE_DEFAULT_TTL', 600);
46
- //
47
- // define('DISPATCHER_CACHE_FAIL_SILENTLY', true);
48
- //
49
- // define('DISPATCHER_DEFAULT_ENCODING', 'UTF-8');
50
- //
51
- // define('DISPATCHER_SUPPORTED_METHODS', 'GET,PUT,POST,DELETE,OPTIONS,HEAD');
52
- //
53
- // define('DISPATCHER_CACHE_FOLDER', DISPATCHER_REAL_PATH."cache/");
54
- //
55
- // define('DISPATCHER_SERVICES_FOLDER', DISPATCHER_REAL_PATH."services/");
56
- //
57
- // define('DISPATCHER_PLUGINS_FOLDER', DISPATCHER_REAL_PATH."plugins/");
58
- //
59
- // define('DISPATCHER_TEMPLATES_FOLDER', DISPATCHER_REAL_PATH."templates/");
60
- //
61
- // define('DISPATCHER_LOG_FOLDER', DISPATCHER_REAL_PATH."logs/");
25
+    // define('DISPATCHER_LOG_ENABLED', false);
26
+    //
27
+    // define('DISPATCHER_LOG_NAME', 'dispatcher');
28
+    //
29
+    // define('DISPATCHER_LOG_TARGET', null);
30
+    //
31
+    // define('DISPATCHER_LOG_LEVEL', 'ERROR');
32
+    //
33
+    // define("DISPATCHER_REAL_PATH", realpath(dirname(__FILE__)."/../")."/");
34
+    //
35
+    // define("DISPATCHER_BASEURL","");
36
+    //
37
+    // define ('DISPATCHER_ENABLED', true);
38
+    //
39
+    // define ('DISPATCHER_USE_REWRITE', true);
40
+    //
41
+    // define('DISPATCHER_AUTO_ROUTE', false);
42
+    //
43
+    // define('DISPATCHER_CACHE_ENABLED', true);
44
+    //
45
+    // define('DISPATCHER_CACHE_DEFAULT_TTL', 600);
46
+    //
47
+    // define('DISPATCHER_CACHE_FAIL_SILENTLY', true);
48
+    //
49
+    // define('DISPATCHER_DEFAULT_ENCODING', 'UTF-8');
50
+    //
51
+    // define('DISPATCHER_SUPPORTED_METHODS', 'GET,PUT,POST,DELETE,OPTIONS,HEAD');
52
+    //
53
+    // define('DISPATCHER_CACHE_FOLDER', DISPATCHER_REAL_PATH."cache/");
54
+    //
55
+    // define('DISPATCHER_SERVICES_FOLDER', DISPATCHER_REAL_PATH."services/");
56
+    //
57
+    // define('DISPATCHER_PLUGINS_FOLDER', DISPATCHER_REAL_PATH."plugins/");
58
+    //
59
+    // define('DISPATCHER_TEMPLATES_FOLDER', DISPATCHER_REAL_PATH."templates/");
60
+    //
61
+    // define('DISPATCHER_LOG_FOLDER', DISPATCHER_REAL_PATH."logs/");
62 62
 
63 63
 class Configuration {
64 64
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 
76 76
         $constants = get_defined_constants(true);
77 77
 
78
-        if ( !isset($constants['user']) ) return;
78
+        if (!isset($constants['user'])) return;
79 79
 
80 80
         $dispatcher_constants = preg_grep("/^DISPATCHER_/", array_keys($constants['user']));
81 81
 
82
-        if ( sizeof($dispatcher_constants) > 0 ) {
82
+        if (sizeof($dispatcher_constants) > 0) {
83 83
 
84 84
             $filtered_constants = array_intersect_key($constants['user'], array_flip($dispatcher_constants));
85 85
 
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 
110 110
     private static function urlGetAbsolute() {
111 111
 
112
-        $http = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '') . '://';
112
+        $http = 'http'.((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 's' : '').'://';
113 113
 
114 114
         $uri = preg_replace("/\/index.php(.*?)$/i", "", $_SERVER['PHP_SELF']);
115 115
 
116
-        return ( $http . $_SERVER['HTTP_HOST'] . $uri . "/" );
116
+        return ($http.$_SERVER['HTTP_HOST'].$uri."/");
117 117
 
118 118
     }
119 119
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,9 @@
 block discarded – undo
75 75
 
76 76
         $constants = get_defined_constants(true);
77 77
 
78
-        if ( !isset($constants['user']) ) return;
78
+        if ( !isset($constants['user']) ) {
79
+            return;
80
+        }
79 81
 
80 82
         $dispatcher_constants = preg_grep("/^DISPATCHER_/", array_keys($constants['user']));
81 83
 
Please login to merge, or discard this patch.
src/Components/Headers.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,17 +28,17 @@  discard block
 block discarded – undo
28 28
 
29 29
     final public function get($header = null) {
30 30
 
31
-        if ( is_null($header) ) return $this->headers;
31
+        if (is_null($header)) return $this->headers;
32 32
 
33
-        else if ( array_key_exists($header, $this->headers) ) return $this->headers[$header];
33
+        else if (array_key_exists($header, $this->headers)) return $this->headers[$header];
34 34
 
35 35
         else return null;
36 36
 
37 37
     }
38 38
 
39
-    final public function set($header, $value=null) {
39
+    final public function set($header, $value = null) {
40 40
 
41
-        if ( is_null($value) ) {
41
+        if (is_null($value)) {
42 42
 
43 43
             $header = explode(":", $header);
44 44
 
@@ -56,13 +56,13 @@  discard block
 block discarded – undo
56 56
 
57 57
     final public function unset($header = null) {
58 58
 
59
-        if ( is_null($header) ) {
59
+        if (is_null($header)) {
60 60
 
61 61
             $this->headers = array();
62 62
 
63 63
             return true;
64 64
 
65
-        } else if ( array_key_exists($header, $this->headers) ) {
65
+        } else if (array_key_exists($header, $this->headers)) {
66 66
 
67 67
             unset($this->headers[$header]);
68 68
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,11 +28,13 @@
 block discarded – undo
28 28
 
29 29
     final public function get($header = null) {
30 30
 
31
-        if ( is_null($header) ) return $this->headers;
32
-
33
-        else if ( array_key_exists($header, $this->headers) ) return $this->headers[$header];
34
-
35
-        else return null;
31
+        if ( is_null($header) ) {
32
+            return $this->headers;
33
+        } else if ( array_key_exists($header, $this->headers) ) {
34
+            return $this->headers[$header];
35
+        } else {
36
+            return null;
37
+        }
36 38
 
37 39
     }
38 40
 
Please login to merge, or discard this patch.
src/Components/Parameters.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
 
27 27
     protected $parameters = array();
28 28
 
29
-    final public function get($parameter=null) {
29
+    final public function get($parameter = null) {
30 30
 
31
-        if ( is_null($parameter) ) return $this->parameters;
31
+        if (is_null($parameter)) return $this->parameters;
32 32
 
33
-        else if ( array_key_exists($parameter, $this->parameters) ) {
33
+        else if (array_key_exists($parameter, $this->parameters)) {
34 34
 
35 35
             return $this->parameters[$parameter];
36 36
 
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 
51 51
     final public function unset($parameter = null) {
52 52
 
53
-        if ( is_null($parameter) ) {
53
+        if (is_null($parameter)) {
54 54
 
55 55
             $this->parameters = array();
56 56
 
57 57
             return true;
58 58
 
59
-        } else if ( array_key_exists($parameter, $this->parameters) ) {
59
+        } else if (array_key_exists($parameter, $this->parameters)) {
60 60
 
61 61
             unset($this->parameters[$parameter]);
62 62
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,16 +28,16 @@
 block discarded – undo
28 28
 
29 29
     final public function get($parameter=null) {
30 30
 
31
-        if ( is_null($parameter) ) return $this->parameters;
32
-
33
-        else if ( array_key_exists($parameter, $this->parameters) ) {
31
+        if ( is_null($parameter) ) {
32
+            return $this->parameters;
33
+        } else if ( array_key_exists($parameter, $this->parameters) ) {
34 34
 
35 35
             return $this->parameters[$parameter];
36 36
 
37
+        } else {
38
+            return null;
37 39
         }
38 40
 
39
-        else return null;
40
-
41 41
     }
42 42
 
43 43
     final public function set($parameter, $value) {
Please login to merge, or discard this patch.
src/Output/Processor.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
                 header($_SERVER["SERVER_PROTOCOL"].' 204 No Content');
110 110
                 header('Status: 204 No Content');
111
-                header('Content-Length: 0',true);
111
+                header('Content-Length: 0', true);
112 112
 
113 113
                 $return = null;
114 114
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
             case 303: //See Other
121 121
             case 307: //Temporary Redirect
122 122
 
123
-                header("Location: ".$location->get(),true,$status);
123
+                header("Location: ".$location->get(), true, $status);
124 124
 
125 125
                 break;
126 126
 
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 
129 129
                 $last_modified = $headers->get('Last-Modified');
130 130
 
131
-                if ( is_null($last_modified) ) {
131
+                if (is_null($last_modified)) {
132 132
 
133 133
                     header($_SERVER["SERVER_PROTOCOL"].' 304 Not Modified');
134 134
 
135
-                } else if ( is_int($last_modified) ) {
135
+                } else if (is_int($last_modified)) {
136 136
 
137 137
                     header('Last-Modified: '.gmdate('D, d M Y H:i:s', $last_modified).' GMT', true, 304);
138 138
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
             case 405: //Not allowed
172 172
 
173
-            header('Allow: ' . $value, true, 405);
173
+            header('Allow: '.$value, true, 405);
174 174
 
175 175
             break;
176 176
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
             case 501: //Not implemented
185 185
 
186
-            header('Allow: ' . $value, true, 501);
186
+            header('Allow: '.$value, true, 501);
187 187
 
188 188
             break;
189 189
 
Please login to merge, or discard this patch.
src/Request/Headers.php 2 patches
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.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@
 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') ) {
45
+            return getallheaders();
46
+        }
45 47
 
46 48
         $headers = array();
47 49
 
Please login to merge, or discard this patch.