Completed
Pull Request — master (#59)
by Alessandro
05:30
created

TempFilenameFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 38
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getFilenameForLog() 0 7 1
A getFilenameForCoverage() 0 7 1
1
<?php
2
3
namespace Paraunit\Configuration;
4
5
use Paraunit\File\TempDirectory;
6
7
/**
8
 * Class TempFilenameFactory
9
 * @package Tests\Unit\Parser
10
 */
11
class TempFilenameFactory
12
{
13
    /** @var  TempDirectory */
14
    private $tempDirectory;
15
16
    /**
17
     * TempFilenameFactory constructor.
18
     * @param TempDirectory $tempDirectory
19
     */
20 27
    public function __construct(TempDirectory $tempDirectory)
21
    {
22 27
        $this->tempDirectory = $tempDirectory;
23 27
    }
24
25
    /**
26
     * @param string $uniqueId
27
     * @return string
28
     */
29 25
    public function getFilenameForLog($uniqueId)
30
    {
31 25
        return $this->tempDirectory->getTempDirForThisExecution()
32
            . '/logs/'
33 25
            . $uniqueId
34 25
            . '.json.log';
35
    }
36
37
    /**
38
     * @param string $uniqueId
39
     * @return string
40
     */
41 1
    public function getFilenameForCoverage($uniqueId)
42
    {
43 1
        return $this->tempDirectory->getTempDirForThisExecution()
44
            . '/coverage/'
45 1
            . $uniqueId
46 1
            . '.php';
47
    }
48
}
49