Completed
Push — master ( d88be7...2e7310 )
by WEBEWEB
01:23
created

SyntaxHighlighterStringsProvider::translate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the core-bundle package.
5
 *
6
 * (c) 2018 WEBEWEB
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 WBW\Bundle\CoreBundle\Provider\Asset;
13
14
use Symfony\Component\Translation\TranslatorInterface;
15
use WBW\Bundle\CoreBundle\Asset\SyntaxHighlighterStrings;
16
use WBW\Bundle\CoreBundle\Provider\ProviderInterface;
17
use WBW\Bundle\CoreBundle\Service\TranslatorTrait;
18
19
/**
20
 * SyntaxHighlighter strings provider.
21
 *
22
 * @author webeweb <https://github.com/webeweb/>
23
 * @package WBW\Bundle\CoreBundle\Provider\Asset
24
 */
25
class SyntaxHighlighterStringsProvider implements ProviderInterface {
26
27
    use TranslatorTrait;
28
29
    /**
30
     * Service name.
31
     *
32
     * @var string
33
     */
34
    const SERVICE_NAME = "wbw.core.provider.asset.syntax_highlighter_strings";
35
36
    /**
37
     * Constructor.
38
     *
39
     * @param TranslatorInterface $translator The translator.
40
     */
41
    public function __construct(TranslatorInterface $translator) {
42
        $this->setTranslator($translator);
43
    }
44
45
    /**
46
     * Get a strings.
47
     *
48
     * @return SyntaxHighlighterStrings Returns the strings.
49
     */
50
    public function getSyntaxHighlighterStrings() {
51
52
        $strings = new SyntaxHighlighterStrings();
53
        $strings->setAlert($this->translate("syntax_highlighter.strings.alert"));
0 ignored issues
show
Documentation introduced by
'syntax_highlighter.strings.alert' is of type string, but the function expects a object<WBW\Bundle\CoreBu...\Provider\Asset\strign>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
54
        $strings->setBrushNotHtmlScript($this->translate("syntax_highlighter.strings.brush_no_html_script"));
0 ignored issues
show
Documentation introduced by
'syntax_highlighter.strings.brush_no_html_script' is of type string, but the function expects a object<WBW\Bundle\CoreBu...\Provider\Asset\strign>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
55
        $strings->setCopyToClipboard($this->translate("syntax_highlighter.strings.copy_to_clipboard"));
0 ignored issues
show
Documentation introduced by
'syntax_highlighter.strings.copy_to_clipboard' is of type string, but the function expects a object<WBW\Bundle\CoreBu...\Provider\Asset\strign>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
56
        $strings->setCopyToClipboardConfirmation($this->translate("syntax_highlighter.strings.copy_to_clipboard_confirmation"));
0 ignored issues
show
Documentation introduced by
'syntax_highlighter.stri...clipboard_confirmation' is of type string, but the function expects a object<WBW\Bundle\CoreBu...\Provider\Asset\strign>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
57
        $strings->setExpandSource($this->translate("syntax_highlighter.strings.expand_source"));
0 ignored issues
show
Documentation introduced by
'syntax_highlighter.strings.expand_source' is of type string, but the function expects a object<WBW\Bundle\CoreBu...\Provider\Asset\strign>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
58
        $strings->setHelp($this->translate("syntax_highlighter.strings.help"));
0 ignored issues
show
Documentation introduced by
'syntax_highlighter.strings.help' is of type string, but the function expects a object<WBW\Bundle\CoreBu...\Provider\Asset\strign>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
59
        $strings->setNoBrush($this->translate("syntax_highlighter.strings.no_brush"));
0 ignored issues
show
Documentation introduced by
'syntax_highlighter.strings.no_brush' is of type string, but the function expects a object<WBW\Bundle\CoreBu...\Provider\Asset\strign>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
60
        $strings->setPrint($this->translate("syntax_highlighter.strings.print"));
0 ignored issues
show
Documentation introduced by
'syntax_highlighter.strings.print' is of type string, but the function expects a object<WBW\Bundle\CoreBu...\Provider\Asset\strign>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
61
        $strings->setViewSource($this->translate("syntax_highlighter.strings.view_source"));
0 ignored issues
show
Documentation introduced by
'syntax_highlighter.strings.view_source' is of type string, but the function expects a object<WBW\Bundle\CoreBu...\Provider\Asset\strign>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
62
63
        return $strings;
64
    }
65
66
    /**
67
     * Translate.
68
     *
69
     * @param strign $id The id.
70
     * @return string Returns the translation.
71
     */
72
    protected function translate($id) {
73
        return $this->getTranslator()->trans($id, [], "WBWCoreBundle");
74
    }
75
}
76