Completed
Pull Request — master (#148)
by Vítor
03:19
created
src/Debug/ExceptionHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -367,7 +367,7 @@
 block discarded – undo
367 367
                 $formattedValue = sprintf("<em>object</em>(%s)", $this->abbrClass($item[1]));
368 368
             } elseif ('array' === $item[0]) {
369 369
                 $formattedValue = sprintf("<em>array</em>(%s)", is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
370
-            } elseif ('string'  === $item[0]) {
370
+            } elseif ('string' === $item[0]) {
371 371
                 $formattedValue = sprintf("'%s'", htmlspecialchars($item[1], ENT_QUOTES | ENT_SUBSTITUTE, $this->charset));
372 372
             } elseif ('null' === $item[0]) {
373 373
                 $formattedValue = '<em>null</em>';
Please login to merge, or discard this patch.
src/Http/Stream.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
      */
68 68
     public function __toString()
69 69
     {
70
-        if (! $this->isReadable()) {
70
+        if (!$this->isReadable()) {
71 71
             return '';
72 72
         }
73 73
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
      */
80 80
     public function close()
81 81
     {
82
-        if (! $this->resource) {
82
+        if (!$this->resource) {
83 83
             return;
84 84
         }
85 85
 
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
     public function attach($resource, $mode = 'r')
117 117
     {
118 118
         $error = null;
119
-        if (! is_resource($resource) && is_string($resource)) {
120
-            set_error_handler(function ($e) use (&$error) {
119
+        if (!is_resource($resource) && is_string($resource)) {
120
+            set_error_handler(function($e) use (&$error) {
121 121
                 $error = $e;
122 122
             }, E_WARNING);
123 123
             $resource = fopen($resource, $mode);
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             throw new InvalidArgumentException('Invalid stream reference provided');
129 129
         }
130 130
 
131
-        if (! is_resource($resource)) {
131
+        if (!is_resource($resource)) {
132 132
             throw new InvalidArgumentException(
133 133
                 'Invalid stream provided; must be a string stream identifier or resource'
134 134
             );
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      */
161 161
     public function tell()
162 162
     {
163
-        if (! $this->resource) {
163
+        if (!$this->resource) {
164 164
             return false;
165 165
         }
166 166
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
      */
175 175
     public function eof()
176 176
     {
177
-        if (! $this->resource) {
177
+        if (!$this->resource) {
178 178
             return true;
179 179
         }
180 180
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
      */
189 189
     public function isSeekable()
190 190
     {
191
-        if (! $this->resource) {
191
+        if (!$this->resource) {
192 192
             return false;
193 193
         }
194 194
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
      */
215 215
     public function seek($offset, $whence = SEEK_SET)
216 216
     {
217
-        if (! $this->resource || ! $this->isSeekable()) {
217
+        if (!$this->resource || !$this->isSeekable()) {
218 218
             return false;
219 219
         }
220 220
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
      */
231 231
     public function rewind()
232 232
     {
233
-        if (! $this->isSeekable()) {
233
+        if (!$this->isSeekable()) {
234 234
             return false;
235 235
         }
236 236
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
      */
247 247
     public function isWritable()
248 248
     {
249
-        if (! $this->resource) {
249
+        if (!$this->resource) {
250 250
             return false;
251 251
         }
252 252
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      */
266 266
     public function write($string)
267 267
     {
268
-        if (! $this->resource) {
268
+        if (!$this->resource) {
269 269
             return false;
270 270
         }
271 271
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
      */
280 280
     public function isReadable()
281 281
     {
282
-        if (! $this->resource) {
282
+        if (!$this->resource) {
283 283
             return false;
284 284
         }
285 285
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
      */
303 303
     public function read($length)
304 304
     {
305
-        if (! $this->resource || ! $this->isReadable()) {
305
+        if (!$this->resource || !$this->isReadable()) {
306 306
             return false;
307 307
         }
308 308
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
      */
321 321
     public function getContents()
322 322
     {
323
-        if (! $this->isReadable()) {
323
+        if (!$this->isReadable()) {
324 324
             return '';
325 325
         }
326 326
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
         }
342 342
 
343 343
         $metadata = stream_get_meta_data($this->resource);
344
-        if (! array_key_exists($key, $metadata)) {
344
+        if (!array_key_exists($key, $metadata)) {
345 345
             return;
346 346
         }
347 347
 
Please login to merge, or discard this patch.
src/Http/Uri.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -109,18 +109,18 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function __construct($uri = '')
111 111
     {
112
-        if (! is_string($uri)) {
112
+        if (!is_string($uri)) {
113 113
             throw new InvalidArgumentException(sprintf(
114 114
                 'URI passed to constructor must be a string; received "%s"',
115 115
                 (is_object($uri) ? get_class($uri) : gettype($uri))
116 116
             ));
117 117
         }
118 118
 
119
-        $this->urlEncode = function (array $matches) {
119
+        $this->urlEncode = function(array $matches) {
120 120
             return rawurlencode($matches[0]);
121 121
         };
122 122
 
123
-        if (! empty($uri)) {
123
+        if (!empty($uri)) {
124 124
             $this->parseUri($uri);
125 125
         }
126 126
     }
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         }
211 211
 
212 212
         $authority = $this->host;
213
-        if (! empty($this->userInfo)) {
213
+        if (!empty($this->userInfo)) {
214 214
             $authority = $this->userInfo . '@' . $authority;
215 215
         }
216 216
 
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
      */
437 437
     public function withPort($port)
438 438
     {
439
-        if (! (is_integer($port) || (is_string($port) && is_numeric($port)))) {
439
+        if (!(is_integer($port) || (is_string($port) && is_numeric($port)))) {
440 440
             throw new InvalidArgumentException(sprintf(
441 441
                 'Invalid port "%s" specified; must be an integer or integer string',
442 442
                 (is_object($port) ? get_class($port) : gettype($port))
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
      */
483 483
     public function withPath($path)
484 484
     {
485
-        if (! is_string($path)) {
485
+        if (!is_string($path)) {
486 486
             throw new InvalidArgumentException(
487 487
                 'Invalid path provided; must be a string'
488 488
             );
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
      */
534 534
     public function withQuery($query)
535 535
     {
536
-        if (! is_string($query)) {
536
+        if (!is_string($query)) {
537 537
             throw new InvalidArgumentException(
538 538
                 'Query string must be a string'
539 539
             );
@@ -594,12 +594,12 @@  discard block
 block discarded – undo
594 594
     {
595 595
         $parts = parse_url($uri);
596 596
 
597
-        $this->scheme    = isset($parts['scheme'])   ? $this->filterScheme($parts['scheme']) : '';
598
-        $this->userInfo  = isset($parts['user'])     ? $parts['user']     : '';
599
-        $this->host      = isset($parts['host'])     ? $parts['host']     : '';
600
-        $this->port      = isset($parts['port'])     ? $parts['port']     : null;
601
-        $this->path      = isset($parts['path'])     ? $this->filterPath($parts['path']) : '';
602
-        $this->query     = isset($parts['query'])    ? $this->filterQuery($parts['query']) : '';
597
+        $this->scheme    = isset($parts['scheme']) ? $this->filterScheme($parts['scheme']) : '';
598
+        $this->userInfo  = isset($parts['user']) ? $parts['user'] : '';
599
+        $this->host      = isset($parts['host']) ? $parts['host'] : '';
600
+        $this->port      = isset($parts['port']) ? $parts['port'] : null;
601
+        $this->path      = isset($parts['path']) ? $this->filterPath($parts['path']) : '';
602
+        $this->query     = isset($parts['query']) ? $this->filterQuery($parts['query']) : '';
603 603
         $this->fragment  = isset($parts['fragment']) ? $this->filterFragment($parts['fragment']) : '';
604 604
 
605 605
         if (isset($parts['pass'])) {
@@ -622,11 +622,11 @@  discard block
 block discarded – undo
622 622
     {
623 623
         $uri = '';
624 624
 
625
-        if (! empty($scheme)) {
625
+        if (!empty($scheme)) {
626 626
             $uri .= sprintf('%s://', $scheme);
627 627
         }
628 628
 
629
-        if (! empty($authority)) {
629
+        if (!empty($authority)) {
630 630
             $uri .= $authority;
631 631
         }
632 632
 
@@ -656,15 +656,15 @@  discard block
 block discarded – undo
656 656
      */
657 657
     private function isNonStandardPort($scheme, $host, $port)
658 658
     {
659
-        if (! $scheme) {
659
+        if (!$scheme) {
660 660
             return true;
661 661
         }
662 662
 
663
-        if (! $host || ! $port) {
663
+        if (!$host || !$port) {
664 664
             return false;
665 665
         }
666 666
 
667
-        return ! isset($this->allowedSchemes[$scheme]) || $port !== $this->allowedSchemes[$scheme];
667
+        return !isset($this->allowedSchemes[$scheme]) || $port !== $this->allowedSchemes[$scheme];
668 668
     }
669 669
 
670 670
     /**
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
             return '';
684 684
         }
685 685
 
686
-        if (! array_key_exists($scheme, $this->allowedSchemes)) {
686
+        if (!array_key_exists($scheme, $this->allowedSchemes)) {
687 687
             throw new InvalidArgumentException(sprintf(
688 688
                 'Unsupported scheme "%s"; must be any empty string or in the set (%s)',
689 689
                 $scheme,
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
      */
729 729
     private function filterQuery($query)
730 730
     {
731
-        if (! empty($query) && strpos($query, '?') === 0) {
731
+        if (!empty($query) && strpos($query, '?') === 0) {
732 732
             $query = substr($query, 1);
733 733
         }
734 734
 
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
             $fragment = '';
780 780
         }
781 781
 
782
-        if (! empty($fragment) && strpos($fragment, '#') === 0) {
782
+        if (!empty($fragment) && strpos($fragment, '#') === 0) {
783 783
             $fragment = substr($fragment, 1);
784 784
         }
785 785
 
Please login to merge, or discard this patch.
src/ServiceManager/Config/MonologConfig.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
         }
82 82
 
83 83
         $loggerClass = $configs['parameters']['monolog.logger.class'];
84
-        $serviceManager->setFactory('monolog.logger', function ($serviceManager) use ($loggerClass, $handlersToChannels) {
84
+        $serviceManager->setFactory('monolog.logger', function($serviceManager) use ($loggerClass, $handlersToChannels) {
85 85
             $logger = new $loggerClass('app');
86 86
             foreach ($handlersToChannels as $handler => $channels) {
87 87
                 $logger->pushHandler($serviceManager->get($handler));
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
         $class            = $parameters[sprintf('monolog.handler.%s.class', $handler['type'])];
106 106
         $handler['level'] = is_int($handler['level']) ? $handler['level'] : constant('Monolog\Logger::' . strtoupper($handler['level']));
107 107
 
108
-        $serviceManager->setFactory($handlerId, function ($serviceManager) use ($class, $handler) {
108
+        $serviceManager->setFactory($handlerId, function($serviceManager) use ($class, $handler) {
109 109
             switch ($handler['type']) {
110 110
             case 'stream':
111 111
                 return new $class($handler['path'], $handler['level'], $handler['bubble']);
Please login to merge, or discard this patch.
src/ServiceManager/Config/ServiceManagerConfig.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             $serviceManager->setShared($name, $value);
134 134
         }
135 135
 
136
-        $serviceManager->addInitializer(function ($instance) use ($serviceManager) {
136
+        $serviceManager->addInitializer(function($instance) use ($serviceManager) {
137 137
             if ($instance instanceof EventManagerAwareInterface) {
138 138
                 if ($instance->getEventManager() instanceof EventManagerInterface) {
139 139
                     $instance->getEventManager()->setSharedManager(
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
             }
146 146
         });
147 147
 
148
-        $serviceManager->addInitializer(function ($instance) use ($serviceManager) {
148
+        $serviceManager->addInitializer(function($instance) use ($serviceManager) {
149 149
             if ($instance instanceof ServiceManagerAwareInterface) {
150 150
                 $instance->setServiceManager($serviceManager);
151 151
             }
152 152
         });
153 153
 
154
-        $serviceManager->addInitializer(function ($instance) use ($serviceManager) {
154
+        $serviceManager->addInitializer(function($instance) use ($serviceManager) {
155 155
             if ($instance instanceof ServiceLocatorAwareInterface) {
156 156
                 $instance->setServiceLocator($serviceManager);
157 157
             }
Please login to merge, or discard this patch.
src/ServiceManager/Config/SessionConfig.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
         $config = $serviceManager->get('Config');
47 47
 
48
-        $options =  array_merge(array(
48
+        $options = array_merge(array(
49 49
             'auto_start'        => false,
50 50
             'storage_id'        => 'session.storage.native',
51 51
             'handler_id'        => 'session.handler.native_file',
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
         }
68 68
 
69 69
         // session handler
70
-        $serviceManager->setFactory('session.handler', function ($serviceManager) use ($options) {
70
+        $serviceManager->setFactory('session.handler', function($serviceManager) use ($options) {
71 71
             $handlerID = $options['handler_id'];
72 72
 
73 73
             return $handlerID === null ? null : $serviceManager->get($handlerID);
74 74
         });
75 75
 
76 76
         // session storage native
77
-        $serviceManager->setFactory('session.storage.native', function ($serviceManager) use ($storageOptions) {
77
+        $serviceManager->setFactory('session.storage.native', function($serviceManager) use ($storageOptions) {
78 78
 
79 79
             // We need to strip out keys with a null value so symfony doesn't try and set things with a blank value
80 80
             $storageOptions = array_filter($storageOptions);
@@ -83,19 +83,19 @@  discard block
 block discarded – undo
83 83
         });
84 84
 
85 85
         // session flash bag
86
-        $serviceManager->setFactory('session.flash_bag', function ($serviceManager) {
86
+        $serviceManager->setFactory('session.flash_bag', function($serviceManager) {
87 87
             return new FlashBag();
88 88
         });
89 89
 
90 90
         // session attribute bag
91
-        $serviceManager->setFactory('session.attribute_bag', function ($serviceManager) {
91
+        $serviceManager->setFactory('session.attribute_bag', function($serviceManager) {
92 92
             return new AttributeBag();
93 93
         });
94 94
 
95 95
         $that = $this;
96 96
 
97 97
         // session handler native file
98
-        $serviceManager->setFactory('session.handler.native_file', function ($serviceManager) use ($that, $storageOptions) {
98
+        $serviceManager->setFactory('session.handler.native_file', function($serviceManager) use ($that, $storageOptions) {
99 99
 
100 100
             // We want absolute paths if we can
101 101
             if (null !== $storageOptions['save_path'] && !$that->isAbsolutePath($storageOptions['save_path'])) {
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         });
113 113
 
114 114
         // session
115
-        $serviceManager->setFactory('session', function ($serviceManager) {
115
+        $serviceManager->setFactory('session', function($serviceManager) {
116 116
 
117 117
             $session = new Session(
118 118
                 $serviceManager->get('session.storage.native'),
Please login to merge, or discard this patch.
src/ServiceManager/Config/TemplatingConfig.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         /*
76 76
          * Templating Locator.
77 77
          */
78
-        $serviceManager->setFactory('templating.locator', function ($serviceManager) use ($appCacheDir) {
78
+        $serviceManager->setFactory('templating.locator', function($serviceManager) use ($appCacheDir) {
79 79
             return new TemplateLocator(
80 80
                 $serviceManager->get('file_locator'),
81 81
                 $appCacheDir
@@ -85,28 +85,28 @@  discard block
 block discarded – undo
85 85
         /*
86 86
          * Templating Name Parser.
87 87
          */
88
-        $serviceManager->setFactory('templating.name_parser', function ($serviceManager) {
88
+        $serviceManager->setFactory('templating.name_parser', function($serviceManager) {
89 89
             return new TemplateNameParser($serviceManager->get('modulemanager'));
90 90
         });
91 91
 
92 92
         /*
93 93
          * Filesystem Loader.
94 94
          */
95
-        $serviceManager->setFactory('templating.loader.filesystem', function ($serviceManager) {
95
+        $serviceManager->setFactory('templating.loader.filesystem', function($serviceManager) {
96 96
             return new FileSystemLoader($serviceManager->get('templating.locator'));
97 97
         });
98 98
 
99 99
         /*
100 100
          * Templating assets helper.
101 101
          */
102
-        $serviceManager->setFactory('templating.helper.assets', function ($serviceManager) {
102
+        $serviceManager->setFactory('templating.helper.assets', function($serviceManager) {
103 103
             return new AssetsHelper($serviceManager->get('request')->getBasePath());
104 104
         });
105 105
 
106 106
         /*
107 107
          * Templating globals.
108 108
          */
109
-        $serviceManager->setFactory('templating.globals', function ($serviceManager) {
109
+        $serviceManager->setFactory('templating.globals', function($serviceManager) {
110 110
             return new GlobalVariables($serviceManager->get('servicemanager'));
111 111
         });
112 112
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
          *
116 116
          * TODO: Migrate to Symfony\Bundle\FrameworkBundle\Templating\PhpEngine
117 117
          */
118
-        $serviceManager->setFactory('templating.engine.php', function ($serviceManager) use ($appCharset) {
118
+        $serviceManager->setFactory('templating.engine.php', function($serviceManager) use ($appCharset) {
119 119
             $engine = new PhpEngine(
120 120
                 $serviceManager->get('templating.name_parser'),
121 121
                 $serviceManager->get('templating.loader'),
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         /*
137 137
          * Twig Engine
138 138
          */
139
-        $serviceManager->setFactory('templating.engine.twig', function ($serviceManager) {
139
+        $serviceManager->setFactory('templating.engine.twig', function($serviceManager) {
140 140
 
141 141
             if (!class_exists('Twig_Environment')) {
142 142
                 throw new \Exception('PPI\Framework\TwigModule not found. Composer require: ppi/twig-module');
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         /*
160 160
          * Smarty Engine.
161 161
          */
162
-        $serviceManager->setFactory('templating.engine.smarty', function ($serviceManager) use ($appCacheDir) {
162
+        $serviceManager->setFactory('templating.engine.smarty', function($serviceManager) use ($appCacheDir) {
163 163
 
164 164
             if (!class_exists('NoiseLabs\Bundle\SmartyBundle\SmartyEngine')) {
165 165
                 throw new \Exception('PPI\Framework\SmartyModule not found. Composer require: ppi/smarty-module');
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         });
189 189
 
190 190
         // Mustache Engine
191
-        $serviceManager->setFactory('templating.engine.mustache', function ($serviceManager, $appCacheDir) {
191
+        $serviceManager->setFactory('templating.engine.mustache', function($serviceManager, $appCacheDir) {
192 192
 
193 193
             if (!class_exists('Mustache_Engine')) {
194 194
                 throw new \Exception('PPI\Framework\MustacheModule not found. Composer require: ppi/mustache-module');
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         /*
207 207
          * Delegating Engine.
208 208
          */
209
-        $serviceManager->setFactory('templating.engine.delegating', function ($serviceManager) use ($engineIds) {
209
+        $serviceManager->setFactory('templating.engine.delegating', function($serviceManager) use ($engineIds) {
210 210
             $delegatingEngine = new DelegatingEngine();
211 211
             // @todo - lazy load this
212 212
             foreach ($engineIds as $id) {
Please login to merge, or discard this patch.
src/ServiceManager/Factory/ConfigFactory.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@
 block discarded – undo
48 48
         $parametersBag = $serviceLocator->get('ApplicationParameters');
49 49
 
50 50
         $config['parameters'] = isset($config['parameters']) ?
51
-            ArrayUtils::merge($parametersBag->all(), $config['parameters']) :
52
-            $config['parameters'] = $parametersBag->all();
51
+            ArrayUtils::merge($parametersBag->all(), $config['parameters']) : $config['parameters'] = $parametersBag->all();
53 52
 
54 53
         return $parametersBag->resolveArray($config);
55 54
     }
Please login to merge, or discard this patch.
src/ServiceManager/Factory/RouterRequestContextFactory.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,6 @@
 block discarded – undo
61 61
         $defaults = $defaults['framework']['router'];
62 62
 
63 63
         return isset($config['framework']['router']) ?
64
-            $this->mergeConfiguration($defaults, $config['framework']['router']) :
65
-            $defaults;
64
+            $this->mergeConfiguration($defaults, $config['framework']['router']) : $defaults;
66 65
     }
67 66
 }
Please login to merge, or discard this patch.