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.

Html   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 15
c 2
b 0
f 0
dl 0
loc 36
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 27 4
1
<?php
2
3
namespace Halfpastfour\PHPChartJS\Renderer;
4
5
use DOMDocument;
6
7
/**
8
 * Class Renderer
9
 *
10
 * @package Halfpastfour\PHPChartJS
11
 */
12
class Html extends Renderer
13
{
14
    /**
15
     * Renders the necessary HTML for the chart to function in the frontend.
16
     *
17
     * @param int|null $flags
18
     *
19
     * @return string
20
     */
21
    public function render($flags = null)
22
    {
23
        $dom = new DOMDocument();
24
25
        // Render canvas HTML element
26
        $canvas = $dom->createElement('canvas');
27
        $canvas->setAttribute('id', $this->chart->getId());
28
29
        // Add title, height and width if applicable
30
        if ($this->chart->getTitle()) {
31
            $canvas->setAttribute('title', $this->chart->getTitle());
32
        }
33
        if ($this->chart->getHeight()) {
34
            $canvas->setAttribute('height', $this->chart->getHeight());
35
        }
36
        if ($this->chart->getWidth()) {
37
            $canvas->setAttribute('width', $this->chart->getWidth());
38
        }
39
40
        $dom->appendChild($canvas);
41
42
        // Render JavaScript
43
        $scriptRenderer = new JavaScript($this->chart);
44
        $script         = $dom->createElement('script', $scriptRenderer->render($flags));
45
        $dom->appendChild($script);
46
47
        return $dom->saveHTML();
48
    }
49
}
50