Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
FeatureFlagServiceProvider
n/a
0 / 0
n/a
0 / 0
1
n/a
0 / 0
 __invoke
n/a
0 / 0
n/a
0 / 0
1
1<?php
2
3/**
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; under version 2
7 * of the License (non-upgradable).
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 *
18 * Copyright (c) 2021 (original work) Open Assessment Technologies SA;
19 */
20
21declare(strict_types=1);
22
23namespace oat\tao\model\featureFlag;
24
25use common_ext_ExtensionsManager;
26use oat\generis\model\data\Ontology;
27use oat\generis\model\DependencyInjection\ContainerServiceProviderInterface;
28use oat\oatbox\cache\SimpleCache;
29use oat\tao\model\ClientLibConfigRegistry;
30use oat\tao\model\featureFlag\Listener\FeatureFlagCacheWarmupListener;
31use oat\tao\model\featureFlag\Repository\FeatureFlagRepository;
32use oat\tao\model\featureFlag\Repository\FeatureFlagRepositoryInterface;
33use oat\tao\model\featureFlag\Service\FeatureFlagPropertiesMapping;
34use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
35
36use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
37
38/**
39 * @codeCoverageIgnore
40 */
41class FeatureFlagServiceProvider implements ContainerServiceProviderInterface
42{
43    public function __invoke(ContainerConfigurator $configurator): void
44    {
45        $services = $configurator->services();
46
47        $services
48            ->set(FeatureFlagListService::class, FeatureFlagListService::class)
49            ->public()
50            ->args(
51                [
52                    service(FeatureFlagRepositoryInterface::class),
53                ]
54            );
55
56        $services
57            ->set(FeatureFlagConfigSwitcher::class)
58            ->public()
59            ->args(
60                [
61                    service(ClientLibConfigRegistry::class),
62                    service(common_ext_ExtensionsManager::class),
63                    service(self::CONTAINER_SERVICE_ID),
64                ]
65            );
66
67        $services
68            ->set(FeatureFlagRepositoryInterface::class, FeatureFlagRepository::class)
69            ->public()
70            ->args(
71                [
72                    service(Ontology::SERVICE_ID),
73                    service(SimpleCache::SERVICE_ID),
74                ]
75            );
76
77        $services
78            ->set(FeatureFlagCacheWarmupListener::class, FeatureFlagCacheWarmupListener::class)
79            ->public()
80            ->args(
81                [
82                    service(FeatureFlagRepositoryInterface::class)
83                ]
84            );
85
86        $services
87            ->set(FeatureFlagPropertiesMapping::class, FeatureFlagPropertiesMapping::class)
88            ->public();
89    }
90}