isAbsolute / isRelative

master
Anton Smirnov 1 year ago
parent d1b917c340
commit f1f898eecf

@ -8,6 +8,16 @@ use Arokettu\Path\Helpers\DataTypeHelper;
abstract class AbstractAbsolutePath extends AbstractPath implements AbsolutePathInterface
{
public function isAbsolute(): bool
{
return true;
}
public function isRelative(): bool
{
return false;
}
/**
* @param static $targetPath
*/

@ -6,6 +6,9 @@ namespace Arokettu\Path;
interface PathInterface extends \Stringable
{
public function isAbsolute(): bool;
public function isRelative(): bool;
public function getPrefix(): string;
public function getComponents(): array;
public function toString(): string;

@ -33,6 +33,16 @@ final class RelativePath extends AbstractPath implements RelativePathInterface
return new self($path, DIRECTORY_SEPARATOR === '\\');
}
public function isAbsolute(): bool
{
return false;
}
public function isRelative(): bool
{
return true;
}
protected function parsePath(string $path, bool $strict): void
{
$components = explode('/', $path);

Loading…
Cancel
Save