TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder Class Reference
Inheritance diagram for TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder:
TYPO3\CMS\Core\SingletonInterface Tx_Extbase_MVC_CLI_RequestBuilder

Public Member Functions

 build ($commandLine='', $callingScript='./typo3/cli_dispatch.phpsh extbase')
 

Protected Member Functions

 parseRawCommandLineArguments (array $rawCommandLineArguments, $controllerObjectName, $controllerCommandName)
 
 extractArgumentNameFromCommandLinePart ($commandLinePart)
 
 getValueOfCurrentCommandLineOption ($currentArgument, array &$rawCommandLineArguments, $expectedArgumentType)
 

Protected Attributes

 $objectManager
 
 $reflectionService
 
 $commandManager
 
 $configurationManager
 

Detailed Description

This file is part of the TYPO3 CMS project.

It is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, either version 2 of the License, or any later version.

For the full copyright and license information, please read the LICENSE.txt file that was distributed with this source code.

The TYPO3 project - inspiring people to share! Builds a CLI request object from the raw command call

http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later

Definition at line 21 of file RequestBuilder.php.

Member Function Documentation

◆ build()

TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder::build (   $commandLine = '',
  $callingScript = './typo3/cli_dispatch.phpsh extbase' 
)

Builds a CLI request object from a command line.

The given command line may be a string (e.g. "myextension: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.

Parameters
mixed$commandLineThe command line, either as a string or as an array
string$callingScriptThe calling script (usually ./typo3/cli_dispatch.phpsh)
Returns
The CLI request as an object

Builds a web request object from the raw HTTP information and the configuration

Returns
The web request as an object

Definition at line 58 of file RequestBuilder.php.

References TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder\parseRawCommandLineArguments().

◆ extractArgumentNameFromCommandLinePart()

TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder::extractArgumentNameFromCommandLinePart (   $commandLinePart)
protected

Extracts the option or argument name from the name / value pair of a command line.

Parameters
string$commandLinePartPart of the command line, e.g. "my-important-option=SomeInterestingValue @return string The lowercased argument name, e.g. "myimportantoption

Definition at line 163 of file RequestBuilder.php.

Referenced by TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder\parseRawCommandLineArguments().

◆ getValueOfCurrentCommandLineOption()

TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder::getValueOfCurrentCommandLineOption (   $currentArgument,
array &  $rawCommandLineArguments,
  $expectedArgumentType 
)
protected

Returns the value of the first argument of the given input array. Shifts the parsed argument off the array.

Parameters
string$currentArgumentThe current argument
array&$rawCommandLineArgumentsArray of the remaining command line arguments
string$expectedArgumentTypeThe expected type of the current argument, because booleans get special attention
Returns
string The value of the first argument

Definition at line 176 of file RequestBuilder.php.

Referenced by TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder\parseRawCommandLineArguments().

◆ parseRawCommandLineArguments()

TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder::parseRawCommandLineArguments ( array  $rawCommandLineArguments,
  $controllerObjectName,
  $controllerCommandName 
)
protected

Takes an array of unparsed command line arguments and options and converts it separated by named arguments, options and unnamed arguments.

Parameters
array$rawCommandLineArgumentsThe unparsed command parts (such as "--foo") as an array
string$controllerObjectNameObject name of the designated command controller
string$controllerCommandNameCommand name of the recognized command (ie. method name without "Command" suffix)
Exceptions

Definition at line 96 of file RequestBuilder.php.

References TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder\extractArgumentNameFromCommandLinePart(), and TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder\getValueOfCurrentCommandLineOption().

Referenced by TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder\build().

Member Data Documentation

◆ $commandManager

TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder::$commandManager
protected

Definition at line 39 of file RequestBuilder.php.

◆ $configurationManager

TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder::$configurationManager
protected

Definition at line 45 of file RequestBuilder.php.

◆ $objectManager

TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder::$objectManager
protected

Definition at line 27 of file RequestBuilder.php.

◆ $reflectionService

TYPO3\CMS\Extbase\Mvc\Cli\RequestBuilder::$reflectionService
protected

Definition at line 33 of file RequestBuilder.php.