PHP Класс yii\gii\CodeFile

С версии: 2.0
Автор: Qiang Xue ([email protected])
Наследование: extends yii\base\Object
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$content the newly generated code content
$id an ID that uniquely identifies this code file.
$operation the operation to be performed. This can be [[OP_CREATE]], [[OP_OVERWRITE]] or [[OP_SKIP]].
$path the file path that the new code should be saved to.

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

Метод Описание
__construct ( string $path, string $content, array $config = [] ) Constructor.
diff ( ) : boolean | string Returns diff or false if it cannot be calculated
getRelativePath ( ) : string
getType ( ) : string
preview ( ) : boolean | string Returns preview or false if it cannot be rendered
save ( ) : string | boolean Saves the code into the file specified by [[path]].

Приватные методы

Метод Описание
renderDiff ( mixed $lines1, mixed $lines2 ) : string Renders diff between two sets of lines

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

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

Constructor.
public __construct ( string $path, string $content, array $config = [] )
$path string the file path that the new code should be saved to.
$content string the newly generated code content.
$config array name-value pairs that will be used to initialize the object properties

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

Returns diff or false if it cannot be calculated
public diff ( ) : boolean | string
Результат boolean | string

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

public getRelativePath ( ) : string
Результат string the code file path relative to the application base path.

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

public getType ( ) : string
Результат string the code file extension (e.g. php, txt)

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

Returns preview or false if it cannot be rendered
public preview ( ) : boolean | string
Результат boolean | string

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

Saves the code into the file specified by [[path]].
public save ( ) : string | boolean
Результат string | boolean the error occurred while saving the code file, or true if no error.

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

$content публичное свойство

the newly generated code content
public $content

$id публичное свойство

an ID that uniquely identifies this code file.
public $id

$operation публичное свойство

the operation to be performed. This can be [[OP_CREATE]], [[OP_OVERWRITE]] or [[OP_SKIP]].
public $operation

$path публичное свойство

the file path that the new code should be saved to.
public $path