Inheritance: implements Art4\JsonApiClient\Utils\ManagerInterface, implements Art4\JsonApiClient\Utils\FactoryManagerInterface
Exemple #1
0
 /**
  * @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;
 }
Exemple #2
0
 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;
 }