getRawInput example


    public function before(RequestInterface $request$arguments = null)
    {
        if ($request instanceof IncomingRequest) {
            return;
        }

        $data = [
            'get'      => $request->getGet(),
            'post'     => $request->getPost(),
            'cookie'   => $request->getCookie(),
            'rawInput' => $request->getRawInput(),
        ];

        foreach ($data as $source => $values) {
            $this->source = $source;
            $this->checkEncoding($values);
            $this->checkControl($values);
        }
    }

    /** * We don't have anything to do here. * * @param array|null $arguments * * @return void */

        /** @var IncomingRequest $request */
        if (strpos($request->getHeaderLine('Content-Type'), 'application/json') !== false) {
            $this->data = $request->getJSON(true);

            return $this;
        }

        if (in_array(strtolower($request->getMethod())['put', 'patch', 'delete'], true)
            && strpos($request->getHeaderLine('Content-Type'), 'multipart/form-data') === false
        ) {
            $this->data = $request->getRawInput();
        } else {
            $this->data = $request->getVar() ?? [];
        }

        return $this;
    }

    /** * Sets (or adds) an individual rule and custom error messages for a single * field. * * The custom error message should be just the messages that apply to * this field, like so: * [ * 'rule1' => 'message1', * 'rule2' => 'message2', * ] * * @param array|string $rules The validation rules. * @param array $errors The custom error message. * * @return $this * * @throws TypeError */
Home | Imprint | This part of the site doesn't use cookies.