class Remove extends Base (View source)

Composer Remove

<?php
// simple execution
$this->taskComposerRemove()->run();
?>

Traits

This task specifies exactly one shell command.

This task is supposed to be executed as shell command.

Use this to add arguments and options to the $arguments property.

Class ExecTrait

Task input/output methods. TaskIO is 'used' in BaseTask, so any task that extends this class has access to all of the methods here.

Task input/output methods. TaskIO is 'used' in BaseTask, so any task that extends this class has access to all of the methods here.

LoggerAwareTrait

Properties

protected ConfigInterface $config from  ConfigAwareTrait
protected OutputAdapterInterface $outputAdapter from  VerbosityThresholdTrait
protected int $verbosityThreshold from  VerbosityThresholdTrait
protected OutputInterface $output from  OutputAwareTrait
protected TimeKeeper|null $timer from  Timer
protected null|ProgressIndicator $progressIndicator from  ProgressIndicatorAwareTrait
protected bool $background from  ExecTrait
protected null|int $timeout from  ExecTrait
protected null|int $idleTimeout from  ExecTrait
protected null|array $env from  ExecTrait
protected Process $process from  ExecTrait
protected resource|string $input from  ExecTrait
protected bool $interactive from  ExecTrait
protected bool $isPrinted from  ExecTrait
protected bool $isMetadataPrinted from  ExecTrait
protected string $workingDirectory from  ExecTrait
protected TimeKeeper $execTimer from  ExecCommand
protected string $arguments from  CommandArguments
protected string $command from  Base
protected bool $built from  Base
protected string $prefer from  Base
protected string $dev from  Base
protected string $ansi from  Base
protected string $nointeraction from  Base
protected $action {@inheritdoc}

Methods

$this
setConfig(ConfigInterface $config)

Set the config management object.

ConfigInterface
getConfig()

Get the config management object.

static string
configPrefix()

Any class that uses ConfigAwareTrait SHOULD override this method , and define a prefix for its configuration items. This is usually done in a base class. When used, this method should return a string that ends with a "."; see BaseTask::configPrefix().

static 
configClassIdentifier($classname)

No description

static 
configPostfix()

No description

static 
configure(string $key, mixed $value, ConfigInterface|null $config = null)

No description

mixed|null
getConfigValue(string $key, mixed|null $default = null)

No description

$this
setVerbosityThreshold(int $verbosityThreshold)

Required verbosity level before any TaskIO output will be produced.

int
verbosityThreshold()

No description

bool
hasOutputAdapter()

No description

writeMessage(string $message)

Print a message if the selected verbosity level is over this task's verbosity threshold.

$this
setOutput(OutputInterface $output)

No description

OutputInterface
output()

No description

OutputInterface
stderr()

No description

OutputInterface
getOutput() deprecated

Backwards compatibility

null|LoggerInterface
logger() deprecated

No description

from  TaskIO
printTaskInfo(string $text, null|array $context = null)

Print information about a task in progress.

from  TaskIO
printTaskSuccess(string $text, null|array $context = null)

Provide notification that some part of the task succeeded.

from  TaskIO
printTaskWarning(string $text, null|array $context = null)

Provide notification that there is something wrong, but execution can continue.

from  TaskIO
printTaskError(string $text, null|array $context = null)

Provide notification that some operation in the task failed, and the task cannot continue.

from  TaskIO
printTaskDebug($text, null|array $context = null)

Provide debugging notification. These messages are only displayed if the log level is VERBOSITY_DEBUG.

from  TaskIO
printTaskOutput(string $level, string $text, null|array $context) deprecated

No description

from  TaskIO
bool
hideTaskProgress()

No description

from  TaskIO
showTaskProgress(bool $inProgress)

No description

from  TaskIO
string
formatBytes(int $size, int $precision = 2)

Format a quantity of bytes.

from  TaskIO
string
getPrintedTaskName(null|object $task = null)

Get the formatted task name for use in task output.

from  TaskIO
array
getTaskContext(null|array $context = null)

No description

from  TaskIO
startTimer()

No description

from  Timer
stopTimer()

No description

from  Timer
resetTimer()

No description

from  Timer
float|null
getExecutionTime()

No description

from  Timer
$this
setProgressIndicator(null|ProgressIndicator $progressIndicator)

No description

null|bool
hideProgressIndicator()

No description

restoreProgressIndicator(bool $visible)

No description

bool
inProgress()

No description

advanceProgressIndicator(int $steps = 1)

No description

$this
inflect(InflectionInterface|mixed $parent)

Ask the provided parent class to inject all of the dependencies that it has and we need.

injectDependencies(mixed $child)

Take all dependencies availble to this task and inject any that are needed into the provided task. The general pattern is that, for every FooAwareInterface that this class implements, it should test to see if the child also implements the same interface, and if so, should call $child->setFoo($this->foo).

from  BaseTask
string
getCommandDescription()

No description

$this
detectInteractive()

Sets $this->interactive() based on posix_isatty().

$this
background(bool $arg = true)

Executes command in background mode (asynchronously)

$this
timeout(int $timeout)

Stop command if it runs longer then $timeout in seconds

$this
idleTimeout(int $timeout)

Stops command if it does not output something for a while

$this
env(string|array $env, bool|string $value = null)

Set a single environment variable, or multiple.

$this
envVars(array $env)

Sets the environment variables for the command

$this
setProcessInput(resource|string $input)

Pass an input to the process. Can be resource created with fopen() or string

$this
setInput(resource|string $input) deprecated

Pass an input to the process. Can be resource created with fopen() or string

$this
interactive(bool $interactive = true)

Attach tty to process for interactive input

bool
getPrinted()

Is command printing its output to screen

$this
dir(string $dir)

Changes working directory of command

$this
silent(bool $arg)

Shortcut for setting isPrinted() and isMetadataPrinted() to false.

$this
printed(bool $arg) deprecated

Should command output be printed

$this
printOutput(bool $arg)

Should command output be printed

$this
printMetadata(bool $arg)

Should command metadata be printed. I,e., command and timer.

execute(Process $process, callable $output_callback = null)

No description

stop()

No description

printAction(array $context = [])

No description

string
formatCommandDisplay(string $command)

No description

array
getResultData()

Gets the data array to be passed to Result().

getExecTimer()

No description

bool|string
findExecutablePhar(string $cmd)

Look for a "{$cmd}.phar" in the current working directory; return a string to exec it if it is found. Otherwise, look for an executable command of the same name via findExecutable.

bool|string
findExecutable(string $cmd)

Return the best path to the executable program with the provided name. Favor vendor/bin in the current project. If not found there, use whatever is on the $PATH.

bool|string
findProjectBin()

No description

string
useCallOnWindows(string $cmd)

Wrap Windows executables in 'call' per 7a88757d

executeCommand(string $command)

No description

$this
arg(string $arg)

Pass argument to executable. Its value will be automatically escaped.

$this
args(string|string[] $args)

Pass methods parameters as arguments to executable. Argument values are automatically escaped.

$this
rawArg(string $arg)

Pass the provided string in its raw (as provided) form as an argument to executable.

static string
escape(string $value)

Escape the provided value, unless it contains only alphanumeric plus a few other basic characters.

$this
option(string $option, string $value = null, string $separator = ' ')

Pass option to executable. Options are prefixed with -- , value can be provided in second parameter.

$this
options(array $options, string $separator = ' ')

Pass multiple options to executable. The associative array contains the key:value pairs that become --key value, for each item in the array.

$this
optionList(string $option, string|array $value = array(), string $separator = ' ')

Pass an option with multiple values to executable. Value can be a string or array.

__construct(null|string $pathToComposer = null)

No description

from  Base
$this
preferDist(bool $preferDist = true)

adds prefer-dist option to composer

from  Base
$this
preferSource()

adds prefer-source option to composer

from  Base
$this
dev(bool $dev = true)

No description

$this
noDev()

adds no-dev option to composer

from  Base
$this
ansi(bool $ansi = true)

adds ansi option to composer

from  Base
$this
noAnsi()

adds no-ansi option to composer

from  Base
$this
interaction(bool $interaction = true)

No description

from  Base
$this
noInteraction()

adds no-interaction option to composer

from  Base
$this
optimizeAutoloader(bool $optimize = true)

adds optimize-autoloader option to composer

from  Base
$this
ignorePlatformRequirements(bool $ignore = true)

adds ignore-platform-reqs option to composer

from  Base
$this
disablePlugins(bool $disable = true)

disable plugins

from  Base
$this
noScripts(bool $disable = true)

skip scripts

from  Base
$this
workingDir(string $dir)

adds --working-dir $dir option to composer

from  Base
buildCommand()

Copy class fields into command options as directed.

from  Base
string
getCommand()

Returns command that can be executed.

from  Base
dependency(array|string $project)

'remove' is a keyword, so it cannot be a method name.

$this
noProgress(bool $noProgress = true)

No description

$this
noUpdate(bool $noUpdate = true)

No description

$this
updateNoDev(bool $updateNoDev = true)

No description

$this
noUpdateWithDependencies(bool $updateWithDependencies = true)

No description

run()

No description

Details

$this setConfig(ConfigInterface $config)

Set the config management object.

Parameters

ConfigInterface $config

Return Value

$this

ConfigInterface getConfig()

Get the config management object.

Return Value

ConfigInterface

static protected string configPrefix()

Any class that uses ConfigAwareTrait SHOULD override this method , and define a prefix for its configuration items. This is usually done in a base class. When used, this method should return a string that ends with a "."; see BaseTask::configPrefix().

Return Value

string

static protected configClassIdentifier($classname)

No description

Parameters

$classname

static protected configPostfix()

No description

static configure(string $key, mixed $value, ConfigInterface|null $config = null)

No description

Parameters

string $key
mixed $value
ConfigInterface|null $config

protected mixed|null getConfigValue(string $key, mixed|null $default = null)

No description

Parameters

string $key
mixed|null $default

Return Value

mixed|null

$this setVerbosityThreshold(int $verbosityThreshold)

Required verbosity level before any TaskIO output will be produced.

e.g. OutputInterface::VERBOSITY_VERBOSE

Parameters

int $verbosityThreshold

Return Value

$this

int verbosityThreshold()

No description

Return Value

int

setOutputAdapter(OutputAdapterInterface $outputAdapter)

No description

Parameters

OutputAdapterInterface $outputAdapter

bool hasOutputAdapter()

No description

Return Value

bool

bool verbosityMeetsThreshold()

No description

Return Value

bool

writeMessage(string $message)

Print a message if the selected verbosity level is over this task's verbosity threshold.

Parameters

string $message

$this setOutput(OutputInterface $output)

No description

Parameters

OutputInterface $output

Return Value

$this

See also

\Robo\Contract\OutputAwareInterface::setOutput()

protected OutputInterface output()

No description

Return Value

OutputInterface

protected OutputInterface stderr()

No description

Return Value

OutputInterface

protected OutputInterface getOutput() deprecated

deprecated

Backwards compatibility

Return Value

OutputInterface

null|LoggerInterface logger() deprecated

deprecated

No description

Return Value

null|LoggerInterface

protected printTaskInfo(string $text, null|array $context = null)

Print information about a task in progress.

With the Symfony Console logger, NOTICE is displayed at VERBOSITY_VERBOSE and INFO is displayed at VERBOSITY_VERY_VERBOSE.

Robo overrides the default such that NOTICE is displayed at VERBOSITY_NORMAL and INFO is displayed at VERBOSITY_VERBOSE.

n.b. We should probably have printTaskNotice for our ordinary output, and use printTaskInfo for less interesting messages.

Parameters

string $text
null|array $context

protected printTaskSuccess(string $text, null|array $context = null)

Provide notification that some part of the task succeeded.

With the Symfony Console logger, success messages are remapped to NOTICE, and displayed in VERBOSITY_VERBOSE. When used with the Robo logger, success messages are displayed at VERBOSITY_NORMAL.

Parameters

string $text
null|array $context

protected printTaskWarning(string $text, null|array $context = null)

Provide notification that there is something wrong, but execution can continue.

Warning messages are displayed at VERBOSITY_NORMAL.

Parameters

string $text
null|array $context

protected printTaskError(string $text, null|array $context = null)

Provide notification that some operation in the task failed, and the task cannot continue.

Error messages are displayed at VERBOSITY_NORMAL.

Parameters

string $text
null|array $context

protected printTaskDebug($text, null|array $context = null)

Provide debugging notification. These messages are only displayed if the log level is VERBOSITY_DEBUG.

Parameters

$text
null|array $context

protected printTaskOutput(string $level, string $text, null|array $context) deprecated

deprecated

No description

Parameters

string $level

One of the \Psr\Log\LogLevel constant

string $text
null|array $context

protected bool hideTaskProgress()

No description

Return Value

bool

protected showTaskProgress(bool $inProgress)

No description

Parameters

bool $inProgress

protected string formatBytes(int $size, int $precision = 2)

Format a quantity of bytes.

Parameters

int $size
int $precision

Return Value

string

protected string getPrintedTaskName(null|object $task = null)

Get the formatted task name for use in task output.

This is placed in the task context under 'name', and used as the log label by Robo\Common\RoboLogStyle, which is inserted at the head of log messages by Robo\Common\CustomLogStyle::formatMessage().

Parameters

null|object $task

Return Value

string

protected array getTaskContext(null|array $context = null)

No description

Parameters

null|array $context

Return Value

array

Context information.

protected startTimer()

No description

protected stopTimer()

No description

protected resetTimer()

No description

protected float|null getExecutionTime()

No description

Return Value

float|null

int progressIndicatorSteps()

No description

Return Value

int

$this setProgressIndicator(null|ProgressIndicator $progressIndicator)

No description

Parameters

null|ProgressIndicator $progressIndicator

Return Value

$this

protected null|bool hideProgressIndicator()

No description

Return Value

null|bool

protected showProgressIndicator()

No description

protected restoreProgressIndicator(bool $visible)

No description

Parameters

bool $visible

protected int getTotalExecutionTime()

No description

Return Value

int

protected startProgressIndicator()

No description

protected bool inProgress()

No description

Return Value

bool

protected stopProgressIndicator()

No description

protected disableProgressIndicator()

No description

protected detatchProgressIndicator()

No description

protected advanceProgressIndicator(int $steps = 1)

No description

Parameters

int $steps

$this inflect(InflectionInterface|mixed $parent)

Ask the provided parent class to inject all of the dependencies that it has and we need.

Parameters

InflectionInterface|mixed $parent

Return Value

$this

injectDependencies(mixed $child)

Take all dependencies availble to this task and inject any that are needed into the provided task. The general pattern is that, for every FooAwareInterface that this class implements, it should test to see if the child also implements the same interface, and if so, should call $child->setFoo($this->foo).

The benefits of this are pretty large. Any time an object that implements InflectionInterface is created, just call $child->inflect($this), and any available optional dependencies will be hooked up via setter injection.

The required dependencies of an object should be provided via constructor injection, not inflection.

Parameters

mixed $child

An object with one or more *AwareInterfaces implemented.

abstract string getCommandDescription()

No description

Return Value

string

$this detectInteractive()

Sets $this->interactive() based on posix_isatty().

Return Value

$this

$this background(bool $arg = true)

Executes command in background mode (asynchronously)

Parameters

bool $arg

Return Value

$this

$this timeout(int $timeout)

Stop command if it runs longer then $timeout in seconds

Parameters

int $timeout

Return Value

$this

$this idleTimeout(int $timeout)

Stops command if it does not output something for a while

Parameters

int $timeout

Return Value

$this

$this env(string|array $env, bool|string $value = null)

Set a single environment variable, or multiple.

Parameters

string|array $env
bool|string $value

Return Value

$this

$this envVars(array $env)

Sets the environment variables for the command

Parameters

array $env

Return Value

$this

$this setProcessInput(resource|string $input)

Pass an input to the process. Can be resource created with fopen() or string

Parameters

resource|string $input

Return Value

$this

$this setInput(resource|string $input) deprecated

deprecated

Pass an input to the process. Can be resource created with fopen() or string

Parameters

resource|string $input

Return Value

$this

$this interactive(bool $interactive = true)

Attach tty to process for interactive input

Parameters

bool $interactive

Return Value

$this

bool getPrinted()

Is command printing its output to screen

Return Value

bool

$this dir(string $dir)

Changes working directory of command

Parameters

string $dir

Return Value

$this

$this silent(bool $arg)

Shortcut for setting isPrinted() and isMetadataPrinted() to false.

Parameters

bool $arg

Return Value

$this

$this printed(bool $arg) deprecated

deprecated

Should command output be printed

Parameters

bool $arg

Return Value

$this

$this printOutput(bool $arg)

Should command output be printed

Parameters

bool $arg

Return Value

$this

$this printMetadata(bool $arg)

Should command metadata be printed. I,e., command and timer.

Parameters

bool $arg

Return Value

$this

protected ResultData execute(Process $process, callable $output_callback = null)

No description

Parameters

Process $process
callable $output_callback

Return Value

ResultData

protected stop()

No description

protected printAction(array $context = [])

No description

Parameters

array $context

protected string formatCommandDisplay(string $command)

No description

Parameters

string $command

Return Value

string

protected array getResultData()

Gets the data array to be passed to Result().

Return Value

array

The data array passed to Result().

protected TimeKeeper getExecTimer()

No description

Return Value

TimeKeeper

protected bool|string findExecutablePhar(string $cmd)

Look for a "{$cmd}.phar" in the current working directory; return a string to exec it if it is found. Otherwise, look for an executable command of the same name via findExecutable.

Parameters

string $cmd

Return Value

bool|string

protected bool|string findExecutable(string $cmd)

Return the best path to the executable program with the provided name. Favor vendor/bin in the current project. If not found there, use whatever is on the $PATH.

Parameters

string $cmd

Return Value

bool|string

protected bool|string findProjectBin()

No description

Return Value

bool|string

protected string useCallOnWindows(string $cmd)

Wrap Windows executables in 'call' per 7a88757d

Parameters

string $cmd

Return Value

string

protected Result executeCommand(string $command)

No description

Parameters

string $command

Return Value

Result

$this arg(string $arg)

Pass argument to executable. Its value will be automatically escaped.

Parameters

string $arg

Return Value

$this

$this args(string|string[] $args)

Pass methods parameters as arguments to executable. Argument values are automatically escaped.

Parameters

string|string[] $args

Return Value

$this

$this rawArg(string $arg)

Pass the provided string in its raw (as provided) form as an argument to executable.

Parameters

string $arg

Return Value

$this

static string escape(string $value)

Escape the provided value, unless it contains only alphanumeric plus a few other basic characters.

Parameters

string $value

Return Value

string

$this option(string $option, string $value = null, string $separator = ' ')

Pass option to executable. Options are prefixed with -- , value can be provided in second parameter.

Option values are automatically escaped.

Parameters

string $option
string $value
string $separator

Return Value

$this

$this options(array $options, string $separator = ' ')

Pass multiple options to executable. The associative array contains the key:value pairs that become --key value, for each item in the array.

Values are automatically escaped.

Parameters

array $options
string $separator

Return Value

$this

$this optionList(string $option, string|array $value = array(), string $separator = ' ')

Pass an option with multiple values to executable. Value can be a string or array.

Option values are automatically escaped.

Parameters

string $option
string|array $value
string $separator

Return Value

$this

__construct(null|string $pathToComposer = null)

No description

Parameters

null|string $pathToComposer

Exceptions

TaskException

$this preferDist(bool $preferDist = true)

adds prefer-dist option to composer

Parameters

bool $preferDist

Return Value

$this

$this preferSource()

adds prefer-source option to composer

Return Value

$this

$this dev(bool $dev = true)

No description

Parameters

bool $dev

Return Value

$this

$this noDev()

adds no-dev option to composer

Return Value

$this

$this ansi(bool $ansi = true)

adds ansi option to composer

Parameters

bool $ansi

Return Value

$this

$this noAnsi()

adds no-ansi option to composer

Return Value

$this

$this interaction(bool $interaction = true)

No description

Parameters

bool $interaction

Return Value

$this

$this noInteraction()

adds no-interaction option to composer

Return Value

$this

$this optimizeAutoloader(bool $optimize = true)

adds optimize-autoloader option to composer

Parameters

bool $optimize

Return Value

$this

$this ignorePlatformRequirements(bool $ignore = true)

adds ignore-platform-reqs option to composer

Parameters

bool $ignore

Return Value

$this

$this disablePlugins(bool $disable = true)

disable plugins

Parameters

bool $disable

Return Value

$this

$this noScripts(bool $disable = true)

skip scripts

Parameters

bool $disable

Return Value

$this

$this workingDir(string $dir)

adds --working-dir $dir option to composer

Parameters

string $dir

Return Value

$this

buildCommand()

Copy class fields into command options as directed.

string getCommand()

Returns command that can be executed.

This method is used to pass generated command from one task to another.

Return Value

string

Remove dependency(array|string $project)

'remove' is a keyword, so it cannot be a method name.

Parameters

array|string $project

Return Value

Remove

$this noProgress(bool $noProgress = true)

No description

Parameters

bool $noProgress

Return Value

$this

$this noUpdate(bool $noUpdate = true)

No description

Parameters

bool $noUpdate

Return Value

$this

$this updateNoDev(bool $updateNoDev = true)

No description

Parameters

bool $updateNoDev

Return Value

$this

$this noUpdateWithDependencies(bool $updateWithDependencies = true)

No description

Parameters

bool $updateWithDependencies

Return Value

$this

Result run()

No description

Return Value

Result