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
Pull Request — master (#563)
by Asmir
05:29
created

JMSSerializerBundle   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 8

Test Coverage

Coverage 94.74%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 8
dl 0
loc 30
ccs 18
cts 19
cp 0.9474
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A build() 0 18 1
A getServiceMapPass() 0 8 2
1
<?php
2
3
/*
4
 * Copyright 2011 Johannes M. Schmitt <[email protected]>
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 * http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
namespace JMS\SerializerBundle;
20
21
use JMS\SerializerBundle\DependencyInjection\Compiler\DoctrinePass;
22
use JMS\SerializerBundle\DependencyInjection\Compiler\TwigExtensionPass;
23
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
24
use JMS\SerializerBundle\DependencyInjection\Compiler\CustomHandlersPass;
25
use JMS\SerializerBundle\DependencyInjection\Compiler\RegisterEventListenersAndSubscribersPass;
26
use JMS\SerializerBundle\DependencyInjection\Compiler\ServiceMapPass;
27
use Symfony\Component\DependencyInjection\ContainerBuilder;
28
use Symfony\Component\HttpKernel\Bundle\Bundle;
29
use JMS\DiExtraBundle\DependencyInjection\Compiler\LazyServiceMapPass;
30
use Symfony\Component\DependencyInjection\Definition;
31
32
class JMSSerializerBundle extends Bundle
33
{
34 19
    public function build(ContainerBuilder $builder)
35
    {
36 19
        $builder->addCompilerPass($this->getServiceMapPass('jms_serializer.serialization_visitor', 'format',
37
            function(ContainerBuilder $container, Definition $def) {
38 19
                $container->getDefinition('jms_serializer.serializer')->replaceArgument(3, $def);
39 19
            }
40 19
        ));
41 19
        $builder->addCompilerPass($this->getServiceMapPass('jms_serializer.deserialization_visitor', 'format',
42 19
            function(ContainerBuilder $container, Definition $def) {
43 19
                $container->getDefinition('jms_serializer.serializer')->replaceArgument(4, $def);
44 19
            }
45 19
        ));
46
47 19
        $builder->addCompilerPass(new TwigExtensionPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION);
48 19
        $builder->addCompilerPass(new RegisterEventListenersAndSubscribersPass(), PassConfig::TYPE_BEFORE_REMOVING);
49 19
        $builder->addCompilerPass(new CustomHandlersPass(), PassConfig::TYPE_BEFORE_REMOVING);
50 19
        $builder->addCompilerPass(new DoctrinePass(), PassConfig::TYPE_BEFORE_REMOVING);
51 19
    }
52
53 19
    private function getServiceMapPass($tagName, $keyAttributeName, $callable)
54
    {
55 19
        if (class_exists('JMS\DiExtraBundle\DependencyInjection\Compiler\LazyServiceMapPass')) {
56
            return new LazyServiceMapPass($tagName, $keyAttributeName, $callable);
57
        }
58
59 19
        return new ServiceMapPass($tagName, $keyAttributeName, $callable);
60
    }
61
}
62