Skip to content

Version 3.0#2

Merged
chadicus merged 22 commits intotraderinteractive:masterfrom
hotline-emu:imp/de-trader
Mar 5, 2018
Merged

Version 3.0#2
chadicus merged 22 commits intotraderinteractive:masterfrom
hotline-emu:imp/de-trader

Conversation

@hotline-emu
Copy link
Contributor

@hotline-emu hotline-emu commented Mar 1, 2018

  • Update LICENSE file
  • Change package owner to traderinteractive
  • Change Namespace to TraderInteractive
  • Add .github files CODEOWNERS, PULL_REQUEST_TEMPLATE, ISSUE_TEMPLATE & CONTRIBUTING
  • Remove support for PHP < 7
  • Switch to PSR2 coding standard
  • Update README
  • Remove composer.lock from version control
  • Update Scrutinizer config
  • Update Coveralls config
  • Update to PHPUnit 6
  • Switch to phpunit.xml.dist config
  • Add parameter and return type hints where possible

@hotline-emu hotline-emu closed this Mar 2, 2018
@hotline-emu hotline-emu deleted the imp/de-trader branch March 2, 2018 13:56
@hotline-emu hotline-emu restored the imp/de-trader branch March 2, 2018 13:56
@hotline-emu hotline-emu reopened this Mar 2, 2018
Copy link
Contributor

@chadicus chadicus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you forgot to change the namespace.
There is also a few issues with exceptions (see comments)
Also look at the README.md in a browser. Makes sure everything makes sense.

@@ -15,23 +15,19 @@ util-http-php requires PHP 5.4 (or later).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now requires php 7.0

README.md Outdated
```sh
composer require traderinteractive/util-http
```
##Documentation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you removed the build.php so the comment below is now invalid

) {
if (!is_string($message)) {
throw new \InvalidArgumentException('$message was not a string');
throw new InvalidArgumentException('$message was not a string');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're using type hints, these exceptions will never be thrown

{
if (!is_string($rawHeaders) || trim($rawHeaders) === '') {
throw new \InvalidArgumentException('$rawHeaders was not a string');
throw new InvalidArgumentException('$rawHeaders was not a string');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with type hints, the is_string check is not needed.

return $headers;
}

private static function setRequest($match, array $headers) : array
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type hint match

return $headers;
}

private static function setResponse($match, array $headers) : array
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type hint match

@hotline-emu hotline-emu changed the title Imp/de trader Version 3.0 Mar 2, 2018
* @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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these are no longer thrown

throw new \InvalidArgumentException('$code was not an int');
}

if ($userMessage !== null && !is_string($userMessage)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will never be true, b/c of type hinting

return $headers;
}

private static function setRequest(array $match, array $headers) : array
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider a better name for both setRequest and setResponse.

public static function getQueryParamsCollapsed($url, array $expectedArrayParams = [])
public static function getQueryParamsCollapsed(string $url, array $expectedArrayParams = []) : array
{
if (!is_string($url)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will never be true due to type hinting

Copy link
Contributor

@chadicus chadicus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You still need to update the namespace of the library

composer.json Outdated
"squizlabs/php_codesniffer": "^3.2"
},
"autoload": {
"psr-4": { "DominionEnterprises\\": "src" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to update the namespace

* Defines the \DominionEnterprises\HttpException class.
*/

namespace DominionEnterprises;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespace

* Defines the \DominionEnterprises\Util\Http class.
*/

namespace DominionEnterprises\Util;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

namespace

public static function parseHeaders($rawHeaders)
public static function parseHeaders(string $rawHeaders) : array
{
if (!is_string($rawHeaders) || trim($rawHeaders) === '') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should probably keep the trim($rawheaders) check

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@chadicus chadicus merged commit d3bba26 into traderinteractive:master Mar 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants