PHP Class Vsch\TranslationManager\Classes\TranslationFileRewriter

Show file Open project: vsch/laravel-translation-manager Class Usage Examples

Public Properties

Property Type Description
$firstLevelKeys contains the key portion of the first level identifier as the key and the value is [ 'section' => int, // index of the section this identifier belongs to. -1 means before first. 'ordinal' => int, // ordinal position of this identifier in the section 'quotes' => string, // type of quoting used for the key if it was a string, ', ", << string, // type of quoting used for value if it was a string, ', ", <<
$options
$sections containing the multi-line comment text as they appear in the file, including leading and trailing blank lines. Indexed by the count of the multi-line comment.
$source string
$tokens array

Public Methods

Method Description
__construct ( ) TranslationFileRewriter constructor.
__toString ( ) : string The __toString method allows a class to decide how it will react when it is converted to a string.
formatForExport ( $trans, $options = null )
optionFlags ( $optionNames )
parseSource ( $source )
str_count_chars ( $chars, $string )
str_count_trailing ( $chars, $string )

Protected Methods

Method Description
formatSection ( $trans, $options = null, $indent )
wrapQuotes ( $value, $options = null )

Method Details

__construct() public method

TranslationFileRewriter constructor.
public __construct ( )

__toString() public method

The __toString method allows a class to decide how it will react when it is converted to a string.
public __toString ( ) : string
return string

formatForExport() public method

public formatForExport ( $trans, $options = null )

formatSection() protected method

protected formatSection ( $trans, $options = null, $indent )

optionFlags() public static method

public static optionFlags ( $optionNames )

parseSource() public method

public parseSource ( $source )
$source TODO: Quite a bit of kludge but does the job. Needs clean up, it is hard on the eyes.

str_count_chars() public static method

public static str_count_chars ( $chars, $string )

str_count_trailing() public static method

public static str_count_trailing ( $chars, $string )

wrapQuotes() protected method

protected wrapQuotes ( $value, $options = null )

Property Details

$firstLevelKeys public property

contains the key portion of the first level identifier as the key and the value is [ 'section' => int, // index of the section this identifier belongs to. -1 means before first. 'ordinal' => int, // ordinal position of this identifier in the section 'quotes' => string, // type of quoting used for the key if it was a string, ', ", << string, // type of quoting used for value if it was a string, ', ", <<
public $firstLevelKeys

$options public static property

public static $options

$sections public property

containing the multi-line comment text as they appear in the file, including leading and trailing blank lines. Indexed by the count of the multi-line comment.
public $sections

$source public property

public string $source
return string

$tokens public property

public array $tokens
return array