inject the minimum required dependencies
@param \TheTwelve\Foursquare\EndpointGateway $gateway
@param null $listId
428669
protected function injectListGatewayDependencies(EndpointGateway $gateway, $listId = null)
    {
        if ($listId) {
            $gateway->setListId($listId);
        }
        $gateway->setRequestUri($this->getRequestUri())
                ->setToken($this->token)
                ->setClientCredentials($this->clientId, $this->clientSecret);
    }
904809
private void insert(E master, E current) {
		Collection<E> dependencies = getDependencies(current);
		for (E item : dependencies) {
			if (item.equals(master)) {
				generateError(master);
			}
			insert(master, item);
		}

		// insert only element does not exists
		if (output.indexOf(current)==-1)
		{		
			output.add(current);
		}
	}
137201
public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint)
    {
        // The provider does nothing, but is required
        $providerId = sprintf('%s.%s', self::PROVIDER_SWITCH_USER_STATELESS, $id);
        $container->setDefinition(
            $providerId,
            new DefinitionDecorator(self::PROVIDER_SWITCH_USER_STATELESS)
        );

        // The listener does the logic
        $listenerId = sprintf('%s.%s', self::LISTENER_SWITCH_USER_STATELESS, $id);
        $container
            ->setDefinition(
                $listenerId,
                new DefinitionDecorator(self::LISTENER_SWITCH_USER_STATELESS)
            )
            ->replaceArgument(1, new Reference($userProvider))
            ->replaceArgument(3, $id)
            ->replaceArgument(6, $config['parameter'])
            ->replaceArgument(7, $config['role'])
        ;

        return [$providerId, $listenerId, $defaultEntryPoint];
    }
1095076
function createDependencyTree( &$dependenciesNode, $dependencyType, $list )
    {
        $dom = $dependenciesNode->ownerDocument;

        foreach ( $list as $dependencyItem )
        {
            unset( $dependencyNode );
            $dependencyNode = $dom->createElement( $dependencyType );
            $dependencyNode->setAttribute( 'type', $dependencyItem['type'] );
            $dependencyNode->setAttribute( 'name', $dependencyItem['name'] );
            if ( $dependencyItem['value'] )
                $dependencyNode->setAttribute( 'value', $dependencyItem['value'] );
            $dependenciesNode->appendChild( $dependencyNode );
            $handler = $this->packageHandler( $dependencyItem['name'] );
            if ( $handler )
            {
                $handler->createDependencyNode( $this, $dependencyNode, $dependencyItem, $dependencyType );
            }
        }
    }
110818
protected function createGateway(ContainerBuilder $container, $gatewayName, array $config)
    {
        $config['payum.api'] = new Reference($config['plugin_controller_service']);

        return parent::createGateway($container, $gatewayName, $config);
    }
432074
protected function applyRequestParameters(Request $request, $listBuilder)
    {
        if (json_decode($request->get('hasNoParent', null))) {
            $listBuilder->where($this->getFieldDescriptorForNoParent(), null);
        }

        if (json_decode($request->get('hasEmail', null))) {
            $listBuilder->whereNot($this->getFieldDescriptors()['mainEmail'], null);
        }
    }
1337814
protected function onConsume(EndpointInterface $endpoint, MessageInterface $message)
    {
        $options = $endpoint->getOptions();
        $method = $options[NoSQLConfigurableProtocol::OPTION_METHOD];
        $config = $this->methodsConfiguration[$method];
        $steps = $config[ConfigurableConsumerInterface::CONFIG_ON_CONSUME];

        $context = $this->getConfHelper()->createContext($options, $message);

        $this->configurableStepsProvider->executeSteps($steps, $options, $context);
    }
753903
public function setListId($list_id)
    {
        $this->list_id = (is_numeric($list_id)) ? abs(round($list_id)) : NULL;

        return $this;
    }
1152660
public function getCheckinsGateway($userId = null)
    {

        $gateway = new CheckinsGateway($this->httpClient);
        $this->injectGatewayDependencies($gateway, $userId);
        return $gateway;

    }
576883
public function getListId(string $listId = null): ?string
    {
        return ($listId == null) ? $this->listId : $listId;
    }
779854
public function delete($endpointId)
    {
        if (ArrayOperations::checkNull([$endpointId])) {
            throw
            new PlivoValidationException(
                'endpoint id is mandatory');
        }
        
        $this->client->delete(
            $this->uri . $endpointId . '/',
            []
        );
    }
596990
function injectDependencies(serviceLoader) {

    var EventEmitter = require('events').EventEmitter;
    serviceLoader.inject('events', new EventEmitter());

    //inject itself so that services can directly use the service loader
    serviceLoader.inject('serviceLoader', serviceLoader);

    //app will be injected by middleware, so this is a placeholder to force our dependency calculations to be correct
    serviceLoader.inject('app', {}, ['middleware']);
}
660631
public function importSubscribers($listId = '', $subscribers = array())
    {
        $settings = CmService::$plugin->getSettings();

        try {
            $auth = array(
                'api_key' => (string)$settings->apiKey);
            $client = new \CS_REST_Subscribers(
                $listId,
                $auth);
            $result = $client->import($subscribers, false);

            if($result->was_successful()) {
                $body = $result->response;
                return [
                    'success' => true,
                    'statusCode' => $result->http_status_code,
                    'body' => $body
                ];
            } else {
                return [
                    'success' => false,
                    'statusCode' => $result->http_status_code,
                    'reason' => $result->response->Message
                ];
            }
        } catch (\Exception $e) {
            return [
                'success' => false,
                'reason' => $e->getMessage()
            ];
        }
    }
940953
public function subscribe(string $listId, string $email, array $mergeFields = [], bool $confirm = true)
    {
        if ($this->status($listId, $email) == 'subscribed') {
            $confirm = false;
        }
        $this->api->addUpdate($listId, $email, $mergeFields, $confirm);
    }
106441
public function delete(string $taskID, string $listID = ''): \BearFramework\Tasks
    {
        $app = App::get();
        $this->lockList($listID);
        $list = $this->getListData($listID);
        if (isset($list[$taskID])) {
            unset($list[$taskID]);
            $this->setListData($listID, $list);
            $app->data->delete($this->getTaskDataKey($taskID, $listID));
        }
        $this->unlockList($listID);
        return $this;
    }
265267
protected function doTransaction(
        $verb,
        $endpoint,
        $data = null,
        array $queryStringParams = null
    ) {
        $response = $this->sendRequest($verb, $endpoint, $data, $queryStringParams);

        if (!in_array($response->statusCode, [200, 204])) {
            $parsed = json_decode($response->rawResponse);
            $error = isset($parsed->error) ? $parsed->error : $parsed;
            throw new GatewayException(
                sprintf(
                    'Status Code: %s - %s',
                    $response->statusCode,
                    isset($error->message) ? $error->message : (string) $error
                )
            );
        }

        return $response->rawResponse;
    }
513440
public static void insertProviderAt(Provider newProvider, int slot) {
        Provider[] provider_list = Security.getProviders();
        if (null == provider_list || 0 == provider_list.length) {
            return;
        }

        // add the new provider to the new list at the correct slot #.
        Provider[] newList = new Provider[provider_list.length + 2];
        newList[slot] = newProvider;

        int newListIndex = 1;
        // add the rest of the providers
        for (int i = 0; i < provider_list.length; i++) {
            Provider currentProvider = provider_list[i];

            if (currentProvider != null && !currentProvider.getName().equals(newProvider.getName())) {
                // keep incrementing until we find the first available slot.
                while (newList[newListIndex] != null) {
                    newListIndex++;
                }

                newList[newListIndex] = currentProvider;
                newListIndex++;
            }
        }

        removeAllProviders();

        // add the rest of the providers to the list.
        for (int i = 0; i < newList.length; i++) {
            Provider currentProvider = newList[i];

            if (currentProvider != null) {
                int position = Security.insertProviderAt(currentProvider, (i + 1));
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    Tr.debug(tc, currentProvider.getName() + " provider added at position " + position);
            }
        }
    }