/**
  * {@inheritdoc}
  */
 public function build(RequestInterface $request, HttpResponseInterface $response)
 {
     $json = $response->getBody();
     $data = json_decode($json);
     $rawPageUrls = $data->Pages->PageUrls;
     return new PagesResult($response, $rawPageUrls);
 }
 /**
  * {@inheritdoc}
  */
 public function build(RequestInterface $request, HttpResponseInterface $response)
 {
     $url = $request->getParams()['url'];
     $json = $response->getBody();
     $data = json_decode($json);
     if (!isset($data->Page)) {
         throw new ResultBuilderException("Required element was not present in response (Page)");
     }
     $rawPage = $data->Page;
     // "Links" can be blank, so we don't check for it
     $requiredProperties = ["HeadContent", "HeadInstructions", "PageContent", "ServerSide"];
     foreach ($requiredProperties as $expectedProperty) {
         if (!isset($rawPage->{$expectedProperty})) {
             throw new ResultBuilderException("Required element was not present in response (Page.{$expectedProperty})");
         }
     }
     $page = new Page($rawPage);
     $page->setPageUrl($url);
     return new PageResult($response, $page);
 }