@param string $variable
@param array  $params

@throws \Http\Client\Exception

@return array
353954
public function show(string $variable, array $params = [])
    {
        $path = $this->buildVariablesPath($variable);

        return $this->get($path, $params);
    }
949545
private function parse(&$params, &$query) {

		//Check the type of param binding ("?" = all keys are numeric or ":" = all keys are strings)
	 	if(0 !== count(array_filter(array_keys($params), 'is_string'))) {
			
			preg_match_all('#:((?:[a-zA-Z_])(?:[a-zA-Z0-9-_]+)?)#', $query, $variables);

			if(true === isset($variables[0])) {

				$parameters = [];

				foreach($variables[0] as $index => $variable) {
					
					if(false === array_key_exists($variables[1][$index], $params)) {
						return trigger_error(sprintf('Parameter "%s" missing from bind parameters', $variables[1][$index]), E_USER_ERROR);
					}
					
					$parameters[] =& $params[$variables[1][$index]];
					$query = str_replace($variables[0][$index], '?', $query);
				}

				$params = $parameters;
			}
	 	}

		$bind = [];

		if(count($params) > 0) {

			$types = '';

			foreach($params as $param => $value) {

				switch(gettype($value)) {
		            
		            case 'NULL'		:
		            case 'string'	: $types .= 's'; break;

		            case 'boolean'	:
		            case 'integer'	: $types .= 'i'; break;
		            
		            case 'blob'		: $types .= 'b'; break;
		            
		            case 'double'	: $types .= 'd'; break;
		        }
			}

			$bind[] =& $types;

			foreach($params as $param => $value) {
				$bind[] =& $params[$param];
			}
		}

		return $bind;
	}
881809
public function query($query, array $params = [])
    {
        // Execute query
        $stmt = $this->connection->prepare($query);
        $stmt->execute($params);
        // Return result resource variable
        return $stmt;
    }
38113
protected function variable($variable)
    {
        return preg_replace_callback(sprintf('/%s(\w*\.*\w*)%s/', static::GLUE, static::GLUE), function ($match) {
            if ( ! $this->has($match[1])) {
                throw new \Exception($match[1]);
            }

            return $this->variables[$match[1]];
        }, $variable);
    }
135775
private function apiGet($url, $params)
    {
        $url = $url . (strpos($url, '?') === false ? '?' : '') . http_build_query($params);

        try {
            $response = $this->httpClient->request('GET', $url, [
                'headers' => [
                    'user-key' => $this->igdbKey,
                    'Accept' => 'application/json'
                ]
            ]);
        } catch (RequestException $exception) {
            if ($response = $exception->getResponse()) {
                throw new \Exception($exception);
            }
            throw new \Exception($exception);
        } catch (Exception $exception) {
            throw new \Exception($exception);
        }

        return $response->getBody();
    }
726548
public function execute($params = array(), $request = array()) {
        //$passableParams = $this->httpRequest->getParameters();
        //remove the uri
        // array_shift($passableParams);

        $this->getQueryBuilder()->where($params);
        $query = '';
        if ($this->entity instanceof AbstractI18nEntity) {
            $query = $this->getQueryBuilder()->getQuery($this->entity, QueryBuilder::GET_ITEM_QUERY, QueryBuilder::PARENT_AND_CHILD);
        } else {
            $query = $this->getQueryBuilder()->getQuery($this->entity, QueryBuilder::GET_ITEM_QUERY);
        }

        $firstResult = $this->query($query);
        $entityName = get_class($this->entity);

        if (is_array($firstResult) && count($firstResult) > 0) {

            $this->loadI18nValues($firstResult, $params);

            $this->loadChildTableParams($firstResult, $params);

            $this->loadOneToOneJoinTables($firstResult);

            $this->loadOneToManyJoinTables($firstResult, $params);


        }

        return array($entityName => is_array($firstResult) ? current($firstResult) : array());
    }
963072
public function request($variable)
    {
        $order = ini_get('request_order');

        if (empty($order)) {
            $order = ini_get('variables_order');
        }

        $len = strlen($order);

        for ($i = 0; $i < $len; ++$i) {
            $character = strtoupper($order[$i]);

            if ($character == 'G') {
                if ($this->get($variable)) return $this->get($variable);
            } else if ($character == 'P') {
                if ($this->post($variable)) return $this->post($variable);
            } else if ($character == 'C') {
                if ($this->cookie($variable)) return $this->cookie($variable);
            }
        }

        return null;
    }
730174
protected function executePreparedStatement($query, $params)
        {
            $res = odbc_prepare($this->_lnk, $query);
            if(!$res) {
                $error = odbc_errormsg($this->_lnk);
                $this->log('Prepare failed: ' . $error);
                throw new Exception('Preparing query failed ' . $error, self::PREPARE_FAILED);
            }
            $res = odbc_execute($res, $params);
            if(!$res) {
                $error = odbc_errormsg($this->_lnk);
                $this->log('Prepared query execution failed: ' . $error);
                throw new Exception('Executing prepared query failed ' . $error, self::QUERY_FAILED);
            }
            return $res;
        }
1371246
private function sanitizeParam($var): array
    {
        if (\is_object($var)) {
            $className = \get_class($var);

            return method_exists($var, '__toString') ?
                [sprintf('/* Object(%s): */"%s"', $className, $var->__toString()), false] :
                [sprintf('/* Object(%s) */', $className), false];
        }

        if (\is_array($var)) {
            $a = [];
            $original = true;
            foreach ($var as $k => $v) {
                list($value, $orig) = $this->sanitizeParam($v);
                $original = $original && $orig;
                $a[$k] = $value;
            }

            return [$a, $original];
        }

        if (\is_resource($var)) {
            return [sprintf('/* Resource(%s) */', get_resource_type($var)), false];
        }

        return [$var, true];
    }
934413
public function execute($command, $params = null)
    {
        $url = $command;

        if (substr($url, -1) !== '/') {
            $url .= '/';
        }

        if ($params) {
            $parameters = array();
            foreach ($params as $k => $v) {
                if (strlen($v)) {
                    $parameters[] = urlencode($k) . '=' . urlencode($v);
                } else {
                    $parameters[] = urlencode($k);
                }
            }
            $url .= '?' . implode('&', $parameters);
        }

        try {
            $response = $this->client->get($url);
        } catch (\Exception $e) {
            return null;
        }
        $this->checkError($response, $url);

        return $response->getBody();
    }
921560
private function subVars($query, $vars = [])
    {
        if (!is_array($vars)) {
            $vars = [$vars];
        }

        $queryParts = explode( "?", $query );
        if ( count( $queryParts ) -1 != count ( $vars ) ) {
            throw new \Exception( "Number of variables supplied does not match number of ?s in the query!" );
        }

        $finalQuery = $queryParts[0];
        $queryPartNo = 0;
        foreach ( $vars as $var ) {
            $var = $this->escapifyVariable($var);
            $queryPartNo++;
            $finalQuery .= $var . $queryParts[$queryPartNo];
        }

        return $finalQuery;
    }
402341
public function putVars($key, $value = null)
    {
        if (is_array($key)) {
            $variables = $key;
        } elseif (!is_null($value)) {
            $variables = [$key => $value];
        } else {
            throw new Exception('Try Assets::putVars(["foo" => "bar"]');
        }

        // First, we have to translate the variables
        // to something JS-friendly.
        $this->buildJavaScriptSyntax($variables);

        return $this;
    }
990087
public function addVariable(PhpVariable $variable)
    {
        if ($this->variableExists($variable->getIdentifier())) {
            throw new Exception('A variable of the name (' . $variable->getIdentifier() . ') does already exist.');
        }

        $this->variables[$variable->getIdentifier()] = $variable;
    }
44226
public function setParamVariable($paramVariable)
    {
        if (is_bool($paramVariable) === true) {
            $this->paramVariable = $paramVariable;
        } else {
            $msg = "The 'paramVariable' argument must be a boolean value, '" . gettype($paramVariable) . "'.";
            throw new InvalidArgumentException($msg);
        }
    }
1321925
public function search($methodVars)
    {
        // Check for required variables
        if (!empty($methodVars['tag'])) {
            $vars = array(
                'method' => 'tag.search',
                'api_key' => $this->auth->apiKey
            );
            $vars = array_merge($vars, $methodVars);

            if ($call = $this->apiGetCall($vars)) {
                $opensearch = $call->results->children('http://a9.com/-/spec/opensearch/1.1/');
                if ($opensearch->totalResults > 0) {
                    $searchResults['totalResults'] = (string) $opensearch->totalResults;
                    $searchResults['startIndex'] = (string) $opensearch->startIndex;
                    $searchResults['itemsPerPage'] = (string) $opensearch->itemsPerPage;
                    $i = 0;
                    foreach ($call->results->tagmatches->tag as $tag) {
                        $searchResults['results'][$i]['name'] = (string) $tag->name;
                        $searchResults['results'][$i]['count'] = (string) $tag->count;
                        $searchResults['results'][$i]['url'] = (string) $tag->url;
                        $i++;
                    }
                    return $searchResults;
                } else {
                    throw new NoResultsException('No results');
                }
            } else {
                return false;
            }
        } else {
            throw new InvalidArgumentException('You must include tag variable in the call for this method');
        }
    }
1332839
public function execute($query, $params = []) : object
    {
        self::$queries[] = $query;
        self::$params[]  = $params;
        self::$numQueries++;

        if ($this->options['verbose']) {
            echo "<p>Num query = "
                . self::$numQueries
                . "</p><p>Query = </p><pre>"
                . htmlentities($query)
                . "</pre>"
                . (empty($params)
                    ? null
                    : "<p>Params:</p><pre>" . htmlentities(print_r($params, 1)) . "</pre>"
                );
        }

        return parent::execute($query, $params);
    }
476049
public static function expand($var, array $params, $recursive = FALSE)
	{
		if (is_array($var)) {
			$res = [];
			foreach ($var as $key => $val) {
				$res[$key] = self::expand($val, $params, $recursive);
			}
			return $res;
		} elseif ($var instanceof Nette\DI\Statement) {
			return new Nette\DI\Statement(
				self::expand($var->getEntity(), $params, $recursive),
				self::expand($var->arguments, $params, $recursive)
			);
		} elseif (!is_string($var)) {
			return $var;
		}

		$parts = preg_split('#%%([\w.-]*)%%#i', $var, -1, PREG_SPLIT_DELIM_CAPTURE);
		$res = '';
		foreach ($parts as $n => $part) {
			if ($n % 2 === 0) {
				$res .= $part;
			} elseif ($part === '') {
				$res .= '%';
			} elseif (isset($recursive[$part])) {
				throw new \Nette\InvalidArgumentException(
					sprintf('Circular reference detected for variables: %s.', implode(', ', array_keys($recursive)))
				);
			} else {
				try {
					$val = Nette\Utils\Arrays::get($params, explode('.', $part));
				} catch (\Nette\InvalidArgumentException $exc) {
					//FIXME: OutOfRangeException only because of BC
					throw new \Nette\OutOfRangeException(
						"Cannot replace %%$part%% because parameter does not exist.",
						0,
						$exc
					);
				}
				if ($recursive) {
					$val = self::expand($val, $params, (is_array($recursive) ? $recursive : []) + [$part => 1]);
				}
				if (strlen($part) + 4 === strlen($var)) {
					return $val;
				}
				if (!is_scalar($val) && $val !== NULL) {
					throw new \Nette\InvalidArgumentException("Unable to concatenate non-scalar parameter '$part' into '$var'.");
				}
				$res .= $val;
			}
		}
		return $res;
	}