Fetch raw data from the request.

@param Request $request

@return array
350665
protected function getTermData(Request $request)
    {
        $data = [];

        foreach ($this->repository as $field) {
            $data[$field->getName()] = $request->get($field->getName());
        }

        return $data;
    }
1374378
protected function resolveRequestData($request): array
    {
        $params = $request->all();

        if ($request instanceof Request) {
            $routeParams = $request->route()->parameters();
            $params = array_merge($params, $routeParams);
        }

        return $params;
    }
1038839
public function cgetNodes(Request $request)
    {
        $tree = $this->getBooleanRequestParameter($request, 'tree', false, false);
        $ids = $this->getRequestParameter($request, 'ids');

        if (true === $tree) {
            return $this->getTreeForUuid($request, $this->getRequestParameter($request, 'id', false, null));
        } elseif (null !== $ids) {
            return $this->getNodesByIds($request, $ids);
        }

        $language = $this->getLanguage($request);
        $webspace = $this->getWebspace($request);
        $excludeGhosts = $this->getBooleanRequestParameter($request, 'exclude-ghosts', false, false);

        $parentUuid = $request->get('parentId');
        $depth = $request->get('depth', 1);
        $depth = intval($depth);
        $flat = $request->get('flat', 'true');
        $flat = ('true' === $flat);

        // TODO pagination
        $result = $this->getRepository()->getNodes(
            $parentUuid,
            $webspace,
            $language,
            $depth,
            $flat,
            false,
            $excludeGhosts
        );

        return $this->handleView($this->view($result));
    }
1233379
private function parseUploadedFiles(Request $request)
    {
        $bodyParams = $request->all();
        if (!isset($bodyParams['map'])) {
            throw new RequestError('The request must define a `map`');
        }

        $map = json_decode($bodyParams['map'], true);
        $result = json_decode($bodyParams['operations'], true);
        if (isset($result['operationName'])) {
            $result['operation'] = $result['operationName'];
            unset($result['operationName']);
        }

        foreach ($map as $fileKey => $locations) {
            foreach ($locations as $location) {
                $items = &$result;
                foreach (explode('.', $location) as $key) {
                    if (!isset($items[$key]) || !is_array($items[$key])) {
                        $items[$key] = [];
                    }
                    $items = &$items[$key];
                }

                $items = $request->allFiles()[$fileKey];
            }
        }

        $request->replace($result);

        return $request;
    }
1335949
public function renderAction(Request $request)
    {
        $data = (array) json_decode($request->getContent(), true);
        $menu = null;

        if (isset($data['data'])) {
            $menu = $this->getMenuFactory()->fromArray($data['data']);
        }

        return [
            'menu'    => $menu,
            'options' => isset($data['options']) ? $data['options'] : [],
        ];
    }
884039
protected function extractQueryFilter(Request $request)
    {
        return array_map(
            function ($value) {
                return array_filter(explode(',', trim($value, ',')), function ($var) {
                    return !empty($var);
                });
            },
            $request->query->all()
        );
    }
222066
public function parse(Request $request): array
    {
        // Extracts the GraphQL request parameters
        $queries = $this->getParsedBody($request);

        if (empty($queries)) {
            throw new BadRequestHttpException('Must provide at least one valid query.');
        }

        foreach ($queries as $i => &$query) {
            $query = \array_filter($query) + self::$queriesDefaultValue;

            if (!\is_string($query[static::PARAM_QUERY])) {
                throw new BadRequestHttpException(\sprintf('%s is not a valid query', \json_encode($query[static::PARAM_QUERY])));
            }
        }

        return $queries;
    }
378445
protected function getCredentials(Request $request)
    {
        $credentials = $request->only($this->loginUsername(), 'password');
        
        return array_merge($credentials, ['site_id' => site()->getCurrent()->id]);
    }
1126436
public function toArray($request)
    {
        return [
            'code'       => $this->code,
            'i18n'       => $this->i18n,
            'is_enabled' => (bool) $this->is_enabled,
            'is_default' => (bool) $this->is_default,
        ];
    }
458048
public function prepareData(ServerRequest $request): array
    {
        $result = $request->getData();

        $event = new Event((string)EventName::MODEL_SEARCH_CHILD_ITEMS(), $this, [
            'criteria' => $result
        ]);
        EventManager::instance()->dispatch($event);

        $result = $event->result ? $event->result : $result;

        $value = Hash::get($result, 'criteria.query');

        // advanced search
        if (!$value) {
            return $result;
        }

        // basic search query, converted to search criteria
        $result['aggregator'] = 'OR';
        $basicSearch = new BasicSearch($this->table, $this->user);
        $result['criteria'] = $basicSearch->getCriteria($value);

        return $result;
    }
1126326
public function toArray($request)
    {
        return [
            'id'         => (int) $this->id,
            'email'      => $this->email,
            'name'       => $this->name,
            'first_name' => $this->first_name,
            'last_name'  => $this->last_name,
            'roles'      => Role::collection($this->whenLoaded('roles')),
        ];
    }
1075307
protected function decodeRequestData(Request $request)
    {
        $dataRaw = $request->getContent();
        $data = null;

        if (!empty($dataRaw)) {
            $data = json_decode($dataRaw, true);
        }

        return $data;
    }
388711
public function cgetAction(Request $request)
    {
        $ids = array_map(
            function($item) {
                $parts = explode(';', $item);

                return ['type' => $parts[0], 'id' => $parts[1]];
            },
            array_filter(explode(',', $request->get('ids', '')))
        );

        return $this->handleView(
            $this->view(
                new CollectionRepresentation(
                    $this->get('sulu_page.teaser.manager')->find($ids, $this->getLocale($request)),
                    'teasers'
                )
            )
        );
    }
1338365
public function get_items( $request ) {

		// Retrieve the list of registered collection query parameters.
		$registered = $this->get_collection_params();

		if ( isset( $registered['type'] ) && ! empty( $request['type'] ) ) {
			$taxonomies = get_object_taxonomies( $request['type'], 'objects' );
		} else {
			$taxonomies = get_taxonomies( '', 'objects' );
		}
		$data = array();
		foreach ( $taxonomies as $tax_type => $value ) {
			if ( empty( $value->show_in_rest ) || ( 'edit' === $request['context'] && ! current_user_can( $value->cap->manage_terms ) ) ) {
				continue;
			}
			$tax = $this->prepare_item_for_response( $value, $request );
			$tax = $this->prepare_response_for_collection( $tax );
			$data[ $tax_type ] = $tax;
		}

		if ( empty( $data ) ) {
			// Response should still be returned as a JSON object when it is empty.
			$data = (object) $data;
		}

		return rest_ensure_response( $data );
	}
889881
private function getContentFromRequest(Request $request): array
    {
        $data = json_decode($request->getContent(), true);
        foreach ($data as $key => $value) {
            if ($value === null || $value === '') {
                unset($data[$key]);
            }
        }
        return $data;
    }
924141
protected function fetchToken(Request $request): string
    {
        if ($request->hasHeader(self::HEADER)) {
            return (string)$request->getHeaderLine(self::HEADER);
        }

        $data = $request->getParsedBody();
        if (is_array($data) && isset($data[self::PARAMETER])) {
            if (is_string($data[self::PARAMETER])) {
                return (string)$data[self::PARAMETER];
            }
        }

        return '';
    }
261982
public function getAll(Request $request)
    {
        $this->authorize(MediasPolicy::PERMISSION_LIST);

        return $this->jsonResponseSuccess([
            'medias' => $this->media->all(
                $request->get('location', '/')
            ),
        ]);
    }