PhpCsFixer\Console\ConfigurationResolver::getPath PHP Méthode

getPath() public méthode

Returns path.
public getPath ( ) : string[]
Résultat string[]
    public function getPath()
    {
        if (null === $this->path) {
            $filesystem = new Filesystem();
            $cwd = $this->cwd;
            if (1 === count($this->options['path']) && '-' === $this->options['path'][0]) {
                $this->path = $this->options['path'];
            } else {
                $this->path = array_map(function ($path) use($cwd, $filesystem) {
                    $absolutePath = $filesystem->isAbsolutePath($path) ? $path : $cwd . DIRECTORY_SEPARATOR . $path;
                    if (!file_exists($absolutePath)) {
                        throw new InvalidConfigurationException(sprintf('The path "%s" is not readable.', $path));
                    }
                    return $absolutePath;
                }, $this->options['path']);
            }
        }
        return $this->path;
    }

Usage Example

 public function testResolvePathRelative()
 {
     $this->resolver->setCwd(__DIR__)->setOption('path', array('Command'))->resolve();
     $this->assertSame(array(__DIR__ . DIRECTORY_SEPARATOR . 'Command'), $this->resolver->getPath());
     $this->resolver->setCwd(dirname(__DIR__))->setOption('path', array(basename(__DIR__)))->resolve();
     $this->assertSame(array(__DIR__), $this->resolver->getPath());
 }