EntityLogTcaWriter   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 99
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 48
c 2
b 0
f 0
dl 0
loc 99
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getChannelLabel() 0 3 1
A getNotificationTcaServiceClass() 0 3 1
A buildTcaArray() 0 63 1
A getEntityTitle() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
/*
5
 * Copyright (C)
6
 * Nathan Boiron <[email protected]>
7
 * Romain Canon <[email protected]>
8
 *
9
 * This file is part of the TYPO3 NotiZ project.
10
 * It is free software; you can redistribute it and/or modify it
11
 * under the terms of the GNU General Public License, either
12
 * version 3 of the License, or any later version.
13
 *
14
 * For the full copyright and license information, see:
15
 * http://www.gnu.org/licenses/gpl-3.0.html
16
 */
17
18
namespace CuyZ\Notiz\Domain\Notification\Log\Application\EntityLog\TCA;
19
20
use CuyZ\Notiz\Core\Notification\TCA\EntityTcaWriter;
21
22
class EntityLogTcaWriter extends EntityTcaWriter
23
{
24
    const LOG_LLL = 'LLL:EXT:notiz/Resources/Private/Language/Notification/Log/Log.xlf';
25
26
    /**
27
     * @return string
28
     */
29
    protected function getNotificationTcaServiceClass(): string
30
    {
31
        return EntityLogTcaService::class;
32
    }
33
34
    /**
35
     * @return string
36
     */
37
    protected function getChannelLabel(): string
38
    {
39
        return self::LOG_LLL . ':field.logger';
40
    }
41
42
    /**
43
     * @inheritdoc
44
     */
45
    protected function buildTcaArray(): array
46
    {
47
        return [
48
            'ctrl' => $this->getDefaultCtrl(),
49
50
            'palettes' => [
51
                'content' => [
52
                    'showitem' => 'message,markers',
53
                    'canNotCollapse' => true,
54
                ],
55
                'levels' => [
56
                    'showitem' => 'level,levels_descriptions',
57
                    'canNotCollapse' => true,
58
                ],
59
            ],
60
61
            'types' => [
62
                '0' => [
63
                    'showitem' => '
64
                        error_message,
65
                        title, description, hidden,
66
                        --div--;' . self::LLL . ':tab.event,
67
                            event, event_configuration_flex,
68
                        --div--;' . self::LLL . ':tab.channel,
69
                            channel,
70
                        --div--;' . self::LOG_LLL . ':tab.log,
71
                            --palette--;' . self::LOG_LLL . ':palette.content;content,
72
                            --palette--;' . self::LOG_LLL . ':palette.levels;levels',
73
                ],
74
            ],
75
76
            'columns' => [
77
                'message' => [
78
                    'exclude' => 1,
79
                    'label' => self::LOG_LLL . ':field.message',
80
                    'config' => [
81
                        'type' => 'input',
82
                        'default' => '',
83
                        'size' => 255,
84
                        'eval' => 'trim,required',
85
                    ],
86
                ],
87
88
                'level' => [
89
                    'exclude' => 1,
90
                    'label' => self::LOG_LLL . ':field.level',
91
                    'l10n_mode' => 'exclude',
92
                    'l10n_display' => 'defaultAsReadonly',
93
                    'config' => [
94
                        'type' => 'radio',
95
                        'items' => [],
96
                        'itemsProcFunc' => EntityLogTcaService::class . '->getLogLevelsList',
97
                        'eval' => 'required',
98
                    ],
99
                ],
100
101
                'levels_descriptions' => [
102
                    'exclude' => 1,
103
                    'label' => self::LOG_LLL . ':field.levels_descriptions_title',
104
                    'l10n_display' => 'defaultAsReadonly',
105
                    'config' => [
106
                        'type' => 'user',
107
                        'userFunc' => EntityLogTcaService::class . '->getLogLevelsDescriptions',
108
                    ],
109
                ],
110
111
            ],
112
        ];
113
    }
114
115
    /**
116
     * @return string
117
     */
118
    protected function getEntityTitle(): string
119
    {
120
        return self::LOG_LLL . ':title';
121
    }
122
}
123