Get gateway instance
@return \Omnipay\AuthorizeNet\SIMGateway
@throws UnexpectedValueException
183753
protected function getGateway()
    {
        /* @var $module \gplcart\modules\omnipay_library\Main */
        $module = $this->module->getInstance('omnipay_library');

        /** @var \Omnipay\AuthorizeNet\SIMGateway $gateway */
        $gateway = $module->getGatewayInstance('AuthorizeNet_SIM');

        if (!$gateway instanceof SIMGateway) {
            throw new UnexpectedValueException('Gateway must be instance of Omnipay\AuthorizeNet\SIMGateway');
        }

        return $gateway;
    }
1024867
public static function getInstance() {

		if( !isset( self::$instance ) ) {

			self::$instance	= new GoogleProperties();

			self::$instance->init( SnsConnectGlobal::CONFIG_SNS_GOOGLE );
		}

		return self::$instance;
	}
461973
private function getAuthenticator(): IAuthenticator
	{
		$ns = $this->userStorage->getNamespace();
		if (isset($this->mapper[$ns])) {
			$ns = $this->mapper[$ns];
		}
		if (!isset($this->authenticators[$ns])) {
			throw new UnexpectedValueException("Namespace '$ns' is not registered");
		}
		return $this->authenticators[$ns];
	}
1013899
protected static function createOmnipayGateway(string $gatewayClassName): GatewayInterface
    {
        $craftClient = Craft::createGuzzleClient();
        $adapter = new Client($craftClient);
        $httpClient = new OmnipayClient($adapter);

        return Omnipay::create($gatewayClassName, $httpClient);
    }
211989
public function getInstance(): Router
    {
        if (! isset(self::$instance)) {
            self::$instance = new self();
        }
        
        return self::$instance;
    }
708291
public function getCatalogue()
    {
        if (!$this->__catalogue instanceof TranslatorCatalogueInterface)
        {
            if(!($this->__catalogue instanceof ObjectIdentifier)) {
                $this->setCatalogue($this->__catalogue);
            }

            $this->__catalogue = $this->getObject($this->__catalogue);
        }

        if(!$this->__catalogue instanceof TranslatorCatalogueInterface)
        {
            throw new \UnexpectedValueException(
                'Catalogue: '.get_class($this->__catalogue).' does not implement TranslatorCatalogueInterface'
            );
        }

        return $this->__catalogue;
    }
9619
protected function getPingInstance()
    {
        if (empty($this->port)) {
            throw new \InvalidArgumentException(
                'Missing host port, ensure you called setPort().'
            );
        }
        $instance = $this->createPing();
        $instance
            ->setPort($this->port);

        return $instance;
    }
832056
public function getExceptionHandler()
    {
        if(!$this->__exception_handler instanceof KExceptionHandlerInterface)
        {
            $this->__exception_handler = $this->getObject($this->__exception_handler);

            if(!$this->__exception_handler instanceof KExceptionHandler)
            {
                throw new UnexpectedValueException(
                    'Exception Handler: '.get_class($this->__exception_handler).' does not implement KExceptionHandlerInterface'
                );
            }
        }

        return $this->__exception_handler;
    }
1326787
public function getRequest()
    {
        if(!$this->_request instanceof KDispatcherRequestInterface)
        {
            $this->_request = $this->getObject($this->_request);

            if(!$this->_request instanceof KDispatcherRequestInterface)
            {
                throw new UnexpectedValueException(
                    'Request: '.get_class($this->_request).' does not implement KDispatcherRequestInterface'
                );
            }
        }

        return $this->_request;
    }
476038
public function getCreator()
    {
        return $this->getCachedProperty(
            'creator',
            function () {
                try {
                    return $this->getValue('creator')
                        ? new Account($this->getValue('creator'))
                        : null;
                } catch (\InvalidArgumentException $e) {
                    throw new \UnexpectedValueException($e->getMessage(), $e->getCode(), $e);
                }
            }
        );
    }
1364486
protected function getUserObjectGuid()
    {
        $guid = $this->user->getConvertedGuid();

        if (trim($guid) == false) {
            $attribute = $this->user->getSchema()->objectGuid();

            throw new UnexpectedValueException(
                "Unable to locate a user without a {$attribute}"
            );
        }

        return $guid;
    }
236149
public function getDriver()
    {
        if(!$this->__driver instanceof DatabaseDriverInterface)
        {
            $this->__driver = $this->getObject($this->__driver);

            if(!$this->__driver instanceof DatabaseDriverInterface)
            {
                throw new \UnexpectedValueException(
                    'Driver: '.get_class($this->__driver).' does not implement DatabaseDriverInterface'
                );
            }
        }

        return $this->__driver;
    }
819980
public function getRequest()
    {
        if(!$this->_request instanceof ControllerRequestInterface)
        {
            //Setup the request
            $this->_request->url  = $this->getIdentifier();
            $this->_request->user = $this->getUser();

            $this->_request = $this->getObject('lib:controller.request', ObjectConfig::unbox($this->_request));

            if(!$this->_request instanceof ControllerRequestInterface)
            {
                throw new \UnexpectedValueException(
                    'Request: '.get_class($this->_request).' does not implement ControllerRequestInterface'
                );
            }
        }

        return $this->_request;
    }
515492
protected function initContainer()
    {
        $container = $this->loadContainer(Configuration::projectDir() . $this->config['container']);

        if (!$container instanceof ContainerInterface) {
            throw new \UnexpectedValueException("Failed to get a container from '{$this->config['container']}'");
        }

        return $container;
    }
348803
public static function newInstance($config)
	{

		if (!function_exists('curl_init')) {
			throw new Exception('Curl required');
		}

		$gateway = new self();
		$gateway->setConfig($config);

		return $gateway;

	}
1001977
public function createPayment($gateway)
    {
        if (!GatewayInfo::isSupported($gateway)) {
            user_error(_t(
                "PaymentProcessor.INVALID_GATEWAY",
                "`{gateway}` is not supported.",
                null,
                array('gateway' => (string)$gateway)
            ), E_USER_ERROR);
        }

        // Create a payment
        $this->payment = Payment::create()->init(
            $gateway,
            $this->reservation->Total,
            self::config()->get('currency')
        );

        // Set a reference to the reservation
        $this->payment->ReservationID = $this->reservation->ID;

        return $this->payment;
    }
236888
private function buildConnection()
    {
        $connection = stream_socket_client("tcp://{$this->host}:{$this->port}", $errno, $message);
        $success    = fread($connection, 26);

        if (false === $connection || false === $success) {
            throw new \UnexpectedValueException("Failed to connect: $message");
        }

        return $connection;
    }