SimplePhpPageBuilder::parse PHP Метод

parse() публичный Метод

Reads the raw content and send events into the page to be built.
public parse ( $response ) : SimplePage
$response SimpleHttpResponse Fetched response.
Результат SimplePage Newly parsed page.
    public function parse($response)
    {
        $this->tags = array();
        $this->page = $this->createPage($response);
        $parser = $this->createParser($this);
        $parser->parse($response->getContent());
        $this->acceptPageEnd();
        $page = $this->page;
        $this->free();
        return $page;
    }

Usage Example

Пример #1
0
 function whenVisiting($url, $content)
 {
     $response = new MockSimpleHttpResponse();
     $response->setReturnValue('getContent', $content);
     $response->setReturnValue('getUrl', new SimpleUrl($url));
     $builder = new SimplePhpPageBuilder();
     return $builder->parse($response);
 }