Completed
Push — v4.0-dev ( 627b53...5ca120 )
by Oscar
02:44
created

CsvDictionary   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A toString() 0 15 2
1
<?php
2
3
namespace Gettext\Generators;
4
5
use Gettext\Translations;
6
7
class CsvDictionary extends Generator implements GeneratorInterface
8
{
9
    /**
10
     * {@parentDoc}.
11
     */
12
    public static function toString(Translations $translations)
13
    {
14
        $handle = fopen('php://memory', 'w');
15
16
        foreach ($translations as $translation) {
17
            fputcsv($handle, [$translation->getOriginal(), $translation->getTranslation()]);
18
        }
19
20
        rewind($handle);
21
        $csv = stream_get_contents($handle);
22
23
        fclose($handle);
24
25
        return $csv;
26
    }
27
}
28