library/Garp/Model/Behavior/YouTubeable.php
protected function _fillFields(Array $input) {
        if (!array_key_exists($this->_fields['watch_url'], $input)) {
            throw new Garp_Model_Behavior_YouTubeable_Exception_MissingField(
                sprintf(self::EXCEPTION_MISSING_FIELD, $this->_fields['watch_url'])
            );
        }
        $url = $input[$this->_fields['watch_url']];
        if (empty($url)) {
            return;
        }
        $entry = $this->_fetchEntryByUrl($url);
        $images = $entry->getSnippet()->getThumbnails();
        $duration = $entry->getContentDetails()->getDuration();

        $data = array(
            'identifier'       => $entry->getId(),
            'name'             => $this->_getVideoName($entry, $input),
            'description'      => $this->_getVideoDescription($entry, $input),
            'flash_player_url' => $this->_getFlashPlayerUrl($entry),
            'watch_url'        => $url,
            'duration'         => $this->_getDurationInSeconds($duration),
            'image_url'        => $images['high']['url'],
            'thumbnail_url'    => $images['default']['url'],
        );
        $out = array();
        foreach ($data as $ytKey => $value) {
            $garpKey = $this->_fields[$ytKey];
            $this->_populateOutput($out, $garpKey, $value);
        }
        return $out;
    }
protected function _fillFields(Array $input) {
        if (!array_key_exists($this->_fields['watch_url'], $input)) {
            throw new Garp_Model_Behavior_YouTubeable_Exception_MissingField(
                sprintf(self::EXCEPTION_MISSING_FIELD, $this->_fields['watch_url'])
            );
        }
        $url = $input[$this->_fields['watch_url']];
        if (empty($url)) {
            return;
        }
        $entry = $this->_fetchEntryByUrl($url);
        $images = $entry->getSnippet()->getThumbnails();
        $duration = $entry->getContentDetails()->getDuration();

        $data = array(
            'identifier'       => $entry->getId(),
            'name'             => $this->_getVideoName($entry, $input),
            'description'      => $this->_getVideoDescription($entry, $input),
            'flash_player_url' => $this->_getFlashPlayerUrl($entry),
            'watch_url'        => $url,
            'duration'         => $this->_getDurationInSeconds($duration),
            'image_url'        => $images['high']['url'],
            'thumbnail_url'    => $images['default']['url'],
        );
        $out = array();
        foreach ($data as $ytKey => $value) {
            $garpKey = $this->_fields[$ytKey];
            $this->_populateOutput($out, $garpKey, $value);
        }
        return $out;
    }
protected function _fillFields ( Array $ input ) { if ( ! array_key_exists ( $ this -> _fields [ 'watch_url' ] , $ input ) ) { throw new Garp_Model_Behavior_YouTubeable_Exception_MissingField ( sprintf ( self :: EXCEPTION_MISSING_FIELD , $ this -> _fields [ 'watch_url' ] ) ) ; } $ url = $ input [ $ this -> _fields [ 'watch_url' ] ] ; if ( empty ( $ url ) ) { return ; } $ entry = $ this -> _fetchEntryByUrl ( $ url ) ; $ images = $ entry -> getSnippet ( ) -> getThumbnails ( ) ; $ duration = $ entry -> getContentDetails ( ) -> getDuration ( ) ; $ data = array ( 'identifier' => $ entry -> getId ( ) , 'name' => $ this -> _getVideoName ( $ entry , $ input ) , 'description' => $ this -> _getVideoDescription ( $ entry , $ input ) , 'flash_player_url' => $ this -> _getFlashPlayerUrl ( $ entry ) , 'watch_url' => $ url , 'duration' => $ this -> _getDurationInSeconds ( $ duration ) , 'image_url' => $ images [ 'high' ] [ 'url' ] , 'thumbnail_url' => $ images [ 'default' ] [ 'url' ] , ) ; $ out = array ( ) ; foreach ( $ data as $ ytKey => $ value ) { $ garpKey = $ this -> _fields [ $ ytKey ] ; $ this -> _populateOutput ( $ out , $ garpKey , $ value ) ; } return $ out ; }
Retrieves additional data about the video corresponding with given input url from YouTube,
and returns new data structure.

@param array $input
@return array
Retrieves additional data about the video corresponding with given input url from YouTube and returns new data structure .