mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 08:47:52 +00:00
Added support for input stream when not json encoded
This commit is contained in:
@@ -82,6 +82,8 @@ class InputHandler
|
|||||||
if ($post !== false) {
|
if ($post !== false) {
|
||||||
$this->originalPost += $post;
|
$this->originalPost += $post;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
parse_str($contents, $this->originalPost);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +110,7 @@ class InputHandler
|
|||||||
foreach ($files as $key => $value) {
|
foreach ($files as $key => $value) {
|
||||||
|
|
||||||
// Parse multi dept file array
|
// Parse multi dept file array
|
||||||
if(isset($value['name']) === false && is_array($value) === true) {
|
if (isset($value['name']) === false && is_array($value) === true) {
|
||||||
$list[$key] = $this->parseFiles($value, $key);
|
$list[$key] = $this->parseFiles($value, $key);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -161,12 +163,12 @@ class InputHandler
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
$file = InputFile::createFromArray([
|
$file = InputFile::createFromArray([
|
||||||
'index' => ($key === '' && $originalIndex !== '') ? $originalIndex : $key,
|
'index' => ($key === '' && $originalIndex !== '') ? $originalIndex : $key,
|
||||||
'name' => $original['name'][$key],
|
'name' => $original['name'][$key],
|
||||||
'error' => $original['error'][$key],
|
'error' => $original['error'][$key],
|
||||||
'tmp_name' => $original['tmp_name'][$key],
|
'tmp_name' => $original['tmp_name'][$key],
|
||||||
'type' => $original['type'][$key],
|
'type' => $original['type'][$key],
|
||||||
'size' => $original['size'][$key],
|
'size' => $original['size'][$key],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (isset($output[$key]) === true) {
|
if (isset($output[$key]) === true) {
|
||||||
@@ -231,7 +233,7 @@ class InputHandler
|
|||||||
{
|
{
|
||||||
$element = null;
|
$element = null;
|
||||||
|
|
||||||
if(count($methods) > 0) {
|
if (count($methods) > 0) {
|
||||||
$methods = is_array(...$methods) ? array_values(...$methods) : $methods;
|
$methods = is_array(...$methods) ? array_values(...$methods) : $methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,9 +305,9 @@ class InputHandler
|
|||||||
public function exists($index, ...$methods): bool
|
public function exists($index, ...$methods): bool
|
||||||
{
|
{
|
||||||
// Check array
|
// Check array
|
||||||
if(is_array($index) === true) {
|
if (is_array($index) === true) {
|
||||||
foreach($index as $key) {
|
foreach ($index as $key) {
|
||||||
if($this->value($key, null, ...$methods) === null) {
|
if ($this->value($key, null, ...$methods) === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user