@@ -28,6 +28,10 @@ |
||
| 28 | 28 | protected $catch = false; |
| 29 | 29 | protected $backendRequest; |
| 30 | 30 | |
| 31 | + /** |
|
| 32 | + * @param string $body |
|
| 33 | + * @param integer $status |
|
| 34 | + */ |
|
| 31 | 35 | public function __construct($body, $status, $headers, \Closure $customizer = null) |
| 32 | 36 | { |
| 33 | 37 | $this->body = $body; |
@@ -260,6 +260,9 @@ |
||
| 260 | 260 | $kernel->handle($request, HttpKernelInterface::MASTER_REQUEST); |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | + /** |
|
| 264 | + * @return \Symfony\Component\HttpKernel\Controller\ControllerResolverInterface |
|
| 265 | + */ |
|
| 263 | 266 | protected function getResolver($controller = null) |
| 264 | 267 | { |
| 265 | 268 | if (null === $controller) { |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrue() |
| 30 | 30 | { |
| 31 | - $kernel = new HttpKernel(new EventDispatcher(), $this->getResolver(function () { throw new \RuntimeException(); })); |
|
| 31 | + $kernel = new HttpKernel(new EventDispatcher(), $this->getResolver(function() { throw new \RuntimeException(); })); |
|
| 32 | 32 | |
| 33 | 33 | $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true); |
| 34 | 34 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function testHandleWhenControllerThrowsAnExceptionAndCatchIsFalseAndNoListenerIsRegistered() |
| 40 | 40 | { |
| 41 | - $kernel = new HttpKernel(new EventDispatcher(), $this->getResolver(function () { throw new \RuntimeException(); })); |
|
| 41 | + $kernel = new HttpKernel(new EventDispatcher(), $this->getResolver(function() { throw new \RuntimeException(); })); |
|
| 42 | 42 | |
| 43 | 43 | $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, false); |
| 44 | 44 | } |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | public function testHandleWhenControllerThrowsAnExceptionAndCatchIsTrueWithAHandlingListener() |
| 47 | 47 | { |
| 48 | 48 | $dispatcher = new EventDispatcher(); |
| 49 | - $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) { |
|
| 49 | + $dispatcher->addListener(KernelEvents::EXCEPTION, function($event) { |
|
| 50 | 50 | $event->setResponse(new Response($event->getException()->getMessage())); |
| 51 | 51 | }); |
| 52 | 52 | |
| 53 | - $kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new \RuntimeException('foo'); })); |
|
| 53 | + $kernel = new HttpKernel($dispatcher, $this->getResolver(function() { throw new \RuntimeException('foo'); })); |
|
| 54 | 54 | $response = $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true); |
| 55 | 55 | |
| 56 | 56 | $this->assertEquals('500', $response->getStatusCode()); |
@@ -62,11 +62,11 @@ discard block |
||
| 62 | 62 | $exception = new \RuntimeException(); |
| 63 | 63 | |
| 64 | 64 | $dispatcher = new EventDispatcher(); |
| 65 | - $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) { |
|
| 65 | + $dispatcher->addListener(KernelEvents::EXCEPTION, function($event) { |
|
| 66 | 66 | // should set a response, but does not |
| 67 | 67 | }); |
| 68 | 68 | |
| 69 | - $kernel = new HttpKernel($dispatcher, $this->getResolver(function () use ($exception) { throw $exception; })); |
|
| 69 | + $kernel = new HttpKernel($dispatcher, $this->getResolver(function() use ($exception) { throw $exception; })); |
|
| 70 | 70 | |
| 71 | 71 | try { |
| 72 | 72 | $kernel->handle(new Request(), HttpKernelInterface::MASTER_REQUEST, true); |
@@ -79,11 +79,11 @@ discard block |
||
| 79 | 79 | public function testHandleExceptionWithARedirectionResponse() |
| 80 | 80 | { |
| 81 | 81 | $dispatcher = new EventDispatcher(); |
| 82 | - $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) { |
|
| 82 | + $dispatcher->addListener(KernelEvents::EXCEPTION, function($event) { |
|
| 83 | 83 | $event->setResponse(new RedirectResponse('/login', 301)); |
| 84 | 84 | }); |
| 85 | 85 | |
| 86 | - $kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new AccessDeniedHttpException(); })); |
|
| 86 | + $kernel = new HttpKernel($dispatcher, $this->getResolver(function() { throw new AccessDeniedHttpException(); })); |
|
| 87 | 87 | $response = $kernel->handle(new Request()); |
| 88 | 88 | |
| 89 | 89 | $this->assertEquals('301', $response->getStatusCode()); |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | public function testHandleHttpException() |
| 94 | 94 | { |
| 95 | 95 | $dispatcher = new EventDispatcher(); |
| 96 | - $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) { |
|
| 96 | + $dispatcher->addListener(KernelEvents::EXCEPTION, function($event) { |
|
| 97 | 97 | $event->setResponse(new Response($event->getException()->getMessage())); |
| 98 | 98 | }); |
| 99 | 99 | |
| 100 | - $kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new MethodNotAllowedHttpException(array('POST')); })); |
|
| 100 | + $kernel = new HttpKernel($dispatcher, $this->getResolver(function() { throw new MethodNotAllowedHttpException(array('POST')); })); |
|
| 101 | 101 | $response = $kernel->handle(new Request()); |
| 102 | 102 | |
| 103 | 103 | $this->assertEquals('405', $response->getStatusCode()); |
@@ -110,11 +110,11 @@ discard block |
||
| 110 | 110 | public function testHandleWhenAnExceptionIsHandledWithASpecificStatusCode($responseStatusCode, $expectedStatusCode) |
| 111 | 111 | { |
| 112 | 112 | $dispatcher = new EventDispatcher(); |
| 113 | - $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) use ($responseStatusCode, $expectedStatusCode) { |
|
| 113 | + $dispatcher->addListener(KernelEvents::EXCEPTION, function($event) use ($responseStatusCode, $expectedStatusCode) { |
|
| 114 | 114 | $event->setResponse(new Response('', $responseStatusCode, array('X-Status-Code' => $expectedStatusCode))); |
| 115 | 115 | }); |
| 116 | 116 | |
| 117 | - $kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new \RuntimeException(); })); |
|
| 117 | + $kernel = new HttpKernel($dispatcher, $this->getResolver(function() { throw new \RuntimeException(); })); |
|
| 118 | 118 | $response = $kernel->handle(new Request()); |
| 119 | 119 | |
| 120 | 120 | $this->assertEquals($expectedStatusCode, $response->getStatusCode()); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | public function testHandleWhenAListenerReturnsAResponse() |
| 135 | 135 | { |
| 136 | 136 | $dispatcher = new EventDispatcher(); |
| 137 | - $dispatcher->addListener(KernelEvents::REQUEST, function ($event) { |
|
| 137 | + $dispatcher->addListener(KernelEvents::REQUEST, function($event) { |
|
| 138 | 138 | $event->setResponse(new Response('hello')); |
| 139 | 139 | }); |
| 140 | 140 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | { |
| 159 | 159 | $response = new Response('foo'); |
| 160 | 160 | $dispatcher = new EventDispatcher(); |
| 161 | - $kernel = new HttpKernel($dispatcher, $this->getResolver(function () use ($response) { return $response; })); |
|
| 161 | + $kernel = new HttpKernel($dispatcher, $this->getResolver(function() use ($response) { return $response; })); |
|
| 162 | 162 | |
| 163 | 163 | $this->assertSame($response, $kernel->handle(new Request())); |
| 164 | 164 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | public function testHandleWhenTheControllerDoesNotReturnAResponse() |
| 202 | 202 | { |
| 203 | 203 | $dispatcher = new EventDispatcher(); |
| 204 | - $kernel = new HttpKernel($dispatcher, $this->getResolver(function () { return 'foo'; })); |
|
| 204 | + $kernel = new HttpKernel($dispatcher, $this->getResolver(function() { return 'foo'; })); |
|
| 205 | 205 | |
| 206 | 206 | $kernel->handle(new Request()); |
| 207 | 207 | } |
@@ -209,10 +209,10 @@ discard block |
||
| 209 | 209 | public function testHandleWhenTheControllerDoesNotReturnAResponseButAViewIsRegistered() |
| 210 | 210 | { |
| 211 | 211 | $dispatcher = new EventDispatcher(); |
| 212 | - $dispatcher->addListener(KernelEvents::VIEW, function ($event) { |
|
| 212 | + $dispatcher->addListener(KernelEvents::VIEW, function($event) { |
|
| 213 | 213 | $event->setResponse(new Response($event->getControllerResult())); |
| 214 | 214 | }); |
| 215 | - $kernel = new HttpKernel($dispatcher, $this->getResolver(function () { return 'foo'; })); |
|
| 215 | + $kernel = new HttpKernel($dispatcher, $this->getResolver(function() { return 'foo'; })); |
|
| 216 | 216 | |
| 217 | 217 | $this->assertEquals('foo', $kernel->handle(new Request())->getContent()); |
| 218 | 218 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | public function testHandleWithAResponseListener() |
| 221 | 221 | { |
| 222 | 222 | $dispatcher = new EventDispatcher(); |
| 223 | - $dispatcher->addListener(KernelEvents::RESPONSE, function ($event) { |
|
| 223 | + $dispatcher->addListener(KernelEvents::RESPONSE, function($event) { |
|
| 224 | 224 | $event->setResponse(new Response('foo')); |
| 225 | 225 | }); |
| 226 | 226 | $kernel = new HttpKernel($dispatcher, $this->getResolver()); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | { |
| 233 | 233 | $dispatcher = new EventDispatcher(); |
| 234 | 234 | $kernel = new HttpKernel($dispatcher, $this->getResolver()); |
| 235 | - $dispatcher->addListener(KernelEvents::TERMINATE, function ($event) use (&$called, &$capturedKernel, &$capturedRequest, &$capturedResponse) { |
|
| 235 | + $dispatcher->addListener(KernelEvents::TERMINATE, function($event) use (&$called, &$capturedKernel, &$capturedRequest, &$capturedResponse) { |
|
| 236 | 236 | $called = true; |
| 237 | 237 | $capturedKernel = $event->getKernel(); |
| 238 | 238 | $capturedRequest = $event->getRequest(); |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | protected function getResolver($controller = null) |
| 264 | 264 | { |
| 265 | 265 | if (null === $controller) { |
| 266 | - $controller = function () { return new Response('Hello'); }; |
|
| 266 | + $controller = function() { return new Response('Hello'); }; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | $resolver = $this->getMock('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface'); |
@@ -725,6 +725,10 @@ discard block |
||
| 725 | 725 | /** |
| 726 | 726 | * Returns a mock for the BundleInterface. |
| 727 | 727 | * |
| 728 | + * @param string $dir |
|
| 729 | + * @param string $parent |
|
| 730 | + * @param string $className |
|
| 731 | + * @param string $bundleName |
|
| 728 | 732 | * @return BundleInterface |
| 729 | 733 | */ |
| 730 | 734 | protected function getBundle($dir = null, $parent = null, $className = null, $bundleName = null) |
@@ -768,7 +772,7 @@ discard block |
||
| 768 | 772 | * @param array $methods Additional methods to mock (besides the abstract ones) |
| 769 | 773 | * @param array $bundles Bundles to register |
| 770 | 774 | * |
| 771 | - * @return Kernel |
|
| 775 | + * @return \PHPUnit_Framework_MockObject_MockObject |
|
| 772 | 776 | */ |
| 773 | 777 | protected function getKernel(array $methods = array(), array $bundles = array()) |
| 774 | 778 | { |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | |
| 425 | 425 | $this->assertEquals(array( |
| 426 | 426 | __DIR__.'/Fixtures/Bundle2Bundle/foo.txt', |
| 427 | - __DIR__.'/Fixtures/Bundle1Bundle/foo.txt', ), |
|
| 427 | + __DIR__.'/Fixtures/Bundle1Bundle/foo.txt',), |
|
| 428 | 428 | $kernel->locateResource('@Bundle1Bundle/foo.txt', null, false)); |
| 429 | 429 | } |
| 430 | 430 | |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | |
| 488 | 488 | $this->assertEquals(array( |
| 489 | 489 | __DIR__.'/Fixtures/Resources/Bundle1Bundle/foo.txt', |
| 490 | - __DIR__.'/Fixtures/Bundle1Bundle/Resources/foo.txt', ), |
|
| 490 | + __DIR__.'/Fixtures/Bundle1Bundle/Resources/foo.txt',), |
|
| 491 | 491 | $kernel->locateResource('@Bundle1Bundle/Resources/foo.txt', __DIR__.'/Fixtures/Resources', false) |
| 492 | 492 | ); |
| 493 | 493 | } |
@@ -84,6 +84,9 @@ |
||
| 84 | 84 | return $this->computeHash($this->buildUrl($url, $params)) === $hash; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | + /** |
|
| 88 | + * @param string $uri |
|
| 89 | + */ |
|
| 87 | 90 | private function computeHash($uri) |
| 88 | 91 | { |
| 89 | 92 | return urlencode(base64_encode(hash_hmac('sha256', $uri, $this->secret, true))); |
@@ -98,7 +98,7 @@ |
||
| 98 | 98 | $host = isset($url['host']) ? $url['host'] : ''; |
| 99 | 99 | $port = isset($url['port']) ? ':'.$url['port'] : ''; |
| 100 | 100 | $user = isset($url['user']) ? $url['user'] : ''; |
| 101 | - $pass = isset($url['pass']) ? ':'.$url['pass'] : ''; |
|
| 101 | + $pass = isset($url['pass']) ? ':'.$url['pass'] : ''; |
|
| 102 | 102 | $pass = ($user || $pass) ? "$pass@" : ''; |
| 103 | 103 | $path = isset($url['path']) ? $url['path'] : ''; |
| 104 | 104 | $query = isset($url['query']) && $url['query'] ? '?'.$url['query'] : ''; |
@@ -267,6 +267,9 @@ discard block |
||
| 267 | 267 | return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var); |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | + /** |
|
| 271 | + * @return string |
|
| 272 | + */ |
|
| 270 | 273 | public static function mb_detect_encoding($str, $encodingList = null, $strict = false) |
| 271 | 274 | { |
| 272 | 275 | if (null === $encodingList) { |
@@ -528,6 +531,9 @@ discard block |
||
| 528 | 531 | return $contents; |
| 529 | 532 | } |
| 530 | 533 | |
| 534 | + /** |
|
| 535 | + * @param boolean $part |
|
| 536 | + */ |
|
| 531 | 537 | private static function getSubpart($pos, $part, $haystack, $encoding) |
| 532 | 538 | { |
| 533 | 539 | if (false === $pos) { |
@@ -575,6 +581,9 @@ discard block |
||
| 575 | 581 | return self::mb_convert_case($s[0], MB_CASE_UPPER, 'UTF-8'); |
| 576 | 582 | } |
| 577 | 583 | |
| 584 | + /** |
|
| 585 | + * @param string $file |
|
| 586 | + */ |
|
| 578 | 587 | private static function getData($file) |
| 579 | 588 | { |
| 580 | 589 | if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.ser')) { |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | private static $language = 'neutral'; |
| 69 | 69 | private static $internalEncoding = 'UTF-8'; |
| 70 | 70 | private static $caseFold = array( |
| 71 | - array('µ','ſ',"\xCD\x85",'ς',"\xCF\x90","\xCF\x91","\xCF\x95","\xCF\x96","\xCF\xB0","\xCF\xB1","\xCF\xB5","\xE1\xBA\x9B","\xE1\xBE\xBE"), |
|
| 72 | - array('μ','s','ι', 'σ','β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1",'ι'), |
|
| 71 | + array('µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"), |
|
| 72 | + array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'), |
|
| 73 | 73 | ); |
| 74 | 74 | |
| 75 | 75 | public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null) |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $vars = array(&$a, &$b, &$c, &$d, &$e, &$f); |
| 116 | 116 | |
| 117 | 117 | $ok = true; |
| 118 | - array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) { |
|
| 118 | + array_walk_recursive($vars, function(&$v) use (&$ok, $toEncoding, $fromEncoding) { |
|
| 119 | 119 | if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) { |
| 120 | 120 | $ok = false; |
| 121 | 121 | } |
@@ -38,6 +38,9 @@ |
||
| 38 | 38 | /** @var bool */ |
| 39 | 39 | private $disableOutput; |
| 40 | 40 | |
| 41 | + /** |
|
| 42 | + * @param boolean $disableOutput |
|
| 43 | + */ |
|
| 41 | 44 | public function __construct($disableOutput, $input) |
| 42 | 45 | { |
| 43 | 46 | $this->disableOutput = (bool) $disableOutput; |
@@ -28,6 +28,9 @@ discard block |
||
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | + /** |
|
| 32 | + * @param string $path |
|
| 33 | + */ |
|
| 31 | 34 | private function setPath($path) |
| 32 | 35 | { |
| 33 | 36 | $this->path = getenv('PATH'); |
@@ -116,6 +119,10 @@ discard block |
||
| 116 | 119 | $this->assertSamePath(PHP_BINARY, $result); |
| 117 | 120 | } |
| 118 | 121 | |
| 122 | + /** |
|
| 123 | + * @param string $expected |
|
| 124 | + * @param string $tested |
|
| 125 | + */ |
|
| 119 | 126 | private function assertSamePath($expected, $tested) |
| 120 | 127 | { |
| 121 | 128 | if ('\\' === DIRECTORY_SEPARATOR) { |
@@ -140,6 +140,8 @@ |
||
| 140 | 140 | * @throws MissingMandatoryParametersException When some parameters are missing that are mandatory for the route |
| 141 | 141 | * @throws InvalidParameterException When a parameter value for a placeholder is not correct because |
| 142 | 142 | * it does not match the requirement |
| 143 | + * @param string $name |
|
| 144 | + * @param integer $referenceType |
|
| 143 | 145 | */ |
| 144 | 146 | protected function doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, array $requiredSchemes = array()) |
| 145 | 147 | { |
@@ -256,6 +256,9 @@ |
||
| 256 | 256 | return $globals; |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | + /** |
|
| 260 | + * @param string $path |
|
| 261 | + */ |
|
| 259 | 262 | protected function createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition) |
| 260 | 263 | { |
| 261 | 264 | return new Route($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition); |