Passed
Push — hotfix/4.1.1 ( 2d60bf...00eef4 )
by Felipe
04:27
created

FlagCache::GetFlagImgByName()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 9
ccs 6
cts 6
cp 1
crap 2
rs 10
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 1
    public static function GetFlagImgByName($aSize, $aName)
24
    {
25 1
        if (self::$_gFlagCache[$aSize] === null) {
26 1
            self::$_gFlagCache[$aSize] = new Image\FlagImages($aSize);
27
        }
28 1
        $f   = self::$_gFlagCache[$aSize];
29 1
        $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 1
        return $f->GetImgByIdx($idx);
32
    }
33
}
34