PHP Class Neos\Flow\Cli\CommandController

Inheritance: implements Neos\Flow\Mvc\Controller\ControllerInterface
Datei anzeigen Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$arguments Neos\Flow\Mvc\Controller\Arguments
$commandManager CommandManager
$commandMethodName string Name of the command method
$objectManager Neos\Flow\ObjectManagement\ObjectManagerInterface
$output ConsoleOutput
$request Request
$response Response

Public Methods

Method Description
__construct ( ) Constructs the command controller
getFlowInvocationString ( ) : string Returns the CLI Flow command depending on the environment
injectCommandManager ( CommandManager $commandManager ) : void
injectObjectManager ( Neos\Flow\ObjectManagement\ObjectManagerInterface $objectManager ) : void Injects the reflection service
processRequest ( Neos\Flow\Mvc\RequestInterface $request, Neos\Flow\Mvc\ResponseInterface $response ) : void Processes a command line request.

Protected Methods

Method Description
callCommandMethod ( ) : void Calls the specified command method and passes the arguments.
forward ( string $commandName, string $controllerObjectName = null, array $arguments = [] ) : void Forwards the request to another command and / or CommandController.
initializeCommandMethodArguments ( ) : void Initializes the arguments array of this controller by creating an empty argument object for each of the method arguments found in the designated command method.
mapRequestArgumentsToControllerArguments ( ) : void Maps arguments delivered by the request object to the local controller arguments.
output ( string $text, array $arguments = [] ) : void Outputs specified text to the console window You can specify arguments that will be passed to the text via sprintf
outputFormatted ( string $text = '', array $arguments = [], integer $leftPadding ) : void Formats the given text to fit into MAXIMUM_LINE_LENGTH and outputs it to the console window
outputLine ( string $text = '', array $arguments = [] ) : void Outputs specified text to the console window and appends a line break
quit ( integer $exitCode ) : void Exits the CLI through the dispatcher and makes sure that Flow is properly shut down.
resolveCommandMethodName ( ) : string Resolves and checks the current command method name
sendAndExit ( integer $exitCode ) : void Sends the response and exits the CLI without any further code execution Should be used for commands that flush code caches.

Method Details

__construct() public method

Constructs the command controller
public __construct ( )

callCommandMethod() protected method

If the command returns a string, it is appended to the content in the response object. If the command doesn't return anything and a valid view exists, the view is rendered automatically.
protected callCommandMethod ( ) : void
return void

forward() protected method

Request is directly transferred to the other command / controller without the need for a new request.
protected forward ( string $commandName, string $controllerObjectName = null, array $arguments = [] ) : void
$commandName string
$controllerObjectName string
$arguments array
return void

getFlowInvocationString() public method

Returns the CLI Flow command depending on the environment
public getFlowInvocationString ( ) : string
return string

initializeCommandMethodArguments() protected method

Initializes the arguments array of this controller by creating an empty argument object for each of the method arguments found in the designated command method.
protected initializeCommandMethodArguments ( ) : void
return void

injectCommandManager() public method

public injectCommandManager ( CommandManager $commandManager ) : void
$commandManager CommandManager
return void

injectObjectManager() public method

Injects the reflection service
public injectObjectManager ( Neos\Flow\ObjectManagement\ObjectManagerInterface $objectManager ) : void
$objectManager Neos\Flow\ObjectManagement\ObjectManagerInterface
return void

mapRequestArgumentsToControllerArguments() protected method

Maps arguments delivered by the request object to the local controller arguments.

output() protected method

Outputs specified text to the console window You can specify arguments that will be passed to the text via sprintf
See also: http://www.php.net/sprintf
protected output ( string $text, array $arguments = [] ) : void
$text string Text to output
$arguments array Optional arguments to use for sprintf
return void

outputFormatted() protected method

Formats the given text to fit into MAXIMUM_LINE_LENGTH and outputs it to the console window
See also: outputLine()
protected outputFormatted ( string $text = '', array $arguments = [], integer $leftPadding ) : void
$text string Text to output
$arguments array Optional arguments to use for sprintf
$leftPadding integer The number of spaces to use for indentation
return void

outputLine() protected method

Outputs specified text to the console window and appends a line break
See also: output()
See also: outputLines()
protected outputLine ( string $text = '', array $arguments = [] ) : void
$text string Text to output
$arguments array Optional arguments to use for sprintf
return void

processRequest() public method

Processes a command line request.
public processRequest ( Neos\Flow\Mvc\RequestInterface $request, Neos\Flow\Mvc\ResponseInterface $response ) : void
$request Neos\Flow\Mvc\RequestInterface The request object
$response Neos\Flow\Mvc\ResponseInterface The response, modified by this handler
return void

quit() protected method

If your command relies on functionality which is triggered through the Bootstrap shutdown (such as the persistence framework), you must use quit() instead of exit().
protected quit ( integer $exitCode ) : void
$exitCode integer Exit code to return on exit (see http://www.php.net/exit)
return void

resolveCommandMethodName() protected method

Note: The resulting command method name might not have the correct case, which isn't a problem because PHP is case insensitive regarding method names.
protected resolveCommandMethodName ( ) : string
return string Method name of the current command

sendAndExit() protected method

Sends the response and exits the CLI without any further code execution Should be used for commands that flush code caches.
protected sendAndExit ( integer $exitCode ) : void
$exitCode integer Exit code to return on exit
return void

Property Details

$arguments protected_oe property

protected Arguments,Neos\Flow\Mvc\Controller $arguments
return Neos\Flow\Mvc\Controller\Arguments

$commandManager protected_oe property

protected CommandManager,Neos\Flow\Cli $commandManager
return CommandManager

$commandMethodName protected_oe property

Name of the command method
protected string $commandMethodName
return string

$objectManager protected_oe property

protected ObjectManagerInterface,Neos\Flow\ObjectManagement $objectManager
return Neos\Flow\ObjectManagement\ObjectManagerInterface

$output protected_oe property

protected ConsoleOutput,Neos\Flow\Cli $output
return ConsoleOutput

$request protected_oe property

protected Request,Neos\Flow\Cli $request
return Request

$response protected_oe property

protected Response,Neos\Flow\Cli $response
return Response