mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48: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);
|
||||
|
||||
switch ($type) {
|
||||
case null:
|
||||
/* @phpstan-ignore-next-line */
|
||||
return ArrayUtils::getArg($key, $this->data);
|
||||
case 'int':
|
||||
/* @phpstan-ignore-next-line */
|
||||
return (int) ArrayUtils::getArg($key, $this->data);
|
||||
|
|
|
|||
|
|
@ -99,16 +99,13 @@ abstract class RequestAbstract implements MessageInterface
|
|||
}
|
||||
|
||||
$key = \mb_strtolower($key);
|
||||
|
||||
if (!isset($this->data[$key])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($type === null) {
|
||||
return $this->data[$key];
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case null:
|
||||
return $this->data[$key];
|
||||
case 'int':
|
||||
return (int) $this->data[$key];
|
||||
case 'string':
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user