Test Failed
Pull Request — master (#144)
by
unknown
05:14
created

FlagCache   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
dl 0
loc 18
ccs 0
cts 8
cp 0
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A GetFlagImgByName() 0 9 2
1
<?php
2
3
/**
4
 * JPGraph v4.0.3
5
 */
6
7
namespace Amenadiel\JpGraph\Util;
8
9
use Amenadiel\JpGraph\Image;
10
11
// Keep a global flag cache to reduce memory usage
12
13
// Only supposed to b called as statics
14
class FlagCache
15
{
16
    private static $_gFlagCache = [
17
        1 => null,
18
        2 => null,
19
        3 => null,
20
        4 => null,
21
    ];
22
23
    public static function GetFlagImgByName($aSize, $aName)
24
    {
25
        if (self::$_gFlagCache[$aSize] === null) {
26
            self::$_gFlagCache[$aSize] = new Image\FlagImages($aSize);
27
        }
28
        $f   = self::$_gFlagCache[$aSize];
29
        $idx = $f->GetIdxByName($aName, $aFullName);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $aFullName seems to be never defined.
Loading history...
30
31
        return $f->GetImgByIdx($idx);
32
    }
33
}
34