Passed
Push — master ( d88647...16a9ac )
by WEBEWEB
02:54
created

getSyntaxHighlighterStrings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 11
nc 1
nop 0
dl 0
loc 16
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of the syntaxhighligter-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\SyntaxHighlighterBundle\Provider;
13
14
use Symfony\Component\Translation\TranslatorInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Translation\TranslatorInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use WBW\Bundle\SyntaxHighlighterBundle\API\SyntaxHighlighterStrings;
16
17
/**
18
 * SyntaxHighlighter strings provider.
19
 *
20
 * @author webeweb <https://github.com/webeweb/>
21
 * @package WBW\Bundle\SyntaxHighlighterBundle\Provider
22
 */
23
class SyntaxHighlighterStringsProvider {
24
25
    /**
26
     * Service name.
27
     *
28
     * @var string
29
     */
30
    const SERVICE_NAME = "webeweb.bundle.syntaxhighlighterbundle.provider.syntaxhighlighterstrings";
31
32
    /**
33
     * Translator.
34
     *
35
     * @var TranslatorInterface
36
     */
37
    private $translator;
38
39
    /**
40
     * Get a SyntaxHighlighter strings.
41
     *
42
     * @return SyntaxHighlighterStrings Returns teh SyntaxHighlighter strings.
43
     */
44
    public function getSyntaxHighlighterStrings() {
45
46
        // Initialize the SyntaxHighlighter strings.
47
        $strings = new SyntaxHighlighterStrings();
48
        $strings->setAlert($this->getTranslator()->trans("strings.alert", [], "SyntaxHighlighterBundle", $this->getTranslator()->getLocale()));
49
        $strings->setBrushNotHtmlScript($this->getTranslator()->trans("strings.brush_no_html_script", [], "SyntaxHighlighterBundle", $this->getTranslator()->getLocale()));
50
        $strings->setCopyToClipboard($this->getTranslator()->trans("strings.copy_to_clipboard", [], "SyntaxHighlighterBundle", $this->getTranslator()->getLocale()));
51
        $strings->setCopyToClipboardConfirmation($this->getTranslator()->trans("strings.copy_to_clipboard_confirmation", [], "SyntaxHighlighterBundle", $this->getTranslator()->getLocale()));
52
        $strings->setExpandSource($this->getTranslator()->trans("strings.expand_source", [], "SyntaxHighlighterBundle", $this->getTranslator()->getLocale()));
53
        $strings->setHelp($this->getTranslator()->trans("strings.help", [], "SyntaxHighlighterBundle", $this->getTranslator()->getLocale()));
54
        $strings->setNoBrush($this->getTranslator()->trans("strings.no_brush", [], "SyntaxHighlighterBundle", $this->getTranslator()->getLocale()));
55
        $strings->setPrint($this->getTranslator()->trans("strings.print", [], "SyntaxHighlighterBundle", $this->getTranslator()->getLocale()));
56
        $strings->setViewSource($this->getTranslator()->trans("strings.view_source", [], "SyntaxHighlighterBundle", $this->getTranslator()->getLocale()));
57
58
        // Return the SyntaxHighlighter strings.
59
        return $strings;
60
    }
61
62
    /**
63
     * Get the translator.
64
     *
65
     * @return TranslatorInterface Returns the translator.
66
     */
67
    public function getTranslator() {
68
        return $this->translator;
69
    }
70
71
    /**
72
     * Set the translator.
73
     *
74
     * @param TranslatorInterafce $translator The translator.
75
     * @return SyntaxHighlighterStringsProvider Returns this SyntaxHighlighter strings provider.
76
     */
77
    protected function setTranslator(TranslatorInterafce $translator) {
0 ignored issues
show
Bug introduced by
The type WBW\Bundle\SyntaxHighlig...der\TranslatorInterafce was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
78
        $this->translator = $translator;
79
        return $this;
80
    }
81
82
}
83