src/Extractor/JsonApiExtractor.php
public function extract(array $json)
    {
        if (!$this->hasData($json)) {
            return null;
        }
        if (!$this->isCollection($json)) {
            return $this->extractOne($json, $json['data']);
        } else {
            $data = $this->extractMultiple($json);
            if ($this->isPaginated($json)) {
                return (new PaginatedEntitySet($data))
                    ->setPerPage($json['meta']['pagination']['per_page'])
                    ->setCurrentPage($json['meta']['pagination']['current_page'])
                    ->setTotal($json['meta']['pagination']['total']);
            }
            return new EntitySet($data);
        }
    }
public function extract(array $json)
    {
        if (!$this->hasData($json)) {
            return null;
        }
        if (!$this->isCollection($json)) {
            return $this->extractOne($json, $json['data']);
        } else {
            $data = $this->extractMultiple($json);
            if ($this->isPaginated($json)) {
                return (new PaginatedEntitySet($data))
                    ->setPerPage($json['meta']['pagination']['per_page'])
                    ->setCurrentPage($json['meta']['pagination']['current_page'])
                    ->setTotal($json['meta']['pagination']['total']);
            }
            return new EntitySet($data);
        }
    }
public function extract ( array $ json ) { if ( ! $ this -> hasData ( $ json ) ) { return null ; } if ( ! $ this -> isCollection ( $ json ) ) { return $ this -> extractOne ( $ json , $ json [ 'data' ] ) ; } else { $ data = $ this -> extractMultiple ( $ json ) ; if ( $ this -> isPaginated ( $ json ) ) { return ( new PaginatedEntitySet ( $ data ) ) -> setPerPage ( $ json [ 'meta' ] [ 'pagination' ] [ 'per_page' ] ) -> setCurrentPage ( $ json [ 'meta' ] [ 'pagination' ] [ 'current_page' ] ) -> setTotal ( $ json [ 'meta' ] [ 'pagination' ] [ 'total' ] ) ; } return new EntitySet ( $ data ) ; } }
Extract entities form an JSON API data

@param array $json

@return EntityInterface|EntitySet|PaginatedEntitySet|null
Extract entities form an JSON API data