@param string               $index
@param UriInterface         $requestUri
@param CrudInterface        $crud
@param JsonSchemasInterface $jsonSchemas
@param EncoderInterface     $encoder

@return ResponseInterface
11660
protected static function defaultCreateResponse(
        string $index,
        UriInterface $requestUri,
        CrudInterface $crud,
        JsonSchemasInterface $jsonSchemas,
        EncoderInterface $encoder
    ): ResponseInterface {
        $model = $crud->read($index);
        assert($model !== null && !($model instanceof PaginatedDataInterface));

        $responses = static::defaultCreateResponses($requestUri, $encoder);
        $fullUrl   = static::defaultGetResourceUrl($model, $requestUri, $jsonSchemas);
        $response  = $responses->getCreatedResponse($model, $fullUrl);

        return $response;
    }
731700
public function send(Request $request)
    {
        $response     = new IndexQueryResponse();
        $httpRequest  = $this->createHttpRequest($request);
        $httpResponse = $this->client->send($httpRequest);
        $code         = $httpResponse->getStatusCode();

        if ( ! isset($this->validResponseCodes[$code])) {
            throw RiakTransportException::unexpectedStatusCode($code);
        }

        $multipartIterator  = new MultipartResponseIterator($httpResponse);
        $responseIterator   = new HttpIndexQueryResponseIterator($request, $multipartIterator);
        $response->iterator = $responseIterator;

        return $response;
    }
226852
@JsonIgnore
  @Override
  public void setUri(URI uri) throws URISyntaxException, NoSuchAlgorithmException, KeyManagementException
  {
    super.setUri(uri);
  }
504955
protected function getUrlAndDecodeResponse($url, PageIndexerResponse $response)
    {
        $headers = $this->getHeaders();
        $rawResponse = $this->getUrl($url, $headers, $this->timeout);
        // convert JSON response to response object properties
        $decodedResponse = $response->getResultsFromJson($rawResponse->getBody()->getContents());

        if ($rawResponse === false || $decodedResponse === false) {
            $this->logger->log(
                SolrLogManager::ERROR,
                'Failed to execute Page Indexer Request. Request ID: ' . $this->requestId,
                [
                    'request ID' => $this->requestId,
                    'request url' => $url,
                    'request headers' => $headers,
                    'response headers' => $rawResponse->getHeaders(),
                    'raw response body' => $rawResponse->getBody()->getContents()
                ]
            );

            throw new \RuntimeException('Failed to execute Page Indexer Request. See log for details. Request ID: ' . $this->requestId, 1319116885);
        }
        return $decodedResponse;
    }
159230
public function execute($params = array(), $requestParams = array()){
      
        $deleteParams = $params;
        if(count($requestParams) > 0) {
            $deleteParams = $requestParams;
        }
        $this->beginTransaction();
        $firstResult = null;
        try{
            //first delete the child tables
            $this->deleteI18nLocales($deleteParams); 
            $this->deleteOneToOneRows($deleteParams);

            //now delete the main tables
            $this->getQueryBuilder()->where($deleteParams);
            $query = $this->getQueryBuilder()->getQuery($this->entity, QueryBuilder::DELETE_QUERY);

            $firstResult = $this->query($query);

            $this->commitTransaction();
        }catch(Exception $e){
            $this->logger->addError($e->getMessage());
            $this->rollbackTransaction();
        }
        return $firstResult;

    }
842441
public function crawlFailed(
        UriInterface $url,
        RequestException $requestException,
        ?UriInterface $foundOnUrl = null
    ) {
        parent::crawlFailed($url, $requestException, $foundOnUrl);

        $statusCode = $requestException->getCode();

        if ($this->isExcludedStatusCode($statusCode)) {
            return;
        }

        $this->log->warning(
            $this->formatLogMessage($url, $requestException, $foundOnUrl)
        );
    }
942959
protected function loadSystemUris($requestUri = null)
    {
        $server = $this->getRequest()->getServerParams();
        $uri = $this->getSystemUri($requestUri);

        $original = $requestUri ? new PsrUri($requestUri) : $this->getRequest()->getUri();

        // Get the host and path from the URI.
        $host = $uri->withQuery('')->withFragment('')->withPath('')->__toString();
        $path = rtrim($uri->getPath(), '/\\');
        $script = trim(ServerHelper::getValue($server, 'SCRIPT_NAME', ''), '/');

        // Check if the path includes "index.php".
        if ($script && strpos($path, $script) === 0) {
            // Remove the index.php portion of the path.
            $path = substr_replace($path, '', strpos($path, $script), strlen($script));
            $path = rtrim($path, '/\\');
        }

        $scriptName = pathinfo($script, PATHINFO_BASENAME);

        // Set the base URI both as just a path and as the full URI.
        $this->uriData->full = rtrim($original->__toString(), '/');
        $this->uriData->current = rtrim($original->withQuery('')->withFragment('')->__toString(), '/');
        $this->uriData->script = $scriptName;
        $this->uriData->root = $host . $path;
        $this->uriData->host = $host;
        $this->uriData->path = $path;

        // Set the extended (non-base) part of the request URI as the route.
        $route = substr_replace($this->uriData->current, '', 0, strlen($this->uriData->root));
        $route = ltrim($route, '/');

        // Only variables should be passed by reference so we use two lines.
        $file = explode('/', $script);
        $file = array_pop($file);

        if ($file === '' || 0 === strpos($route, $file)) {
            $route = trim(substr($route, strlen($file)), '/');
        }

        $this->uriData->route = $route;
    }
285627
public function handle( $requestUri )
    {
        $url = $this->_di->getService( "url" );

        /**
         * Remove the uri prefix from the request uri
         * (the uri prefix is added when route is created)
         */
        $requestUri = str_replace( $url->getUriPrefix(), "", $requestUri );

        $request_route = $this->_createRoute( ["uri" => $requestUri] );

        /**
         * Passing the uri to the get function in the url service to make sure the uri:s have a consistent format
         */
        //$request_route->setUri( $url->get( $request_route->getUri() ) );

        $request_route_uri_fragments = explode( "/", $request_route->getUri() );

        foreach ($this->_routeDefinitions as $routeDefinition)
        {
            $route = call_user_func($routeDefinition);

            /**
             * Passing the uri to the get function in the url service to make sure the uri:s have a consistent format
             */
            //$route->setUri( $url->get( $route->getUri() ) );

            $route_uri_fragments = explode( "/", $route->getUri() );

            /**
             * Check if request uri and route uri has the same number of fragments.
             * If not, continue to next route.
             */
            if ( count($route_uri_fragments) != count($request_route_uri_fragments) )
            {
                continue;
            }

            $params = array();

            /**
             * Compare every fragment of the uris
             */
            for ( $i = 0; $i < count($route_uri_fragments); $i++ )
            {
                /**
                 * Parameters are not compared
                 */
                if ( $route_uri_fragments[$i] == "{param}" )
                {
                    $params[] = $request_route_uri_fragments[$i];

                    continue;
                }

                /**
                 * If a fragment is not equal -> continue to next route
                 */
                if ( $route_uri_fragments[$i] != $request_route_uri_fragments[$i] )
                {
                    continue 2;
                }
            }

            $route->setParams( $params );

            /**
             * We have a match!
             */
            $this->_matchRoute = $route;

            return;
        }

        /**
         * No match :(
         * If not found route has been set -> set as out match route
         */
        if ( isset($this->_notFoundRoute) )
        {
            $this->_matchRoute = $this->_notFoundRoute;

            return;
        }

        /**
         * With no other options, we set the match route to a default route
         */
        $this->_matchRoute = new Route();
    }
524799
public function makeRedirectUri($uri, $params = [], $queryDelimiter = '?')
    {
        $uri .= (strstr($uri, $queryDelimiter) === false) ? $queryDelimiter : '&';

        return $uri . http_build_query($params);
    }
734765
public function requestServerData($uri, $postData = [])
    {
        $result = Http::post($this->createServerUrl($uri), function ($http) use ($postData) {
            $this->applyHttpAttributes($http, $postData);
        });

        if ($result->code == 404) {
            throw new ApplicationException(Lang::get('system::lang.server.response_not_found'));
        }

        if ($result->code != 200) {
            throw new ApplicationException(
                strlen($result->body)
                ? $result->body
                : Lang::get('system::lang.server.response_empty')
            );
        }

        $resultData = false;

        try {
            $resultData = @json_decode($result->body, true);
        }
        catch (Exception $ex) {
            throw new ApplicationException(Lang::get('system::lang.server.response_invalid'));
        }

        if ($resultData === false || (is_string($resultData) && !strlen($resultData))) {
            throw new ApplicationException(Lang::get('system::lang.server.response_invalid'));
        }

        return $resultData;
    }
1059874
public function post(Provider $provider, $userId, $requestScope, $requestUri, array $postBody, array $requestHeaders = [])
    {
        return $this->send($provider, $userId, $requestScope, Request::post($requestUri, $postBody, $requestHeaders));
    }
763681
public function retrieve($uri)
    {
        $ch = curl_init();

        curl_setopt($ch, CURLOPT_URL, $uri);
        curl_setopt($ch, CURLOPT_HEADER, true);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));

        $response = curl_exec($ch);
        if (false === $response) {
            throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
        }

        $this->fetchMessageBody($response);
        $this->fetchContentType($response);

        curl_close($ch);

        return $this->messageBody;
    }
967160
public function createSymmetricEncryptedRequest(
        string $method,
        string $uri,
        string $body,
        SharedEncryptionKey $key,
        array $headers = []
    ): RequestInterface {
        return new Request(
            $method,
            $uri,
            $headers,
            Base64UrlSafe::encode(Simple::encrypt($body, $key))
        );
    }
238141
public function request(?string $index = null, $xss_clean = false)
    {
        // Check if a field has been provided.
        if ($index === null && \count($_REQUEST) > 0) {
            $request = [];

            // Loop through the full $_REQUEST array and return the value.
            foreach (array_keys($_REQUEST) as $key) {
                $request[$key] = $this->fetchFromArray($_REQUEST, $key, $xss_clean);
            }

            return $request;
        }

        return $this->fetchFromArray($_REQUEST, $index, $xss_clean);
    }
1287701
private function fetchSchemaAt($uri)
    {
        if ($hook = $this->preFetchHook) {
            $uri = $hook($uri);
        }

        set_error_handler(function ($severity, $error) use ($uri) {
            restore_error_handler();
            throw new UnfetchableUriException([$uri, $error, $severity]);
        });

        $content = file_get_contents($uri);
        restore_error_handler();

        $schema = json_decode($content);

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new JsonDecodeException(sprintf(
                'Cannot decode JSON from URI "%s" (error: %s)',
                $uri,
                Utils::lastJsonErrorMessage()
            ));
        }

        if (!is_object($schema)) {
            throw new InvalidRemoteSchemaException([$uri]);
        }

        return $schema;
    }
1126608
public String sendData(String jsonSource, String index, String type) {
        return sendData(jsonSource, index, type, null).getId();
    }
1123747
public function execute($uri, $requestMethod)
    {
        foreach ($this->routes as $route) {
            if (true === $route->matches($uri, $requestMethod)) {
                return $route;
            }
        }
        return null;
    }