src/Dropbox/Models/ModelFactory.php
public static function make(array $data = array())
    {
        if (static::isFileOrFolder($data)) {
            $tag = $data['.tag'];

            //File
            if (static::isFile($tag)) {
                return new FileMetadata($data);
            }

            //Folder
            if (static::isFolder($tag)) {
                return new FolderMetadata($data);
            }
        }

        //Temporary Link
        if (static::isTemporaryLink($data)) {
            return new TemporaryLink($data);
        }

        //List
        if (static::isList($data)) {
            return new MetadataCollection($data);
        }

        //Search Results
        if (static::isSearchResult($data)) {
            return new SearchResults($data);
        }

        //Deleted File/Folder
        if (static::isDeletedFileOrFolder($data)) {
            return new DeletedMetadata($data);
        }

        //Base Model
        return new BaseModel($data);
    }
public static function make(array $data = array())
    {
        if (static::isFileOrFolder($data)) {
            $tag = $data['.tag'];

            //File
            if (static::isFile($tag)) {
                return new FileMetadata($data);
            }

            //Folder
            if (static::isFolder($tag)) {
                return new FolderMetadata($data);
            }
        }

        //Temporary Link
        if (static::isTemporaryLink($data)) {
            return new TemporaryLink($data);
        }

        //List
        if (static::isList($data)) {
            return new MetadataCollection($data);
        }

        //Search Results
        if (static::isSearchResult($data)) {
            return new SearchResults($data);
        }

        //Deleted File/Folder
        if (static::isDeletedFileOrFolder($data)) {
            return new DeletedMetadata($data);
        }

        //Base Model
        return new BaseModel($data);
    }
public static function make ( array $ data = array ( ) ) { if ( static :: isFileOrFolder ( $ data ) ) { $ tag = $ data [ '.tag' ] ; //File if ( static :: isFile ( $ tag ) ) { return new FileMetadata ( $ data ) ; } //Folder if ( static :: isFolder ( $ tag ) ) { return new FolderMetadata ( $ data ) ; } } //Temporary Link if ( static :: isTemporaryLink ( $ data ) ) { return new TemporaryLink ( $ data ) ; } //List if ( static :: isList ( $ data ) ) { return new MetadataCollection ( $ data ) ; } //Search Results if ( static :: isSearchResult ( $ data ) ) { return new SearchResults ( $ data ) ; } //Deleted File/Folder if ( static :: isDeletedFileOrFolder ( $ data ) ) { return new DeletedMetadata ( $ data ) ; } //Base Model return new BaseModel ( $ data ) ; }
Make a Model Factory

@param  array $data Model Data

@return \Kunnu\Dropbox\Models\ModelInterface
Make a Model Factory