PHP Class Platformsh\Cli\Local\LocalProject

Mostrar archivo Open project: commerceguys/platform-cli Class Usage Examples

Protected Properties

Property Type Description
$config
$fs
$projectConfigs

Public Methods

Method Description
__construct ( CliConfig $config = null )
ensureGitRemote ( string $dir, string $url ) Ensure there are appropriate Git remotes in the repository.
ensureLocalDir ( string $projectRoot )
getLegacyProjectRoot ( ) : string | false Find the legacy root of the current project, from CLI versions <3.
getProjectConfig ( string $projectRoot = null ) : array | null Get the configuration for the current project.
getProjectRoot ( ) : string | false Find the root of the current project.
writeCurrentProjectConfig ( array $config, string $projectRoot = null, boolean $merge = false ) : array Write configuration for a project.
writeGitExclude ( string $dir ) Write to the Git exclude file.

Protected Methods

Method Description
findTopDirectoryContaining ( string $file, callable $callback = null ) : string | false Find the highest level directory that contains a file.
getGitRemoteUrl ( string $dir ) : string | false
parseGitUrl ( string $gitUrl ) : array | false

Method Details

__construct() public method

public __construct ( CliConfig $config = null )
$config Platformsh\Cli\CliConfig

ensureGitRemote() public method

Ensure there are appropriate Git remotes in the repository.
public ensureGitRemote ( string $dir, string $url )
$dir string
$url string

ensureLocalDir() public method

public ensureLocalDir ( string $projectRoot )
$projectRoot string

findTopDirectoryContaining() protected static method

Find the highest level directory that contains a file.
protected static findTopDirectoryContaining ( string $file, callable $callback = null ) : string | false
$file string The filename to look for.
$callback callable A callback to validate the directory when found. Accepts one argument (the directory path). Return true to use the directory, or false to continue traversing upwards.
return string | false The path to the directory, or false if the file is not found.

getGitRemoteUrl() protected method

protected getGitRemoteUrl ( string $dir ) : string | false
$dir string
return string | false The Git remote URL.

getLegacyProjectRoot() public method

Find the legacy root of the current project, from CLI versions <3.
public getLegacyProjectRoot ( ) : string | false
return string | false

getProjectConfig() public method

Get the configuration for the current project.
public getProjectConfig ( string $projectRoot = null ) : array | null
$projectRoot string
return array | null The current project's configuration.

getProjectRoot() public method

Find the root of the current project.
public getProjectRoot ( ) : string | false
return string | false

parseGitUrl() protected method

protected parseGitUrl ( string $gitUrl ) : array | false
$gitUrl string
return array | false An array containing 'id' and 'host', or false on failure.

writeCurrentProjectConfig() public method

Configuration is stored as YAML, in the location configured by 'local.project_config'.
public writeCurrentProjectConfig ( array $config, string $projectRoot = null, boolean $merge = false ) : array
$config array The configuration.
$projectRoot string The project root.
$merge boolean Whether to merge with existing configuration.
return array The updated project configuration.

writeGitExclude() public method

Write to the Git exclude file.
public writeGitExclude ( string $dir )
$dir string

Property Details

$config protected_oe property

protected $config

$fs protected_oe property

protected $fs

$projectConfigs protected_oe static_oe property

protected static $projectConfigs