PHP Класс lithium\console\command\Create

li3 create --template=controller Posts li3 create --template=model Posts
Наследование: extends lithium\console\Command
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$library string Name of library to use
$template string The name of the template to use to generate the file. This allows you to add a custom template to be used in place of the core template for each command. Place templates in \extensions\command\create\template.

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

Свойство Тип Описание
$_library array Holds library data from lithium\core\Libraries::get().

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

Метод Описание
run ( string $command = null ) : boolean Run the create command. Takes $command and delegates to $command::$method

Защищенные методы

Метод Описание
_default ( string $name ) : boolean Run through the default set. model, controller, test model, test controller
_execute ( string $command ) : boolean Execute the given sub-command for the current request.
_init ( ) : void Class initializer. Parses template and sets up params that need to be filled.
_instance ( string $name, array $config = [] ) : object Get an instance of a sub-command
_namespace ( string $request, array $options = [] ) : string Get the namespace.
_params ( ) : array Parse a template to find available variables specified in {:name} format. Each variable corresponds to a method in the sub command. For example, a {:namespace} variable will call the namespace method in the model command when li3 create model Post is called.
_save ( array $params = [] ) : string | boolean Save a template with the current params. Writes file to Create::$path.
_template ( ) : string Returns the contents of the template.

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

_default() защищенный Метод

Run through the default set. model, controller, test model, test controller
protected _default ( string $name ) : boolean
$name string class name to create
Результат boolean

_execute() защищенный Метод

Execute the given sub-command for the current request.
protected _execute ( string $command ) : boolean
$command string The sub-command name. example: Model, Controller, Test
Результат boolean

_init() защищенный Метод

Class initializer. Parses template and sets up params that need to be filled.
protected _init ( ) : void
Результат void

_instance() защищенный Метод

Get an instance of a sub-command
protected _instance ( string $name, array $config = [] ) : object
$name string the name of the sub-command to instantiate
$config array
Результат object

_namespace() защищенный Метод

Get the namespace.
protected _namespace ( string $request, array $options = [] ) : string
$request string
$options array
Результат string

_params() защищенный Метод

Parse a template to find available variables specified in {:name} format. Each variable corresponds to a method in the sub command. For example, a {:namespace} variable will call the namespace method in the model command when li3 create model Post is called.
protected _params ( ) : array
Результат array

_save() защищенный Метод

Save a template with the current params. Writes file to Create::$path.
protected _save ( array $params = [] ) : string | boolean
$params array
Результат string | boolean A result string on success of writing the file. If any errors occur along the way such as missing information boolean false is returned.

_template() защищенный Метод

Returns the contents of the template.
protected _template ( ) : string
Результат string

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

Run the create command. Takes $command and delegates to $command::$method
public run ( string $command = null ) : boolean
$command string
Результат boolean

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

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

Holds library data from lithium\core\Libraries::get().
protected array $_library
Результат array

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

Name of library to use
public string $library
Результат string

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

The name of the template to use to generate the file. This allows you to add a custom template to be used in place of the core template for each command. Place templates in \extensions\command\create\template.
public string $template
Результат string