Completed
Push — master ( a17288...aa8e2a )
by Derek Stephen
01:49
created

Flag   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 21
ccs 0
cts 11
cp 0
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
    public static function render(Country $country, $size)
21
    {
22
        $path = dirname(dirname(__DIR__)).DIRECTORY_SEPARATOR.'public'.DIRECTORY_SEPARATOR.'img'.DIRECTORY_SEPARATOR.'flags'.DIRECTORY_SEPARATOR.$size.DIRECTORY_SEPARATOR;
23
        $img = new Image($path.$country->getFlag());
24
        $header = $img->getHeader();
25
26
        ob_start();
27
        $img->output();
28
        $img->destroy();
29
        $i = ob_get_clean();
30
31
        return( '<img src="data:'.$header.';base64,' . base64_encode( $i ).'" />');
32
    }
33
}