# wpide/3.4.2/App/Kernel/Request.php

WPIDE – File Manager &amp; Code Editor, version 3.4.2. 48 lines.

- Page: https://pluginprobe.com/plugins/wpide/3.4.2/code/App/Kernel/Request.php
- Raw: https://pluginprobe.com/plugins/wpide/3.4.2/raw/App/Kernel/Request.php
- Modified: 2022-07-30T20:33:10+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wpide/3.4.2/code/App/Kernel/Request.php#L10-L20`.

```php
<?php

namespace WPIDE\App\Kernel;

use Symfony\Component\HttpFoundation\Request as SymfonyRequest;

class Request extends SymfonyRequest
{
    public function input($key, $default = null)
    {
        // first try GET, then POST
        $value = $this->get($key, $this->query->get($key));

        // then look into JSON content, fallback to default
        if ($value === null) {
            $content = json_decode((string) $this->getContent());
            $value = isset($content->{$key}) ? $content->{$key} : $default;
        }

        return $value;
    }

    public function all(): array
    {
        $params = [];

        // first look into JSON content
        $content = json_decode((string) $this->getContent());
        if (! empty($content)) {
            foreach ($content as $key => $param) {
                $params[$key] = $param;
            }
        }

        // then try (and override) with POST
        foreach ($this->request as $key => $param) {
            $params[$key] = $param;
        }

        // finally try (and override) with GET
        foreach ($this->query as $key => $param) {
            $params[$key] = $param;
        }

        return $params;
    }
}

```
