Passed
Push — trunk ( 13f525...a8cce2 )
by Christian
12:21 queued 14s
created

MockSnippetFile::getTechnicalName()   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 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Shopware\Core\System\Test\Snippet\Mock;
4
5
use Shopware\Core\System\Snippet\Files\AbstractSnippetFile;
6
7
/**
8
 * @internal
9
 */
10
class MockSnippetFile extends AbstractSnippetFile
11
{
12
    private string $name;
13
14
    private bool $isBase;
15
16
    private string $iso;
17
18
    private string $technicalName;
19
20
    public function __construct(string $name, ?string $iso = null, string $content = '{}', bool $isBase = true, string $technicalName = 'mock')
21
    {
22
        $this->name = $name;
23
        $this->iso = $iso ?? $name;
24
        $this->isBase = $isBase;
25
        file_put_contents($this->getPath(), $content);
26
        $this->technicalName = $technicalName;
27
    }
28
29
    public function getName(): string
30
    {
31
        return $this->name;
32
    }
33
34
    public function getPath(): string
35
    {
36
        return sprintf('%s/_fixtures/%s.json', __DIR__, $this->getName());
37
    }
38
39
    public function getIso(): string
40
    {
41
        return $this->iso;
42
    }
43
44
    public function getAuthor(): string
45
    {
46
        return $this->name;
47
    }
48
49
    public function isBase(): bool
50
    {
51
        return $this->isBase;
52
    }
53
54
    public function getTechnicalName(): string
55
    {
56
        return $this->technicalName;
57
    }
58
}
59