Evaluate Connection type

@param bool $evaluate
@return ObjectType|Callable
767371
public function getConnectionType($evaluate = true)
    {
        return ($evaluate && is_callable($this->connectedType))
            ? call_user_func($this->connectedType)
            : $this->connectedType;
    }
1199324
public static function getInstance($connectName = self::DEFAULT_CONNECT_NAME, $isActive = false)
    {
        self::getActiveConnectName($connectName, $isActive);
        $connectionData = self::getConnectionData($connectName);
        return $connectionData->getConnection();
    }
829429
public static function inferType($value)
    {
        if (is_int($value)) {
            return Type::INTEGER;
        }

        if (is_bool($value)) {
            return Type::BOOLEAN;
        }

        if ($value instanceof DateTimeInterface) {
            return Type::DATETIME;
        }

        if ($value instanceof DateInterval) {
            return Type::DATEINTERVAL;
        }

        if (is_array($value)) {
            return is_int(current($value))
                ? Connection::PARAM_INT_ARRAY
                : Connection::PARAM_STR_ARRAY;
        }

        return ParameterType::STRING;
    }
844197
public function evaluate($values)
    {
        $returnValue = (bool) false;

        
        $invert = $this->hasOption('invert') ? $this->getOption('invert') : false;
        $reference = $this->getOption('reference');
		$equals = ($values == $reference->getRawValue());
		$returnValue = $invert ? !$equals : $equals;
        

        return (bool) $returnValue;
    }
128419
public function has( $relation, $operator = '>=', $count = 1, $boolean = 'and', Closure $callback = null )
	{
		if ( strpos( $relation, '.' ) !== false )
		{
			return $this->hasNested( $relation, $operator, $count, $boolean, $callback );
		}

		$relation = $this->getHasRelationQuery( $relation );

		// If we only need to check for the existence of the relation, then we can
		// optimize the subquery to only run a "where exists" clause instead of
		// the full "count" clause. This will make the query run much faster.
		$queryType = $this->shouldRunExistsQuery( $operator, $count ) ? 'getRelationQuery' : 'getRelationCountQuery';

		$query = $relation->{$queryType}( $relation->getRelated()->newQuery(), $this );

		if ( $callback )
		{
			$query->callScope( $callback );
		}

		return $this->addHasWhere( $query, $relation, $operator, $count, $boolean );
	}
1342902
public static function getTypeFromPHPVariable($variable)
    {
        if ($variable === null) {
            throw ODMException::cannotInferTypeFromNullValue();
        }

        $phpType = gettype($variable);
        
        if ($phpType === 'string') {
            if ($variable === '') {
                throw new \InvalidArgumentException;
            }

            return self::getType(Type::STRING);
        }

        if ($phpType instanceof NumberValue) {
            //use type coercion to determine the actual php type
            $phpType = gettype((string)$variable + 0);
        }

        if ($phpType === 'integer') {
            return self::getType(Type::INT);
        }

        if ($phpType === 'double') {
            return self::getType(Type::FLOAT);
        }

        if (is_resource($variable) || $variable instanceof StreamInterface || $variable instanceof BinaryValue) {
            return self::getType(Type::BIN);
        }

        if ($phpType === 'object') {
            if ($variable instanceof SetValue) {
                return self::getType(Type::SET);
            }

            if (!$variable instanceof \Traversable && !$variable instanceof \stdClass) {
                throw ODMException::unmappedObjectSerializationNotSupported();
            }

            //Traversable objects fall through to the array case
            $phpType = 'array';
        }

        if ($phpType === 'array') {
            $i = 0;
            foreach ($variable as $k => $v) {
                if (!is_int($k) || $k != $i++) {
                    return self::getType(Type::MAP);
                }
            }

            return self::getType(Type::LIST_);
        }

        if ($phpType === 'boolean') {
            return self::getType(Type::BOOL);
        }

        //NULL, closed resource or unknown type
        throw new \InvalidArgumentException;
    }
1023128
private function getType($keepWaiting = false)
    {
        $type = null;
        while (!feof($this->socket)) {
            $type = fgetc($this->socket);
            if ($type !== false && $type !== '') {
                break;
            }

            $info = stream_get_meta_data($this->socket);
            if (!$keepWaiting || !$info['timed_out']) {
                break;
            }
        }

        if ($type === false || $type === '') {
            throw new ConnectionException('Nothing received while reading from client');
        }

        return $type;
    }
215788
public function evaluate()
    {
        $type = $this->getType();
        $content = $this->getContent();
        if ($type && $content) {
            return  'data:' . $type . ';base64,' . base64_encode($content);
        }
    }
419625
private function inferType($binding)
	{
		if (is_bool($binding))
		{
			$type = \PDO::PARAM_BOOL;
		}
		elseif (is_null($binding))
		{
			$type = \PDO::PARAM_NULL;
		}
		elseif (is_int($binding))
		{
			$type = \PDO::PARAM_INT;
		}
		else
		{
			$type = \PDO::PARAM_STR;
		}

		return $type;
	}
92288
protected function parseParameterType($value): int
    {

        if ($value === null) {
            return PDO::PARAM_NULL;
        }

        if (\is_int($value) === true || \is_bool($value) === true) {
            return PDO::PARAM_INT;
        }

        return PDO::PARAM_STR;
    }
70022
public function evaluate(array $options)
    {
        $request = $this->requestStack->getCurrentRequest();
        $referrer = $request->headers->get('referer');
        if ($this->referrerHeader && $request->headers->has($this->referrerHeader)) {
            $referrer = $request->headers->get($this->referrerHeader);
        }

        return (bool) preg_match(
            '/^' . str_replace(['*', '/'], ['(.*)', '\/'], $options[static::REFERRER]) . '$/',
            $referrer
        );
    }
1276464
protected function requestExceptionHandler(Throwable $exception) : ?Throwable
    {
        if ($exception instanceof RequestException) {
            if (
                $exception->hasResponse() &&
                $exception->getResponse()->hasError()
            ) {
                return new BadRemoteCallException($exception->getResponse());
            }

            return new ConnectionException(
                $exception->getRequest(),
                $exception->getMessage(),
                $exception->getCode()
            );
        }

        return null;
    }
271659
public function evaluate(array $parameters): bool
    {
        if (false === $this->permissionResolver->canUser('role', 'read', $parameters['content'])) {
            return false;
        }

        /** @var \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType */
        $contentType = $parameters['contentType'];

        $isUser = new ContentTypeIsUser($this->userContentTypeIdentifier);
        $isUserGroup = new ContentTypeIsUserGroup($this->userGroupContentTypeIdentifier);
        $isUserOrUserGroup = (new OrSpecification($isUser, $isUserGroup))->isSatisfiedBy($contentType);

        return $isUserOrUserGroup;
    }
1119411
protected function evaluate($exp)
    {
        list(, $op, $left, $right, $whiteBefore, $whiteAfter) = $exp;

        $left = $this->reduce($left);
        $right = $this->reduce($right);

        if ($leftColor = $this->coerceColor($left)) {
            $left = $leftColor;
        }

        if ($rightColor = $this->coerceColor($right)) {
            $right = $rightColor;
        }

        $ltype = $left[0];
        $rtype = $right[0];

        // operators that work on all types
        if ($op == 'and') {
            return $this->toBool($left == self::$TRUE && $right == self::$TRUE);
        }

        if ($op == '=') {
            return $this->toBool($this->eq($left, $right));
        }

        if ($op == '+' && !is_null($str = $this->stringConcatenate($left, $right))) {
            return $str;
        }

        // type based operators
        $fname = "op_${ltype}_${rtype}";
        if (is_callable(array($this, $fname))) {
            $out = $this->$fname($op, $left, $right);
            if (!is_null($out)) {
                return $out;
            }
        }

        // make the expression look it did before being parsed
        $paddedOp = $op;
        if ($whiteBefore) {
            $paddedOp = ' '.$paddedOp;
        }
        if ($whiteAfter) {
            $paddedOp .= ' ';
        }

        return array('string', '', array($left, $paddedOp, $right));
    }
343337
protected function getDataTypeByValue($value)
    {
        if(null === $value)
        {
            return \PDO::PARAM_NULL;
        }
        if(is_bool($value))
        {
            return \PDO::PARAM_BOOL;
        }
        if(is_int($value))
        {
            return \PDO::PARAM_INT;
        }
        return \PDO::PARAM_STR;
    }
234525
public function transaction($closure, $execute=true)
    {
        $transaction = static::connection()->transaction();
        $transaction->callback($closure, $this);

        if($execute)
            $transaction->execute();

        return $transaction;
    }
427193
private function bindDataType($value)
    {
        switch (true) {
            case is_string($value):
                return PDO::PARAM_STR;
            case is_int($value):
                return PDO::PARAM_INT;
            case is_bool($value):
                return PDO::PARAM_BOOL;
            case is_null($value):
                return PDO::PARAM_NULL;
            default:
                return false;
        }
    }