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

TemplatePathBagFactory::getTemplatePathList()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 27
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 27
ccs 0
cts 20
cp 0
rs 8.8571
c 0
b 0
f 0
cc 2
eloc 16
nc 2
nop 1
crap 6
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