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.

Factory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 16
c 2
b 0
f 0
dl 0
loc 27
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 10 2
1
<?php
2
3
namespace Halfpastfour\PHPChartJS;
4
5
/**
6
 * Class Factory
7
 * @package Halfpastfour\PHPChartJS
8
 */
9
class Factory
10
{
11
    const BAR            = 'bar';
12
    const BUBBLE         = 'bubble';
13
    const DOUGHNUT       = 'doughnut';
14
    const HORIZONTAL_BAR = 'horizontalBar';
15
    const LINE           = 'line';
16
    const PIE            = 'pie';
17
    const POLAR_AREA     = 'polarArea';
18
    const RADAR          = 'radar';
19
    const SCATTER        = 'scatter';
20
21
    /**
22
     * @param $type
23
     *
24
     * @return Chart
25
     */
26
    public function create($type)
27
    {
28
        $className  = ucfirst($type);
29
        $namespace  = "\\Halfpastfour\\PHPChartJS\\Chart";
30
        $path       = "{$namespace}\\{$className}";
31
        if (! class_exists($path)) {
32
            throw new \InvalidArgumentException("Invalid chart type. {$path} does not exist.");
33
        }
34
35
        return new $path;
36
    }
37
}
38