Completed
Push — master ( a09b4a...382e94 )
by Tobias
08:18
created

LegacyTranslationWriter::write()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 3
crap 2
1
<?php
2
3
/*
4
 * This file is part of the PHP Translation package.
5
 *
6
 * (c) PHP Translation team <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Translation\SymfonyStorage;
13
14
use Symfony\Component\Translation\MessageCatalogue;
15
use Symfony\Component\Translation\Writer\TranslationWriter;
16
17
/**
18
 * This writer is just a wrapper for Symfony TranslationWriter
19
 * and provide a BC layer for Symfony 2.7 to 3.3.
20
 *
21
 * @author Victor Bocharsky <[email protected]>
22
 */
23
final class LegacyTranslationWriter // implements Symfony\Component\Translation\Writer\TranslationWriterInterface
24
{
25
    private $writer;
26
27
    public function __construct($writer)
28
    {
29
        // If not Translation writer from sf 2.7 to 3.3
30
        if (!$writer instanceof TranslationWriter) {
31
            throw new \LogicException(sprintf('PHP-Translation/SymfonyStorage does not support a TranslationWriter of type "%s".', get_class($writer)));
32
        }
33
34
        $this->writer = $writer;
35
    }
36
37
    public function write(MessageCatalogue $catalogue, $format, $options = [])
38
    {
39
        $this->writer->writeTranslations($catalogue, $format, $options);
0 ignored issues
show
Bug introduced by
The method writeTranslations() does not seem to exist on object<Symfony\Component...iter\TranslationWriter>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
40
    }
41
}
42