Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Conversation

@snapshotpl
Copy link
Contributor

Something more to @samsonasik pr in #125

$header = new static($value, trim($mediaType));

if (count($parts) > 0) {
if (!empty($parts)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

space after not operator

$explode = explode('=', $param, 2);

if (count($explode) === 2) {
if (isset($explode[1])) {
Copy link
Member

Choose a reason for hiding this comment

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

Should check that key 0 exists, and key 2 doesn't.

Copy link
Member

Choose a reason for hiding this comment

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

The explode operation was given a limit of 2, so there's no chance a key 2 will ever exist.

if (strlen($a->raw) == strlen($b->raw)) {
$aLength = strlen($a->raw);
$bLength = strlen($b->raw);
if ($aLength === $bLength) {
Copy link
Member

Choose a reason for hiding this comment

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

Spaceship operator: only case where I ever suggested its usage.

Copy link
Member

Choose a reason for hiding this comment

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

Can't use it here; this component still supports PHP 5.6.


if (count($parts) > 0) {
if (! empty($parts)) {
$parameters = [];
Copy link
Member

Choose a reason for hiding this comment

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

empty() not needed: the ! is sufficient

foreach ($nvPairs as $nvPair) {
$parts = explode('=', $nvPair, 2);
if (count($parts) != 2) {
if (! isset($parts[1])) {
Copy link
Member

Choose a reason for hiding this comment

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

Should check for key 2. Test needed

Copy link
Member

Choose a reason for hiding this comment

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

Never mind, explode is limited to 2 elements

} elseif ($value instanceof Header\HeaderInterface) {
continue;
}
if (is_array($value)) {
Copy link
Member

Choose a reason for hiding this comment

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

Move contents of this block to a private method

if (empty($this->content)) {
$requestBody = file_get_contents('php://input');
if (strlen($requestBody) > 0) {
if (! empty($requestBody)) {
Copy link
Member

Choose a reason for hiding this comment

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

empty() not needed: ! is sufficient

Copy link
Contributor

Choose a reason for hiding this comment

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

for bool comparison usage, with if ($requestBody) { should be enough

@weierophinney
Copy link
Member

Closing, as the author has not incorporated any of the requested changes.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants