Obtains an instance for this facade.

@param IClient $agi Client AGI to use.

@return void
18608
public static function getLogger(IClient $agi)
    {
        if (self::$instance === false) {
            $ret = new AsteriskLoggerImpl($agi);
            self::$instance = $ret;
        } else {
            $ret = self::$instance;
        }
        return $ret;
    }
788649
public function getClient($id)
    {
        $response = $this->get('/en/client/edit/id/' . $id);

        $content = trim($this->getBetween((string)$response->getBody(), '<table class="wide">', "</table>"));

        $client = new Client(array(
            'id' => $id,
            'email' => $this->getBetween($content, '<input type="text" name="email" id="email" value="', '">'),
            'first_name' => $this->getBetween($content, '<input type="text" name="first_name" id="first_name" value="', '">'),
            'last_name' => $this->getBetween($content, '<input type="text" name="last_name" id="last_name" value="', '">'),
            'company' => $this->getBetween($content, '<input type="text" name="company" id="company" value="', '">'),
            'address_1' => $this->getBetween($content, '<input type="text" name="address_1" id="address_1" value="', '">'),
            'address_2' => $this->getBetween($content, '<input type="text" name="address_2" id="address_2" value="', '">'),
            'country' => $this->getBetweenReverse($content, '<option value="', '" selected="selected">'),
            'city' => $this->getBetween($content, '<input type="text" name="city" id="city" value="', '">'),
            'state' => $this->getBetween($content, '<input type="text" name="state" id="state" value="', '">'),
            'zip' => $this->getBetween($content, '<input type="text" name="zip" id="zip" value="', '">'),
            'phone_cc' => $this->getBetween($content, '<input type="text" name="phone_cc" id="phone_cc" value="', '">'),
            'phone' => $this->getBetween($content, '<input type="text" name="phone" id="phone" value="', '">'),
        ));

        return $client;
    }
1148906
private function setupGoogleClient()
    {
        $client = new Google_Client();

        $client->setClientId($this->getConfig('oauth2_client_id'));
        $client->setClientSecret($this->getConfig('oauth2_client_secret'));
        $client->setRedirectUri($this->getConfig('oauth2_redirect_uri'));
        $client->setScopes($this->getConfig('services'));
        $client->setAccessType($this->getConfig('access_type'));
        $client->setApprovalPrompt($this->getConfig('approval_prompt'));

        return $client;
    }
727748
public function build(): GetCertificateRequest
	{
		$instance = new GetCertificateRequest();
		if ($this->origin === null) {
			throw new BuilderException('Property [origin] is required.');
		}
		$instance->origin = $this->origin;
		return $instance;
	}
575213
protected function setCreatedProvider(string $type, SchemaInterface $provider): void
    {
        $this->createdProviders[$type] = $provider;
    }
894532
public function create() {
		$ssoClient = new \Flowpack\SingleSignOn\Client\Domain\Model\SsoClient();
		if ((string)$this->clientServiceBaseUri === '') {
			throw new Exception('Missing Flowpack.SingleSignOn.Client.client.serviceBaseUri setting', 1351075078);
		}
		$ssoClient->setServiceBaseUri($this->clientServiceBaseUri);
		if ((string)$this->clientPublicKeyFingerprint === '') {
			throw new Exception('Missing Flowpack.SingleSignOn.Client.client.publicKeyFingerprint setting', 1351075159);
		}
		$ssoClient->setPublicKeyFingerprint($this->clientPublicKeyFingerprint);
		return $ssoClient;
	}
123471
public function getClient($credential_id = null, $use_own_certificate = true)
    {
        $this->library->load('gapi');

        if (!class_exists('Google_Client')) {
            throw new LogicException('Class \Google_Client not found');
        }

        $client = new \Google_Client;

        if ($use_own_certificate) {
            $http = new Client(array('verify' => __DIR__ . '/../certificates/cacert.pem'));
            $client->setHttpClient($http);
        }

        if (isset($credential_id)) {

            $credential = $this->credential->get($credential_id);

            if (empty($credential['data']['file'])) {
                throw new OutOfBoundsException('Credential file path is empty');
            }

            $client->setAuthConfig(gplcart_file_absolute($credential['data']['file']));
        }


        return $client;
    }
1150618
public function instance($abstract, $instance)
		{
			// First, we will extract the alias from the abstract if it is an array so we
			// are using the correct name when binding the type. If we get an alias it
			// will be registered with the container so we can resolve it out later.
			if (Arrays::is($abstract)) {
				list($abstract, $alias) = $this->extractAlias($abstract);
				$this->alias($abstract, $alias);
			}

			unset($this->aliases[$abstract]);

			// We'll check to determine if this type has been bound before, and if it has
			// we will fire the rebound callbacks registered with the container and it
			// can be updated with consuming classes that have gotten resolved here.
			$bound = $this->bound($abstract);
			$this->instances[$abstract] = $instance;
			if ($bound) {
				$this->rebound($abstract);
			}
		}
1257337
public static function newInstance(Entity_Interface $realEntity)
  {
    $basename = $realEntity->basename();
    $path = $realEntity->path();

    $instance = new static($basename, $path);
    /* @var $instance Entity_Deleted */
    $instance->_realEntity = $realEntity;

    return $instance;
  }
819712
public <C extends IClient<?, ?>> C getClient(String name, Class<C> clientClass) {
		return getInstance(name, clientClass);
	}
762719
public function getGrantedScopes($clientId, $subject)
    {
        ValidationUtility::ensureStringOrInteger('$clientId', $clientId);
        ValidationUtility::ensureString('$subject', $subject);

        $request = new GrantedScopesGetRequest();
        $request->setSubject($subject);

        return $this->callServicePostApi(
            '\Authlete\Dto\GrantedScopesGetResponse::fromJson',
            self::$GRANTED_SCOPES_GET_API_PATH . $clientId,
            null, $request);
    }
86799
public function get(Identity $aggregateId)
    {
        if (!is_null($this->snapshotStore)) {
            if (!($snapshot = $this->loadSnapshot($aggregateId))) {
                $missing = $this->eventStore->getAggregateHistoryFor($aggregateId, $snapshot->getVersion());

                if ($missing->count() > 0) {
                    $snapshot->correctMissingHistory($missing);
                }

                return $snapshot->getAggregate();
            }
        }

        $aggregateHistory = $this->eventStore->getAggregateHistoryFor($aggregateId);
        $fqn = $this->getAggregateRootFqcn();

        return $fqn::reconstituteFrom($aggregateHistory);
    }
1058868
public function getServiceInstanceByInterface($interface)
    {
        foreach ($this->getServiceInstances() as $info) {
            if (!isset($info['instance'])) {
                continue;
            }
            $instance = $info['instance'];

            if ($instance instanceof $interface) {
                return $instance;
            }
        }

        return false;
    }
225503
protected function createInterface($interface)
    {
        if($this->repositoryNameExists($interface) === true) {
            return $this->error('Interface already exists');
        }

        $this->createInterfaceDirectory();

        $this->createBaseInterfaceFile();

        $this->createInterfaceFile($interface);
    }
1181001
public function createAskResourceOwnerForApprovalResponse(
        string $type,
        ClientInterface $client,
        string $redirectUri = null,
        bool $isScopeModified = false,
        array $scopeList = null,
        string $state = null,
        array $extraParameters = []
    ): ResponseInterface {
        /** @var Client $client */
        assert($client instanceof Client);

        // TODO think if we can receive objects instead of individual properties
        $scopeList = empty($scopeList) === true ? null : implode(' ', $scopeList);
        $filtered  = array_filter([
            self::SCOPE_APPROVAL_TYPE              => $type,
            self::SCOPE_APPROVAL_CLIENT_ID         => $client->getIdentifier(),
            self::SCOPE_APPROVAL_CLIENT_NAME       => $client->getName(),
            self::SCOPE_APPROVAL_REDIRECT_URI      => $redirectUri,
            self::SCOPE_APPROVAL_IS_SCOPE_MODIFIED => $isScopeModified,
            self::SCOPE_APPROVAL_SCOPE             => $scopeList,
            self::SCOPE_APPROVAL_STATE             => $state,
        ], function ($value) {
            return $value !== null;
        });

        return new RedirectResponse($this->createRedirectUri($this->getApprovalUriString(), $filtered));
    }
470499
public function create($interface)
    {
        if (!Util::existsDirWritable($this->config->getProxyRootDir())) {
            throw new InitiallyRpcException("Proxy builder error: proxy class root dir not to be write");
        }

        $this->interface = $interface;
        $this->reflectionInterfaceAndCheck();
        $this->service = $this->config->getServiceByKey($this->interface);
        $info = $this->parseProxyClassInfo();
        $dir = $this->getProxyClassDirAndCreate($info->getNamespace());
        $file = sprintf("%s/%s.php", $dir, $info->getClassName());

        $methodString = "";
        foreach ($this->refectionClass->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
            $methodString .= $this->buildMethod($method);
        }

        $useString = "";
        $this->useList = array_unique($this->useList);
        foreach ($this->useList as $value) {
            $useString .= "use {$value};" . PHP_EOL;
        }

        $replaces = array(
            $info->getNamespace(),
            $useString,
            $this->refectionClass->getDocComment(),
            $info->getClassName(),
            sprintf("\\%s", $this->refectionClass->getName()),
            str_replace("\\", "\\\\", $this->refectionClass->getName()),
            $methodString
        );
        $content = str_replace(self::CLASS_TPL_SEARCHES, $replaces, $this->template->getClassTemplate());
        if (!@file_put_contents($file, $content)) {
            throw new InitiallyRpcException("Proxy builder error: proxy class code write failed");
        }

        $this->clear();
    }
1211511
public function make(string $type)
    {
        if (isset($this->iocContainerArray[$type])) {
            $type = $this->iocContainerArray[$type];

            return $type();
        }
        throw new ClientException('No type registered with that name');
    }