Passed
Push — master ( 16a9ac...022ef4 )
by WEBEWEB
02:07
created

SyntaxHighlighterStringsProvider   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 66
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getSyntaxHighlighterStrings() 0 16 1
A setTranslator() 0 3 1
A getTranslator() 0 2 1
A __construct() 0 2 1
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;
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
     * Constructor.
41
     *
42
     * @param TranslatorInterface $translator The translator.
43
     */
44
    public function __construct(TranslatorInterface $translator) {
45
        $this->setTranslator($translator);
46
    }
47
48
    /**
49
     * Get a SyntaxHighlighter strings.
50
     *
51
     * @return SyntaxHighlighterStrings Returns teh SyntaxHighlighter strings.
52
     */
53
    public function getSyntaxHighlighterStrings() {
54
55
        // Initialize the SyntaxHighlighter strings.
56
        $strings = new SyntaxHighlighterStrings();
57
        $strings->setAlert($this->getTranslator()->trans("strings.alert", [], "SyntaxHighlighterBundle", $this->getTranslator()->getLocale()));
58
        $strings->setBrushNotHtmlScript($this->getTranslator()->trans("strings.brush_no_html_script", [], "SyntaxHighlighterBundle", $this->getTranslator()->getLocale()));
59
        $strings->setCopyToClipboard($this->getTranslator()->trans("strings.copy_to_clipboard", [], "SyntaxHighlighterBundle", $this->getTranslator()->getLocale()));
60
        $strings->setCopyToClipboardConfirmation($this->getTranslator()->trans("strings.copy_to_clipboard_confirmation", [], "SyntaxHighlighterBundle", $this->getTranslator()->getLocale()));
61
        $strings->setExpandSource($this->getTranslator()->trans("strings.expand_source", [], "SyntaxHighlighterBundle", $this->getTranslator()->getLocale()));
62
        $strings->setHelp($this->getTranslator()->trans("strings.help", [], "SyntaxHighlighterBundle", $this->getTranslator()->getLocale()));
63
        $strings->setNoBrush($this->getTranslator()->trans("strings.no_brush", [], "SyntaxHighlighterBundle", $this->getTranslator()->getLocale()));
64
        $strings->setPrint($this->getTranslator()->trans("strings.print", [], "SyntaxHighlighterBundle", $this->getTranslator()->getLocale()));
65
        $strings->setViewSource($this->getTranslator()->trans("strings.view_source", [], "SyntaxHighlighterBundle", $this->getTranslator()->getLocale()));
66
67
        // Return the SyntaxHighlighter strings.
68
        return $strings;
69
    }
70
71
    /**
72
     * Get the translator.
73
     *
74
     * @return TranslatorInterface Returns the translator.
75
     */
76
    public function getTranslator() {
77
        return $this->translator;
78
    }
79
80
    /**
81
     * Set the translator.
82
     *
83
     * @param TranslatorInterafce $translator The 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...
84
     * @return SyntaxHighlighterStringsProvider Returns this SyntaxHighlighter strings provider.
85
     */
86
    protected function setTranslator(TranslatorInterface $translator) {
87
        $this->translator = $translator;
88
        return $this;
89
    }
90
91
}
92