Creates and sets a parameter.

@param mixed $value The value.
@param mixed $type  The type.

@return string The parameter placeholder.
543758
public function createParameter($value, $type = null)
    {
        if ($this->mode === self::MODE_POSITIONAL) {
            return $this->createPositionalParameter($value, $type);
        }

        return $this->createNamedParameter($value, $type);
    }
193687
public function typeIs($value)
    {
        $this->add(new Criterium(self::CRITERIUM_TYPE_IS, (int) $value));

        return $this;
    }
1311103
protected function getTypeSwapValue($type, $value)
    {
        switch (strtolower($type)) {
            case 'int':
            case 'integer':
                return (int) $value;
            case 'real':
            case 'float':
            case 'double':
                return (float) $value;
            case 'string':
                return (string) $value;
            default:
                return $value;
        }
    }
368552
protected function toDbType($value, $type)
    {
        switch ($type) {
            case 'int':
                return (int) $value;

            case 'bool':
                return (bool) $value;

            case 'string':
            case 'datetime': // Coverts by database
            case 'date':
            case 'float':
                return (string) $value;

            case 'array':
            case 'json':
                return json_encode((array) $value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);

            default:
                throw new InvalidArgumentException('Unsupported cast type: ' . $type);
        }
    }
381987
public function bindValue($parameter, $value, $type = null)
    {
        return $this->bindParam($parameter, $value, $type);
    }
955370
public static function invalidValue($type, $value)
    {
        if (is_object($value)) {
            $value = get_class($value);
        } elseif (is_bool($value) || is_null($value)) {
            $value = var_export($value, true);
        }

        return new self(sprintf('The type "%s" does not have a name for the value "%s".', $type, $value));
    }
898082
public function bindValue($parameter, $value, $type = \PDO::PARAM_STR)
    {
        $this->bindedValues[$parameter] = $value;

        return $this->bindParam($parameter, $this->bindedValues[$parameter], $type);
    }
617544
protected function addNamedParameter($name, $value, $queryBuilder, $type = null)
    {
        $bound_suffix = '_' . (microtime(true) * 10000) . '_' . random_int(1000, 9999) . '_' . count($queryBuilder->getParameters());
        $placeHolder = ":" . $name . $bound_suffix;
        $queryBuilder->setParameter(substr($placeHolder, 1), $value, $type);
        return $placeHolder;
    }
1080940
private function parserParamType(string $type, $value)
    {
        switch ($type) {
            case 'int':
                $value = (int)$value;
                break;
            case 'string':
                $value = (string)$value;
                break;
            case 'bool':
                $value = (bool)$value;
                break;
            case 'float':
                $value = (float)$value;
                break;
            case 'double':
                $value = (double)$value;
                break;
        }

        return $value;
    }
1153308
protected function castParameter($value, $type = null) {
		//check null value
		if (is_null($value))
			return 'NULL';
		elseif (is_null($type)) {
			//obtain default type handler
			$typeHandler = $this->getDefaultTypeHandler($value);
			if (is_null($typeHandler))
				return 'NULL';
			if (is_array($value))
				return $this->castArray($value, $typeHandler, '_');
		}
		else {
			//cast value to the specified type
			$typeHandler = $this->typeManager->getTypeHandler($type);
				
			if ($typeHandler === false)
				throw new \RuntimeException("No type handler found for type '$type'");
				
			if (is_array($value))
				return $this->castArray($value, $typeHandler, '_');
			
			//check if returned value is null
			$value = $typeHandler->castParameter($value);
			if (is_null($value))
				return 'NULL';
		}
	
		//get parameter expression
		$value = $typeHandler->setParameter($value);
	
		//check null value
		if (is_null($value))
			return 'NULL';
		//cast to string
		if (!is_string($value))
			$value = strval($value);
		return $value;
	}
757906
public function bindValue($parameter, $value, $data_type = Connection::PARAM_STR)
    {
        // numbered holder to named holder.
        if (is_int($parameter)) {
            $parameter = ':numbered_holder_' . $parameter;
        }
        return parent::bindValue($parameter, $value, $data_type);
    }
796417
public static function create($type, $value, $extra = null)
    {
        switch (strtolower($type)) {
            case 'int':
            case 'integer':
                return self::createInt($value);
            case 'float':
            case 'double':
                return self::createFloat($value);
            case 'string':
                return self::createString($value);
            case 'bool':
            case 'boolean':
                return self::createBool($value);
            case 'digit':
                return self::createDigit($value);
            case 'natural':
                return self::createNatural($value);
            case 'whole':
                return self::createWhole($value);
            case 'complex':
                return self::createComplex($value, $extra);
            case 'rational':
                return self::createRational($value, $extra);
            default:
                throw new InvalidTypeException(strtolower($type));
        }
    }
913315
public static function decode(string $value, string $type = null)
    {
        return self::run(self::DECODER, $value, $type);
    }
1219218
protected function setParam($type, $index, $value, $override = false) {
        if ($override) {
            $this->{$type}[$index] = $value;
        } else if (!isset($this->{$type}[$index])) {
            $this->{$type}[$index] = $value;
        }

        return $this;
    }
1012026
public function bindValue($column, $value, $type = 'string')
    {
        if ($type === null) {
            $type = 'string';
        }
        if (!ctype_digit($type)) {
            list($value, $type) = $this->cast($value, $type);
        }
        if ($type == PDO::PARAM_LOB) {
            $this->_statement->bindParam($column, $value, $type, 0, PDO::SQLSRV_ENCODING_BINARY);
        } else {
            $this->_statement->bindValue($column, $value, $type);
        }
    }
446110
protected function createNodeByValueAndType($value, $type)
    {
        /*
         * URI
         */
        if ('uri' == $type) {
            return $this->nodeFactory->createNamedNode($value);

        /*
         * Any Pattern
         */
        } elseif ('var' == $type) {
            return $this->nodeFactory->createAnyPattern();

        /*
         * Typed Literal or Literal
         */
        } elseif ('typed-literal' == $type || 'literal' == $type) {
            return $this->nodeFactory->createLiteral($value);

        /*
         * Unknown type
         */
        } else {
            throw new \Exception('Unknown type given: '.$type);
        }
    }
1230667
public function param($param, $value, $type = null)
    {
        return $this->setParameter($param, $value, $type);
    }