L10nExporter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 2
dl 0
loc 35
ccs 10
cts 10
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A exportAllL10nResourceList() 0 7 1
1
<?php
2
3
namespace L10nBundle\Business;
4
5
use L10nBundle\Manager\L10nManagerInterface;
6
use L10nBundle\Manager\L10nConverterInterface;
7
8
/**
9
 * @todo doc
10
 *
11
 * @author Cyril Otal
12
 */
13
class L10nExporter
14
{
15
    /**
16
     * @var L10nManagerInterface $l10nManager
17
     */
18
    protected $l10nManager;
19
20
    /**
21
     * @var L10nConverterInterface
22
     */
23
    protected $l10nConverter;
24
25
    /**
26
     * @param L10nManagerInterface   $l10nManager
27
     * @param L10nConverterInterface $l10nConverter
28
     */
29 1
    public function __construct(L10nManagerInterface $l10nManager, L10nConverterInterface $l10nConverter)
30
    {
31 1
        $this->l10nManager = $l10nManager;
32 1
        $this->l10nConverter = $l10nConverter;
33 1
    }
34
35
    /**
36
     * Export L10nResources in the given filename
37
     *
38
     * @param string $filePath name of the export file
39
     */
40 1
    public function exportAllL10nResourceList($filePath = '')
41
    {
42 1
        $l10nResourceList = $this->l10nManager->getAllL10nResourceList();
43 1
        $output = $this->l10nConverter->convertL10nResourceList($l10nResourceList);
44 1
        $f = fopen($filePath, 'w+');
45 1
        fwrite($f, $output);
46 1
    }
47
}
48