Completed
Push — master ( 3b9aa0...812432 )
by Anton
03:38
created

SourceContext::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * components
4
 *
5
 * @author    Wolfy-J
6
 */
7
8
namespace Spiral\Stempler;
9
10
/**
11
 * Default implementation for ContextInterface.
12
 */
13
final class SourceContext implements SourceContextInterface
14
{
15
    /**
16
     * Must be local stream.
17
     *
18
     * @var string
19
     */
20
    private $filename;
21
22
    /**
23
     * @param string $filename
24
     */
25
    public function __construct(string $filename)
26
    {
27
        $this->filename = $filename;
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function getFilename(): string
34
    {
35
        return $this->filename;
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function getSource(): string
42
    {
43
        return file_get_contents($this->filename);
44
    }
45
}