Completed
Push — master ( 80539d...151257 )
by Mārtiņš
02:11
created

UntranslatedMessageExporter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 20
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A exportToString() 0 5 1
1
<?php
2
3
namespace Printful\GettextCms;
4
5
use Gettext\Generators\Po;
6
7
/**
8
 * Export untranslated messages to a .po file contents that can be saved for translating
9
 */
10
class UntranslatedMessageExporter
11
{
12
    /** @var MessageStorage */
13
    private $storage;
14
15 6
    public function __construct(MessageStorage $storage)
16
    {
17 6
        $this->storage = $storage;
18 6
    }
19
20
    /**
21
     * @param string $locale
22
     * @param string $domain
23
     * @return bool
24
     */
25 6
    public function exportToString(string $locale, string $domain)
26
    {
27 6
        $translations = $this->storage->getRequiresTranslating($locale, $domain);
28
29 6
        return Po::toString($translations);
0 ignored issues
show
Bug Best Practice introduced by
The expression return Gettext\Generator...toString($translations) returns the type string which is incompatible with the documented return type boolean.
Loading history...
30
    }
31
}