Passed
Push — master ( 4bccec...259a7c )
by David
01:44
created

getBlocksDirectory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace TheCodingMachine\CMS\StaticRegistry\DI;
3
4
use Psr\Container\ContainerInterface;
5
use Psr\SimpleCache\CacheInterface;
6
use TheCodingMachine\CMS\StaticRegistry\Registry\BlockRegistry;
7
use TheCodingMachine\CMS\StaticRegistry\Registry\PageRegistry;
8
use TheCodingMachine\CMS\StaticRegistry\Registry\StaticRegistry;
9
use TheCodingMachine\CMS\StaticRegistry\Registry\ThemeRegistry;
10
use TheCodingMachine\Funky\Annotations\Factory;
11
use TheCodingMachine\Funky\ServiceProvider;
12
13
class StaticRegistryServiceProvider extends ServiceProvider
14
{
15
    /**
16
     * @Factory()
17
     */
18
    public static function getStaticRegistry(PageRegistry $pageRegistry, ThemeRegistry $themeRegistry): StaticRegistry
19
    {
20
        return new StaticRegistry($pageRegistry, $themeRegistry);
21
    }
22
23
    /**
24
     * @Factory()
25
     */
26
    public static function getPageRegistry(string $PAGES_DIRECTORY, CacheInterface $cache): PageRegistry
27
    {
28
        return new PageRegistry($PAGES_DIRECTORY, $cache);
29
    }
30
31
    /**
32
     * @Factory()
33
     */
34
    public static function getThemeRegistry(string $THEMES_DIRECTORY, string $SUBTHEMES_DIRECTORY, ContainerInterface $container, CacheInterface $cache, BlockRegistry $blockRegistry): ThemeRegistry
35
    {
36
        return new ThemeRegistry($THEMES_DIRECTORY, $SUBTHEMES_DIRECTORY, $container, $cache, $blockRegistry);
37
    }
38
39
    /**
40
     * @Factory()
41
     */
42
    public static function getBlockRegistry(string $BLOCKS_DIRECTORY, ContainerInterface $container, CacheInterface $cache): BlockRegistry
43
    {
44
        return new BlockRegistry($BLOCKS_DIRECTORY, $container, $cache);
45
    }
46
47
    /**
48
     * @Factory(name="PAGES_DIRECTORY")
49
     */
50
    public static function getPagesDirectory(string $CMS_ROOT): string
51
    {
52
        return $CMS_ROOT.'/pages';
53
    }
54
55
    /**
56
     * @Factory(name="THEMES_DIRECTORY")
57
     */
58
    public static function getThemesDirectory(string $CMS_ROOT): string
59
    {
60
        return $CMS_ROOT.'/themes';
61
    }
62
63
    /**
64
     * @Factory(name="SUBTHEMES_DIRECTORY")
65
     */
66
    public static function getSubthemesDirectory(string $CMS_ROOT): string
67
    {
68
        return $CMS_ROOT.'/sub_themes';
69
    }
70
71
    /**
72
     * @Factory(name="BLOCKS_DIRECTORY")
73
     */
74
    public static function getBlocksDirectory(string $CMS_ROOT): string
75
    {
76
        return $CMS_ROOT.'/blocks';
77
    }
78
}
79