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.

Renderer   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
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 34
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A render() 0 15 2
1
<?php
2
3
namespace Air\View\Mustache;
4
5
use Air\View\Renderer as BaseRenderer;
6
use Mustache_Loader_FilesystemLoader;
7
use Mustache_Engine;
8
9
class Renderer extends BaseRenderer
10
{
11
    /**
12
     * @param string|null $cacheDir A directory to cache rendered templates into (enables caching).
13
     * @param string|null $partialsDir A directory where static partials are stored.
14
     */
15
    public function __construct($cacheDir = null, $partialsDir = null)
16
    {
17
        $this->cacheDir = $cacheDir;
18
        $this->partialsDir = $partialsDir;
19
    }
20
21
22
    /**
23
     * @param string $file The file to load.
24
     * @param array $data The data to inject.
25
     * @return string The rendered output.
26
     */
27
    public function render($file, array $data)
28
    {
29
        if (!is_null($this->cacheDir)) {
30
            $mustache = new Mustache_Engine([
31
                'cache' => $this->cacheDir,
32
                'partials_loader' => new Mustache_Loader_FilesystemLoader($this->partialsDir)
33
            ]);
34
        } else {
35
            $mustache = new Mustache_Engine([
36
                'partials_loader' => new Mustache_Loader_FilesystemLoader($this->partialsDir)
37
            ]);
38
        }
39
40
        return $mustache->render(file_get_contents($file), $data);
41
    }
42
}
43