PHP Class Platformsh\Cli\Command\CommandBase

Inheritance: extends Symfony\Component\Console\Command\Command, implements Platformsh\Cli\Command\CanHideInListInterface, use trait Platformsh\Cli\Command\HasExamplesTrait
Afficher le fichier Open project: commerceguys/platform-cli Class Usage Examples

Protected Properties

Свойство Type Description
$canBeRunMultipleTimes
$config Platformsh\Cli\CliConfig
$envArgName
$hiddenInList
$interactive boolean
$local
$localProject Platformsh\Cli\Local\LocalProject | null
$output Symfony\Component\Console\Output\OutputInterface | null
$runningViaMulti
$stdErr Symfony\Component\Console\Output\OutputInterface | null

Méthodes publiques

Méthode Description
__construct ( $name = null )
canBeRunMultipleTimes ( )
getCurrentEnvironment ( Platformsh\Client\Model\Project $expectedProject = null, boolean | null $refresh = null ) : Platformsh\Client\Model\Environment | false Get the current environment if the user is in a project directory.
getCurrentProject ( ) : Platformsh\Client\Model\Project | false Get the current project if the user is in a project directory.
getHelper ( $name )
getProcessedHelp ( )
getProjectRoot ( ) : string | false
getSynopsis ( $short = false )
getVisibleAliases ( ) : array Get aliases that should be visible in help.
isHiddenInList ( )
isLocal ( ) : boolean Is this a local command? (if it does not make API requests)
login ( ) Log in the user.
setRunningViaMulti ( $runningViaMulti = true )
updateDrushAliases ( EnvironmentsChangedEvent $event ) Update the user's local Drush aliases.

Méthodes protégées

Méthode Description
addAppOption ( ) : CommandBase Add the --app option.
addEnvironmentOption ( ) : CommandBase Add the --environment option.
addNoWaitOption ( string $description = 'Do not wait for the operation to complete' ) : CommandBase Add the --no-wait option.
addProjectOption ( ) : CommandBase Add the --project and --host options.
api ( ) : Api Set up the API object.
checkUpdates ( boolean $reset = false ) Check for updates.
debug ( string $message ) Print a message if debug output is enabled.
getHomeDir ( ) : string
getSelectedEnvironment ( ) : Platformsh\Client\Model\Environment Get the environment selected by the user.
getSelectedProject ( ) : Platformsh\Client\Model\Project Get the project selected by the user.
getSessionsDir ( ) : string
hasSelectedEnvironment ( ) : boolean Check whether a single environment is selected.
hasSelectedProject ( ) : boolean Check whether a project is selected.
initialize ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
interact ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
isTerminal ( Symfony\Component\Console\Output\OutputInterface $output ) : boolean Detect automatically whether the output is a TTY terminal.
parseProjectId ( string $url ) : array Parse the project ID and possibly other details from a provided URL.
promptLegacyMigrate ( ) Prompt the user to migrate from the legacy project file structure.
rebuildWarning ( ) Warn the user that the remote environment needs rebuilding.
runOtherCommand ( string $name, array $arguments = [], Symfony\Component\Console\Output\OutputInterface $output = null ) : integer Run another CLI command.
selectApp ( Symfony\Component\Console\Input\InputInterface $input, callable $filter = null ) : string | null Find the name of the app the user wants to use for an SSH command.
selectEnvironment ( string | null $environmentId = null ) : Platformsh\Client\Model\Environment Select the current environment for the user.
selectProject ( string $projectId = null, string $host = null ) : Platformsh\Client\Model\Project Select the project for the user, based on input or the environment.
selectedProjectIsCurrent ( ) : boolean
setHiddenAliases ( array $hiddenAliases ) : CommandBase Add aliases that should be hidden from help.
setProjectRoot ( string $root )
validateInput ( Symfony\Component\Console\Input\InputInterface $input, boolean $envNotRequired = false )

Method Details

__construct() public méthode

public __construct ( $name = null )

addAppOption() protected méthode

Add the --app option.
protected addAppOption ( ) : CommandBase
Résultat CommandBase

addEnvironmentOption() protected méthode

Add the --environment option.
protected addEnvironmentOption ( ) : CommandBase
Résultat CommandBase

addNoWaitOption() protected méthode

Add the --no-wait option.
protected addNoWaitOption ( string $description = 'Do not wait for the operation to complete' ) : CommandBase
$description string
Résultat CommandBase

addProjectOption() protected méthode

Add the --project and --host options.
protected addProjectOption ( ) : CommandBase
Résultat CommandBase

api() protected méthode

Set up the API object.
protected api ( ) : Api
Résultat Platformsh\Cli\Api

canBeRunMultipleTimes() public méthode

checkUpdates() protected méthode

Check for updates.
protected checkUpdates ( boolean $reset = false )
$reset boolean

debug() protected méthode

Print a message if debug output is enabled.
protected debug ( string $message )
$message string

getCurrentEnvironment() public méthode

Get the current environment if the user is in a project directory.
public getCurrentEnvironment ( Platformsh\Client\Model\Project $expectedProject = null, boolean | null $refresh = null ) : Platformsh\Client\Model\Environment | false
$expectedProject Platformsh\Client\Model\Project The expected project.
$refresh boolean | null Whether to refresh the environments or projects cache.
Résultat Platformsh\Client\Model\Environment | false The current environment.

getCurrentProject() public méthode

Get the current project if the user is in a project directory.
public getCurrentProject ( ) : Platformsh\Client\Model\Project | false
Résultat Platformsh\Client\Model\Project | false The current project

getHelper() public méthode

public getHelper ( $name )

getHomeDir() protected méthode

protected getHomeDir ( ) : string
Résultat string

getProcessedHelp() public méthode

Overrides the default method so that the description is not repeated twice.
public getProcessedHelp ( )

getProjectRoot() public méthode

public getProjectRoot ( ) : string | false
Résultat string | false

getSelectedEnvironment() protected méthode

The project is selected via validateInput(), if there is an --environment option in the command.
protected getSelectedEnvironment ( ) : Platformsh\Client\Model\Environment
Résultat Platformsh\Client\Model\Environment

getSelectedProject() protected méthode

The project is selected via validateInput(), if there is a --project option in the command.
protected getSelectedProject ( ) : Platformsh\Client\Model\Project
Résultat Platformsh\Client\Model\Project

getSessionsDir() protected méthode

protected getSessionsDir ( ) : string
Résultat string

getSynopsis() public méthode

public getSynopsis ( $short = false )

getVisibleAliases() public méthode

Get aliases that should be visible in help.
public getVisibleAliases ( ) : array
Résultat array

hasSelectedEnvironment() protected méthode

Check whether a single environment is selected.
protected hasSelectedEnvironment ( ) : boolean
Résultat boolean

hasSelectedProject() protected méthode

Check whether a project is selected.
protected hasSelectedProject ( ) : boolean
Résultat boolean

initialize() protected méthode

protected initialize ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface

interact() protected méthode

protected interact ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface

isHiddenInList() public méthode

public isHiddenInList ( )

isLocal() public méthode

Is this a local command? (if it does not make API requests)
public isLocal ( ) : boolean
Résultat boolean

isTerminal() protected méthode

Detect automatically whether the output is a TTY terminal.
protected isTerminal ( Symfony\Component\Console\Output\OutputInterface $output ) : boolean
$output Symfony\Component\Console\Output\OutputInterface
Résultat boolean

login() public méthode

This is called via the 'login_required' event.
See also: Api::getClient()
public login ( )

parseProjectId() protected méthode

Parse the project ID and possibly other details from a provided URL.
protected parseProjectId ( string $url ) : array
$url string A web UI, API, or public URL of the project.
Résultat array An array of containing at least a 'projectId'. Keys 'host', 'environmentId', and 'appId' will be either null or strings.

promptLegacyMigrate() protected méthode

If the input is interactive, the user will be asked to migrate up to once per hour. The time they were last asked will be stored in the project configuration. If the input is not interactive, the user will be warned (on every command run) that they should run the 'legacy-migrate' command.
protected promptLegacyMigrate ( )

rebuildWarning() protected méthode

Warn the user that the remote environment needs rebuilding.
protected rebuildWarning ( )

runOtherCommand() protected méthode

Run another CLI command.
protected runOtherCommand ( string $name, array $arguments = [], Symfony\Component\Console\Output\OutputInterface $output = null ) : integer
$name string The name of the other command.
$arguments array Arguments for the other command.
$output Symfony\Component\Console\Output\OutputInterface The output for the other command. Defaults to the current output.
Résultat integer

selectApp() protected méthode

Find the name of the app the user wants to use for an SSH command.
protected selectApp ( Symfony\Component\Console\Input\InputInterface $input, callable $filter = null ) : string | null
$input Symfony\Component\Console\Input\InputInterface The user input object.
$filter callable A filter callback that takes one argument: a LocalApplication object.
Résultat string | null The application name, or null if it could not be found.

selectEnvironment() protected méthode

Select the current environment for the user.
protected selectEnvironment ( string | null $environmentId = null ) : Platformsh\Client\Model\Environment
$environmentId string | null The environment ID specified by the user, or null to auto-detect the environment.
Résultat Platformsh\Client\Model\Environment

selectProject() protected méthode

Select the project for the user, based on input or the environment.
protected selectProject ( string $projectId = null, string $host = null ) : Platformsh\Client\Model\Project
$projectId string
$host string
Résultat Platformsh\Client\Model\Project

selectedProjectIsCurrent() protected méthode

protected selectedProjectIsCurrent ( ) : boolean
Résultat boolean

setHiddenAliases() protected méthode

Add aliases that should be hidden from help.
See also: parent::setAliases()
protected setHiddenAliases ( array $hiddenAliases ) : CommandBase
$hiddenAliases array
Résultat CommandBase

setProjectRoot() protected méthode

protected setProjectRoot ( string $root )
$root string

setRunningViaMulti() public méthode

public setRunningViaMulti ( $runningViaMulti = true )

updateDrushAliases() public méthode

This is called via the 'environments_changed' event.
See also: Api::getEnvironments()
public updateDrushAliases ( EnvironmentsChangedEvent $event )
$event Platformsh\Cli\Event\EnvironmentsChangedEvent

validateInput() protected méthode

protected validateInput ( Symfony\Component\Console\Input\InputInterface $input, boolean $envNotRequired = false )
$input Symfony\Component\Console\Input\InputInterface
$envNotRequired boolean

Property Details

$canBeRunMultipleTimes protected_oe property

protected $canBeRunMultipleTimes

$config protected_oe static_oe property

protected static CliConfig,Platformsh\Cli $config
Résultat Platformsh\Cli\CliConfig

$envArgName protected_oe property

protected $envArgName

$hiddenInList protected_oe property

protected $hiddenInList

$interactive protected_oe static_oe property

protected static bool $interactive
Résultat boolean

$local protected_oe property

protected $local

$localProject protected_oe property

protected LocalProject,Platformsh\Cli\Local|null $localProject
Résultat Platformsh\Cli\Local\LocalProject | null

$output protected_oe property

protected OutputInterface,Symfony\Component\Console\Output|null $output
Résultat Symfony\Component\Console\Output\OutputInterface | null

$runningViaMulti protected_oe property

protected $runningViaMulti

$stdErr protected_oe property

protected OutputInterface,Symfony\Component\Console\Output|null $stdErr
Résultat Symfony\Component\Console\Output\OutputInterface | null