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

MockSnippetFile   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 47
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getAuthor() 0 3 1
A getName() 0 3 1
A __construct() 0 7 1
A getPath() 0 3 1
A isBase() 0 3 1
A getIso() 0 3 1
A getTechnicalName() 0 3 1
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