TQ\Vcs\FileSystem::normalizeDirectorySeparator PHP Méthode

normalizeDirectorySeparator() public static méthode

Normalizes the directory separator to /
public static normalizeDirectorySeparator ( string $path ) : string
$path string The path
Résultat string The normalized path
    public static function normalizeDirectorySeparator($path)
    {
        return str_replace(array('\\', '/'), '/', $path);
    }

Usage Example

 /**
  * List the directory at a given version
  *
  * @param   string  $directory      The path ot the directory
  * @param   string  $ref            The version ref
  * @return  array
  * @throws  \RuntimeException
  */
 public function listDirectory($directory = '.', $ref = 'HEAD')
 {
     $directory = FileSystem::normalizeDirectorySeparator($directory);
     $directory = rtrim($directory, '/') . '/';
     $args = array('--xml', '--revision' => $ref, $this->resolveLocalPath($directory));
     /** @var $result CallResult */
     $result = $this->getSvn()->{'list'}($this->getRepositoryPath(), $args);
     $result->assertSuccess(sprintf('Cannot list directory "%s" at "%s" from "%s"', $directory, $ref, $this->getRepositoryPath()));
     $xml = simplexml_load_string($result->getStdOut());
     if (!$xml) {
         throw new \RuntimeException(sprintf('Cannot read list XML for "%s" at "%s" from "%s"', $directory, $ref, $this->getRepositoryPath()));
     }
     $list = array();
     foreach ($xml->xpath('/lists/list/entry') as $item) {
         $list[] = (string) $item->name;
     }
     return $list;
 }
All Usage Examples Of TQ\Vcs\FileSystem::normalizeDirectorySeparator