PHP 클래스 lithium\console\command\Create

li3 create --template=controller Posts li3 create --template=model Posts
상속: extends lithium\console\Command
파일 보기 프로젝트 열기: unionofrad/lithium 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$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.

보호된 프로퍼티들

프로퍼티 타입 설명
$_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