Completed
Push — master ( 2c5b30...4f9913 )
by WEBEWEB
02:03
created

QuoteTwigExtension::quoteAuthorFunction()   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) 2019 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\Twig\Extension;
13
14
use Twig\Environment;
15
use Twig\TwigFunction;
16
use WBW\Bundle\CoreBundle\Manager\QuoteManager;
17
use WBW\Bundle\CoreBundle\Manager\QuoteManagerTrait;
18
19
/**
20
 * Quote Twig extension.
21
 *
22
 * @author webeweb <https://github.com/webeweb/>
23
 * @package WBW\Bundle\CoreBundle\Twig\Extension
24
 */
25
class QuoteTwigExtension extends AbstractTwigExtension {
26
27
    use QuoteManagerTrait;
28
29
    /**
30
     * Service name.
31
     *
32
     * @var string
33
     */
34
    const SERVICE_NAME = "webeweb.core.twig.extension.quote";
35
36
    /**
37
     * Constructor.
38
     *
39
     * @param Environment $twigEnvironment The Twig environment.
40
     * @param QuoteManager $quoteManager The quote manager.
41
     */
42
    public function __construct(Environment $twigEnvironment, QuoteManager $quoteManager) {
43
        parent::__construct($twigEnvironment);
44
        $this->setQuoteManager($quoteManager);
45
    }
46
47
    /**
48
     * Get the Twig functions.
49
     *
50
     * @return TwigFunction[] Returns the Twig functions.
51
     */
52
    public function getFunctions() {
53
        return [
54
            new TwigFunction("quoteAuthor", [$this, "quoteAuthorFunction"], ["is_safe" => ["html"]]),
55
            new TwigFunction("quoteContent", [$this, "quoteContentFunction"], ["is_safe" => ["html"]]),
56
        ];
57
    }
58
59
    /**
60
     * Displays a quote author.
61
     *
62
     * @param array $args The arguments.
63
     * @return string Returns the quote author.
64
     */
65
    public function quoteAuthorFunction(array $args = []) {
0 ignored issues
show
Unused Code introduced by
The parameter $args is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
66
67
    }
68
69
    /**
70
     * Displays a quote content.
71
     *
72
     * @param array $args The arguments.
73
     * @return string Returns the quote content.
74
     */
75
    public function quoteContentFunction(array $args = []) {
0 ignored issues
show
Unused Code introduced by
The parameter $args is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
76
77
    }
78
}
79