@@ -2,10 +2,10 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace spec\Subreality\Dilmun\Anshar\Http; |
| 4 | 4 | |
| 5 | +use PhpSpec\ObjectBehavior; |
|
| 5 | 6 | use Psr\Http\Message\StreamInterface; |
| 6 | 7 | use Psr\Http\Message\UriInterface; |
| 7 | 8 | use Subreality\Dilmun\Anshar\Http\Request; |
| 8 | -use PhpSpec\ObjectBehavior; |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Class RequestSpec |
@@ -455,7 +455,7 @@ |
||
| 455 | 455 | * @param \PhpSpec\Wrapper\Collaborator|StreamInterface $new_body |
| 456 | 456 | */ |
| 457 | 457 | function it_retains_its_body_when_returning_a_new_request_with_a_body(StreamInterface $old_body, |
| 458 | - StreamInterface $new_body) |
|
| 458 | + StreamInterface $new_body) |
|
| 459 | 459 | { |
| 460 | 460 | $old_body->getContents()->willReturn("I'm the original stream!"); |
| 461 | 461 | $new_body->getContents()->willReturn("I'm the new stream!"); |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | |
| 703 | 703 | $uri->getHost()->willReturn($host); |
| 704 | 704 | |
| 705 | - $empty_host = $this->withHeader("host",""); |
|
| 705 | + $empty_host = $this->withHeader("host", ""); |
|
| 706 | 706 | |
| 707 | 707 | $request = $empty_host->withUri($uri, true); |
| 708 | 708 | |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | { |
| 724 | 724 | $uri->getHost()->willReturn(null); |
| 725 | 725 | |
| 726 | - $empty_host = $this->withHeader("host",""); |
|
| 726 | + $empty_host = $this->withHeader("host", ""); |
|
| 727 | 727 | |
| 728 | 728 | $request = $empty_host->withUri($uri); |
| 729 | 729 | |
@@ -1,9 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace spec\Subreality\Dilmun\Anshar\Http; |
| 3 | 3 | |
| 4 | -use Subreality\Dilmun\Anshar\Http\Uri; |
|
| 5 | 4 | use PhpSpec\ObjectBehavior; |
| 6 | -use Prophecy\Argument; |
|
| 5 | +use Subreality\Dilmun\Anshar\Http\Uri; |
|
| 7 | 6 | |
| 8 | 7 | class UriSpec extends ObjectBehavior |
| 9 | 8 | { |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | * Checks if a header exists by the given case-insensitive name. |
| 107 | 107 | * |
| 108 | 108 | * @param string $name Case-insensitive header field name. |
| 109 | - * @return bool Returns true if any header names match the given header |
|
| 109 | + * @return boolean|null Returns true if any header names match the given header |
|
| 110 | 110 | * name using a case-insensitive string comparison. Returns false if |
| 111 | 111 | * no matching header name is found in the message. |
| 112 | 112 | */ |
@@ -397,6 +397,9 @@ |
||
| 397 | 397 | // TODO: Implement __toString() method. |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | + /** |
|
| 401 | + * @param string $uri |
|
| 402 | + */ |
|
| 400 | 403 | private function explodeUri($uri) |
| 401 | 404 | { |
| 402 | 405 | echo $uri . "\n"; |
@@ -399,24 +399,24 @@ discard block |
||
| 399 | 399 | |
| 400 | 400 | private function explodeUri($uri) |
| 401 | 401 | { |
| 402 | - echo $uri . "\n"; |
|
| 402 | + echo $uri."\n"; |
|
| 403 | 403 | |
| 404 | 404 | $uri_parts = array(); |
| 405 | 405 | |
| 406 | 406 | $reg_start = '/^'; |
| 407 | - $scheme_part = '(.+?)'; //Adding '?' makes it lazy since a URI may contain several colons |
|
| 407 | + $scheme_part = '(.+?)'; //Adding '?' makes it lazy since a URI may contain several colons |
|
| 408 | 408 | $scheme_separator = ':'; |
| 409 | 409 | $hier_part = '(.+)'; |
| 410 | 410 | $query_part = '\?'; |
| 411 | 411 | $query_separator = '#'; |
| 412 | 412 | $reg_end = '/'; |
| 413 | 413 | |
| 414 | - $uri_syntax = $reg_start . |
|
| 415 | - $scheme_part . |
|
| 416 | - $scheme_separator . |
|
| 414 | + $uri_syntax = $reg_start. |
|
| 415 | + $scheme_part. |
|
| 416 | + $scheme_separator. |
|
| 417 | 417 | $reg_end; |
| 418 | 418 | |
| 419 | - echo $uri_syntax . "\n"; |
|
| 419 | + echo $uri_syntax."\n"; |
|
| 420 | 420 | |
| 421 | 421 | $uri_valid = preg_match($uri_syntax, $uri, $parts); |
| 422 | 422 | |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | $uri_parts["scheme"] = ""; |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | - echo $uri_parts["scheme"] . "\n"; |
|
| 429 | + echo $uri_parts["scheme"]."\n"; |
|
| 430 | 430 | |
| 431 | 431 | return $uri_parts; |
| 432 | 432 | } |