Ergo\Http\HeaderCollection::values PHP Method

values() public method

Gets an array of the values for a header
public values ( $name ) : array
return array
    function values($name)
    {
        $normalizer = new HeaderCaseNormalizer();
        $name = $normalizer->normalize($name);
        $values = array();
        foreach ($this->_headers as $header) {
            if ($header->getName() == $name) {
                $values[] = $header->getValue();
            }
        }
        return $values;
    }

Usage Example

Example #1
0
 public function testSimpleUsage()
 {
     $collection = new Http\HeaderCollection();
     $collection->add('Content-Length: 9');
     $this->assertEquals($collection->values('Content-Length'), array('9'));
     $this->assertEquals($collection->value('Content-Length'), '9');
     $this->assertEquals($collection->toArray(false), array('Content-Length: 9'));
 }