Tebru\Retrofit\Annotation\Headers::__construct PHP Method

__construct() public method

Constructor
public __construct ( array $params )
$params array
    public function __construct(array $params)
    {
        Tebru\assertArrayKeyExists('value', $params, 'An argument was not passed to a "%s" annotation.', get_class($this));
        // convert to array
        $params['value'] = (array) $params['value'];
        // loop through each string and break on ':'
        foreach ($params['value'] as $header) {
            $pos = strpos($header, ':');
            Tebru\assertThat(false !== $pos, 'Header in an incorrect format.  Expected "Name: value"');
            $name = trim(substr($header, 0, $pos));
            $value = trim(substr($header, $pos + 1));
            $this->headers[$name] = $value;
        }
    }