You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
php-path/src/FilesystemPath.php

25 lines
564 B
PHP

<?php
declare(strict_types=1);
namespace Arokettu\Path;
abstract class FilesystemPath extends AbstractAbsolutePath
{
/**
* @codeCoverageIgnore OS specific
*/
public static function parse(string $path, bool $strict = false): self
{
if (DIRECTORY_SEPARATOR === '\\') {
return new WindowsPath($path, $strict);
}
if (DIRECTORY_SEPARATOR === '/') {
return new UnixPath($path, $strict);
}
throw new \LogicException('Unknown directory separator: ' . DIRECTORY_SEPARATOR);
}
}