Socket_Client::create PHP Method

create() public static method

public static create ( $uriList, $async = true )
    public static function create($uriList, $async = true)
    {
        if (!self::$clientFactoriesInited) {
            self::initClientFactories();
        }
        if (is_string($uriList)) {
            $uriList = array($uriList);
        }
        $scheme = strtolower(parse_url($uriList[0], PHP_URL_SCHEME));
        $n = count($uriList);
        for ($i = 1; $i < $n; ++$i) {
            if (strtolower(parse_url($uriList[$i], PHP_URL_SCHEME)) != $scheme) {
                throw new Exception("Not support multiple protocol.");
            }
        }
        $clientFactory = self::$clientFactories[$scheme];
        if (empty($clientFactory)) {
            throw new Exception("This client doesn't support {$scheme} scheme.");
        }
        return new $clientFactory($uriList, $async);
    }