PHP Class GrumPHP\Console\Helper\PathsHelper

Class PathsHelper
Inheritance: extends Symfony\Component\Console\Helper\Helper
Show file Open project: phpro/grumphp

Protected Properties

Property Type Description
$config GrumPHP\Configuration\GrumPHP
$fileSystem GrumPHP\Util\Filesystem

Public Methods

Method Description
__construct ( GrumPHP $config, Filesystem $fileSystem, ExternalCommand $externalCommandLocator, string $defaultConfigPath )
getAbsolutePath ( $path ) : mixed
getAsciiContent ( $resource ) : string Load an ascii image
getAsciiPath ( ) : string Get the path with all ascii art
getBinCommand ( $command, $forceUnix = false ) : string Search a command in the bin folder Note: the command locator is not injected because it needs the relative bin path
getBinDir ( ) : string Find the relative bin directory
getDefaultConfigPath ( ) : string
getGitDir ( ) : string Find the relative git directory
getGitHookExecutionPath ( ) : string Gets the path from where the command needs to be executed in the GIT hook.
getGitHookTemplatesDir ( ) : string The folder with all git hooks
getGitHooksDir ( ) : string Returns the directory where the git hooks are installed.
getGrumPHPPath ( ) : string Get the root path of the GrumPHP package:
getName ( )
getPathWithTrailingSlash ( string $path ) : string
getRelativePath ( $path ) : string
getRelativeProjectPath ( string $path ) : string This method will return a relative path to a file of directory if it lives in the current project.
getResourcesPath ( ) : string Get the folder which contains all resources
getWorkingDir ( ) : string This is the directory in which the cli script is initialized.

Method Details

__construct() public method

public __construct ( GrumPHP $config, Filesystem $fileSystem, ExternalCommand $externalCommandLocator, string $defaultConfigPath )
$config GrumPHP\Configuration\GrumPHP
$fileSystem GrumPHP\Util\Filesystem
$externalCommandLocator GrumPHP\Locator\ExternalCommand
$defaultConfigPath string

getAbsolutePath() public method

public getAbsolutePath ( $path ) : mixed
$path
return mixed

getAsciiContent() public method

Load an ascii image
public getAsciiContent ( $resource ) : string
$resource
return string

getAsciiPath() public method

Get the path with all ascii art
public getAsciiPath ( ) : string
return string

getBinCommand() public method

Search a command in the bin folder Note: the command locator is not injected because it needs the relative bin path
public getBinCommand ( $command, $forceUnix = false ) : string
$command
$forceUnix
return string

getBinDir() public method

Find the relative bin directory
public getBinDir ( ) : string
return string

getDefaultConfigPath() public method

public getDefaultConfigPath ( ) : string
return string

getGitDir() public method

Find the relative git directory
public getGitDir ( ) : string
return string

getGitHookExecutionPath() public method

Gets the path from where the command needs to be executed in the GIT hook.
public getGitHookExecutionPath ( ) : string
return string

getGitHookTemplatesDir() public method

The folder with all git hooks
public getGitHookTemplatesDir ( ) : string
return string

getGitHooksDir() public method

Returns the directory where the git hooks are installed.
public getGitHooksDir ( ) : string
return string

getGrumPHPPath() public method

Get the root path of the GrumPHP package:
public getGrumPHPPath ( ) : string
return string

getName() public method

public getName ( )

getPathWithTrailingSlash() public method

public getPathWithTrailingSlash ( string $path ) : string
$path string
return string

getRelativePath() public method

public getRelativePath ( $path ) : string
$path
return string

getRelativeProjectPath() public method

When the file is not located in the current project, the absolute path to the file is returned.
public getRelativeProjectPath ( string $path ) : string
$path string
return string

getResourcesPath() public method

Get the folder which contains all resources
public getResourcesPath ( ) : string
return string

getWorkingDir() public method

Normally this should be the directory where the composer.json file is located.
public getWorkingDir ( ) : string
return string

Property Details

$config protected property

protected GrumPHP,GrumPHP\Configuration $config
return GrumPHP\Configuration\GrumPHP

$fileSystem protected property

protected Filesystem,GrumPHP\Util $fileSystem
return GrumPHP\Util\Filesystem