class Robo (View source)

Manages the container reference and other static data. Favor using dependency injection wherever possible. Avoid using this class directly, unless setting up a custom DI container.

Constants

APPLICATION_NAME

private VERSION

Properties

static protected ContainerInterface|null $container

The currently active container object, or NULL if not initialized yet.

Methods

static int
run(string[] $argv, string $commandClasses, null|string $appName = null, null|string $appVersion = null, null|OutputInterface $output = null, null|string $repository = null)

Entrypoint for standalone Robo-based tools. See docs/framework.md.

static 
version()

Only provide access to the Robo version via Robo::version() so that roave/backward-compatibility-check does not complain about b/c breaks when the version number changes.

static 
setContainer(ContainerInterface $container)

Sets a new global container.

static 
unsetContainer()

Unsets the global container.

static ContainerInterface
getContainer()

Returns the currently active global container.

static bool
hasContainer()

Returns TRUE if the container has been initialized, FALSE otherwise.

static ConfigInterface
createConfiguration(string[] $paths)

Create a config object and load it from the provided paths.

static 
loadConfiguration(string[] $paths, null|ConfigInterface $config = null)

Use a simple config loader to load configuration values from specified paths

static ContainerInterface
createContainer(null|Application $app = null, null|ConfigInterface $config = null, null|ClassLoader $classLoader = null)

Create a container for Robo application.

static ContainerInterface
createDefaultContainer(null|InputInterface $input = null, null|OutputInterface $output = null, null|Application $app = null, null|ConfigInterface $config = null, null|ClassLoader $classLoader = null) deprecated

Create a container and initiailze it. If you wish to change anything defined in the container, then you should call Robo::createContainer() and Robo::finalizeContainer() instead of this function.

static 
finalizeContainer(ContainerInterface $container)

Do final initialization to the provided container. Make any necessary modifications to the container before calling this method.

static DefinitionInterface
addShared(ContainerInterface $container, string $id, mixed $concrete)

Adds a shared instance to the container. This is to support 3.x and 4.x of league/container.

static 
configureContainer(ContainerInterface $container, Application $app, ConfigInterface $config, null|InputInterface $input = null, null|OutputInterface $output = null, null|ClassLoader $classLoader = null)

Initialize a container with all of the default Robo services.

static Application
createDefaultApplication(null|string $appName = null, null|string $appVersion = null)

No description

static 
addInflectors(ContainerInterface $container)

Add the Robo League\Container inflectors to the container

static mixed
service(string $id)

Retrieves a service from the container.

static bool
hasService(string $id)

Indicates if a service is defined in the container.

static ResultPrinter
resultPrinter() deprecated

Return the result printer object.

static ConfigInterface
config()

No description

static Logger
logger()

No description

static Application
application()

No description

static OutputInterface
output()

Return the output object.

static InputInterface
input()

Return the input object.

static ProcessExecutor
process(Process $process)

No description

static array
register(Application $app, $handlers)

No description

static null|object
registerSingle(Application $app, string|object $handler)

No description

static null|object
instantiate(string|object $handler)

No description

Details

static int run(string[] $argv, string $commandClasses, null|string $appName = null, null|string $appVersion = null, null|OutputInterface $output = null, null|string $repository = null)

Entrypoint for standalone Robo-based tools. See docs/framework.md.

Parameters

string[] $argv
string $commandClasses
null|string $appName
null|string $appVersion
null|OutputInterface $output
null|string $repository

Return Value

int

static version()

Only provide access to the Robo version via Robo::version() so that roave/backward-compatibility-check does not complain about b/c breaks when the version number changes.

static setContainer(ContainerInterface $container)

Sets a new global container.

Parameters

ContainerInterface $container

A new container instance to replace the current.

static unsetContainer()

Unsets the global container.

static ContainerInterface getContainer()

Returns the currently active global container.

Return Value

ContainerInterface

Exceptions

RuntimeException

static bool hasContainer()

Returns TRUE if the container has been initialized, FALSE otherwise.

Return Value

bool

static ConfigInterface createConfiguration(string[] $paths)

Create a config object and load it from the provided paths.

Parameters

string[] $paths

Return Value

ConfigInterface

static loadConfiguration(string[] $paths, null|ConfigInterface $config = null)

Use a simple config loader to load configuration values from specified paths

Parameters

string[] $paths
null|ConfigInterface $config

static ContainerInterface createContainer(null|Application $app = null, null|ConfigInterface $config = null, null|ClassLoader $classLoader = null)

Create a container for Robo application.

After calling this method you may add any additional items you wish to manage in your application. After you do that, you must call Robo::finalizeContainer($container) to complete container initialization.

Parameters

null|Application $app
null|ConfigInterface $config
null|ClassLoader $classLoader

Return Value

ContainerInterface

static ContainerInterface createDefaultContainer(null|InputInterface $input = null, null|OutputInterface $output = null, null|Application $app = null, null|ConfigInterface $config = null, null|ClassLoader $classLoader = null) deprecated

deprecated Use createContainer instead

Create a container and initiailze it. If you wish to change anything defined in the container, then you should call Robo::createContainer() and Robo::finalizeContainer() instead of this function.

Parameters

null|InputInterface $input
null|OutputInterface $output
null|Application $app
null|ConfigInterface $config
null|ClassLoader $classLoader

Return Value

ContainerInterface

static finalizeContainer(ContainerInterface $container)

Do final initialization to the provided container. Make any necessary modifications to the container before calling this method.

Parameters

ContainerInterface $container

static DefinitionInterface addShared(ContainerInterface $container, string $id, mixed $concrete)

Adds a shared instance to the container. This is to support 3.x and 4.x of league/container.

Parameters

ContainerInterface $container
string $id
mixed $concrete

Return Value

DefinitionInterface

static configureContainer(ContainerInterface $container, Application $app, ConfigInterface $config, null|InputInterface $input = null, null|OutputInterface $output = null, null|ClassLoader $classLoader = null)

Initialize a container with all of the default Robo services.

IMPORTANT: after calling this method, clients MUST call:

Robo::finalizeContainer($container);

Any modification to the container should be done prior to fetching objects from it.

It is recommended to use Robo::createContainer() instead.

Parameters

ContainerInterface $container
Application $app
ConfigInterface $config
null|InputInterface $input
null|OutputInterface $output
null|ClassLoader $classLoader

static Application createDefaultApplication(null|string $appName = null, null|string $appVersion = null)

No description

Parameters

null|string $appName
null|string $appVersion

Return Value

Application

static addInflectors(ContainerInterface $container)

Add the Robo League\Container inflectors to the container

Parameters

ContainerInterface $container

static mixed service(string $id)

Retrieves a service from the container.

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.

Parameters

string $id

The ID of the service to retrieve.

Return Value

mixed

The specified service.

static bool hasService(string $id)

Indicates if a service is defined in the container.

Parameters

string $id

The ID of the service to check.

Return Value

bool

TRUE if the specified service exists, FALSE otherwise.

static ResultPrinter resultPrinter() deprecated

deprecated

Return the result printer object.

Return Value

ResultPrinter

static ConfigInterface config()

No description

Return Value

ConfigInterface

static Logger logger()

No description

Return Value

Logger

static Application application()

No description

Return Value

Application

static OutputInterface output()

Return the output object.

Return Value

OutputInterface

static InputInterface input()

Return the input object.

Return Value

InputInterface

static ProcessExecutor process(Process $process)

No description

Parameters

Process $process

Return Value

ProcessExecutor

static array register(Application $app, $handlers)

No description

Parameters

Application $app
$handlers

Return Value

array

static protected null|object registerSingle(Application $app, string|object $handler)

No description

Parameters

Application $app
string|object $handler

Return Value

null|object

static null|object instantiate(string|object $handler)

No description

Parameters

string|object $handler

Return Value

null|object