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

HeadersGeneratorTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 2
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A generateHeaders() 0 10 2
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