Execute the content queries.

This is tightly coupled to $this->getContent()

@see $this->getContent()

@param array $decoded
@param array $parameters

@return array
7654
protected function executeGetContentSearch($decoded, $parameters)
    {
        $limit = 2000;
        $offset = 0;

        // set correct limit and offset if these are set.
        if (isset($decoded['parameters']['limit'])) {
            $limit = $decoded['parameters']['limit'];
        }

        if (isset($decoded['parameters']['paging']) && ($decoded['parameters']['paging'] === true) && isset($decoded['parameters']['page'])) {
            // Pagenumbers are one-based, not zero-based.
            $offset = $limit * ($decoded['parameters']['page'] - 1);
        }

        $results = $this->searchContent(
            $parameters['filter'],
            $decoded['contenttypes'],
            null,
            $limit,
            $offset
        );

        return [
            $results['results'],
            $results['no_of_results'],
        ];
    }
930349
public function executeStatement($statementQuery, array $parameters) {
		$statement = $this->connection->prepare($statementQuery);
		foreach ($parameters as $parameterName => $parameterValue) {
			$statement->bindValue($parameterName, $parameterValue);
		}

		$result = $statement->execute();
		$resultArray = array();
		while ($resultRow = $result->fetchArray(SQLITE3_ASSOC)) {
			$resultArray[] = $resultRow;
		}

		return $resultArray;
	}
310201
private function execute($aSql, array $parameters)
    {
        $statement = $this->pdo->prepare($aSql);
        $statement->execute($parameters);

        return $statement;
    }
1095044
public static function parse(array $parameters)
    {
        if (base64_decode($parameters[self::PARAMETER_REQUEST], true) === false) {
            throw new InvalidRequestException('Failed decoding SAML request, did not receive a valid base64 string');
        }

        $parsed = new self($parameters[self::PARAMETER_REQUEST]);

        if (isset($parameters[self::PARAMETER_RELAY_STATE])) {
            $parsed->relayState = $parameters[self::PARAMETER_RELAY_STATE];
        }

        $decoded = $parsed->getDecodedSamlRequest();
        $request = ReceivedAuthnRequest::from($decoded);

        $parsed->receivedRequest = $request;

        // Return AuthnRequest
        return $parsed;
    }
290927
private function createRequestBody(array $parameters): array
    {
        $resources = [];
        foreach ($parameters as $key => $values) {
            if (!is_array($values)) {
                $values = [$values];
            }
            foreach ($values as $value) {
                $resources[] = [
                    'name' => $key,
                    'content' => $value,
                ];
            }
        }

        return $resources;
    }
1045300
public function sendReadQuery($query, array $parameters = array())
    {
        return $this->sendCypherQuery($query, $parameters, $this->getReadConnection()->getAlias(), self::READ_QUERY);
    }
55531
private function prepareParameters(array $parameters, $escape = true)
    {
        $filtered = array();
        foreach ($parameters as $key => $value) {
            if (is_array($value)) {
                $value = $this->prepareParameters($value, $escape);
            } elseif ($value instanceof Reference || is_string($value) && 0 === strpos($value, '@')) {
                $value = '@'.$value;
            }

            $filtered[$key] = $value;
        }

        return $escape ? $this->escape($filtered) : $filtered;
    }
1059463
public function queryString($params = [], $format = null) {
		$result = [];
		$query = [];

		foreach (array_filter([$this->query, $params]) as $querySet) {
			if (is_string($querySet)) {
				$result[] = $querySet;
				continue;
			}
			$query = array_merge($query, $querySet);
		}
		$query = array_filter($query);

		if ($format) {
			$q = null;
			foreach ($query as $key => $value) {
				if (!is_array($value)) {
					$q .= Text::insert($format, [
						'key' => urlencode($key),
						'value' => urlencode($value)
					]);
					continue;
				}
				foreach ($value as $val) {
					$q .= Text::insert($format, [
						'key' => urlencode("{$key}[]"),
						'value' => urlencode($val)
					]);
				}
			}
			$result[] = substr($q, 0, -1);
		} else {
			$result[] = http_build_query($query);
		}

		$result = array_filter($result);
		return $result ? "?" . join("&", $result) : null;
	}
1064029
function decodeCommand( $name, $parameters )
    {
        $names = $this->ruleNames();
        $rules = array();
        switch ( $name )
        {
            // Special code handlers
            case 'url_cleanup_iri':
            case 'url_cleanup':
            case 'url_cleanup_compat':
            case 'identifier_cleanup':
            {
            } break;

            case 'normalize':
            case 'search_normalize':
            case 'decompose':
            case 'diacritical':
            case 'lowercase':
            case 'uppercase':
            case 'search_cleanup':
            {
                if ( count( $parameters ) == 0 )
                {
                    // Include all normalize rules
                    foreach ( $names as $rule )
                    {
                        if ( preg_match( '#_'. $name . '$#', $rule ) )
                            $rules[] = $rule;
                    }
                }
                else
                {
                    foreach ( $parameters as $parameter )
                    {
                        $rule = $parameter . '_' . $name;
                        if ( in_array( $rule, $names ) )
                            $rules[] = $rule;
                    }
                }
            } break;

            case 'transform':
            case 'transliterate':
            {
                $dividers = array( 'transform' => '_to_',
                                   'transliterate' => '_transliterate_' );
                $divider = $dividers[$name];
                if ( count( $parameters ) == 0 )
                {
                    // Include all transformation rules
                    foreach ( $names as $rule )
                    {
                        if ( preg_match( '#^[a-zA-Z][a-zA-Z0-9-]+'. $divider . '[a-zA-Z][a-zA-Z0-9-]+$#', $rule ) )
                            $rules[] = $rule;
                    }
                }
                else if ( count( $parameters ) == 2 )
                {
                    $rule = $parameters[0] . $divider . $parameters[1];
                    if ( in_array( $rule, $names ) )
                        $rules[] = $rule;
                }
            } break;

            default:
            {
                $ini = eZINI::instance( 'transform.ini' );
                $commands = $ini->variable( 'Extensions', 'Commands' );
                if ( isset( $commands[$name] ) )
                {
                    break;
                }
                eZDebug::writeError( "Unknown command '$name'", __METHOD__ );
            } break;
        }
        return $rules;
    }
1291883
protected function process($parameters)
    {
        // Properly encode parameters
        $parameters = $this->encode($parameters);

        $request  = "POST /recaptcha/api/verify HTTP/1.0\r\n";
        $request .= "Host: " . self::VERIFY_SERVER . "\r\n";
        $request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
        $request .= "Content-Length: " . strlen($parameters) . "\r\n";
        $request .= "User-Agent: reCAPTCHA/PHP5\r\n";
        $request .= "\r\n";
        $request .= $parameters;

        if (false == ($socket = @fsockopen(self::VERIFY_SERVER, 80))) {
            throw new Exception('Could not open socket to: ' . self::VERIFY_SERVER);
        }

        fwrite($socket, $request);

        $response = '';

        while (!feof($socket) ) {
            $response .= fgets($socket, 1160);
        }

        fclose($socket);

        return explode("\r\n\r\n", $response, 2);
    }
946803
public function getApiKey($decoded = false)
    {
        return ($decoded === false) ? $this->apiKey : base64_decode($this->apiKey);
    }
686494
protected function encode($method, array $parameters = [])
    {
        $this->encoder = $this->encoder ?: new XmlrpcEncoder();

        return $this->encoder->encodeCall($method, $parameters);
    }
668217
public void decodeQueryTo(MultiMap<String> parameters) {
        if (_query == null)
            return;
        UrlEncoded.decodeUtf8To(_query, parameters);
    }
1250510
public void decodeQueryTo(MultiMap<String> parameters, Charset encoding) throws UnsupportedEncodingException {
        if (_query == null)
            return;

        if (encoding == null || StandardCharsets.UTF_8.equals(encoding))
            UrlEncoded.decodeUtf8To(_query, parameters);
        else
            UrlEncoded.decodeTo(_query, parameters, encoding);
    }
1125669
public function execute(array $parameters = [])
    {
        if (!$this->isValid()) {
            throw new InvalidCommandExecutionException($this->commandName);
        }

        $parameters = \array_merge($this->commandParameters, $parameters);
        $command = new CommandToExecute($this->commandName, $parameters);

        return $this->commandExecutor->execute($command);
    }
208095
protected function getContainersRawData(array $parameters = array())
    {
        $cacheKey = md5(json_encode($parameters));

        if (!array_key_exists($cacheKey, self::$listContainersCache)) {
            $tmp = array();

            foreach ($parameters as $k => $v) {
                if (in_array($k, self::$allowedParameters)) {
                    $tmp[$k] = $v;
                }
            }

            $response = $this->makeRequest(Client::GET, array(), array(), $tmp);
            self::$listContainersCache[$cacheKey] = $response['body'];
        }

        return self::$listContainersCache[$cacheKey];
    }
466828
public function callAction($method, $parameters)
    {
        $response = call_user_func_array([$this, $method], $parameters);

        if (is_null($response) && ! is_null($this->layout)) {
            $response = $this->layout;
        }

        return $response;
    }