mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
add path value retrieval
This commit is contained in:
parent
17756362a1
commit
d8fd9b74d2
|
|
@ -322,6 +322,20 @@ final class Argument implements UriInterface
|
|||
return $this->pathElements[$pos + ($useOffset ? $this->pathOffset : 0)] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPathKey(string $key) : string
|
||||
{
|
||||
foreach ($this->pathElements as $index => $element) {
|
||||
if ($element === $key) {
|
||||
return $this->pathElements[$index + 1] ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -391,6 +391,20 @@ final class HttpUri implements UriInterface
|
|||
return $this->pathElements[$pos + ($useOffset ? $this->pathOffset : 0)] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPathKey(string $key) : string
|
||||
{
|
||||
foreach ($this->pathElements as $index => $element) {
|
||||
if ($element === $key) {
|
||||
return $this->pathElements[$index + 1] ?? '';
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -128,6 +128,17 @@ interface UriInterface
|
|||
*/
|
||||
public function getPathElement(int $pos = 0, bool $useOffset = true) : string;
|
||||
|
||||
/**
|
||||
* Get the value after a key
|
||||
*
|
||||
* @param string $key Key to search for in path
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getPathKey(string $key) : string;
|
||||
|
||||
/**
|
||||
* Get path elements.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user