RectPatternFactory   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 29
dl 0
loc 48
ccs 0
cts 34
cp 0
rs 10
c 1
b 0
f 0
wmc 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
B Create() 0 41 9
1
<?php
2
3
/**
4
 * JPGraph v4.0.3
5
 */
6
7
namespace Amenadiel\JpGraph\Graph;
8
9
use Amenadiel\JpGraph\Util;
10
11
/**
12
 * @class RectPatternFactory
13
 * // Factory class for rectangular pattern
14
 */
15
class RectPatternFactory
16
{
17
    public function __construct()
18
    {
19
        // Empty
20
    }
21
22
    public function Create($aPattern, $aColor, $aWeight = 1)
23
    {
24
        switch ($aPattern) {
25
            case BAND_RDIAG:
26
                $obj = new RectPatternRDiag($aColor, $aWeight);
27
28
                break;
29
            case BAND_LDIAG:
30
                $obj = new RectPatternLDiag($aColor, $aWeight);
31
32
                break;
33
            case BAND_SOLID:
34
                $obj = new RectPatternSolid($aColor, $aWeight);
35
36
                break;
37
            case BAND_VLINE:
38
                $obj = new RectPatternVert($aColor, $aWeight);
39
40
                break;
41
            case BAND_HLINE:
42
                $obj = new RectPatternHor($aColor, $aWeight);
43
44
                break;
45
            case BAND_3DPLANE:
46
                $obj = new RectPattern3DPlane($aColor, $aWeight);
47
48
                break;
49
            case BAND_HVCROSS:
50
                $obj = new RectPatternCross($aColor, $aWeight);
51
52
                break;
53
            case BAND_DIAGCROSS:
54
                $obj = new RectPatternDiagCross($aColor, $aWeight);
55
56
                break;
57
            default:
58
                Util\JpGraphError::RaiseL(16003, $aPattern);
59
                //(" Unknown pattern specification ($aPattern)");
60
        }
61
62
        return $obj;
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $obj does not seem to be defined for all execution paths leading up to this point.
Loading history...
63
    }
64
}
65