YnloGraphQLBundle::getContainerExtension()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
c 0
b 0
f 0
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle;
12
13
use Symfony\Component\DependencyInjection\ContainerBuilder;
14
use Symfony\Component\DependencyInjection\Reference;
15
use Symfony\Component\HttpKernel\Bundle\Bundle;
16
use Ynlo\GraphQLBundle\Component\TaggedServices\TaggedServicesCompilerPass;
17
use Ynlo\GraphQLBundle\DependencyInjection\Compiler\ControllerPass;
18
use Ynlo\GraphQLBundle\DependencyInjection\YnloGraphQLExtension;
19
use Ynlo\GraphQLBundle\Encoder\IDEncoderManager;
20
use Ynlo\GraphQLBundle\Error\Exporter\ErrorListExporterInterface;
21
use Ynlo\GraphQLBundle\Extension\ExtensionInterface;
22
use Ynlo\GraphQLBundle\Filter\FilterInterface;
23
use Ynlo\GraphQLBundle\Filter\FilterResolverInterface;
24
use Ynlo\GraphQLBundle\Form\Input\InputFieldTypeGuesser;
25
use Ynlo\GraphQLBundle\SearchBy\SearchByInterface;
26
use Ynlo\GraphQLBundle\Subscription\Publisher;
27
use Ynlo\GraphQLBundle\Subscription\SubscriptionAwareInterface;
28
use Ynlo\GraphQLBundle\Type\Loader\TypeAutoLoader;
29
use Ynlo\GraphQLBundle\Type\Registry\TypeRegistry;
30
use Ynlo\GraphQLBundle\Util\IDEncoder;
31
32
/**
33
 * Class YnloGraphQLBundle
34
 */
35
class YnloGraphQLBundle extends Bundle
36
{
37
    /**
38
     * {@inheritDoc}
39
     */
40
    public function boot()
41
    {
42
        TypeRegistry::clear(); //required for tests
43
44
        $this->container->get(TypeAutoLoader::class)->autoloadTypes();
45
46
        //setup the encoder to use statically
47
        IDEncoder::setup($this->container->get(IDEncoderManager::class)->getEncoder());
48
    }
49
50
    /**
51
     * {@inheritDoc}
52
     */
53
    public function build(ContainerBuilder $container)
54
    {
55
        $container->addCompilerPass(new TaggedServicesCompilerPass());
0 ignored issues
show
Deprecated Code introduced by
The class Ynlo\GraphQLBundle\Compo...gedServicesCompilerPass has been deprecated: since v1.1 and will be deleted in v2.0, use symfony tag injection instead "!tagged tag_name" ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

55
        $container->addCompilerPass(/** @scrutinizer ignore-deprecated */ new TaggedServicesCompilerPass());
Loading history...
56
        $container->addCompilerPass(new ControllerPass());
57
        $container->registerForAutoconfiguration(ErrorListExporterInterface::class)->addTag('graphql.error_list_exporter');
58
        $container->registerForAutoconfiguration(ExtensionInterface::class)->addTag('graphql.extension');
59
        $container->registerForAutoconfiguration(InputFieldTypeGuesser::class)->addTag('graphql.input_type_guesser');
60
        $container->registerForAutoconfiguration(FilterResolverInterface::class)->addTag('graphql.filter_resolver');
61
        $container->registerForAutoconfiguration(SearchByInterface::class)
62
                  ->addTag('graphql.list_search')
63
                  ->setPublic(true);
64
        $container->registerForAutoconfiguration(FilterInterface::class)
65
                  ->addTag('graphql.list_filter')
66
                  ->setPublic(true);
67
    }
68
69
    /**
70
     * {@inheritDoc}
71
     */
72
    public function getContainerExtension()
73
    {
74
        return new YnloGraphQLExtension();
75
    }
76
}
77