PHPComposter\PHPComposter\Paths::getPath PHP Method

getPath() public static method

Get a specific path by key.
Since: 0.1.0
public static getPath ( string $key ) : string
$key string Key of the path to retrieve.
return string Path associated with the key. Empty string if not found.
    public static function getPath($key)
    {
        if (empty(static::$paths)) {
            static::initPaths();
        }
        if (array_key_exists($key, static::$paths)) {
            return static::$paths[$key];
        }
        return '';
    }

Usage Example

示例#1
0
 /**
  * Symlink each known Git hook to the PHP Composter bootstrapping script.
  *
  * @since 0.1.0
  *
  * @param Filesystem $filesystem Reference to the Filesystem instance.
  */
 protected function createGitHooks(Filesystem $filesystem)
 {
     $hooksPath = Paths::getPath('root_hooks');
     $gitScriptPath = Paths::getPath('git_script');
     foreach ($this->getGitHookNames() as $githook) {
         $hookPath = $hooksPath . $githook;
         if (static::$io->isDebug()) {
             static::$io->write(sprintf(_('Symlinking %1$s to %2$s'), $hookPath, $gitScriptPath));
         }
         $filesystem->relativeSymlink($gitScriptPath, $hookPath);
     }
 }
All Usage Examples Of PHPComposter\PHPComposter\Paths::getPath