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

TemplateProcessor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 29
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A process() 0 8 2
1
<?php
2
namespace Yoanm\DefaultPhpRepository\Processor;
3
4
use Yoanm\DefaultPhpRepository\Helper\TemplateHelper;
5
6
/**
7
 * Class TemplateProcessor
8
 */
9
class TemplateProcessor
10
{
11
    /** @var TemplateFileProcessor */
12
    private $templateFileProcessor;
13
    /** @var TemplateFolderProcessor */
14
    private $templateFolderProcessor;
15
16
    /**
17
     * @param TemplateHelper $templateHelper
18
     */
19
    public function __construct(TemplateHelper $templateHelper)
20
    {
21
        $this->templateFileProcessor = new TemplateFileProcessor($templateHelper);
22
        $this->templateFolderProcessor = new TemplateFolderProcessor($templateHelper);
23
    }
24
25
    /**
26
     * @param string $templatePath
27
     * @param string $outputDir
28
     */
29
    public function process($templatePath, $outputDir = '.')
30
    {
31
        if (is_dir($templatePath)) {
32
            $this->templateFolderProcessor->process($templatePath, $outputDir);
33
        } else {
34
            $this->templateFileProcessor->process($templatePath, $outputDir);
35
        }
36
    }
37
}
38