Passed
Push — master ( 669ab6...e096b1 )
by
unknown
14:08
created

ServiceProvider::getViewHelperResolverFactory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the TYPO3 CMS project.
7
 *
8
 * It is free software; you can redistribute it and/or modify it under
9
 * the terms of the GNU General Public License, either version 2
10
 * of the License, or any later version.
11
 *
12
 * For the full copyright and license information, please read the
13
 * LICENSE.txt file that was distributed with this source code.
14
 *
15
 * The TYPO3 project - inspiring people to share!
16
 */
17
18
namespace TYPO3\CMS\Fluid;
19
20
use Psr\Container\ContainerInterface;
21
use TYPO3\CMS\Core\Cache\CacheManager;
22
use TYPO3\CMS\Core\Package\AbstractServiceProvider;
23
use TYPO3\CMS\Extbase\Object\ObjectManager;
24
25
/**
26
 * @internal
27
 */
28
class ServiceProvider extends AbstractServiceProvider
29
{
30
    protected static function getPackagePath(): string
31
    {
32
        return __DIR__ . '/../';
33
    }
34
35
    public function getFactories(): array
36
    {
37
        return [
38
            Core\Rendering\RenderingContextFactory::class => [ static::class, 'getRenderingContextFactory' ],
39
            Core\ViewHelper\ViewHelperResolverFactory::class => [ static::class, 'getViewHelperResolverFactory' ],
40
        ];
41
    }
42
43
    public static function getRenderingContextFactory(ContainerInterface $container): Core\Rendering\RenderingContextFactory
44
    {
45
        return self::new($container, Core\Rendering\RenderingContextFactory::class, [
46
            $container,
47
            $container->get(CacheManager::class),
48
            $container->get(Core\ViewHelper\ViewHelperResolverFactory::class)
49
        ]);
50
    }
51
52
    public static function getViewHelperResolverFactory(ContainerInterface $container): Core\ViewHelper\ViewHelperResolverFactory
53
    {
54
        return self::new($container, Core\ViewHelper\ViewHelperResolverFactory::class, [
55
            $container,
56
            $container->get(ObjectManager::class)
57
        ]);
58
    }
59
}
60