mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-10 22:18:40 +00:00
Simplify getData()
This commit is contained in:
parent
f88a530b96
commit
ebc270c84e
|
|
@ -94,6 +94,9 @@ final class CliRequest extends RequestAbstract
|
||||||
$key = \mb_strtolower($key);
|
$key = \mb_strtolower($key);
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
|
case null:
|
||||||
|
/* @phpstan-ignore-next-line */
|
||||||
|
return ArrayUtils::getArg($key, $this->data);
|
||||||
case 'int':
|
case 'int':
|
||||||
/* @phpstan-ignore-next-line */
|
/* @phpstan-ignore-next-line */
|
||||||
return (int) ArrayUtils::getArg($key, $this->data);
|
return (int) ArrayUtils::getArg($key, $this->data);
|
||||||
|
|
|
||||||
|
|
@ -99,16 +99,13 @@ abstract class RequestAbstract implements MessageInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = \mb_strtolower($key);
|
$key = \mb_strtolower($key);
|
||||||
|
|
||||||
if (!isset($this->data[$key])) {
|
if (!isset($this->data[$key])) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type === null) {
|
|
||||||
return $this->data[$key];
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
|
case null:
|
||||||
|
return $this->data[$key];
|
||||||
case 'int':
|
case 'int':
|
||||||
return (int) $this->data[$key];
|
return (int) $this->data[$key];
|
||||||
case 'string':
|
case 'string':
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user