public function hydrate($source): AbstractDocument
    {
        if (! isset($source->data)) {
            return $this->processNoDataDocument($source);
        }

        if (is_object($source->data)) {
            return $this->processSingleResourceDocument($source);
        }

        if (is_array($source->data)) {
            return $this->processResourceCollectionDocument($source);
        }

        throw new InvalidDocumentException('If data is present and is not null it must be an object or an array');
    }
public function hydrate($source): AbstractDocument
    {
        if (! isset($source->data)) {
            return $this->processNoDataDocument($source);
        }

        if (is_object($source->data)) {
            return $this->processSingleResourceDocument($source);
        }

        if (is_array($source->data)) {
            return $this->processResourceCollectionDocument($source);
        }

        throw new InvalidDocumentException('If data is present and is not null it must be an object or an array');
    }
public function hydrate ( $ source ) : AbstractDocument { if ( ! isset ( $ source -> data ) ) { return $ this -> processNoDataDocument ( $ source ) ; } if ( is_object ( $ source -> data ) ) { return $ this -> processSingleResourceDocument ( $ source ) ; } if ( is_array ( $ source -> data ) ) { return $ this -> processResourceCollectionDocument ( $ source ) ; } throw new InvalidDocumentException ( 'If data is present and is not null it must be an object or an array' ) ; }
Hydrate source to a document

@param  object $source
@return AbstractDocument
Hydrate source to a document