@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | /** |
| 455 | 455 | * @note Added for compatibility with Symfony's HttpKernel\Kernel. |
| 456 | 456 | * |
| 457 | - * @return null|ServiceManager\ServiceManager |
|
| 457 | + * @return ServiceManager\ServiceManager |
|
| 458 | 458 | */ |
| 459 | 459 | public function getContainer() |
| 460 | 460 | { |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | /** |
| 653 | 653 | * Creates and initializes a ServiceManager instance. |
| 654 | 654 | * |
| 655 | - * @return ServiceManager The compiled service manager |
|
| 655 | + * @return ServiceManagerBuilder The compiled service manager |
|
| 656 | 656 | */ |
| 657 | 657 | protected function buildServiceManager() |
| 658 | 658 | { |
@@ -703,7 +703,7 @@ discard block |
||
| 703 | 703 | /** |
| 704 | 704 | * Logs with an arbitrary level. |
| 705 | 705 | * |
| 706 | - * @param mixed $level |
|
| 706 | + * @param string $level |
|
| 707 | 707 | * @param string $message |
| 708 | 708 | * @param array $context |
| 709 | 709 | */ |
@@ -21,7 +21,6 @@ |
||
| 21 | 21 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
| 22 | 22 | use Symfony\Component\Routing\Exception\ResourceNotFoundException; |
| 23 | 23 | use PPI\Framework\Http\Request as HttpRequest; |
| 24 | -use PPI\Framework\Http\Response as HttpResponse; |
|
| 25 | 24 | |
| 26 | 25 | /** |
| 27 | 26 | * The PPI App bootstrap class. |
@@ -125,10 +125,10 @@ discard block |
||
| 125 | 125 | public function __construct(array $options = array()) |
| 126 | 126 | { |
| 127 | 127 | // Default options |
| 128 | - $this->environment = isset($options['environment']) && $options['environment'] ? (string)$options['environment'] : 'prod'; |
|
| 129 | - $this->debug = isset($options['debug']) && null !== $options['debug'] ? (boolean)$options['debug'] : false; |
|
| 130 | - $this->rootDir = isset($options['rootDir']) && $options['rootDir'] ? (string)$options['rootDir'] : $this->getRootDir(); |
|
| 131 | - $this->name = isset($options['name']) && $options['name'] ? (string)$options['name'] : $this->getName(); |
|
| 128 | + $this->environment = isset($options['environment']) && $options['environment'] ? (string) $options['environment'] : 'prod'; |
|
| 129 | + $this->debug = isset($options['debug']) && null !== $options['debug'] ? (boolean) $options['debug'] : false; |
|
| 130 | + $this->rootDir = isset($options['rootDir']) && $options['rootDir'] ? (string) $options['rootDir'] : $this->getRootDir(); |
|
| 131 | + $this->name = isset($options['name']) && $options['name'] ? (string) $options['name'] : $this->getName(); |
|
| 132 | 132 | |
| 133 | 133 | if ($this->debug) { |
| 134 | 134 | $this->startTime = microtime(true); |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | $result = $module->dispatch($request, $response); |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - if(is_string($result)) { |
|
| 347 | + if (is_string($result)) { |
|
| 348 | 348 | $response->setContent($result); |
| 349 | 349 | } else if ($result instanceof ResponseInterface) { |
| 350 | 350 | $response = $result; |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | - * @param $appVersion |
|
| 70 | + * @param string $appVersion |
|
| 71 | 71 | * |
| 72 | 72 | * @return $this |
| 73 | 73 | */ |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * This method uses plain PHP functions like header() and echo to output |
| 129 | 129 | * the response. |
| 130 | 130 | * |
| 131 | - * @param \Exception|FlattenException $exception An \Exception instance |
|
| 131 | + * @param \Exception $exception An \Exception instance |
|
| 132 | 132 | */ |
| 133 | 133 | public function sendPhpResponse($exception) |
| 134 | 134 | { |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | /** |
| 148 | 148 | * Creates the error Response associated with the given Exception. |
| 149 | 149 | * |
| 150 | - * @param \Exception|FlattenException $exception An \Exception instance |
|
| 150 | + * @param \Exception $exception An \Exception instance |
|
| 151 | 151 | * |
| 152 | 152 | * @return Response A Response instance |
| 153 | 153 | */ |
@@ -299,6 +299,10 @@ discard block |
||
| 299 | 299 | EOT; |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | + /** |
|
| 303 | + * @param string $content |
|
| 304 | + * @param string $css |
|
| 305 | + */ |
|
| 302 | 306 | private function decorate($content, $css) |
| 303 | 307 | { |
| 304 | 308 | $baseStylesheet = $this->getBaseStylesheet(); |
@@ -180,11 +180,11 @@ |
||
| 180 | 180 | public function getContent(FlattenException $exception, $showAll = true) |
| 181 | 181 | { |
| 182 | 182 | switch ($exception->getStatusCode()) { |
| 183 | - case 404: |
|
| 184 | - $title = "The page you are looking for could not be found"; |
|
| 185 | - break; |
|
| 186 | - default: |
|
| 187 | - $title = "Oh noes, something's broken"; |
|
| 183 | + case 404: |
|
| 184 | + $title = "The page you are looking for could not be found"; |
|
| 185 | + break; |
|
| 186 | + default: |
|
| 187 | + $title = "Oh noes, something's broken"; |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | $content = ''; |
@@ -367,7 +367,7 @@ |
||
| 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>'; |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * This file is part of the PPI Framework. |
|
| 4 | - * |
|
| 5 | - * @copyright Copyright (c) 2011-2013 Paul Dragoonis <[email protected]> |
|
| 6 | - * @license http://opensource.org/licenses/mit-license.php MIT |
|
| 7 | - * |
|
| 8 | - * @link http://www.ppi.io |
|
| 9 | - */ |
|
| 3 | + * This file is part of the PPI Framework. |
|
| 4 | + * |
|
| 5 | + * @copyright Copyright (c) 2011-2013 Paul Dragoonis <[email protected]> |
|
| 6 | + * @license http://opensource.org/licenses/mit-license.php MIT |
|
| 7 | + * |
|
| 8 | + * @link http://www.ppi.io |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | namespace PPI\Framework\View; |
| 12 | 12 | |
@@ -592,7 +592,7 @@ |
||
| 592 | 592 | * |
| 593 | 593 | * @throws InvalidArgumentException on invalid HTTP method. |
| 594 | 594 | * |
| 595 | - * @return bool |
|
| 595 | + * @return boolean|null |
|
| 596 | 596 | */ |
| 597 | 597 | private function validateMethod($method) |
| 598 | 598 | { |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $value = array($value); |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - if (! is_array($value) || ! $this->arrayContainsOnlyStrings($value)) { |
|
| 176 | + if (!is_array($value) || !$this->arrayContainsOnlyStrings($value)) { |
|
| 177 | 177 | throw new InvalidArgumentException( |
| 178 | 178 | 'Invalid header value; must be a string or array of strings' |
| 179 | 179 | ); |
@@ -212,13 +212,13 @@ discard block |
||
| 212 | 212 | $value = array($value); |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - if (! is_array($value) || ! $this->arrayContainsOnlyStrings($value)) { |
|
| 215 | + if (!is_array($value) || !$this->arrayContainsOnlyStrings($value)) { |
|
| 216 | 216 | throw new InvalidArgumentException( |
| 217 | 217 | 'Invalid header value; must be a string or array of strings' |
| 218 | 218 | ); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - if (! $this->hasHeader($header)) { |
|
| 221 | + if (!$this->hasHeader($header)) { |
|
| 222 | 222 | return $this->withHeader($header, $value); |
| 223 | 223 | } |
| 224 | 224 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public function withoutHeader($header) |
| 248 | 248 | { |
| 249 | - if (! $this->hasHeader($header)) { |
|
| 249 | + if (!$this->hasHeader($header)) { |
|
| 250 | 250 | return clone $this; |
| 251 | 251 | } |
| 252 | 252 | |
@@ -599,14 +599,14 @@ discard block |
||
| 599 | 599 | if (null === $method) { |
| 600 | 600 | return true; |
| 601 | 601 | } |
| 602 | - if (! is_string($method)) { |
|
| 602 | + if (!is_string($method)) { |
|
| 603 | 603 | throw new InvalidArgumentException(sprintf( |
| 604 | 604 | 'Unsupported HTTP method; must be a string, received %s', |
| 605 | 605 | (is_object($method) ? get_class($method) : gettype($method)) |
| 606 | 606 | )); |
| 607 | 607 | } |
| 608 | 608 | $method = strtoupper($method); |
| 609 | - if (! in_array($method, $this->validMethods, true)) { |
|
| 609 | + if (!in_array($method, $this->validMethods, true)) { |
|
| 610 | 610 | throw new InvalidArgumentException(sprintf( |
| 611 | 611 | 'Unsupported HTTP method "%s" provided', |
| 612 | 612 | $method |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | */ |
| 624 | 624 | private function arrayContainsOnlyStrings(array $array) |
| 625 | 625 | { |
| 626 | - return array_reduce($array, array( __CLASS__, 'filterStringValue'), true); |
|
| 626 | + return array_reduce($array, array(__CLASS__, 'filterStringValue'), true); |
|
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | /** |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * This file is part of the PPI Framework. |
|
| 4 | - * |
|
| 5 | - * @copyright Copyright (c) 2011-2015 Paul Dragoonis <[email protected]> |
|
| 6 | - * @license http://opensource.org/licenses/mit-license.php MIT |
|
| 7 | - * |
|
| 8 | - * @link http://www.ppi.io |
|
| 9 | - */ |
|
| 3 | + * This file is part of the PPI Framework. |
|
| 4 | + * |
|
| 5 | + * @copyright Copyright (c) 2011-2015 Paul Dragoonis <[email protected]> |
|
| 6 | + * @license http://opensource.org/licenses/mit-license.php MIT |
|
| 7 | + * |
|
| 8 | + * @link http://www.ppi.io |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | namespace PPI\Framework\Router; |
| 12 | 12 | |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | /** |
| 446 | - * @param $reasonPhrase |
|
| 446 | + * @param string $reasonPhrase |
|
| 447 | 447 | * |
| 448 | 448 | * @return $this |
| 449 | 449 | */ |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | * @link http://tools.ietf.org/html/rfc7231#section-6 |
| 467 | 467 | * @link http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml |
| 468 | 468 | * |
| 469 | - * @return string|null Reason phrase, or null if unknown. |
|
| 469 | + * @return string Reason phrase, or null if unknown. |
|
| 470 | 470 | */ |
| 471 | 471 | public function getReasonPhrase() |
| 472 | 472 | { |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | /** |
| 536 | 536 | * Validate a status code. |
| 537 | 537 | * |
| 538 | - * @param int|string $code |
|
| 538 | + * @param integer $code |
|
| 539 | 539 | * |
| 540 | 540 | * @throws InvalidArgumentException on an invalid status code. |
| 541 | 541 | */ |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $value = array($value); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if (! is_array($value) || ! $this->arrayContainsOnlyStrings($value)) { |
|
| 166 | + if (!is_array($value) || !$this->arrayContainsOnlyStrings($value)) { |
|
| 167 | 167 | throw new InvalidArgumentException( |
| 168 | 168 | 'Invalid header value; must be a string or array of strings' |
| 169 | 169 | ); |
@@ -202,13 +202,13 @@ discard block |
||
| 202 | 202 | $value = array($value); |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - if (! is_array($value) || ! $this->arrayContainsOnlyStrings($value)) { |
|
| 205 | + if (!is_array($value) || !$this->arrayContainsOnlyStrings($value)) { |
|
| 206 | 206 | throw new InvalidArgumentException( |
| 207 | 207 | 'Invalid header value; must be a string or array of strings' |
| 208 | 208 | ); |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - if (! $this->hasHeader($header)) { |
|
| 211 | + if (!$this->hasHeader($header)) { |
|
| 212 | 212 | return $this->withHeader($header, $value); |
| 213 | 213 | } |
| 214 | 214 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | public function withoutHeader($header) |
| 238 | 238 | { |
| 239 | - if (! $this->hasHeader($header)) { |
|
| 239 | + if (!$this->hasHeader($header)) { |
|
| 240 | 240 | return clone $this; |
| 241 | 241 | } |
| 242 | 242 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | public function setBody($body = 'php://memory') |
| 259 | 259 | { |
| 260 | - if (! is_string($body) && ! is_resource($body) && ! $body instanceof StreamInterface) { |
|
| 260 | + if (!is_string($body) && !is_resource($body) && !$body instanceof StreamInterface) { |
|
| 261 | 261 | throw new InvalidArgumentException( |
| 262 | 262 | 'Stream must be a string stream resource identifier, ' |
| 263 | 263 | . 'an actual stream resource, ' |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | */ |
| 483 | 483 | private function arrayContainsOnlyStrings(array $array) |
| 484 | 484 | { |
| 485 | - return array_reduce($array, array( __CLASS__, 'filterStringValue'), true); |
|
| 485 | + return array_reduce($array, array(__CLASS__, 'filterStringValue'), true); |
|
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | /** |
@@ -498,23 +498,23 @@ discard block |
||
| 498 | 498 | { |
| 499 | 499 | $headerNames = $headers = array(); |
| 500 | 500 | foreach ($originalHeaders as $header => $value) { |
| 501 | - if (! is_string($header)) { |
|
| 501 | + if (!is_string($header)) { |
|
| 502 | 502 | continue; |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - if (! is_array($value) && ! is_string($value)) { |
|
| 505 | + if (!is_array($value) && !is_string($value)) { |
|
| 506 | 506 | continue; |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | - if (! is_array($value)) { |
|
| 510 | - $value = array( $value ); |
|
| 509 | + if (!is_array($value)) { |
|
| 510 | + $value = array($value); |
|
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | $headerNames[strtolower($header)] = $header; |
| 514 | 514 | $headers[$header] = $value; |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - return array( $headerNames, $headers ); |
|
| 517 | + return array($headerNames, $headers); |
|
| 518 | 518 | } |
| 519 | 519 | |
| 520 | 520 | /** |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | */ |
| 542 | 542 | private function validateStatus($code) |
| 543 | 543 | { |
| 544 | - if (! is_numeric($code) |
|
| 544 | + if (!is_numeric($code) |
|
| 545 | 545 | || is_float($code) |
| 546 | 546 | || $code < 100 |
| 547 | 547 | || $code >= 600 |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | * |
| 93 | 93 | * After the stream has been detached, the stream is in an unusable state. |
| 94 | 94 | * |
| 95 | - * @return resource|null |
|
| 95 | + * @return resource |
|
| 96 | 96 | */ |
| 97 | 97 | public function detach() |
| 98 | 98 | { |
@@ -67,7 +67,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * This file is part of the PPI Framework. |
|
| 4 | - * |
|
| 5 | - * @copyright Copyright (c) 2011-2015 Paul Dragoonis <[email protected]> |
|
| 6 | - * @license http://opensource.org/licenses/mit-license.php MIT |
|
| 7 | - * |
|
| 8 | - * @link http://www.ppi.io |
|
| 9 | - */ |
|
| 3 | + * This file is part of the PPI Framework. |
|
| 4 | + * |
|
| 5 | + * @copyright Copyright (c) 2011-2015 Paul Dragoonis <[email protected]> |
|
| 6 | + * @license http://opensource.org/licenses/mit-license.php MIT |
|
| 7 | + * |
|
| 8 | + * @link http://www.ppi.io |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | namespace PPI\Framework\Router; |
| 12 | 12 | |
@@ -589,6 +589,7 @@ |
||
| 589 | 589 | |
| 590 | 590 | /** |
| 591 | 591 | * Parse a URI into its parts, and set the properties. |
| 592 | + * @param string $uri |
|
| 592 | 593 | */ |
| 593 | 594 | private function parseUri($uri) |
| 594 | 595 | { |
@@ -109,18 +109,18 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * This file is part of the PPI Framework. |
|
| 4 | - * |
|
| 5 | - * @copyright Copyright (c) 2011-2015 Paul Dragoonis <[email protected]> |
|
| 6 | - * @license http://opensource.org/licenses/mit-license.php MIT |
|
| 7 | - * |
|
| 8 | - * @link http://www.ppi.io |
|
| 9 | - */ |
|
| 3 | + * This file is part of the PPI Framework. |
|
| 4 | + * |
|
| 5 | + * @copyright Copyright (c) 2011-2015 Paul Dragoonis <[email protected]> |
|
| 6 | + * @license http://opensource.org/licenses/mit-license.php MIT |
|
| 7 | + * |
|
| 8 | + * @link http://www.ppi.io |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | namespace PPI\Framework\Router; |
| 12 | 12 | |
@@ -40,6 +40,9 @@ |
||
| 40 | 40 | $this->add($uri, 'post', $callback); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | + /** |
|
| 44 | + * @param string $method |
|
| 45 | + */ |
|
| 43 | 46 | public function add($uri, $method, $callback) |
| 44 | 47 | { |
| 45 | 48 | $this->routes[md5($uri . $method)] = array( |
@@ -12,10 +12,8 @@ |
||
| 12 | 12 | |
| 13 | 13 | use PPI\Framework\App as BaseApp; |
| 14 | 14 | use Symfony\Component\Routing\Matcher\UrlMatcher as UrlMatcher; |
| 15 | -use Symfony\Component\Routing\RequestContext; |
|
| 16 | 15 | use Symfony\Component\Routing\Route as Route; |
| 17 | 16 | use Symfony\Component\Routing\RouteCollection; |
| 18 | -use Symfony\Component\Routing\Router; |
|
| 19 | 17 | |
| 20 | 18 | /** |
| 21 | 19 | * The PPI MicroApp bootstrap class. |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * This file is part of the PPI Framework. |
|
| 4 | - * |
|
| 5 | - * @copyright Copyright (c) 2011-2013 Paul Dragoonis <[email protected]> |
|
| 6 | - * @license http://opensource.org/licenses/mit-license.php MIT |
|
| 7 | - * |
|
| 8 | - * @link http://www.ppi.io |
|
| 9 | - */ |
|
| 3 | + * This file is part of the PPI Framework. |
|
| 4 | + * |
|
| 5 | + * @copyright Copyright (c) 2011-2013 Paul Dragoonis <[email protected]> |
|
| 6 | + * @license http://opensource.org/licenses/mit-license.php MIT |
|
| 7 | + * |
|
| 8 | + * @link http://www.ppi.io |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | namespace PPI\Framework\View; |
| 12 | 12 | |
@@ -458,7 +458,7 @@ |
||
| 458 | 458 | * Get an option from the controller. |
| 459 | 459 | * |
| 460 | 460 | * @param string $option The option name |
| 461 | - * @param null $default The default value if the option does not exist |
|
| 461 | + * @param string $default The default value if the option does not exist |
|
| 462 | 462 | * |
| 463 | 463 | * @return mixed |
| 464 | 464 | */ |
@@ -254,34 +254,34 @@ |
||
| 254 | 254 | { |
| 255 | 255 | switch ($key = strtolower($key)) { |
| 256 | 256 | |
| 257 | - case 'ajax': |
|
| 258 | - if (!isset($this->isCache['ajax'])) { |
|
| 259 | - return $this->isCache['ajax'] = $this->getService('Request')->isXmlHttpRequest(); |
|
| 260 | - } |
|
| 261 | - |
|
| 262 | - return $this->isCache['ajax']; |
|
| 263 | - |
|
| 264 | - case 'put': |
|
| 265 | - case 'delete': |
|
| 266 | - case 'post': |
|
| 267 | - case 'patch': |
|
| 268 | - if (!isset($this->isCache['requestMethod'][$key])) { |
|
| 269 | - $this->isCache['requestMethod'][$key] = $this->getService('Request')->getMethod() === strtoupper($key); |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - return $this->isCache['requestMethod'][$key]; |
|
| 273 | - |
|
| 274 | - case 'ssl': |
|
| 275 | - case 'https': |
|
| 276 | - case 'secure': |
|
| 277 | - if (!isset($this->isCache['secure'])) { |
|
| 278 | - $this->isCache['secure'] = $this->getService('Request')->isSecure(); |
|
| 279 | - } |
|
| 280 | - |
|
| 281 | - return $this->isCache['secure']; |
|
| 282 | - |
|
| 283 | - default: |
|
| 284 | - throw new \InvalidArgumentException("Invalid 'is' key supplied: {$key}"); |
|
| 257 | + case 'ajax': |
|
| 258 | + if (!isset($this->isCache['ajax'])) { |
|
| 259 | + return $this->isCache['ajax'] = $this->getService('Request')->isXmlHttpRequest(); |
|
| 260 | + } |
|
| 261 | + |
|
| 262 | + return $this->isCache['ajax']; |
|
| 263 | + |
|
| 264 | + case 'put': |
|
| 265 | + case 'delete': |
|
| 266 | + case 'post': |
|
| 267 | + case 'patch': |
|
| 268 | + if (!isset($this->isCache['requestMethod'][$key])) { |
|
| 269 | + $this->isCache['requestMethod'][$key] = $this->getService('Request')->getMethod() === strtoupper($key); |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + return $this->isCache['requestMethod'][$key]; |
|
| 273 | + |
|
| 274 | + case 'ssl': |
|
| 275 | + case 'https': |
|
| 276 | + case 'secure': |
|
| 277 | + if (!isset($this->isCache['secure'])) { |
|
| 278 | + $this->isCache['secure'] = $this->getService('Request')->isSecure(); |
|
| 279 | + } |
|
| 280 | + |
|
| 281 | + return $this->isCache['secure']; |
|
| 282 | + |
|
| 283 | + default: |
|
| 284 | + throw new \InvalidArgumentException("Invalid 'is' key supplied: {$key}"); |
|
| 285 | 285 | |
| 286 | 286 | } |
| 287 | 287 | } |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * This file is part of the PPI Framework. |
|
| 4 | - * |
|
| 5 | - * @copyright Copyright (c) 2012 Paul Dragoonis <[email protected]> |
|
| 6 | - * @license http://opensource.org/licenses/mit-license.php MIT |
|
| 7 | - * |
|
| 8 | - * @link http://www.ppi.io |
|
| 9 | - */ |
|
| 3 | + * This file is part of the PPI Framework. |
|
| 4 | + * |
|
| 5 | + * @copyright Copyright (c) 2012 Paul Dragoonis <[email protected]> |
|
| 6 | + * @license http://opensource.org/licenses/mit-license.php MIT |
|
| 7 | + * |
|
| 8 | + * @link http://www.ppi.io |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | namespace PPI\Framework\View\Twig\Loader; |
| 12 | 12 | |
@@ -20,7 +20,6 @@ |
||
| 20 | 20 | use Zend\ModuleManager\Listener\ModuleResolverListener; |
| 21 | 21 | use Zend\ModuleManager\ModuleEvent; |
| 22 | 22 | use Zend\Stdlib\ArrayUtils; |
| 23 | -use Aura\Router\Router as AuraRouter; |
|
| 24 | 23 | |
| 25 | 24 | /** |
| 26 | 25 | * DefaultListenerAggregate class. |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * This file is part of the PPI Framework. |
|
| 4 | - * |
|
| 5 | - * @copyright Copyright (c) 2011-2015 Paul Dragoonis <[email protected]> |
|
| 6 | - * @license http://opensource.org/licenses/mit-license.php MIT |
|
| 7 | - * |
|
| 8 | - * @link http://www.ppi.io |
|
| 9 | - */ |
|
| 3 | + * This file is part of the PPI Framework. |
|
| 4 | + * |
|
| 5 | + * @copyright Copyright (c) 2011-2015 Paul Dragoonis <[email protected]> |
|
| 6 | + * @license http://opensource.org/licenses/mit-license.php MIT |
|
| 7 | + * |
|
| 8 | + * @link http://www.ppi.io |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | namespace PPI\Framework\Router; |
| 12 | 12 | |