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

LegacyTranslationWriter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
A write() 0 4 1
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