Browse Source

add cross-platform separator support

main
yggverse 9 months ago
parent
commit
bbdc276db6
  1. 16
      src/Address.php

16
src/Address.php

@ -16,6 +16,8 @@ class Address @@ -16,6 +16,8 @@ class Address
private array $_dirs = [];
private string $_separator = '/';
public function __construct(?string $address = null)
{
if ($address)
@ -138,12 +140,17 @@ class Address @@ -138,12 +140,17 @@ class Address
public function setPath(string $value): void
{
$this->_path = $value;
if (false !== strpos($value, '\\'))
{
$this->_separator = '\\';
}
$this->_dirs = explode(
'/',
$this->_separator,
$value
);
$this->_path = $value;
}
public function getDirs(): array
@ -161,6 +168,11 @@ class Address @@ -161,6 +168,11 @@ class Address
$this->_query = $value;
}
public function getSeparator(): string
{
return $this->_separator;
}
public function absolute(string $address): string
{
// @TODO

Loading…
Cancel
Save