Bind variable

@param string                 $type     'assoc' or 'numeric'
@param ServerRequestInterface $request
@param array                  $parts
@param array                  $options
@return array
161089
protected function bindVar($type, ServerRequestInterface $request, array $parts, array $options)
    {
        foreach ($options as $option) {
            $value = null;
            
            $bound = 
                $this->bindVarString($option, $value) ||
                $this->bindVarSuperGlobal($option, $request, $value) ||
                $this->bindVarRequestHeader($option, $request, $value) ||
                $this->bindVarMultipleUrlParts($option, $type, $parts, $value) ||
                $this->bindVarSingleUrlPart($option, $parts, $value);
            
            if ($bound && isset($value)) {
                return $value;
            }
        }
        
        return [null];
    }
151838
public function bindValue($parameter, $value, $data_type = \PDO::PARAM_STR) {
        $this->_debugBindValues[$parameter] = $value;
        parent::bindValue($parameter, $value, $data_type);
    }
1018801
public function bind($param, $value, $type = null)
    {
        if (is_null($type)) {
            switch (true) {
                case is_int($value):
                    $type = PDO::PARAM_INT;
                    break;
                case is_bool($value):
                    $type = PDO::PARAM_BOOL;
                    break;
                case is_null($value):
                    $type = PDO::PARAM_NULL;
                    break;
                default:
                    $type = PDO::PARAM_STR;
            }
        }
        //then run PDO bindValue on the statement to bind the values
        self::$statement->bindValue($param, $value, $type);
    }
1154518
public function doRequest($type, $url, $params, $options = [], $headers = []) {
        // get access to the curl wrapper and set the bearer
        $curl = CURL::setBearer($this->getAccessToken());

        // set the request options
        foreach ($options as $var => $value) {
            $curl->setOption($var, $value);
        }

        // set the header values
        foreach ($headers as $var => $value) {
            $curl->setHeader($var, $value);
        }

        // execute the request
        $result = $curl->$type($url, $params);

        // done, return the result
        return $result;
    }
464205
public function bindColumn($column, &$param, $type=null, $maxlen=null, $driver=null)
    {
        $column = is_numeric($column) ? $column : strtoupper($column);
        $this->_binds[$column] = &$param;
    }
574658
public static function bindExecuteLastInsertId($query, $parameters = [])
    {
        try {
            return static::$adapter->bindExecuteLastInsertId($query, $parameters);
        } catch (\Exception $e) {
            throw new DatabaseException('Database Error', $e->getMessage());
        }
    }
230731
protected function bindCondition($type, $key, $values = [])
    {
        $conditionHolder = "{$type}Conditions";
        if (!is_array($values)) {
            $values = [$values];
        }

        array_push($this->$conditionHolder, [$key, $values]);

        return $this;
    }
459687
private function bindRequestParamsToClass(ServerRequestInterface $request, \ReflectionClass $reflectClass)
    {
        try {
            $object = $reflectClass->newInstance();
            $queryParams = $request->getQueryParams();
            // Get request body, auto decode when content type is json format
            if (StringHelper::startsWith($request->getHeaderLine('Content-Type'), 'application/json')) {
                $requestBody = JsonHelper::decode($request->getBody()->getContents(), true);
            } else {
                $requestBody = $request->getParsedBody();
            }
            // Merge query params and request body
            $requestParams = array_merge($queryParams, $requestBody);
            // Binding request params to target object
            $properties = $reflectClass->getProperties();
            foreach ($properties as $property) {
                $name = $property->getName();
                if (!isset($requestParams[$name])) {
                    continue;
                }
                if (!$property->isPublic()) {
                    $property->setAccessible(true);
                }
                $property->setValue($object, $requestParams[$name]);
            }
        } catch (\Exception $e) {
            $object = null;
        }
        return $object;
    }
381987
public function bindValue($parameter, $value, $type = null)
    {
        return $this->bindParam($parameter, $value, $type);
    }
544827
public function bindParam($column, &$variable, $type = ParameterType::STRING, $length = null)
    {
        switch ($type) {
            case ParameterType::INTEGER:
            case ParameterType::BOOLEAN:
                $type = 'i';
                break;

            case ParameterType::LARGE_OBJECT:
                $type = 'b';
                break;

            case ParameterType::NULL:
            case ParameterType::STRING:
            case ParameterType::BINARY:
                $type = 's';
                break;

            default:
                throw new SQLAnywhereException('Unknown type: ' . $type);
        }

        $this->boundValues[$column] =& $variable;

        if (! sasql_stmt_bind_param_ex($this->stmt, $column - 1, $variable, $type, $variable === null)) {
            throw SQLAnywhereException::fromSQLAnywhereError($this->conn, $this->stmt);
        }

        return true;
    }
270841
protected function bindVarMultipleUrlParts($option, $type, array $parts, &$value)
    {
        if (substr($option, -3) === '...' && ctype_digit(substr($option, 1, -3))) {
            $i = (int)substr($option, 1, -3);

            if ($type === 'assoc') {
                throw new \InvalidArgumentException("Binding multiple parts using '$option' is only allowed in numeric arrays");
            } else {
                $value = array_slice($parts, $i - 1);
            }
            
            return true;
        }
        
        return false;
    }
721601
public function before_request(&$url, &$headers, &$data, &$type, &$options)
    {
        $headers['Authorization'] = 'Basic '.base64_encode($this->token.':'.$this->key);
    }
236411
public function bind($params, $types)
    {
        if (empty($params)) {
            return;
        }

        $anonymousParams = is_int(key($params)) ? true : false;
        $offset = 1;
        foreach ($params as $index => $value) {
            $type = null;
            if (isset($types[$index])) {
                $type = $types[$index];
            }
            if ($anonymousParams) {
                $index += $offset;
            }
            $this->bindValue($index, $value, $type);
        }
    }
10954
protected function bindVarSuperGlobal($option, ServerRequestInterface $request, &$value)
    {
        if (preg_match('/^\$_(GET|POST|COOKIE)\[([^\[]*)\]$/i', $option, $matches)) {
            list(, $var, $key) = $matches;

            $var = strtolower($var);
            $data = null;

            if ($var === 'get') {
                $data = $request->getQueryParams();                
            } elseif ($var === 'post') {
                $data = $request->getParsedBody();
            } elseif ($var === 'cookie') {
                $data = $request->getCookieParams();
            }

            $value = isset($data[$key]) ? [$data[$key]] : null;
            return true;
        }
        
        return false;
    }
851236
public static function create($type, $uri, $method = 'GET', $parameters = [], $cookies = [], $files = [], $server = [], $content = null)
    {
        self::configureFactory($type);

        return \call_user_func_array([self::getClass($type), 'create'], [$uri, $method, $parameters, $cookies, $files, $server, $content]);
    }
809926
public function bindParam($tag, &$param, $type = DB::PARAM_AUTO) {
        if (!is_int($tag) and ctype_digit($tag))
            $tag = intval($tag);
        elseif (is_string($tag)) {
            if (':' != substr($tag, 0, 1))
                $tag = ":$tag";
        } else
            return false;
        $this->parameters[$tag] = array('param' => &$param, 'type' => $type);
        return true;
    }
268207
protected function bindPartArray($var, ServerRequestInterface $request, array $parts, &$part)
    {
        if (!is_array($var) && !$var instanceof \stdClass) {
            return false;
        }
        
        $part = [$this->bind($var, $request, $parts)];
        return true;
    }