Conversation
| @@ -15,23 +15,19 @@ util-http-php requires PHP 5.4 (or later). | |||
|
|
|||
README.md
Outdated
| ```sh | ||
| composer require traderinteractive/util-http | ||
| ``` | ||
| ##Documentation |
There was a problem hiding this comment.
Can you fix these headers? Add a space between the ## and the title
| * [Issues](https://github.com/traderinteractive/util-http-php/issues) | ||
|
|
||
| ##Project Build | ||
| With a checkout of the code get [Composer](http://getcomposer.org) in your PATH and run: |
There was a problem hiding this comment.
you removed the build.php so the comment below is now invalid
src/HttpException.php
Outdated
| ) { | ||
| if (!is_string($message)) { | ||
| throw new \InvalidArgumentException('$message was not a string'); | ||
| throw new InvalidArgumentException('$message was not a string'); |
There was a problem hiding this comment.
Since you're using type hints, these exceptions will never be thrown
src/Util/Http.php
Outdated
| { | ||
| if (!is_string($rawHeaders) || trim($rawHeaders) === '') { | ||
| throw new \InvalidArgumentException('$rawHeaders was not a string'); | ||
| throw new InvalidArgumentException('$rawHeaders was not a string'); |
There was a problem hiding this comment.
with type hints, the is_string check is not needed.
src/Util/Http.php
Outdated
| return $headers; | ||
| } | ||
|
|
||
| private static function setRequest($match, array $headers) : array |
src/Util/Http.php
Outdated
| return $headers; | ||
| } | ||
|
|
||
| private static function setResponse($match, array $headers) : array |
src/HttpException.php
Outdated
| * @throws \InvalidArgumentException if $httpStatusCode is not an int | ||
| * @throws \InvalidArgumentException if $code is not an int | ||
| * @throws \InvalidArgumentException if $userMmessage is not null and is not a string | ||
| * @throws InvalidArgumentException if $message is not a string |
There was a problem hiding this comment.
Most of these are no longer thrown
src/HttpException.php
Outdated
| throw new \InvalidArgumentException('$code was not an int'); | ||
| } | ||
|
|
||
| if ($userMessage !== null && !is_string($userMessage)) { |
There was a problem hiding this comment.
this will never be true, b/c of type hinting
src/Util/Http.php
Outdated
| return $headers; | ||
| } | ||
|
|
||
| private static function setRequest(array $match, array $headers) : array |
There was a problem hiding this comment.
consider a better name for both setRequest and setResponse.
src/Util/Http.php
Outdated
| public static function getQueryParamsCollapsed($url, array $expectedArrayParams = []) | ||
| public static function getQueryParamsCollapsed(string $url, array $expectedArrayParams = []) : array | ||
| { | ||
| if (!is_string($url)) { |
There was a problem hiding this comment.
This will never be true due to type hinting
chadicus
left a comment
There was a problem hiding this comment.
You still need to update the namespace of the library
composer.json
Outdated
| "squizlabs/php_codesniffer": "^3.2" | ||
| }, | ||
| "autoload": { | ||
| "psr-4": { "DominionEnterprises\\": "src" } |
There was a problem hiding this comment.
Need to update the namespace
src/HttpException.php
Outdated
| * Defines the \DominionEnterprises\HttpException class. | ||
| */ | ||
|
|
||
| namespace DominionEnterprises; |
src/Util/Http.php
Outdated
| * Defines the \DominionEnterprises\Util\Http class. | ||
| */ | ||
|
|
||
| namespace DominionEnterprises\Util; |
| public static function parseHeaders($rawHeaders) | ||
| public static function parseHeaders(string $rawHeaders) : array | ||
| { | ||
| if (!is_string($rawHeaders) || trim($rawHeaders) === '') { |
There was a problem hiding this comment.
you should probably keep the trim($rawheaders) check
19f5aaf to
7c90640
Compare
traderinteractiveTraderInteractive