PHP Class Neos\Flow\Cli\RequestBuilder

Datei anzeigen Open project: neos/flow-development-collection Class Usage Examples

Protected Properties

Property Type Description
$commandManager CommandManager
$environment Neos\Flow\Utility\Environment
$objectManager Neos\Flow\ObjectManagement\ObjectManagerInterface
$packageManager Neos\Flow\Package\PackageManagerInterface

Public Methods

Method Description
build ( mixed $commandLine ) : Request Builds a CLI request object from a command line.
injectCommandManager ( CommandManager $commandManager ) : void
injectEnvironment ( Environment $environment ) : void
injectObjectManager ( Neos\Flow\ObjectManagement\ObjectManagerInterface $objectManager ) : void
injectPackageManager ( Neos\Flow\Package\PackageManagerInterface $packageManager ) : void

Protected Methods

Method Description
extractArgumentNameFromCommandLinePart ( string $commandLinePart ) : string Extracts the option or argument name from the name / value pair of a command line.
getValueOfCurrentCommandLineOption ( string $currentArgument, array &$rawCommandLineArguments, string $expectedArgumentType ) : string Returns the value of the first argument of the given input array. Shifts the parsed argument off the array.
parseRawCommandLineArguments ( array $rawCommandLineArguments, string $controllerObjectName, string $controllerCommandName ) : array Takes an array of unparsed command line arguments and options and converts it separated by named arguments, options and unnamed arguments.

Method Details

build() public method

The given command line may be a string (e.g. "mypackage:foo do-that-thing --force") or an array consisting of the individual parts. The array must not include the script name (like in $argv) but start with command right away.
public build ( mixed $commandLine ) : Request
$commandLine mixed The command line, either as a string or as an array
return Request The CLI request as an object

extractArgumentNameFromCommandLinePart() protected method

Extracts the option or argument name from the name / value pair of a command line.
protected extractArgumentNameFromCommandLinePart ( string $commandLinePart ) : string
$commandLinePart string Part of the command line, e.g. "my-important-option=SomeInterestingValue"
return string The lowercased argument name, e.g. "myimportantoption"

getValueOfCurrentCommandLineOption() protected method

Returns the value of the first argument of the given input array. Shifts the parsed argument off the array.
protected getValueOfCurrentCommandLineOption ( string $currentArgument, array &$rawCommandLineArguments, string $expectedArgumentType ) : string
$currentArgument string The current argument
$rawCommandLineArguments array
$expectedArgumentType string The expected type of the current argument, because booleans get special attention
return string The value of the first argument

injectCommandManager() public method

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

injectEnvironment() public method

public injectEnvironment ( Environment $environment ) : void
$environment Neos\Flow\Utility\Environment
return void

injectObjectManager() public method

public injectObjectManager ( Neos\Flow\ObjectManagement\ObjectManagerInterface $objectManager ) : void
$objectManager Neos\Flow\ObjectManagement\ObjectManagerInterface
return void

injectPackageManager() public method

public injectPackageManager ( Neos\Flow\Package\PackageManagerInterface $packageManager ) : void
$packageManager Neos\Flow\Package\PackageManagerInterface
return void

parseRawCommandLineArguments() protected method

Takes an array of unparsed command line arguments and options and converts it separated by named arguments, options and unnamed arguments.
protected parseRawCommandLineArguments ( array $rawCommandLineArguments, string $controllerObjectName, string $controllerCommandName ) : array
$rawCommandLineArguments array The unparsed command parts (such as "--foo") as an array
$controllerObjectName string Object name of the designated command controller
$controllerCommandName string Command name of the recognized command (ie. method name without "Command" suffix)
return array All and exceeding command line arguments

Property Details

$commandManager protected_oe property

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

$environment protected_oe property

protected Environment,Neos\Flow\Utility $environment
return Neos\Flow\Utility\Environment

$objectManager protected_oe property

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

$packageManager protected_oe property

protected PackageManagerInterface,Neos\Flow\Package $packageManager
return Neos\Flow\Package\PackageManagerInterface