HuasoFoundries /
jpgraph
| 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
Loading history...
|
|||
| 30 | |||
| 31 | 1 | return $f->GetImgByIdx($idx); |
|
| 32 | } |
||
| 33 | } |
||
| 34 |