GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( bd1580...0ea8fb )
by Florian
09:56
created

FacetCompilerPass   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 4
dl 0
loc 29
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 23 4
1
<?php
2
declare(strict_types=1);
3
4
namespace StingerSoft\EntitySearchBundle\DependencyInjection\Compiler;
5
6
use StingerSoft\EntitySearchBundle\Services\Facet\FacetServiceInterface;
7
use StingerSoft\EntitySearchBundle\Services\SearchService;
8
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
9
use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass;
10
use Symfony\Component\DependencyInjection\ContainerBuilder;
11
use Symfony\Component\DependencyInjection\Reference;
12
13
class FacetCompilerPass implements CompilerPassInterface {
14
15
	/**
16
	 * @param ContainerBuilder $container
17
	 */
18
	public function process(ContainerBuilder $container) {
19
		if(!$container->hasAlias(SearchService::class)) {
20
			return;
21
		}
22
23
		$serviceId = (string)$container->getAlias(SearchService::class);
24
25
		if(!$container->hasDefinition($serviceId)) {
26
			return;
27
		}
28
29
		$definition = $container->getDefinition($serviceId);
30
31
		$servicesMap = array();
32
		// Builds an array with fully-qualified type class names as keys and service IDs as values
33
		foreach($container->findTaggedServiceIds(FacetServiceInterface::TAG_NAME, true) as $serviceId => $tag) {
34
			// Add form type service to the service locator
35
			$serviceDefinition = $container->getDefinition($serviceId);
36
			$servicesMap[$serviceDefinition->getClass()] = new Reference($serviceId);
37
			$servicesMap[$serviceId] = new Reference($serviceId);
38
		}
39
		$definition->addMethodCall('setFacetContainer', [ServiceLocatorTagPass::register($container, $servicesMap)]);
40
	}
41
}