Completed
Push — master ( 55caa0...3f2e9b )
by Oscar
02:05
created

HeadersGeneratorTrait::generateHeaders()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 10
rs 9.4285
1
<?php
2
3
namespace Gettext\Utils;
4
5
use Gettext\Translations;
6
7
/**
8
 * Trait to provide the functionality of extracting headers
9
 */
10
trait HeadersGeneratorTrait
11
{
12
    /**
13
     * Returns the headers as a string
14
     * 
15
     * @param Translations $translations
16
     *
17
     * @return string
18
     */
19
    private static function generateHeaders(Translations $translations)
20
    {
21
        $headers = '';
22
23
        foreach ($translations->getHeaders() as $name => $value) {
24
            $headers .= sprintf("%s: %s\n", $name, $value);
25
        }
26
27
        return $headers;
28
    }
29
}
30