PHP Class Platformsh\Cli\Helper\DrushHelper

Inheritance: extends Symfony\Component\Console\Helper\Helper, implements Platformsh\Cli\Console\OutputAwareInterface
Show file Open project: commerceguys/platform-cli Class Usage Examples

Protected Properties

Property Type Description
$config Platformsh\Cli\CliConfig
$fs Symfony\Component\Filesystem\Filesystem
$homeDir
$shellHelper Platformsh\Cli\Helper\ShellHelperInterface

Public Methods

Method Description
__construct ( CliConfig $config = null, Platformsh\Cli\Helper\ShellHelperInterface $shellHelper = null, Symfony\Component\Filesystem\Filesystem $fs = null )
clearCache ( ) : boolean
createAliases ( Platformsh\Client\Model\Project $project, string $projectRoot, Platformsh\Client\Model\Environment[] $environments, string $original = null, boolean $merge = true ) : boolean Create Drush aliases for the provided project and environments.
ensureInstalled ( )
execute ( array $args, string $dir = null, boolean $mustRun = false, boolean $quiet = true ) : string | boolean Execute a Drush command.
getAliases ( string $groupName ) : string | boolean
getName ( )
getVersion ( boolean $reset = false ) : string | false Get the installed Drush version.
setHomeDir ( string $homeDir ) Set the user's home directory.
setOutput ( Symfony\Component\Console\Output\OutputInterface $output )

Protected Methods

Method Description
exportAlias ( string $name, array $alias ) : string
generateRemoteAlias ( Platformsh\Client\Model\Environment $environment, LocalApplication $app, boolean $multiApp = false ) : array | false
getAutoRemoveKey ( ) : string
getDrushExecutable ( ) : string Get the full path to the Drush executable.
writeAliasFile ( string $filename, string $contents ) Write a file and create a backup if the contents have changed.

Method Details

__construct() public method

public __construct ( CliConfig $config = null, Platformsh\Cli\Helper\ShellHelperInterface $shellHelper = null, Symfony\Component\Filesystem\Filesystem $fs = null )
$config Platformsh\Cli\CliConfig
$shellHelper Platformsh\Cli\Helper\ShellHelperInterface
$fs Symfony\Component\Filesystem\Filesystem

clearCache() public method

public clearCache ( ) : boolean
return boolean

createAliases() public method

Create Drush aliases for the provided project and environments.
public createAliases ( Platformsh\Client\Model\Project $project, string $projectRoot, Platformsh\Client\Model\Environment[] $environments, string $original = null, boolean $merge = true ) : boolean
$project Platformsh\Client\Model\Project The project
$projectRoot string The project root
$environments Platformsh\Client\Model\Environment[] The environments
$original string The original group name
$merge boolean Whether to merge existing alias settings
return boolean Whether any aliases have been created.

ensureInstalled() public method

public ensureInstalled ( )

execute() public method

Execute a Drush command.
public execute ( array $args, string $dir = null, boolean $mustRun = false, boolean $quiet = true ) : string | boolean
$args array Command arguments (everything after 'drush').
$dir string The working directory.
$mustRun boolean Enable exceptions if the command fails.
$quiet boolean Suppress command output.
return string | boolean

exportAlias() protected method

protected exportAlias ( string $name, array $alias ) : string
$name string
$alias array
return string

generateRemoteAlias() protected method

protected generateRemoteAlias ( Platformsh\Client\Model\Environment $environment, LocalApplication $app, boolean $multiApp = false ) : array | false
$environment Platformsh\Client\Model\Environment
$app Platformsh\Cli\Local\LocalApplication
$multiApp boolean
return array | false

getAliases() public method

public getAliases ( string $groupName ) : string | boolean
$groupName string
return string | boolean

getAutoRemoveKey() protected method

protected getAutoRemoveKey ( ) : string
return string

getDrushExecutable() protected method

Get the full path to the Drush executable.
protected getDrushExecutable ( ) : string
return string The absolute path to the executable, or 'drush' if the path is not known.

getName() public method

public getName ( )

getVersion() public method

Get the installed Drush version.
public getVersion ( boolean $reset = false ) : string | false
$reset boolean
return string | false The Drush version, or false if it cannot be determined.

setHomeDir() public method

Set the user's home directory.
public setHomeDir ( string $homeDir )
$homeDir string

setOutput() public method

public setOutput ( Symfony\Component\Console\Output\OutputInterface $output )
$output Symfony\Component\Console\Output\OutputInterface

writeAliasFile() protected method

Write a file and create a backup if the contents have changed.
protected writeAliasFile ( string $filename, string $contents )
$filename string
$contents string

Property Details

$config protected property

protected CliConfig,Platformsh\Cli $config
return Platformsh\Cli\CliConfig

$fs protected property

protected Filesystem,Symfony\Component\Filesystem $fs
return Symfony\Component\Filesystem\Filesystem

$homeDir protected property

protected $homeDir

$shellHelper protected property

protected ShellHelperInterface,Platformsh\Cli\Helper $shellHelper
return Platformsh\Cli\Helper\ShellHelperInterface