Execute a set of batched queries on the lighthouse schema and return a
collection of ExecutionResults.

@param  \Nuwave\Lighthouse\Execution\GraphQLRequest  $request
@return mixed[]
1335
public function executeRequest(GraphQLRequest $request): array
    {
        $result = $this->executeQuery(
            $request->query(),
            $this->createsContext->generate(
                app('request')
            ),
            $request->variables(),
            null,
            $request->operationName()
        );

        return $this->applyDebugSettings($result);
    }
1224692
public function indexAction(Request $request)
    {
        $jobManager = $this->get('phlexible_queue.job_manager');

        $limit = $request->get('limit', 25);
        $offset = $request->get('start', 0);

        $data = [];
        foreach ($jobManager->findBy([], ['createdAt' => 'DESC'], $limit, $offset) as $queueItem) {
            $data[] = [
                'id' => $queueItem->getId(),
                'command' => $queueItem->getCommand(),
                'priority' => $queueItem->getPriority(),
                'status' => $queueItem->getState(),
                'create_time' => $queueItem->getCreatedAt()->format('Y-m-d H:i:s'),
                'start_time' => $queueItem->getStartedAt() ? $queueItem->getStartedAt()->format('Y-m-d H:i:s') : null,
                'end_time' => $queueItem->getFinishedAt() ? $queueItem->getFinishedAt()->format('Y-m-d H:i:s') : null,
                'output' => nl2br($queueItem->getOutput()),
            ];
        }

        $total = $jobManager->countBy([]);

        return new JsonResponse(['data' => $data, 'total' => $total]);
    }
255947
public function cgetAction(Request $request)
    {
        $fieldDescriptors = $this->getFieldDescriptors(DoctrineFieldDescriptorInterface::class);
        $factory = $this->get('sulu_core.doctrine_list_builder_factory');

        $listBuilder = $this->prepareListBuilder($fieldDescriptors, $request, $factory->create(Task::class));
        $result = $this->executeListBuilder($fieldDescriptors, $request, $listBuilder);

        for ($i = 0; $i < count($result); ++$i) {
            $result[$i] = $this->extendResponseItem($result[$i]);
        }

        return $this->handleView(
            $this->view(
                new ListRepresentation(
                    $result,
                    'tasks',
                    'get_tasks',
                    $request->query->all(),
                    $listBuilder->getCurrentPage(),
                    $listBuilder->getLimit(),
                    $listBuilder->count()
                )
            )
        );
    }
705685
public function execute($request)
  {
    if ($request instanceof Google_Http_Request) {
      $request->setUserAgent(
          $this->getApplicationName()
          . " " . self::USER_AGENT_SUFFIX
          . $this->getLibraryVersion()
      );
      if (!$this->getClassConfig("Google_Http_Request", "disable_gzip")) {
        $request->enableGzip();
      }
      $request->maybeMoveParametersToBody();
      return Google_Http_REST::execute($this, $request);
    } else if ($request instanceof Google_Http_Batch) {
      return $request->execute();
    } else {
      throw new Google_Exception("Do not know how to execute this type of object.");
    }
  }
1200490
public function getRouteCollectionForRequest(Request $request)
    {
        $collection = new RouteCollection();

        // Fetch pages IDs by request path.
        $qb = $this->pageRepository->createQueryBuilder('p');
        $qb
            ->select('p.id')
            ->join('p.translations', 't')
            ->andWhere($qb->expr()->eq('p.static', 0))
            ->andWhere($qb->expr()->eq('t.path', $qb->expr()->literal(rawurldecode($request->getPathInfo()))))
        ;
        $results = $qb
            ->getQuery()
            ->getArrayResult()
        ;
        if (empty($results)) {
            return $collection;
        }

        $ids = array_unique(array_map(function($row) {
            return $row['id'];
        }, $results));

        // Fetch pages by IDs
        $qb = $this->pageRepository->createQueryBuilder('p');
        $results = $qb
            ->select('p.route, p.controller, t.path, t.locale')
            ->join('p.translations', 't')
            ->andWhere($qb->expr()->eq('p.static', 0))
            ->andWhere($qb->expr()->in('p.id', $ids))
            ->getQuery()
            ->getArrayResult()
        ;

        $routes =  $this->transformResultsToRoutes($results);

        // Build collection
        foreach ($routes as $name => $route) {
            $collection->add($name, $route);
        }

        return $collection;
    }
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;
    }
695126
public function getAll(GetAllFriendRequest $request)
    {
        $request->setIdentifier($this->identifier);
        $response = new BaseResponse();
        return $this->client->sendRequest($request, $response);
    }
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;
    }
574797
private function getRoles($request)
    {
        $routeActions = $this->getActions($request);

        $roles = array_get($routeActions, 'is', []);

        return is_array($roles) ? $roles : (array) $roles;
    }
1127959
public function get_items( $request ) {

		// Register missing routes
		$this->registerRouteDependencies();

		// Override search request
		$search = $request->get_query_params();
		unset( $search['per_page'], $search['next'] );
		$request['search'] = ! empty( $search ) ? $search : [
			null => null,
		]; // Set some weird value that means abort

		$response = rest_ensure_response( $this->searchBooks( $request ) );
		unset( $request['search'] );

		$this->addNextSearchLinks( $request, $response );

		return $response;
	}
847499
public function get_items( $request ) {
		$data = array();
		foreach ( get_post_types( array(), 'object' ) as $obj ) {
			if ( empty( $obj->show_in_rest ) || ( 'edit' === $request['context'] && ! current_user_can( $obj->cap->edit_posts ) ) ) {
				continue;
			}
			$post_type = $this->prepare_item_for_response( $obj, $request );
			$data[ $obj->name ] = $this->prepare_response_for_collection( $post_type );
		}
		return rest_ensure_response( $data );
	}
463111
public function getAutocompleteResults(Request $request, $type)
    {
        $form = $this->formFactory->create($type);
        $fieldOptions = $form->get($request->get('field_name'))->getConfig()->getOptions();

        /** @var EntityRepository $repo */
        $repo = $this->doctrine->getRepository($fieldOptions['class']);

        $term = $request->get('q');

        $countQB = $repo->createQueryBuilder('e');
        $countQB
            ->select($countQB->expr()->count('e'))
            ->where('e.'.$fieldOptions['property'].' LIKE :term')
            ->setParameter('term', '%' . $term . '%')
        ;

        $maxResults = $fieldOptions['page_limit'];
        $offset = ($request->get('page', 1) - 1) * $maxResults;

        $resultQb = $repo->createQueryBuilder('e');
        $resultQb
            ->where('e.'.$fieldOptions['property'].' LIKE :term')
            ->setParameter('term', '%' . $term . '%')
            ->setMaxResults($maxResults)
            ->setFirstResult($offset)
        ;

        if (is_callable($fieldOptions['callback'])) {
            $cb = $fieldOptions['callback'];

            $cb($countQB, $request);
            $cb($resultQb, $request);
        }

        $count = $countQB->getQuery()->getSingleScalarResult();
        $paginationResults = $resultQb->getQuery()->getResult();

        $result = ['results' => null, 'more' => $count > ($offset + $maxResults)];

        $accessor = PropertyAccess::createPropertyAccessor();

        $result['results'] = array_map(function ($item) use ($accessor, $fieldOptions) {
            return ['id' => $accessor->getValue($item, $fieldOptions['primary_key']), 'text' => $accessor->getValue($item, $fieldOptions['property'])];
        }, $paginationResults);

        return $result;
    }
560005
protected function search(Request $request)
    {
        $allResults = $this->repository->search($request->all());
        return Response::apiResponse([
            'data' => $allResults
        ]);
    }
615133
private function getParsedBody(Request $request): array
    {
        $body = $request->getContent();
        $contentType = \explode(';', (string) $request->headers->get('content-type'), 2)[0];

        switch ($contentType) {
            // Plain string
            case static::CONTENT_TYPE_GRAPHQL:
                $parsedBody = [static::PARAM_QUERY => $body];
                break;

            // JSON object
            case static::CONTENT_TYPE_JSON:
                if (empty($body)) {
                    throw new BadRequestHttpException('The request content body must not be empty when using json content type request.');
                }

                $parsedBody = \json_decode($body, true);

                if (\JSON_ERROR_NONE !== \json_last_error()) {
                    throw new BadRequestHttpException('POST body sent invalid JSON');
                }
                break;

            // URL-encoded query-string
            case static::CONTENT_TYPE_FORM:
                $parsedBody = $request->request->all();
                break;

            case static::CONTENT_TYPE_FORM_DATA:
                $parsedBody = $this->handleUploadedFiles($request->request->all(), $request->files->all());
                break;

            default:
                $parsedBody = [];
                break;
        }

        return $parsedBody;
    }
1073865
public function execute($request)
    {

        ArrayObject::ensureArrayObject($request->getModel());
        $this->gateway->execute($status = new GetHttpRequest());

        if (isset($status->request['operation']) === false) {
            $request->markNew();
            return;
        }

        if (isset($status->request['operation']['status'])) {
            $status = $status->request['operation']['status'];

            if (EcommpayBridgeInterface::STATUS_SUCCESS === $status) {
                $request->markCaptured();
                return;
            }

            if (EcommpayBridgeInterface::STATUS_DECLINE === $status) {
                $request->markFailed();
            }
        }
    }
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 );
	}
1181107
public ExecutionResult request(Request request) {
        // Schema
        GraphQLSchema schema = schemaService.getSchema();
        // Execution
        return graphQLService.execute(
                schema,
                request.getQuery(),
                request.getVariables(),
                request.getOperationName(),
                true
        );
    }