PHP Class Captioning\File

Inheritance: implements captioning\FileInterface
Afficher le fichier Open project: captioning/captioning Class Usage Examples

Protected Properties

Свойство Type Description
$cues array
$encoding string
$fileContent string
$filename string
$lineEnding string
$stats array
$useIconv boolean

Méthodes publiques

Méthode Description
__construct ( null $_filename = null, null $_encoding = null, boolean | false $_useIconv = false ) File constructor.
addCue ( mixed $_mixed, string $_start = null, string $_stop = null ) : File Add a cue
build ( )
changeFPS ( float $_old_fps, float $_new_fps ) : File Converts timecodes based on the specified FPS ratio
convertTo ( string $_output_format ) : mixed
getCue ( integer $_index ) : Cue | null
getCueFromStart ( $_start )
getCues ( ) : array
getCuesCount ( ) : integer
getEncoding ( ) : string
getExpectedCueClass ( captioning\FileInterface $_file, boolean | true $_full_namespace = true ) : string
getFileContent ( ) : string
getFilename ( ) : string
getFirstCue ( ) : Cue | null
getFormat ( captioning\FileInterface $_file ) : mixed
getLastCue ( ) : Cue | null
getStats ( ) Computes reading speed statistics
getUseIconv ( ) : boolean | false
loadFromFile ( null $_filename = null )
loadFromString ( string $_str )
merge ( captioning\FileInterface $_file )
removeCue ( integer $_index ) : File Removes a cue
save ( string $filename = null, boolean $writeBOM = false ) Saves the file
search ( string $_word, boolean $_case_sensitive = false, boolean $_strict = false ) : array Searches a word/expression and returns ids of the matched entries
setEncoding ( string $_encoding )
setFilename ( string $_filename )
setLineEnding ( string $_lineEnding )
setUseIconv ( boolean $_useIconv )
shift ( integer $_time, integer $_startIndex = null, integer $_endIndex = null ) Shifts a range of subtitles a specified amount of time.
sortCues ( ) Sorts cues
sync ( integer $_startIndex, integer $_startTime, integer $_endIndex, integer $_endTime, boolean $_syncLast = true ) : boolean Auto syncs a range of subtitles given their first and last correct times.

Méthodes protégées

Méthode Description
encode ( ) Encode file content
getFileContentAsArray ( ) : array
getNextValueFromArray ( array &$array ) : mixed

Method Details

__construct() public méthode

File constructor.
public __construct ( null $_filename = null, null $_encoding = null, boolean | false $_useIconv = false )
$_filename null
$_encoding null
$_useIconv boolean | false

addCue() public méthode

Add a cue
public addCue ( mixed $_mixed, string $_start = null, string $_stop = null ) : File
$_mixed mixed An cue instance or a string representing the text
$_start string A timecode
$_stop string A timecode
Résultat File

build() public méthode

public build ( )

changeFPS() public méthode

Converts timecodes based on the specified FPS ratio
public changeFPS ( float $_old_fps, float $_new_fps ) : File
$_old_fps float
$_new_fps float
Résultat File

convertTo() public méthode

public convertTo ( string $_output_format ) : mixed
$_output_format string
Résultat mixed

encode() protected méthode

Encode file content
protected encode ( )

getCue() public méthode

public getCue ( integer $_index ) : Cue | null
$_index integer
Résultat Cue | null

getCueFromStart() public méthode

public getCueFromStart ( $_start )

getCues() public méthode

public getCues ( ) : array
Résultat array

getCuesCount() public méthode

public getCuesCount ( ) : integer
Résultat integer

getEncoding() public méthode

public getEncoding ( ) : string
Résultat string

getExpectedCueClass() public static méthode

public static getExpectedCueClass ( captioning\FileInterface $_file, boolean | true $_full_namespace = true ) : string
$_file captioning\FileInterface
$_full_namespace boolean | true
Résultat string

getFileContent() public méthode

public getFileContent ( ) : string
Résultat string

getFileContentAsArray() protected méthode

protected getFileContentAsArray ( ) : array
Résultat array

getFilename() public méthode

public getFilename ( ) : string
Résultat string

getFirstCue() public méthode

public getFirstCue ( ) : Cue | null
Résultat Cue | null

getFormat() public static méthode

public static getFormat ( captioning\FileInterface $_file ) : mixed
$_file captioning\FileInterface
Résultat mixed

getLastCue() public méthode

public getLastCue ( ) : Cue | null
Résultat Cue | null

getNextValueFromArray() protected méthode

protected getNextValueFromArray ( array &$array ) : mixed
$array array
Résultat mixed

getStats() public méthode

Computes reading speed statistics
public getStats ( )

getUseIconv() public méthode

public getUseIconv ( ) : boolean | false
Résultat boolean | false

loadFromFile() public méthode

public loadFromFile ( null $_filename = null )
$_filename null

loadFromString() public méthode

public loadFromString ( string $_str )
$_str string

merge() public méthode

public merge ( captioning\FileInterface $_file )
$_file captioning\FileInterface

removeCue() public méthode

Removes a cue
public removeCue ( integer $_index ) : File
$_index integer
Résultat File

save() public méthode

Saves the file
public save ( string $filename = null, boolean $writeBOM = false )
$filename string
$writeBOM boolean

setEncoding() public méthode

public setEncoding ( string $_encoding )
$_encoding string

setFilename() public méthode

public setFilename ( string $_filename )
$_filename string The filename

setLineEnding() public méthode

public setLineEnding ( string $_lineEnding )
$_lineEnding string

setUseIconv() public méthode

public setUseIconv ( boolean $_useIconv )
$_useIconv boolean

shift() public méthode

Shifts a range of subtitles a specified amount of time.
public shift ( integer $_time, integer $_startIndex = null, integer $_endIndex = null )
$_time integer The time to use (ms), which can be positive or negative.
$_startIndex integer The subtitle index the range begins with.
$_endIndex integer The subtitle index the range ends with.

sortCues() public méthode

Sorts cues
public sortCues ( )

sync() public méthode

The subtitles are first shifted to the first subtitle's correct time, and then proportionally adjusted using the last subtitle's correct time. Based on gnome-subtitles (https://git.gnome.org/browse/gnome-subtitles/)
public sync ( integer $_startIndex, integer $_startTime, integer $_endIndex, integer $_endTime, boolean $_syncLast = true ) : boolean
$_startIndex integer The subtitle index to start the adjustment with.
$_startTime integer The correct start time for the first subtitle.
$_endIndex integer The subtitle index to end the adjustment with.
$_endTime integer The correct start time for the last subtitle.
$_syncLast boolean Whether to sync the last subtitle.
Résultat boolean Whether the subtitles could be adjusted

Property Details

$cues protected_oe property

protected array $cues
Résultat array

$encoding protected_oe property

protected string $encoding
Résultat string

$fileContent protected_oe property

protected string $fileContent
Résultat string

$filename protected_oe property

protected string $filename
Résultat string

$lineEnding protected_oe property

protected string $lineEnding
Résultat string

$stats protected_oe property

protected array $stats
Résultat array

$useIconv protected_oe property

protected bool $useIconv
Résultat boolean