src/Soluble/DbWrapper/AdapterFactory.php
public static function createAdapterFromResource($resource)
    {
        if (is_scalar($resource) || is_array($resource)) {
            throw new Exception\InvalidArgumentException("Resource param must be a valid 'resource' link (mysqli, pdo)");
        }
        if ($resource instanceof \PDO) {
            $adapter = self::getAdapterFromPdo($resource);
        } elseif (extension_loaded('mysqli') && $resource instanceof \mysqli) {
            $adapter = new Adapter\MysqliAdapter($resource);
        } else {
            throw new Exception\InvalidArgumentException('Resource must be a valid connection link, like PDO or mysqli');
        }

        return $adapter;
    }
public static function createAdapterFromResource($resource)
    {
        if (is_scalar($resource) || is_array($resource)) {
            throw new Exception\InvalidArgumentException("Resource param must be a valid 'resource' link (mysqli, pdo)");
        }
        if ($resource instanceof \PDO) {
            $adapter = self::getAdapterFromPdo($resource);
        } elseif (extension_loaded('mysqli') && $resource instanceof \mysqli) {
            $adapter = new Adapter\MysqliAdapter($resource);
        } else {
            throw new Exception\InvalidArgumentException('Resource must be a valid connection link, like PDO or mysqli');
        }

        return $adapter;
    }
public static function createAdapterFromResource ( $ resource ) { if ( is_scalar ( $ resource ) || is_array ( $ resource ) ) { throw new Exception \ InvalidArgumentException ( "Resource param must be a valid 'resource' link (mysqli, pdo)" ) ; } if ( $ resource instanceof \ PDO ) { $ adapter = self :: getAdapterFromPdo ( $ resource ) ; } elseif ( extension_loaded ( 'mysqli' ) && $ resource instanceof \ mysqli ) { $ adapter = new Adapter \ MysqliAdapter ( $ resource ) ; } else { throw new Exception \ InvalidArgumentException ( 'Resource must be a valid connection link, like PDO or mysqli' ) ; } return $ adapter ; }
Create adapter from an existing connection resource.

@param mixed $resource database connection object (mysqli, pdo_mysql,...)

@throws Exception\InvalidArgumentException
@throws Exception\UnsupportedDriverException

@return Adapter\AdapterInterface
Create adapter from an existing connection resource .