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

SourceContext   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getFilename() 0 4 1
A getSource() 0 4 1
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
}