mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-05-25 10:48:41 +00:00
Fix abstraction
This commit is contained in:
parent
c59c2d9f2a
commit
e8bed84e6e
|
|
@ -39,6 +39,22 @@ final class Argument implements UriInterface
|
||||||
*/
|
*/
|
||||||
private $rootPath = '/';
|
private $rootPath = '/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path offset.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
private $pathOffset = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path elements.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
private $pathElements = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uri.
|
* Uri.
|
||||||
*
|
*
|
||||||
|
|
@ -186,6 +202,8 @@ final class Argument implements UriInterface
|
||||||
|
|
||||||
$this->path = $path;
|
$this->path = $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->pathElements = \explode('/', $this->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -253,7 +271,14 @@ final class Argument implements UriInterface
|
||||||
public function setRootPath(string $root) : void
|
public function setRootPath(string $root) : void
|
||||||
{
|
{
|
||||||
$this->rootPath = $root;
|
$this->rootPath = $root;
|
||||||
$this->set($this->uri);
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function setPathOffset(int $offset = 0) : void
|
||||||
|
{
|
||||||
|
$this->pathOffset = $offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -334,9 +359,9 @@ final class Argument implements UriInterface
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function getPathElement(int $pos = null) : string
|
public function getPathElement(int $pos = 0) : string
|
||||||
{
|
{
|
||||||
return \explode('/', $this->path)[$pos] ?? '';
|
return $this->pathElements[$pos + $this->pathOffset] ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -344,7 +369,7 @@ final class Argument implements UriInterface
|
||||||
*/
|
*/
|
||||||
public function getPathElements() : array
|
public function getPathElements() : array
|
||||||
{
|
{
|
||||||
return \explode('/', $this->path);
|
return $this->pathElements;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user