Completed
Branch 09branch (31301e)
by Anton
02:42
created

LoaderBridge::getSource()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * spiral
4
 *
5
 * @author    Wolfy-J
6
 */
7
8
namespace Spiral\Views\Engines\Stempler;
9
10
use Spiral\Stempler\LoaderInterface;
11
use Spiral\Stempler\StemplerSource;
12
13
class LoaderBridge implements LoaderInterface
0 ignored issues
show
Bug introduced by
There is one abstract method getSourceContext in this class; you could implement it, or declare this class as abstract.
Loading history...
14
{
15
    /**
16
     * @var \Spiral\Views\LoaderInterface
17
     */
18
    private $loader;
19
20
    /**
21
     * @param \Spiral\Views\LoaderInterface $loader
22
     */
23
    public function __construct(\Spiral\Views\LoaderInterface $loader)
24
    {
25
        $this->loader = $loader;
26
    }
27
28
    /**
29
     * @param string $path
30
     *
31
     * @return StemplerSource
32
     */
33
    public function getSource(string $path): StemplerSource
34
    {
35
        $context = $this->loader->getSource($path);
36
37
        return new StemplerSource($context->getFilename(), $context->getCode());
38
    }
39
}