PHP Класс app\models\File

Наследование: extends NeoEloquent
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$getID3 getID\getID3 The getID3 object, for ID3 tag reading.
$hash string This value is unique, and can be used to query a Song record.
$mtime integer The file's last modified time.
$path string The file's path.
$song Song The song model that's associated with this file.
$splFileInfo SplFileInf\SplFileInfo The SplFileInfo object of the file.
$syncError string The last parsing error text, if any.

Открытые методы

Метод Описание
__construct ( string | SplFileInf\SplFileInfo $path, getID\getID3 $getID3 = null ) Construct our File object.
getGetID3 ( ) : getID\getID3
getHash ( string $path ) : string Get a unique hash from a file path.
getInfo ( ) : array | void Get all applicable ID3 info from the file.
getPath ( ) : string
getSyncError ( ) : syncError Get the last parsing error's text.
isChanged ( ) : boolean Determine if the file is changed (its Song record is found, but the timestamp is different).
isNew ( ) : boolean Determine if the file is new (its Song record can't be found in the database).
isNewOrChanged ( ) : boolean Determine if the file is new or changed.
setGetID3 ( getID\getID3 $getID3 = null )
sync ( array $tags, boolean $force = false ) : boolean | Song Sync the song with all available media info against the database.

Приватные методы

Метод Описание
getCoverFileUnderSameDirectory ( ) : string | false Issue #380.

Описание методов

__construct() публичный метод

Upon construction, we'll set the path, hash, and associated Song object (if any).
public __construct ( string | SplFileInf\SplFileInfo $path, getID\getID3 $getID3 = null )
$path string | SplFileInf\SplFileInfo Either the file's path, or a SplFileInfo object
$getID3 getID\getID3 A getID3 object for DI (and better performance)

getGetID3() публичный метод

public getGetID3 ( ) : getID\getID3
Результат getID\getID3

getHash() публичный статический метод

Get a unique hash from a file path.
public static getHash ( string $path ) : string
$path string
Результат string

getInfo() публичный метод

Get all applicable ID3 info from the file.
public getInfo ( ) : array | void
Результат array | void

getPath() публичный метод

public getPath ( ) : string
Результат string

getSyncError() публичный метод

Get the last parsing error's text.
public getSyncError ( ) : syncError
Результат syncError

isChanged() публичный метод

Determine if the file is changed (its Song record is found, but the timestamp is different).
public isChanged ( ) : boolean
Результат boolean

isNew() публичный метод

Determine if the file is new (its Song record can't be found in the database).
public isNew ( ) : boolean
Результат boolean

isNewOrChanged() публичный метод

Determine if the file is new or changed.
public isNewOrChanged ( ) : boolean
Результат boolean

setGetID3() публичный метод

public setGetID3 ( getID\getID3 $getID3 = null )
$getID3 getID\getID3

sync() публичный метод

Sync the song with all available media info against the database.
public sync ( array $tags, boolean $force = false ) : boolean | Song
$tags array The (selective) tags to sync (if the song exists)
$force boolean Whether to force syncing, even if the file is unchanged
Результат boolean | Song A Song object on success, true if file exists but is unmodified, or false on an error.

Описание свойств

$getID3 защищенное свойство

The getID3 object, for ID3 tag reading.
protected getID3,getID $getID3
Результат getID\getID3

$hash защищенное свойство

This value is unique, and can be used to query a Song record.
protected string $hash
Результат string

$mtime защищенное свойство

The file's last modified time.
protected int $mtime
Результат integer

$path защищенное свойство

The file's path.
protected string $path
Результат string

$song защищенное свойство

The song model that's associated with this file.
protected Song,app\models $song
Результат Song

$splFileInfo защищенное свойство

The SplFileInfo object of the file.
protected SplFileInfo,SplFileInf $splFileInfo
Результат SplFileInf\SplFileInfo

$syncError защищенное свойство

The last parsing error text, if any.
protected string $syncError
Результат string