Completed
Push — master ( 960360...5c8c09 )
by Dion
18s queued 11s
created

Writable::shouldClobber()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the SexyField package.
5
 *
6
 * (c) Dion Snoeijen <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare (strict_types = 1);
13
14
namespace Tardigrades\SectionField\Generator\Writer;
15
16
class Writable
17
{
18
    /** @var string */
19
    private $template;
20
21
    /** @var string */
22
    private $namespace;
23
24
    /** @var string */
25
    private $filename;
26
27
    /** @var bool */
28
    private $clobber;
29
30
    private function __construct(
31
        string $template,
32
        string $namespace,
33
        string $filename,
34
        bool $clobber = true
35
    ) {
36
        $this->template = $template;
37
        $this->namespace = $namespace;
38
        $this->filename = $filename;
39
        $this->clobber = $clobber;
40
    }
41
42
    public function getTemplate(): string
43
    {
44
        return $this->template;
45
    }
46
47
    public function getNamespace(): string
48
    {
49
        return $this->namespace;
50
    }
51
52
    public function getFilename(): string
53
    {
54
        return $this->filename;
55
    }
56
57
    public function shouldClobber(): bool
58
    {
59
        return $this->clobber;
60
    }
61
62
    public static function create(
63
        string $template,
64
        string $namespace,
65
        string $filename,
66
        bool $clobber = true
67
    ): self {
68
        return new static($template, $namespace, $filename, $clobber);
69
    }
70
}
71