Zend\Diactoros\MessageTrait::getHeader PHP Method

getHeader() public method

This method returns an array of all the header values of the given case-insensitive header name. If the header does not appear in the message, this method MUST return an empty array.
public getHeader ( string $header ) : string[]
$header string Case-insensitive header field name.
return string[] An array of string values as provided for the given header. If the header does not appear in the message, this method MUST return an empty array.
    public function getHeader($header)
    {
        if (!$this->hasHeader($header)) {
            return [];
        }
        $header = $this->headerNames[strtolower($header)];
        $value = $this->headers[$header];
        $value = is_array($value) ? $value : [$value];
        return $value;
    }