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

LoaderBridge   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2

2 Methods

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