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::validateServiceClass()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 4
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