src/Graviton/RestBundle/HttpFoundation/LinkHeaderItem.php
public static function fromString($itemValue)
    {
        $bits = preg_split('/(".+?"|[^;]+)(?:;|$)/', $itemValue, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
        $value = array_shift($bits);
        $attributes = [];

        foreach ($bits as $bit) {
            list($bitName, $bitValue) = explode('=', trim($bit));

            $bitValue = self::trimEdge($bitValue, '"');
            $bitValue = self::trimEdge($bitValue, '\'');

            $attributes[$bitName] = $bitValue;
        }

        $url = self::trimEdge($value, '<');

        return new self($url, $attributes);
    }
public static function fromString($itemValue)
    {
        $bits = preg_split('/(".+?"|[^;]+)(?:;|$)/', $itemValue, 0, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
        $value = array_shift($bits);
        $attributes = [];

        foreach ($bits as $bit) {
            list($bitName, $bitValue) = explode('=', trim($bit));

            $bitValue = self::trimEdge($bitValue, '"');
            $bitValue = self::trimEdge($bitValue, '\'');

            $attributes[$bitName] = $bitValue;
        }

        $url = self::trimEdge($value, '<');

        return new self($url, $attributes);
    }
public static function fromString ( $ itemValue ) { $ bits = preg_split ( '/(".+?"|[^;]+)(?:;|$)/' , $ itemValue , 0 , PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ) ; $ value = array_shift ( $ bits ) ; $ attributes = [ ] ; foreach ( $ bits as $ bit ) { list ( $ bitName , $ bitValue ) = explode ( '=' , trim ( $ bit ) ) ; $ bitValue = self :: trimEdge ( $ bitValue , '"' ) ; $ bitValue = self :: trimEdge ( $ bitValue , '\'' ) ; $ attributes [ $ bitName ] = $ bitValue ; } $ url = self :: trimEdge ( $ value , '<' ) ; return new self ( $ url , $ attributes ) ; }
Builds a LinkHeaderItem instance from a string.

@param string $itemValue value of a single link header

@return \Graviton\RestBundle\HttpFoundation\LinkHeaderItem
Builds a LinkHeaderItem instance from a string .