mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-09 05:38:39 +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)] ?? '';
|
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}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -391,6 +391,20 @@ final class HttpUri implements UriInterface
|
||||||
return $this->pathElements[$pos + ($useOffset ? $this->pathOffset : 0)] ?? '';
|
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}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,17 @@ interface UriInterface
|
||||||
*/
|
*/
|
||||||
public function getPathElement(int $pos = 0, bool $useOffset = true) : string;
|
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.
|
* Get path elements.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user