Failed Conditions
Push — master ( 28e23e...6697e2 )
by Yo
01:52
created

TemplatePathBagFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 53
ccs 0
cts 28
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A load() 0 4 1
B getTemplatePathList() 0 27 2
1
<?php
2
namespace Yoanm\DefaultPhpRepository\Factory;
3
4
use Yoanm\DefaultPhpRepository\Command\Mode;
5
use Yoanm\DefaultPhpRepository\Registry\TemplateRegistry;
6
7
/**
8
 * Class TemplatePathBagFactory
9
 */
10
class TemplatePathBagFactory
11
{
12
    /** @var TemplateRegistry */
13
    private $templateRegistry;
14
15
    public function __construct()
16
    {
17
        $this->templateRegistry = new TemplateRegistry();
18
    }
19
20
    /**
21
     * @param $mode
22
     *
23
     * @return array
24
     */
25
    public function load($mode)
26
    {
27
        return $this->getTemplatePathList($mode);
28
    }
29
30
    /**
31
     * @param string $mode
32
     *
33
     * @return array
34
     */
35
    protected function getTemplatePathList($mode)
36
    {
37
        $list = [
38
            // Init
39
            'template.init.readme' => $this->templateRegistry->getTemplatePath('README.md.tmpl'),
40
            'template.init.license' => $this->templateRegistry->getTemplatePath('LICENSE.tmpl'),
41
            'template.init.contributing' => $this->templateRegistry->getTemplatePath('CONTRIBUTING.md.tmpl'),
42
            // Git
43
            'template.git.gitignore' => $this->templateRegistry->getTemplatePath('.gitignore.tmpl'),
44
            // Composer
45
            'template.composer.config' => $this->templateRegistry->getTemplatePath('composer.json.tmpl'),
46
            // Tests
47
            'template.test.phpcs.config' => $this->templateRegistry->getTemplatePath('phpcs.xml.dist.tmpl'),
48
            'template.test.phpunit.config' => $this->templateRegistry->getTemplatePath('phpunit.xml.dist.tmpl'),
49
            'template.test.phpunit.folder' => $this->templateRegistry->getTemplatePath('tests'),
50
            'template.test.behat.config' => $this->templateRegistry->getTemplatePath('behat.yml.tmpl'),
51
            'template.test.behat.folder' => $this->templateRegistry->getTemplatePath('features'),
52
            // Continuous integration
53
            'template.ci.scrutinizer' => $this->templateRegistry->getTemplatePath('.scrutinizer.yml.tmpl'),
54
        ];
55
56
        if (Mode::PROJECT !== $mode) {
57
            $list['template.ci.travis'] = $this->templateRegistry->getTemplatePath('.travis.yml.tmpl');
58
        }
59
60
        return $list;
61
    }
62
}
63