src/Article.php
public static function parse(string $data): self
    {
        $separator = strpos($data, "\r\n\r\n");

        if ($separator === false) {
            throw new FormatException('Invalid article format');
        }

        $headers = HeaderBag::parse(substr($data, 0, $separator + 2));
        $body = substr($data, $separator + 4);

        return new self($body, $headers);
    }
public static function parse(string $data): self
    {
        $separator = strpos($data, "\r\n\r\n");

        if ($separator === false) {
            throw new FormatException('Invalid article format');
        }

        $headers = HeaderBag::parse(substr($data, 0, $separator + 2));
        $body = substr($data, $separator + 4);

        return new self($body, $headers);
    }
public static function parse ( string $ data ) : self { $ separator = strpos ( $ data , "\r\n\r\n" ) ; if ( $ separator === false ) { throw new FormatException ( 'Invalid article format' ) ; } $ headers = HeaderBag :: parse ( substr ( $ data , 0 , $ separator + 2 ) ) ; $ body = substr ( $ data , $ separator + 4 ) ; return new self ( $ body , $ headers ) ; }
Parses an article from a string.
Parses an article from a string .