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.

AbstractCompilerPass   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 39
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validateServiceClass() 0 11 2
A validateTagAttributes() 0 12 3
1
<?php
2
3
namespace Nimble\ElasticBundle\DependencyInjection\Compiler;
4
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
5
6
/**
7
 * Abstract compiler pass with convenience methods.
8
 */
9
abstract class AbstractCompilerPass implements CompilerPassInterface
10
{
11
    /**
12
     * @param string $serviceId
13
     * @param $actualClassName
14
     * @param string $expectedClassName
15
     * @param string $tagName
16
     */
17
    protected function validateServiceClass($actualClassName, $expectedClassName, $serviceId, $tagName)
18
    {
19
        if (!is_a($actualClassName, $expectedClassName, true)) {
20
            throw new \RuntimeException(sprintf('Expected service "%s" tagged with "%s" to be an instance of "%s" but instead got "%s".',
21
                $serviceId,
22
                $tagName,
23
                $expectedClassName,
24
                $actualClassName
25
            ));
26
        }
27
    }
28
29
    /**
30
     * @param array $actualAttributes
31
     * @param array $expectedAttributeNames
32
     * @param string $serviceId
33
     * @param string $tagName
34
     */
35
    protected function validateTagAttributes(array $actualAttributes, array $expectedAttributeNames, $serviceId, $tagName)
36
    {
37
        foreach ($expectedAttributeNames as $attrName) {
38
            if (!array_key_exists($attrName, $actualAttributes)) {
39
                throw new \RuntimeException(sprintf('Tag "%s" on service "%s" is missing attribute "%s".',
40
                    $tagName,
41
                    $serviceId,
42
                    $attrName
43
                ));
44
            }
45
        }
46
    }
47
}
48