PHP Class SrtParser\srtFileEntry

Show file Open project: delphiki/subrip-file-parser

Public Methods

Method Description
__construct ( string $_start, string $_stop, string $_text ) srtFileEntry constructor
calcDuration ( ) Computes entry duration in milliseconds
getCPS ( )
getDurationMS ( )
getReadingSpeed ( )
getStart ( )
getStartTC ( )
getStop ( )
getStopTC ( )
getStrippedText ( )
getText ( boolean $stripTags = false, boolean $stripBasic = false, array $replacements = [] ) : string Returns the text of the entry
getTimeCodeString ( $_WebVTT = false ) : string Get the full timecode of the entry
ms2tc ( integer $ms ) : string Converts milliseconds into timecode string
prepForStats ( )
scale ( $baseTime, $factor = 1 )
setStart ( integer $_start ) Sets the start timecode as milliseconds
setStartTC ( string $_start ) Sets the start timecode
setStop ( integer $_stop ) Sets the stop timecode as milliseconds
setStopTC ( string $_stop ) Sets the stop timecode
setText ( $_text ) Sets a new text value
shift ( $time ) Set a delay (positive or negative)
stripTags ( boolean $stripBasic = false, array $replacements = [] ) : boolean Strips Advanced SSA tags
strlen ( ) : integer Returns the *real* string length
tc2ms ( string $tc ) : integer Converts timecode string into milliseconds

Private Methods

Method Description
calcCPS ( ) Computes car. / second ratio
calcRS ( ) Computes Reading Speed (based on VisualSubSync algorithm)
genStrippedText ( ) Generates stripped text in order to compute statistics

Method Details

__construct() public method

srtFileEntry constructor
public __construct ( string $_start, string $_stop, string $_text )
$_start string Start timecode
$_stop string End timcode
$_text string Text of the entry

calcDuration() public method

Computes entry duration in milliseconds
public calcDuration ( )

getCPS() public method

public getCPS ( )

getDurationMS() public method

public getDurationMS ( )

getReadingSpeed() public method

public getReadingSpeed ( )

getStart() public method

public getStart ( )

getStartTC() public method

public getStartTC ( )

getStop() public method

public getStop ( )

getStopTC() public method

public getStopTC ( )

getStrippedText() public method

public getStrippedText ( )

getText() public method

Returns the text of the entry
public getText ( boolean $stripTags = false, boolean $stripBasic = false, array $replacements = [] ) : string
$stripTags boolean
$stripBasic boolean
$replacements array
return string

getTimeCodeString() public method

Get the full timecode of the entry
public getTimeCodeString ( $_WebVTT = false ) : string
return string

ms2tc() public static method

Converts milliseconds into timecode string
public static ms2tc ( integer $ms ) : string
$ms integer
return string

prepForStats() public method

public prepForStats ( )

scale() public method

public scale ( $baseTime, $factor = 1 )

setStart() public method

Sets the start timecode as milliseconds
public setStart ( integer $_start )
$_start integer

setStartTC() public method

Sets the start timecode
public setStartTC ( string $_start )
$_start string

setStop() public method

Sets the stop timecode as milliseconds
public setStop ( integer $_stop )
$_stop integer

setStopTC() public method

Sets the stop timecode
public setStopTC ( string $_stop )
$_stop string

setText() public method

Sets a new text value
public setText ( $_text )

shift() public method

Set a delay (positive or negative)
public shift ( $time )

stripTags() public method

Strips Advanced SSA tags
public stripTags ( boolean $stripBasic = false, array $replacements = [] ) : boolean
$stripBasic boolean If true, , and tags will be stripped
$replacements array
return boolean (true if tags were actually stripped)

strlen() public method

Returns the *real* string length
public strlen ( ) : integer
return integer

tc2ms() public static method

Converts timecode string into milliseconds
public static tc2ms ( string $tc ) : integer
$tc string timecode as string
return integer