Test Setup Failed
Pull Request — master (#4522)
by Craig
08:26 queued 03:47
created

UserInterfaceRuntime::moduleFooter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Zikula package.
7
 *
8
 * Copyright Zikula - https://ziku.la/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Zikula\ExtensionsModule\Twig\Runtime;
15
16
use Symfony\Component\HttpKernel\Controller\ControllerReference;
17
use Symfony\Component\HttpKernel\Fragment\FragmentHandler;
18
use Twig\Extension\RuntimeExtensionInterface;
19
20
class UserInterfaceRuntime implements RuntimeExtensionInterface
21
{
22
    /**
23
     * @var FragmentHandler
24
     */
25
    private $handler;
26
27
    public function __construct(FragmentHandler $handler)
28
    {
29
        $this->handler = $handler;
30
    }
31
32
    public function moduleFooter(): string
33
    {
34
        $ref = new ControllerReference('Zikula\ExtensionsModule\Controller\ExtensionsInterfaceController::footer');
35
36
        return $this->handler->render($ref) ?? '';
37
    }
38
39
    public function moduleHeader(
40
        string $type = 'user',
41
        string $title = '',
42
        string $titleLink = '',
43
        bool $setPageTitle = false,
44
        bool $insertFlashes = false,
45
        bool $menuFirst = false,
46
        bool $image = false
47
    ): string {
48
        $ref = new ControllerReference('Zikula\ExtensionsModule\Controller\ExtensionsInterfaceController::header', [
49
            'type' => $type,
50
            'title' => $title,
51
            'titlelink' => $titleLink,
52
            'setpagetitle' => $setPageTitle,
53
            'insertflashes' => $insertFlashes,
54
            'menufirst' => $menuFirst,
55
            'image' => $image
56
        ]);
57
58
        return $this->handler->render($ref) ?? '';
59
    }
60
61
    public function moduleLinks(
62
        string $type = 'user',
63
        array $links = [],
64
        string $modName = '',
65
        string $menuId = '',
66
        string $menuClass = '',
67
        string $itemClass = '',
68
        string $first = '',
69
        string $last = '',
70
        string $template = ''
71
    ): string {
72
        $ref = new ControllerReference('Zikula\ExtensionsModule\Controller\ExtensionsInterfaceController::links', [
73
            'type' => $type,
74
            'links' => $links,
75
            'modname' => $modName,
76
            'menuid' => $menuId,
77
            'menuclass' => $menuClass,
78
            'itemclass' => $itemClass,
79
            'first' => $first,
80
            'last' => $last,
81
            'template' => $template
82
        ]);
83
84
        return $this->handler->render($ref) ?? '';
85
    }
86
}
87