PHP Class Robo\Robo

Mostra file Open project: codegyre/robo Class Usage Examples

Protected Properties

Property Type Description
$container League\Container\ContainerInterface | null The currently active container object, or NULL if not initialized yet.

Public Methods

Method Description
addInflectors ( League\Container\ContainerInterface $container ) Add the Robo League\Container inflectors to the container
application ( ) : Robo\Application
config ( ) : Robo\Config
configureContainer ( League\Container\ContainerInterface $container, Application $app, robo\Config $config, null | Symfony\Component\Console\Input\InputInterface $input = null, null | Symfony\Component\Console\Output\OutputInterface $output = null ) Initialize a container with all of the default Robo services.
createDefaultApplication ( null | string $appName = null, null | string $appVersion = null ) : Robo\Application
createDefaultContainer ( null | Symfony\Component\Console\Input\InputInterface $input = null, null | Symfony\Component\Console\Output\OutputInterface $output = null, null | Robo\Application $app = null, null | Robo\Config $config = null ) : League\Container\Container | League\Container\ContainerInterface Create a container and initiailze it. If you wish to *change* anything defined in the container, then you should call \Robo::configureContainer() instead of this function.
getContainer ( ) : League\Container\ContainerInterface Returns the currently active global container.
hasContainer ( ) : boolean Returns TRUE if the container has been initialized, FALSE otherwise.
hasService ( string $id ) : boolean Indicates if a service is defined in the container.
input ( ) : Symfony\Component\Console\Input\InputInterface Return the input object.
logger ( ) : Consolidation\Log\Logger
output ( ) : Symfony\Component\Console\Output\OutputInterface Return the output object.
resultPrinter ( ) : Robo\Log\ResultPrinter Return the result printer object.
run ( string[] $argv, string $commandClasses, null | string $appName = null, null | string $appVersion = null, null | Symfony\Component\Console\Output\OutputInterface $output = null ) : integer Entrypoint for standalone Robo-based tools. See docs/framework.md.
service ( string $id ) : mixed Retrieves a service from the container.
setContainer ( League\Container\ContainerInterface $container ) Sets a new global container.
unsetContainer ( ) Unsets the global container.

Method Details

addInflectors() public static method

Add the Robo League\Container inflectors to the container
public static addInflectors ( League\Container\ContainerInterface $container )
$container League\Container\ContainerInterface

application() public static method

public static application ( ) : Robo\Application
return Robo\Application

config() public static method

public static config ( ) : Robo\Config
return Robo\Config

configureContainer() public static method

IMPORTANT: after calling this method, clients MUST call: $dispatcher = $container->get('eventDispatcher'); $app->setDispatcher($dispatcher); Any modification to the container should be done prior to fetching objects from it. It is recommended to use \Robo::createDefaultContainer() instead, which does all required setup for the caller, but has the limitation that the container it creates can only be extended, not modified.
public static configureContainer ( League\Container\ContainerInterface $container, Application $app, robo\Config $config, null | Symfony\Component\Console\Input\InputInterface $input = null, null | Symfony\Component\Console\Output\OutputInterface $output = null )
$container League\Container\ContainerInterface
$app Symfony\Component\Console\Application
$config robo\Config
$input null | Symfony\Component\Console\Input\InputInterface
$output null | Symfony\Component\Console\Output\OutputInterface

createDefaultApplication() public static method

public static createDefaultApplication ( null | string $appName = null, null | string $appVersion = null ) : Robo\Application
$appName null | string
$appVersion null | string
return Robo\Application

createDefaultContainer() public static method

Create a container and initiailze it. If you wish to *change* anything defined in the container, then you should call \Robo::configureContainer() instead of this function.
public static createDefaultContainer ( null | Symfony\Component\Console\Input\InputInterface $input = null, null | Symfony\Component\Console\Output\OutputInterface $output = null, null | Robo\Application $app = null, null | Robo\Config $config = null ) : League\Container\Container | League\Container\ContainerInterface
$input null | Symfony\Component\Console\Input\InputInterface
$output null | Symfony\Component\Console\Output\OutputInterface
$app null | Robo\Application
$config null | Robo\Config
return League\Container\Container | League\Container\ContainerInterface

getContainer() public static method

Returns the currently active global container.
public static getContainer ( ) : League\Container\ContainerInterface
return League\Container\ContainerInterface

hasContainer() public static method

Returns TRUE if the container has been initialized, FALSE otherwise.
public static hasContainer ( ) : boolean
return boolean

hasService() public static method

Indicates if a service is defined in the container.
public static hasService ( string $id ) : boolean
$id string The ID of the service to check.
return boolean TRUE if the specified service exists, FALSE otherwise.

input() public static method

Return the input object.
public static input ( ) : Symfony\Component\Console\Input\InputInterface
return Symfony\Component\Console\Input\InputInterface

logger() public static method

public static logger ( ) : Consolidation\Log\Logger
return Consolidation\Log\Logger

output() public static method

Return the output object.
public static output ( ) : Symfony\Component\Console\Output\OutputInterface
return Symfony\Component\Console\Output\OutputInterface

resultPrinter() public static method

Return the result printer object.
public static resultPrinter ( ) : Robo\Log\ResultPrinter
return Robo\Log\ResultPrinter

run() public static method

Entrypoint for standalone Robo-based tools. See docs/framework.md.
public static run ( string[] $argv, string $commandClasses, null | string $appName = null, null | string $appVersion = null, null | Symfony\Component\Console\Output\OutputInterface $output = null ) : integer
$argv string[]
$commandClasses string
$appName null | string
$appVersion null | string
$output null | Symfony\Component\Console\Output\OutputInterface
return integer

service() public static method

Use this method if the desired service is not one of those with a dedicated accessor method below. If it is listed below, those methods are preferred as they can return useful type hints.
public static service ( string $id ) : mixed
$id string The ID of the service to retrieve.
return mixed The specified service.

setContainer() public static method

Sets a new global container.
public static setContainer ( League\Container\ContainerInterface $container )
$container League\Container\ContainerInterface A new container instance to replace the current.

unsetContainer() public static method

Unsets the global container.
public static unsetContainer ( )

Property Details

$container protected_oe static_oe property

The currently active container object, or NULL if not initialized yet.
protected static ContainerInterface,League\Container|null $container
return League\Container\ContainerInterface | null