parse() public method

Parse a JSON API string into an object
public parse ( string $string ) : Art4\JsonApiClient\AccessInterface
$string string The JSON API string
return Art4\JsonApiClient\AccessInterface
Beispiel #1
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;
 }