Folder   A
last analyzed

↳ Parent: Project

Coupling/Cohesion

Components 1
Dependencies 0

Complexity

Total Complexity 8

Size/Duplication

Total Lines 100
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 0
dl 0
loc 100
ccs 22
cts 22
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A setName() 0 6 1
A getName() 0 4 1
A setPath() 0 10 2
A getPath() 0 4 1
A setFallback() 0 6 1
A getFallback() 0 4 1
1
<?php
2
3
namespace League\Plates\Template;
4
5
use LogicException;
6
7
/**
8
 * A template folder.
9
 */
10
class Folder
11
{
12
    /**
13
     * The folder name.
14
     * @var string
15
     */
16
    protected $name;
17
18
    /**
19
     * The folder path.
20
     * @var string
21
     */
22
    protected $path;
23
24
    /**
25
     * The folder fallback status.
26
     * @var boolean
27
     */
28
    protected $fallback;
29
30
    /**
31
     * Create a new Folder instance.
32
     * @param string  $name
33
     * @param string  $path
34
     * @param boolean $fallback
35
     */
36 128
    public function __construct($name, $path, $fallback = false)
37
    {
38 128
        $this->setName($name);
39 128
        $this->setPath($path);
40 120
        $this->setFallback($fallback);
41 120
    }
42
43
    /**
44
     * Set the folder name.
45
     * @param  string $name
46
     * @return Folder
47
     */
48 128
    public function setName($name)
49
    {
50 128
        $this->name = $name;
51
52 128
        return $this;
53
    }
54
55
    /**
56
     * Get the folder name.
57
     * @return string
58
     */
59 12
    public function getName()
60
    {
61 12
        return $this->name;
62
    }
63
64
    /**
65
     * Set the folder path.
66
     * @param  string $path
67
     * @return Folder
68
     */
69 128
    public function setPath($path)
70
    {
71 128
        if (!is_dir($path)) {
72 12
            throw new LogicException('The specified directory path "' . $path . '" does not exist.');
73
        }
74
75 120
        $this->path = $path;
76
77 120
        return $this;
78
    }
79
80
    /**
81
     * Get the folder path.
82
     * @return string
83
     */
84 24
    public function getPath()
85
    {
86 24
        return $this->path;
87
    }
88
89
    /**
90
     * Set the folder fallback status.
91
     * @param  boolean $fallback
92
     * @return Folder
93
     */
94 120
    public function setFallback($fallback)
95
    {
96 120
        $this->fallback = $fallback;
97
98 120
        return $this;
99
    }
100
101
    /**
102
     * Get the folder fallback status.
103
     * @return boolean
104
     */
105 8
    public function getFallback()
106
    {
107 8
        return $this->fallback;
108
    }
109
}
110