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

UntranslatedMessageExporter::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 1
crap 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
}