PHP Класс Flitch\File\File

Наследование: extends SplDoublyLinkedLis\SplDoublyLinkedList, implements SeekableIterato\SeekableIterator
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$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.

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

Метод Описание
__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.

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

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

Create a new file representation.
public __construct ( string $filename, string $source, string $encoding = 'utf-8' ) : void
$filename string
$source string
$encoding string
Результат void

addViolation() публичный Метод

Add a violation to the file.
public addViolation ( Violation $violation ) : void
$violation Violation
Результат void

getEncoding() публичный Метод

Get encoding of the file.
public getEncoding ( ) : string
Результат string

getFilename() публичный Метод

Get the filename of the represented file.
public getFilename ( ) : string
Результат string

getLines() публичный Метод

Get all lines of the source code as array.
public getLines ( ) : array
Результат array

getSource() публичный Метод

Get the source code of the represented file.
public getSource ( ) : string
Результат string

getViolations() публичный Метод

Violations will be sorted by line/column before being returned.
public getViolations ( ) : array
Результат array

seek() публичный Метод

seek(): defined by SeekableIterator interface.
См. также: SeekableIterator::seek()
public seek ( integer $position ) : void
$position integer
Результат void

seekNextLine() публичный Метод

Seek to the next line.
public seekNextLine ( ) : boolean
Результат boolean

seekTokenType() публичный Метод

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
Результат boolean

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

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

Encoding of the file.
protected string $encoding
Результат string

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

Filename of the represented file.
protected string $filename
Результат string

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

Lines of the file.
protected array $lines
Результат array

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

Source code of the represented file.
protected string $source
Результат string

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

Violations in this file.
protected array $violations
Результат array