Completed
Push — master ( 6aec97...01562b )
by Derek Stephen
01:48
created

Flag   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 21
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 13 1
1
<?php
2
/**
3
 * User: delboy1978uk
4
 * Date: 30/10/15
5
 * Time: 17:32
6
 */
7
8
namespace Del\Helper;
9
10
use Del\Image;
11
use Del\Entity\Country;
12
13
class Flag
14
{
15
    /**
16
     * @param Country $country
17
     * @param $size
18
     * @return string
19
     */
20 1
    public static function render(Country $country, $size)
21
    {
22 1
        $path = dirname(dirname(__DIR__)).DIRECTORY_SEPARATOR.'public'.DIRECTORY_SEPARATOR.'img'.DIRECTORY_SEPARATOR.'flags'.DIRECTORY_SEPARATOR.$size.DIRECTORY_SEPARATOR;
23 1
        $img = new Image($path.$country->getFlag());
24 1
        $header = $img->getHeader();
25
26 1
        ob_start();
27 1
        $img->output();
28 1
        $img->destroy();
29 1
        $i = ob_get_clean();
30
31 1
        return( '<img src="data:'.$header.';base64,' . base64_encode( $i ).'" />');
32
    }
33
}