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

Conversation

@samsonasik
Copy link
Contributor

  • Is this related to quality assurance?

}

$this->getHeaders()->addHeaders($headers);
$headers = $this->getHeaders()->addHeaders($headers);
Copy link
Member

Choose a reason for hiding this comment

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

Personally I am not sure if it is good improvement, I mean, for me it is less readable - as definition of the variable and usage of it is several lines below.
Also it takes advantages of fluent interfaces, and as far as I know we tend to drop them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I reverted the change of re-assignment headers.

// Set the host
if ($this->getHeaders()->get('host')) {
$host = $this->getHeaders()->get('host')->getFieldValue();
if ($headers->get('host')) {
Copy link
Member

Choose a reason for hiding this comment

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

We have then twice ->get('host').
What about:

$headerHost = $this->getHeaders()->get('host');
if ($headerHost) {
    $host = $headerHost->getFieldValue();
    ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, implemented assign first to $headerHost

@michalbundyra michalbundyra added this to the 2.10.1 milestone Sep 26, 2019
@michalbundyra
Copy link
Member

Thanks, @samsonasik!

michalbundyra added a commit that referenced this pull request Sep 26, 2019
reduce getHeaders() call in Request::setServer()
michalbundyra added a commit that referenced this pull request Sep 26, 2019
@michalbundyra michalbundyra merged commit ac77601 into zendframework:master Sep 26, 2019
@samsonasik samsonasik deleted the reduce-get-headers-cal branch September 26, 2019 09:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants