Transport factory

@param string $type
@return Transport
503849
public static function factory($type)
    {
        if (isset(self::$transports[$type])) {
            return self::$transports[$type];
        }

        self::$transports[$type] = new Transport($type);
        return self::$transports[$type];
    }
775042
public function copy($type = null)
    {
        $builder = new Builder($this->type, $this->dogmatist, $this->parent, $this->strict);
        $this->copyData($builder);

        if ($type !== null) {
            $builder->setType($type);
        }

        return $builder;
    }
623031
public static function factory($host, $port, $sendTimeout = null, $receiveTimeout = null, $framedTransport = false)
    {
        $socket = self::createSocket($host, $port, $sendTimeout, $receiveTimeout);
        $transport = self::createTransport($socket, $framedTransport);
        $protocol = new TBinaryProtocolAccelerated($transport);
        $client = new RestClient($protocol);
        $transport->open();

        return $client;
    }
883943
public static function createTransport(): TransportInterface
    {
        if (class_exists(HttpClientDiscovery::class) && class_exists(MessageFactoryDiscovery::class)) {
            try {
                return new HttpClientTransport(HttpClientDiscovery::find(), MessageFactoryDiscovery::find());
            } catch (NotFoundException $e) {
                // Do nothing
            }
        }

        if (class_exists(Client::class)) {
            return new Guzzle6Transport();
        }

        if (extension_loaded('curl')) {
            return new CurlExtensionTransport();
        }

        throw new RuntimeException('Cannot create an HTTP transport object');
    }
345210
public function getFromGateway($type) {
        $mapper = $this->config->getCcTypesMapper();
        $type   = strtolower($type);

        if( array_key_exists($type, $mapper) ) {
            return $mapper[$type];
        }

        return 'OT';
    }
890914
public static function createObject($type)
    {
        if (\is_string($type)) {
            return static::get($type);
        } elseif (\is_array($type)) {
            if (!isset($type['class'])) {
                throw new InvalidConfigException('Object configuration must be an array containing a "class" element.');
            }

            $class = $type['class'];
            unset($type['class']);

            return static::get($class, $type);
        }

        throw new InvalidConfigException('Unsupported configuration type: ' . \gettype($type));
    }
290781
public static function GetConverter ($type) {
		if (!is_callable($type)) {
			switch ($type ?: 'none') {
				case 'datetime':
					$type = function ($value) {
						if ($value === '' || $value === null) {
							return $value;
						}
						return new \DateTime($value);
					};
					break;
			}
		}
		return $type;
	}
990259
public function factory($type)
    {
        if (!is_string($type)) {
            throw new \InvalidArgumentException('Invalid confirmation attributes value in confirmation factory');
        }
        if (!array_key_exists($type, $this->typeClassMap)) {
            throw new \InvalidArgumentException('Invalid confirmation attributes value type "'.$type.'"');
        }
        $className = __NAMESPACE__.'\\'.$this->typeClassMap[$type];

        return new $className();
    }
1013404
public function getConverter($type)
    {
        if (isset($this->converters[$type])) {
            return $this->converters[$type];
        }

        return $this->converters[$type] = new JsonConverter($this->domainHydrator);
    }
809243
protected function getProxyFactory(string $type): SimpleFactory
    {
        switch ($type[0]) {
            case 'E':
                $factory = $this->exceptionProxyFactory;
                break;
            case 'C':
                $factory = $this->iteratorProxyFactory;
                break;
            case 'A':
                $factory = $this->arrayProxyFactory;
                break;
            case 'O':
            default:
                $factory = $this->proxyFactory;
        }

        return $factory;
    }
50702
public function load($resource, $type = null)
    {
        return $this->routeCollectionMapper->mapCollection($this->import($resource));
    }
813235
private function getClassMatcherFactory($type)
    {
        if (isset($this->classMatcherFactories[$type])) {
            return $this->classMatcherFactories[$type];
        }

        throw new \InvalidArgumentException("Specified ClassMatcher factory '{$type}' is not available.");
    }
1113961
public function withType(string $type): self
    {
        $metadata = clone $this;
        $metadata->type = $type;

        return $metadata;
    }
1040852
public function factory($type, $level = 0)
    {
        $result = null;

        if (!array_key_exists('type_extended_' . $type, $this->types)) {
            throw new InvalidTypeException;
        }

        /** @var $result ExtendedTypeInterface */
        $result = clone($this->types['type_extended_' . $type]);
        $result->setLevel($level);

        return $result;
    }
1112694
public static function get($type)
    {
        $instance = null;

        switch ($type) {

            case 'IM/Send':
                $instance = new SendService();
                break;

            case 'IM/Status':
                $instance = new StatusService();
                break;

            case 'TFA/Request':
                $instance = new RequestService();
                break;

            case 'TFA/Validate':
                $instance = new ValidateService();
                break;

            default:
                throw new \Exception("Error - Unknow service", 1);

        }
        return $instance;
    }
510080
protected function create($type)
	{
		if ( !isset($this->browserConfigurations[$type]) ) {
			throw new \InvalidArgumentException('Browser configuration type "' . $type . '" not registered');
		}

		return clone $this->browserConfigurations[$type];
	}
1159930
public function build($type)
    {
        if (!isset($this->types[$type])) {
            throw new \Exception("Unknown request type.");
        }
        return new $this->types[$type]();
    }