public static function hydrate(stdClass $resource)
    {
        $hydrated = new ResourceEntity();

        if (isset($resource->id)) {
            $hydrated->setId($resource->id);
        }

        if (isset($resource->title)) {
            $hydrated->setTitle($resource->title);
        }

        if (isset($resource->author)) {
            $hydrated->setAuthor($resource->author);
        }

        if (isset($resource->url)) {
            $hydrated->setUrl($resource->url);
        }

        if (isset($resource->published_at)) {
            $hydrated->setPublishedAt(new DateTime($resource->published_at));
        }

        if (isset($resource->languages) && is_array($resource->languages)) {
            $hydrated->setLanguages(LanguageHydrator::hydrateCollection($resource->languages));
        }

        return $hydrated;
    }
public static function hydrate(stdClass $resource)
    {
        $hydrated = new ResourceEntity();

        if (isset($resource->id)) {
            $hydrated->setId($resource->id);
        }

        if (isset($resource->title)) {
            $hydrated->setTitle($resource->title);
        }

        if (isset($resource->author)) {
            $hydrated->setAuthor($resource->author);
        }

        if (isset($resource->url)) {
            $hydrated->setUrl($resource->url);
        }

        if (isset($resource->published_at)) {
            $hydrated->setPublishedAt(new DateTime($resource->published_at));
        }

        if (isset($resource->languages) && is_array($resource->languages)) {
            $hydrated->setLanguages(LanguageHydrator::hydrateCollection($resource->languages));
        }

        return $hydrated;
    }
public static function hydrate ( stdClass $ resource ) { $ hydrated = new ResourceEntity ( ) ; if ( isset ( $ resource -> id ) ) { $ hydrated -> setId ( $ resource -> id ) ; } if ( isset ( $ resource -> title ) ) { $ hydrated -> setTitle ( $ resource -> title ) ; } if ( isset ( $ resource -> author ) ) { $ hydrated -> setAuthor ( $ resource -> author ) ; } if ( isset ( $ resource -> url ) ) { $ hydrated -> setUrl ( $ resource -> url ) ; } if ( isset ( $ resource -> published_at ) ) { $ hydrated -> setPublishedAt ( new DateTime ( $ resource -> published_at ) ) ; } if ( isset ( $ resource -> languages ) && is_array ( $ resource -> languages ) ) { $ hydrated -> setLanguages ( LanguageHydrator :: hydrateCollection ( $ resource -> languages ) ) ; } return $ hydrated ; }
Hydrate a resource object into a ResourceEntity object

@param stdClass $resource
@return ResourceEntity
Hydrate a resource object into a ResourceEntity object