src/GoogleDriveAdapter.php
protected function normaliseObject(Google_Service_Drive_DriveFile $object, $dirname)
    {
        $id = $object->getId();
        $path_parts = $this->splitFileExtension($object->getName());
        $result = ['name' => $object->getName()];
        $result['type'] = $object->mimeType === self::DIRMIME ? 'dir' : 'file';
        $result['path'] = ($dirname ? ($dirname . '/') : '') . $id;
        $result['filename'] = $path_parts['filename'];
        $result['extension'] = $path_parts['extension'];
        $result['timestamp'] = strtotime($object->getModifiedTime());
        if ($result['type'] === 'file') {
            $result['mimetype'] = $object->mimeType;
            $result['size'] = (int) $object->getSize();
        }
        if ($result['type'] === 'dir') {
            $result['size'] = 0;
            if ($this->useHasDir) {
                $result['hasdir'] = isset($this->cacheHasDirs[$id]) ? $this->cacheHasDirs[$id] : false;
            }
        }
        // attach additional fields
        if ($this->additionalFields) {
            foreach($this->additionalFields as $field) {
                if (property_exists($object, $field)) {
                    $result[$field] = $object->$field;
                }
            }
        }
        return $result;
    }
protected function normaliseObject(Google_Service_Drive_DriveFile $object, $dirname)
    {
        $id = $object->getId();
        $path_parts = $this->splitFileExtension($object->getName());
        $result = ['name' => $object->getName()];
        $result['type'] = $object->mimeType === self::DIRMIME ? 'dir' : 'file';
        $result['path'] = ($dirname ? ($dirname . '/') : '') . $id;
        $result['filename'] = $path_parts['filename'];
        $result['extension'] = $path_parts['extension'];
        $result['timestamp'] = strtotime($object->getModifiedTime());
        if ($result['type'] === 'file') {
            $result['mimetype'] = $object->mimeType;
            $result['size'] = (int) $object->getSize();
        }
        if ($result['type'] === 'dir') {
            $result['size'] = 0;
            if ($this->useHasDir) {
                $result['hasdir'] = isset($this->cacheHasDirs[$id]) ? $this->cacheHasDirs[$id] : false;
            }
        }
        // attach additional fields
        if ($this->additionalFields) {
            foreach($this->additionalFields as $field) {
                if (property_exists($object, $field)) {
                    $result[$field] = $object->$field;
                }
            }
        }
        return $result;
    }
protected function normaliseObject ( Google_Service_Drive_DriveFile $ object , $ dirname ) { $ id = $ object -> getId ( ) ; $ path_parts = $ this -> splitFileExtension ( $ object -> getName ( ) ) ; $ result = [ 'name' => $ object -> getName ( ) ] ; $ result [ 'type' ] = $ object -> mimeType === self :: DIRMIME ? 'dir' : 'file' ; $ result [ 'path' ] = ( $ dirname ? ( $ dirname . '/' ) : '' ) . $ id ; $ result [ 'filename' ] = $ path_parts [ 'filename' ] ; $ result [ 'extension' ] = $ path_parts [ 'extension' ] ; $ result [ 'timestamp' ] = strtotime ( $ object -> getModifiedTime ( ) ) ; if ( $ result [ 'type' ] === 'file' ) { $ result [ 'mimetype' ] = $ object -> mimeType ; $ result [ 'size' ] = ( int ) $ object -> getSize ( ) ; } if ( $ result [ 'type' ] === 'dir' ) { $ result [ 'size' ] = 0 ; if ( $ this -> useHasDir ) { $ result [ 'hasdir' ] = isset ( $ this -> cacheHasDirs [ $ id ] ) ? $ this -> cacheHasDirs [ $ id ] : false ; } } // attach additional fields if ( $ this -> additionalFields ) { foreach ( $ this -> additionalFields as $ field ) { if ( property_exists ( $ object , $ field ) ) { $ result [ $ field ] = $ object -> $ field ; } } } return $ result ; }
Get normalised files array from Google_Service_Drive_DriveFile

@param Google_Service_Drive_DriveFile $object
@param String $dirname
Parent directory itemId path

@return array Normalised files array
Get normalised files array from Google_Service_Drive_DriveFile