@param $providerClass
@param IDictionary $shared

@return mixed
483748
public function create($providerClass, IDictionary $shared) {
        $provider = $this->container->get($providerClass, ['shared' => $shared]);
        $this->container->set($providerClass, $provider);

        return $provider;
    }
1107930
public function getTokensByProvider($providerHandle)
    {
        $conditions = 'providerHandle=:providerHandle';
        $params = array(':providerHandle' => $providerHandle);
        $records = Oauth_TokenRecord::model()->findAll($conditions, $params);
        return Oauth_TokenModel::populateModels($records);
    }
863555
public function bindIf($abstract, $concrete = null, $shared = false)
    {
        if (! $this->bound($abstract)) {
            $this->bind($abstract, $concrete, $shared);
        }
    }
486284
public function provider(ProviderRequest $providerRequest)
    {
      // Extract SimplePay user from request
      $user = $providerRequest->getUser();

      // Create request
      $request = new StdClass();
      $request->User = new StdClass();
      $request->User->Uuid = $user->getUuid()->getValue();
      $request->User->Hash = $user->getHash();

      /*$request = new StdClass();
       $request->Auth = new StdClass();
       $request->Auth->Uuid
       $request->Auth->Method
       $request->Auth->Signature
       $request->Auth->Token
       $request->Auth->Timestamp
       $request->Auth->Nonce
       $request->Auth->Version*/

      // Check type
      if($providerRequest->hasType())
        $request->Type = $providerRequest->getType();

      // Send request
      $response = $this->getSoapClient()->provider($request);

      // Create a new ProviderResponse
      $providerResponse = new ProviderResponse();

      if(!is_array($response->Provider))
        $response->Provider = array($response->Provider);

      foreach($response->Provider as $provider)
      {
        // Extract values from reponse
        $uuid = $provider->Uuid;
        $name = $provider->Name;
        $type = $provider->Type;

        $uuid = new Uuid($uuid);

        // Create a new Provider
        $provider = new Provider($uuid, $name, $type);

        // Add bank to response
        $providerResponse->addProvider($provider);
      }

      return $providerResponse;
    }
1183340
public function loadLayoutIds(bool $includeDrafts, ?bool $shared = null, int $offset = 0, ?int $limit = null): array
    {
        $query = $this->connection->createQueryBuilder();

        $query->select('DISTINCT l.id, l.name')
            ->from('ngbm_layout', 'l');

        if ($includeDrafts) {
            $query->leftJoin(
                'l',
                'ngbm_layout',
                'l2',
                $query->expr()->andX(
                    $query->expr()->eq('l.id', 'l2.id'),
                    $query->expr()->eq('l2.status', ':status')
                )
            );
        }

        if ($shared !== null) {
            $query->where(
                $query->expr()->eq('l.shared', ':shared')
            );
        }

        $statusExpr = $query->expr()->eq('l.status', ':status');
        if ($includeDrafts) {
            $statusExpr = $query->expr()->orX(
                $statusExpr,
                $query->expr()->isNull('l2.id')
            );
        }

        $query->andWhere($statusExpr);

        if ($shared !== null) {
            $query->setParameter('shared', $shared, Type::BOOLEAN);
        }

        $query->setParameter('status', Value::STATUS_PUBLISHED, Type::INTEGER);

        $this->applyOffsetAndLimit($query, $offset, $limit);
        $query->orderBy('l.name', 'ASC');

        $result = $query->execute()->fetchAll(PDO::FETCH_ASSOC);

        return array_column($result, 'id');
    }
200735
public function build(string $modelClass): IEntityService
    {
        if (!isset($this->sharedInstances[$modelClass]) || $this->sharedInstances[$modelClass] === null) {
            $this->sharedInstances[$modelClass] = $this->buildEntityService($modelClass);
        }
        return $this->sharedInstances[$modelClass];
    }
539598
public function addFactory($name, $factory, $shared = null)
    {
        return $this->add($name, $factory, self::ENTRY_TYPE_FACTORY, $shared);
    }
1298661
public function get_cache_shared($name, $packed=true)
    {
        $shared_name = "shared_$name";

        if (!array_key_exists($shared_name, $this->caches)) {
            $opt  = strtolower($name) . '_cache';
            $type = $this->config->get($opt);
            $ttl  = $this->config->get($opt . '_ttl');

            if (!$type) {
                // cache is disabled
                return $this->caches[$shared_name] = null;
            }

            if ($ttl === null) {
                $ttl = $this->config->get('shared_cache_ttl', '10d');
            }

            $this->caches[$shared_name] = new rcube_cache_shared($type, $name, $ttl, $packed);
        }

        return $this->caches[$shared_name];
    }
1024444
protected function findAllForClass(&$providers, $findClass)
    {

        $all = [];

        foreach ($providers as $class=>$provider) {
            if (is_subclass_of($findClass, $class) || $findClass == $class) {
                $all[$class] = $provider;
            }
        }

        return $all;

    }
85778
public function getProviders($provider)
    {
        $name = \is_string($provider) ? $provider : \get_class($provider);

        return Arr::where($this->loadedProviders, function ($value) use ($name) {
            return $value instanceof $name;
        });
    }
238780
private function getAccessToken(Provider $provider, $userId, $scope)
    {
        $accessTokenList = $this->tokenStorage->getAccessTokenList($userId);
        foreach ($accessTokenList as $accessToken) {
            if ($provider->getProviderId() !== $accessToken->getProviderId()) {
                continue;
            }
            if ($scope !== $accessToken->getScope()) {
                continue;
            }

            return $accessToken;
        }

        return false;
    }
503702
private function createDataProviderClass(
        string $providerName,
        array $providerData,
        PhpNamespace $namespace
    ): ClassType {
        $dataProvider = $this->createNewDataProvider($providerName, $namespace);
        $providerElements = $providerData['elements'];

        foreach ($providerElements as $element) {
            $this->addProperty($dataProvider, $element);
            $this->addGetter($dataProvider, $element, $providerData['configs']);
            $this->addSetter($dataProvider, $element, $providerData['configs']);
            $this->addUnsetter($dataProvider, $element, $providerData['configs']);
            $this->addHas($dataProvider, $element, $providerData['configs']);
            $this->addSingleSetter($element, $dataProvider, $providerData['configs']);

        }

        $this->addElementsGetter($dataProvider, $providerElements);
        return $dataProvider;
    }
1197509
private static function getProvider($query, array $providers, Provider $currentProvider = null): Provider
    {
        if (null !== $currentProvider) {
            return $currentProvider;
        }

        if (0 === count($providers)) {
            throw ProviderNotRegistered::noProviderRegistered();
        }

        // Take first
        $key = key($providers);

        return $providers[$key];
    }
1112103
public function setShared($shared)
    {
        $this->changes['shared'] = true;

        $this->shared = (bool) $shared;

        return $this;
    }
928975
public function getRegistered($provider)
    {
        $name = is_string($provider) ? $provider : get_class($provider);

        if (array_key_exists($name, $this->loadedProviders)) {
            return array_first($this->serviceProviders, function($key, $value) use ($name)
            {
                return get_class($value) == $name;
            });
        }
    }
789070
private function getMappings($entityClass)
    {
        if ($this->metadataManager->hasMetadata($entityClass)) {
            return $this->metadataManager->getMetadata($entityClass)->getMappings();
        }
        try {
            return $this->em->getClassMetadata($entityClass)->fieldMappings;
        } catch (MappingException $ex) {
            throw new WidgetException(sprintf('Unable to get Doctrine metadata for class "%s".', $entityClass));
        }
    }
1314983
public static function Collections( $context, $provider, $collection )
	{
		if ( ! ExtFuncs::validateUri( $collection ) || ! isset( $context->availableCollections[ $collection ] ) )
		{
			throw XPath2Exception::withErrorCodeAndParam( "FODC0004", Resources::FODC0004, $collection );
		}

		return $context->availableCollections[ $collection ];
	}