Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ErrorCatcher with RFC7231 accept header process #149 #151

Merged
merged 7 commits into from Nov 14, 2019

Conversation

@kamarton
Copy link
Contributor

kamarton commented Nov 11, 2019

Q A
Is bugfix?
New feature? ✔️
Breaks BC?
Tests pass? ✔️
Fixed issues #149
Somogyi Márton added 2 commits Nov 11, 2019
Somogyi Márton
src/Helper/HeaderHelper.php Outdated Show resolved Hide resolved
src/Helper/HeaderHelper.php Outdated Show resolved Hide resolved
src/Helper/HeaderHelper.php Outdated Show resolved Hide resolved
src/Helper/HeaderHelper.php Outdated Show resolved Hide resolved
}
/**
* @param $values string|string[]|RequestInterface $values Header value as a comma-separated string

This comment has been minimized.

Copy link
@samdark

samdark Nov 11, 2019

Member

It is better to have at least a separate method that works with RequestInterface. Having too many types in a single parameter adds to overall method complexity including its usage.

This comment has been minimized.

Copy link
@kamarton

kamarton Nov 14, 2019

Author Contributor

How about using only RequestInterface as input?
I don't know if anyone wants to use this for a non-standard Accept header.

src/Helper/HeaderHelper.php Outdated Show resolved Hide resolved
@@ -99,7 +100,7 @@ private function getRenderer(string $contentType): ?ThrowableRendererInterface
private function getContentType(ServerRequestInterface $request): string
{
$acceptHeaders = preg_split('~\s*,\s*~', $request->getHeaderLine('Accept'), PREG_SPLIT_NO_EMPTY);
$acceptHeaders = HeaderHelper::getSortedAcceptTypes($request);

This comment has been minimized.

Copy link
@samdark

samdark Nov 11, 2019

Member

It is the only usage of the helper so far. What do you think about making some of the methods of the helper private?

This comment has been minimized.

Copy link
@kamarton

kamarton Nov 12, 2019

Author Contributor

It may be problematic in terms of testability.

This comment has been minimized.

Copy link
@samdark

samdark Nov 12, 2019

Member

Why? Tests should reflect usage overall.

This comment has been minimized.

Copy link
@kamarton

kamarton Nov 14, 2019

Author Contributor

Why? Tests should reflect usage overall.

This is true. The problem is that e.g. testing the A and B functions that are built into the C function is usually tested with fewer tests than the A, B, and C functions are tested separately. Obviously this is wrong, but usually it will be the result.

kamarton and others added 2 commits Nov 12, 2019
Co-Authored-By: Alexander Makarov <sam@rmcreative.ru>
Somogyi Márton
* @see getValueAndParameters
* @link https://developer.mozilla.org/en-US/docs/Glossary/Quality_values
*/
public static function getByQFactorSortedList($values): array

This comment has been minimized.

Copy link
@samdark

samdark Nov 12, 2019

Member

getValuesListSortedByQFactor?

This comment has been minimized.

Copy link
@kamarton

kamarton Nov 14, 2019

Author Contributor

getSortedValueAndParameters

No other sorting method found. What I have found is all sorted by q factor, so it's unnecessary to name q factor in the method name.

Somogyi Márton and others added 3 commits Nov 14, 2019
@samdark samdark self-requested a review Nov 14, 2019
@samdark samdark merged commit d19f66f into yiisoft:master Nov 14, 2019
3 checks passed
3 checks passed
Scrutinizer 1 new issues, 17 updated code elements
Details
continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@samdark

This comment has been minimized.

Copy link
Member

samdark commented Nov 14, 2019

Merged. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.