public function parse(Header $header, $htmlValidatorBodyContent) { $body = new Body(); switch ($header->get('content-type')->getTypeSubtypeString()) { case 'application/json': $applicationJsonParser = new ApplicationJsonParser(); $applicationJsonParser->setConfiguration($this->getConfiguration()); $body->setContent($applicationJsonParser->parse($htmlValidatorBodyContent)); break; case 'text/html': $textHtmlParser = new TextHtmlBodyParser(); $body->setContent($textHtmlParser->parse($htmlValidatorBodyContent)); break; default: throw new \InvalidArgumentException('Invalid content type: ' . $header->get('content-type')->getTypeSubtypeString(), 1); } return $body; }
/** * * @return boolean */ public function wasAborted() { $status = $this->header->get('status'); return is_null($status) || $status == self::STATUS_ABORT; }