GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ViewFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 4
Bugs 0 Features 3
Metric Value
wmc 3
c 4
b 0
f 3
lcom 1
cbo 3
dl 0
loc 41
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 4 1
A getUnrendered() 0 4 1
A __construct() 0 5 1
1
<?php
2
3
namespace Air\View\Mustache;
4
5
use Air\View\ViewFactory as BaseViewFactory;
6
use Air\View\View;
7
use Air\View\ViewInterface;
8
9
class ViewFactory extends BaseViewFactory
10
{
11
    /**
12
     * @var string $fileExtension The file extension to use when looking for views.
13
     */
14
    protected $fileExtension = 'mustache';
15
16
17
    /**
18
     * @param string|null $cacheDir A directory to cache rendered templates into (enables caching).
19
     * @param string|null $partialsDir A directory where static partials are stored.
20
     */
21
    public function __construct($cacheDir = null, $partialsDir = null)
22
    {
23
        $this->cacheDir = $cacheDir;
24
        $this->partialsDir = $partialsDir;
25
    }
26
27
28
    /**
29
     * @param string $fileName The name of the file to load.
30
     * @return ViewInterface A view.
31
     */
32
    public function get($fileName)
33
    {
34
        return new View(new Renderer($this->cacheDir, $this->partialsDir), $this->find($fileName));
35
    }
36
37
38
    /**
39
     * Return a mustache raw template.
40
     *
41
     * @param string $fileName The name of the file to load.
42
     * @return string The unrendered template (raw).
43
     * @throws \Exception
44
     */
45
    public function getUnrendered($fileName)
46
    {
47
        return file_get_contents($this->find($fileName));
48
    }
49
}
50