/** * @param string $json_string * * @return Document * * @throws ValidationException */ public static function parse($json_string) { $data = static::decodeJson($json_string); $manager = new Manager(); $document = $manager->getFactory()->make('Document', [$manager]); $document->parse($data); return $document; }
public function parse(Response $response) { if ($response->getStatusCode() !== 200) { return false; } $jsonResponse = $response->getBody()->getContents(); $jsonapi = new JsonManager(); try { $parsed = $jsonapi->parse($jsonResponse); } catch (ValidationException $e) { return false; } return $parsed; }