Grabs a service from Symfony DIC container.
Recommended to use for unit testing.

``` php
<?php
$em = $I->grabService('doctrine');
?>
```

@param $service
@return mixed
@part services
779536
public function grabService($service)
    {
        $container = $this->_getContainer();
        if (!$container->has($service)) {
            $this->fail("Service $service is not available in container");
        }
        return $container->get($service);
    }
1212676
public function resolve(string $service): ResolveAllUrlsResponse
    {
        $key = $this->cacheKey($service);
        $item = $this->cache->getItem($key);

        if ($item->isHit()) {
            return $item->get();
        }

        $options = [
            'query' => [
                'schema' => self::SCHEMA_VERSION,
                '_service' => $service,
            ],
        ];

        $response = $this->authenticatedClient->request('GET', static::RESOLVE_ALL_URLS_URL, $options);

        $encoders = [new JsonEncoder()];
        $normalizers = [new UriNormalizer(), new ObjectNormalizer(null, null, null, new PhpDocExtractor()), new ArrayDenormalizer()];
        $serializer = new Serializer($normalizers, $encoders);

        /** @var ResolveAllUrlsResponse $resolved */
        $resolved = $serializer->deserialize($response->getBody(), ResolveAllUrlsResponse::class, 'json');
        $resolved->setService($service);
        $this->saveCache($key, $resolved);

        return $resolved;
    }
610924
public function getService(string $id)
    {
        if ($this->serviceContainer->has($id)) {
            return $this->serviceContainer->get($id);
        }

        if ($this->reversibleLocator->has($id)) {
            return $this->reversibleLocator->get($id);
        }

        if (isset($this->serviceContainer->getRemovedIds()[$id])) {
            throw new ServiceNotFoundException($id, null, null, [], sprintf('The "%s" service is private and cannot be accessed by reference. You should either make it public, or tag it as "%s".', $id, $this->tagName));
        }

        // will throw a ServiceNotFoundException
        $this->serviceContainer->get($id);
    }
138532
protected function getService($service)
    {
        if (!isset($this->app[$service])) {
            throw new \Exception('O serviço '.$service.' não foi registrado na aplicação!');
        }

        return $this->app[$service];
    }
852319
public function getService($service)
    {
        $service = $this->mapServiceName($service);

        if (isset($this->services[$service])) {
            return $this->services[$service];
        }

        return $this->services[$service] = $this->createService($service);
    }
171686
private function getService($id)
    {
        if (null !== $this->container && $this->container->has($id)) {
            return $this->container->get($id);
        }

        return null;
    }
1049936
public function call(string $service, ...$params)
    {
        return Container::getInstance()->make(ServiceCaller::class)->call($service, ...$params);
    }
927382
protected function retrieveToken( $service ) {
        $tokenResponse = $this->client->attemptSoapResponse( 'sts', function() use ( $service ) {
            return $this->generateTokenRequest( $service );
        } );

        $securityDOM = new \DOMDocument();
        $securityDOM->loadXML( $tokenResponse );

        $newToken = new SecurityToken();

        $cipherValues = $securityDOM->getElementsByTagName( 'CipherValue' );
        $newToken->securityToken0 = $cipherValues->item( 0 )->textContent;
        $newToken->securityToken1 = $cipherValues->item( 1 )->textContent;

        $newToken->keyIdentifier = $securityDOM->getElementsByTagName( 'KeyIdentifier' )->item( 0 )->textContent;

        $newToken->binarySecret = $securityDOM->getElementsByTagName( 'BinarySecret' )->item( 0 )->textContent;

        if ( $securityDOM->getElementsByTagName( 'SecurityTokenReference' )->item( 0 )->prefix === 'wsse' ) {
            $securityDOM->getElementsByTagName( 'SecurityTokenReference' )->item( 0 )->setAttributeNS( 'http://www.w3.org/2000/xmlns/', 'xmlns:wsse', 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd' );
        }

        $newToken->securityToken = $securityDOM->saveXML( $securityDOM->getElementsByTagName( "RequestedSecurityToken" )->item( 0 )->firstChild );

        $expiryTime = $securityDOM->getElementsByTagName( "RequestSecurityTokenResponse" )->item( 0 )->getElementsByTagName( 'Expires' )->item( 0 )->textContent;
        $newToken->expiryTime = Client::parseTime( substr( $expiryTime, 0, -1 ), '%Y-%m-%dT%H:%M:%S' );

        $this->client->logger->info( 'Issued a new ' . $service . ' security token - expires at: ' . date( 'r', $newToken->expiryTime ) );

        return $newToken;
    }
737784
public function getServiceEndpoint( $service ) {
        switch ( $service ) {
            case 'organization':
                return $this->organizationUrl;
            case 'discovery':
                return $this->discoveryUrl;
            case 'sts':
            case 'login':
                return $this->loginUrl;
            default:
                return $service;
        }
    }
195834
protected function getService($service) {
		$service = strtolower($service);
		$services = $this->getServices();
		if (!isset($services[$service])) {
			throw new EAuthException(Yii::t('eauth', 'Undefined service name: {service}.', array('{service}' => $service)), 500);
		}
		return $services[$service];
	}
179033
public function resolve($service)
    {
        if (isset($this->resolved[$service])) {
            return $this->resolved[$service];
        }

        return $this->resolved[$service] = $this->getFunc($service);
    }
386888
public function getService(string $serviceKey): DIServiceWrapper
    {
        /** @var DIServiceWrapper $service */
        foreach ($this->getServices() as $service) {
            if ($service->getKey() === $serviceKey) {
                return $service;
            }
        }
        throw new MissingServiceException("Service $serviceKey not found");
    }
1183150
public function getService($id) {
            if (!isset($this->services[$id])) {
                // TODO: execption
                return null;
            }
            if (is_string($this->services[$id])) {
                $this->services[$id] = $this->container->get($this->services[$id]);
            }

            return $this->services[$id];
        }
588969
protected function get($service, array &$options)
    {
        if (isset($options[$service]) && is_object($options[$service])) {
            return $options[$service];
        }

        $service = explode('_', $service);
        $service = array_map('ucfirst', $service);
        $service = 'get' . implode('', $service);

        return $options[$service] = $this->$service($options);
    }
280924
public function getService($handle, $version = '')
    {
        $result = null;
        if ($this->has($handle)) {
            $key = $handle;
            $version = (string) $version;
            if ($version !== '') {
                $key .= "@$version";
            }
            if (!isset($this->services[$key])) {
                $abstract = $this->extensions[$handle];
                $service = $this->buildService($abstract, $version);
                if ($service === null) {
                    throw new \RuntimeException('Invalid service binding.');
                }
                $this->services[$key] = $service;
            }
            $result = $this->services[$key];
        }

        return $result;
    }
582964
private function getRepositoryDefinition($object, array $services, ContainerBuilder $container)
    {
        $repositoryKey = $this->getContainerKey('repository', $object, '.class');

        // default repository
        $repositoryClass = 'Sulu\Component\Persistence\Repository\ORM\EntityRepository';

        if ($container->hasParameter($repositoryKey)) {
            $repositoryClass = $container->getParameter($repositoryKey);
        }

        if (isset($services['repository'])) {
            $repositoryClass = $services['repository'];
        }

        $definition = new Definition($repositoryClass);
        $definition->setArguments([
            new Reference($this->getEntityManagerServiceKey()),
            $this->getClassMetadataDefinition($services['model']),
        ]);

        return $definition;
    }
92148
protected function retrieveToken( $service ) {
        $stsUri = $this->getSTSUrl( $this->settings->username );

        if ( $stsUri !== null ) {
            $assertResponse = $this->client->attemptSoapResponse( $stsUri, function() use ( $stsUri ) {
                return $this->generateAssertRequest( $stsUri );
            } );

            $assertToken = $this->extractAssertToken( $assertResponse );

            $tokenResponse = $this->client->attemptSoapResponse( 'sts', function() use ( $assertToken ) {
                return $this->generateAssertTokenRequest( $assertToken );
            } );
        } else {
            $tokenResponse = $this->client->attemptSoapResponse( 'sts', function() use ( $service ) {
                return $this->generateTokenRequest( $service );
            } );
        }

        $token = $this->extractToken( $tokenResponse );

        $this->client->logger->info( 'Issued a new security token [' . $service . '] - expires at: ' . date( 'r', $token->expiryTime ) );

        return $token;
    }