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.

ReportGenerator::setupDirectory()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
4
namespace Inspector\Analysis\Report;
5
6
use Illuminate\Filesystem\Filesystem;
7
use Inspector\Analysis\Result\AnalysisResult;
8
9
10
/**
11
 * @author Kabir Baidhya
12
 */
13
class ReportGenerator
14
{
15
16
    /**
17
     * @var Filesystem
18
     */
19
    protected $filesystem;
20
21
    /**
22
     * @param Filesystem $filesystem
23
     */
24
    public function __construct(Filesystem $filesystem)
25
    {
26
        $this->filesystem = $filesystem;
27
    }
28
29
    /**
30
     * @param $path
31
     * @param array $data
32
     */
33
    public function generate($path, array $data)
34
    {
35
        $this->setupDirectory($path);
36
        $html = $this->renderReport([
37
            'analyzedPath' => $data['path'],
38
            'analysis' => $data['result']
39
        ]);
40
41
        // Write report html to the file
42
        $this->filesystem->put($path . '/index.html', $html);
43
    }
44
45
    /**
46
     * Sets up the report directory.
47
     *
48
     * @param string $path
49
     * @return $this
50
     */
51
    protected function setupDirectory($path)
52
    {
53
        $src = BASEPATH . 'resources/output/html';
54
        $this->filesystem->copyDirectory($src, $path);
55
56
        return $this;
57
    }
58
59
    /**
60
     * Renders the Report HTML and returns it
61
     *
62
     * @param array $data
63
     * @return string
64
     */
65
    protected function renderReport(array $data)
66
    {
67
        extract($data);
68
        ob_start();
69
        require(BASEPATH . 'resources/view/report.php');
70
71
        return ob_get_clean();
72
    }
73
}
74