PHP Class Flitch\File\File

Inheritance: extends SplDoublyLinkedLis\SplDoublyLinkedList, implements SeekableIterato\SeekableIterator
Afficher le fichier Open project: dasprid/flitch Class Usage Examples

Protected Properties

Свойство Type Description
$encoding string Encoding of the file.
$filename string Filename of the represented file.
$lines array Lines of the file.
$source string Source code of the represented file.
$violations array Violations in this file.

Méthodes publiques

Méthode Description
__construct ( string $filename, string $source, string $encoding = 'utf-8' ) : void Create a new file representation.
addViolation ( Violation $violation ) : void Add a violation to the file.
getEncoding ( ) : string Get encoding of the file.
getFilename ( ) : string Get the filename of the represented file.
getLines ( ) : array Get all lines of the source code as array.
getSource ( ) : string Get the source code of the represented file.
getViolations ( ) : array Get all produced violations.
seek ( integer $position ) : void seek(): defined by SeekableIterator interface.
seekNextLine ( ) : boolean Seek to the next line.
seekTokenType ( mixed $type, boolean $backwards = false, mixed $stopper = null ) : boolean Seek to a specific token type.

Method Details

__construct() public méthode

Create a new file representation.
public __construct ( string $filename, string $source, string $encoding = 'utf-8' ) : void
$filename string
$source string
$encoding string
Résultat void

addViolation() public méthode

Add a violation to the file.
public addViolation ( Violation $violation ) : void
$violation Violation
Résultat void

getEncoding() public méthode

Get encoding of the file.
public getEncoding ( ) : string
Résultat string

getFilename() public méthode

Get the filename of the represented file.
public getFilename ( ) : string
Résultat string

getLines() public méthode

Get all lines of the source code as array.
public getLines ( ) : array
Résultat array

getSource() public méthode

Get the source code of the represented file.
public getSource ( ) : string
Résultat string

getViolations() public méthode

Violations will be sorted by line/column before being returned.
public getViolations ( ) : array
Résultat array

seek() public méthode

seek(): defined by SeekableIterator interface.
See also: SeekableIterator::seek()
public seek ( integer $position ) : void
$position integer
Résultat void

seekNextLine() public méthode

Seek to the next line.
public seekNextLine ( ) : boolean
Résultat boolean

seekTokenType() public méthode

Returns true on success and false if the token can not be found. Seeking starts from current element. If the current token matches the given type, the position is not changed. In case a stopper is supplied, the seeking will stop at the given token.
public seekTokenType ( mixed $type, boolean $backwards = false, mixed $stopper = null ) : boolean
$type mixed
$backwards boolean
$stopper mixed
Résultat boolean

Property Details

$encoding protected_oe property

Encoding of the file.
protected string $encoding
Résultat string

$filename protected_oe property

Filename of the represented file.
protected string $filename
Résultat string

$lines protected_oe property

Lines of the file.
protected array $lines
Résultat array

$source protected_oe property

Source code of the represented file.
protected string $source
Résultat string

$violations protected_oe property

Violations in this file.
protected array $violations
Résultat array