Flag::render()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
c 2
b 0
f 0
nc 1
nop 2
dl 0
loc 12
ccs 9
cts 9
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Del\Helper;
6
7
use Del\Image;
8
use Del\Entity\Country;
9
10
class Flag
11
{
12 1
    public static function render(Country $country, string $size): string
13
    {
14 1
        $path = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'img' . DIRECTORY_SEPARATOR . 'flags' . DIRECTORY_SEPARATOR . $size . DIRECTORY_SEPARATOR;
15 1
        $img = new Image($path . $country->getFlag());
16 1
        $header = $img->getHeader();
17
18 1
        ob_start();
19 1
        $img->output();
20 1
        $img->destroy();
21 1
        $i = ob_get_clean();
22
23 1
        return ('<img src="data:' . $header . ';base64,' . base64_encode($i) . '" />');
24
    }
25
}
26