Passed
Push — feature/6.x ( 53903f...32797a )
by Schlaefer
05:38 queued 02:15
created

Editor::getMarkupSet()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 82
Code Lines 59

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 59
nc 1
nop 0
dl 0
loc 82
rs 8.8945
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * Saito - The Threaded Web Forum
6
 *
7
 * @copyright Copyright (c) the Saito Project Developers
8
 * @link https://github.com/Schlaefer/Saito
9
 * @license http://opensource.org/licenses/MIT
10
 */
11
12
namespace BbcodeParser\Lib;
13
14
use App\View\Helper\ParserHelper;
15
16
class Editor
17
{
18
    /**
19
     * {@inheritDoc}
20
     */
21
    public function getEditorHelp(ParserHelper $helper): string
22
    {
23
        return $helper->SaitoHelp->icon(
24
            'BbcodeParser.1',
25
            ['label' => __d('bbcode_parser', 'parsedAsBbcode')]
26
        );
27
    }
28
29
    /**
30
     * {@inheritDoc}
31
     */
32
    public function getMarkupSet(): array
33
    {
34
        return [
35
            [
36
                'name' => "<i class='fa fa-bold'></i>",
37
                'title' => __('Bold'),
38
                'className' => 'btn-markup-Bold',
39
                'type' => 'enclose',
40
                'openWith' => '[b]',
41
                'closeWith' => '[/b]',
42
            ],
43
            [
44
                'name' => "<i class='fa fa-italic'></i>",
45
                'title' => __('Italic'),
46
                'className' => 'btn-markup-Italic',
47
                'type' => 'enclose',
48
                'openWith' => '[i]',
49
                'closeWith' => '[/i]',
50
            ],
51
            [
52
                'name' => "<i class='fa fa-strikethrough'></i>",
53
                'title' => __('Strike Through'),
54
                'className' => 'btn-markup-Stroke',
55
                'type' => 'enclose',
56
                'openWith' => '[strike]',
57
                'closeWith' => '[/strike]',
58
            ],
59
            [
60
                'name' => "<i class='fa fa-s-code'></i>",
61
                'title' => __('Code'),
62
                'className' => 'btn-markup-Code',
63
                'type' => 'enclose',
64
                'openWith' => "[code=text]\n",
65
                'closeWith' => "\n[/code]",
66
            ],
67
            [
68
                'name' => "<i class='fa fa-list-ul'></i>",
69
                'title' => __('Bullet List'),
70
                'className' => 'btn-markup-List',
71
                'type' => 'enclose',
72
                'openWith' => "[list]\n[*] ",
73
                'closeWith' => "\n[*]\n[/list]",
74
            ],
75
            [
76
                'name' => "<i class='fa fa-stop'></i>",
77
                'className' => 'btn-markup-Spoiler',
78
                'title' => __('Spoiler'),
79
                'type' => 'enclose',
80
                'openWith' => '[spoiler]',
81
                'closeWith' => '[/spoiler]',
82
            ],
83
            [
84
                'name' => "<i class='fa fa-quote-left'></i>",
85
                'className' => 'btn-markup-Quote',
86
                'title' => __('Cite'),
87
                'type' => 'enclose',
88
                'openWith' => '[quote]',
89
                'closeWith' => '[/quote]',
90
            ],
91
            [
92
                'type' => 'separator',
93
            ],
94
            [
95
                'name' => "<i class='fa fa-link'></i>",
96
                'title' => __('Link'),
97
                'className' => 'btn-markup-Link',
98
                'type' => 'saito-link',
99
                'handler' => 'link',
100
            ],
101
            [
102
                'name' => "<i class='fa fa-multimedia'></i>",
103
                'className' => 'btn-markup-Media',
104
                'title' => __('Media'),
105
                'type' => 'saito-media',
106
                'handler' => 'media',
107
            ],
108
            [
109
                'name' => '<i class=\'fa fa-upload\'></i>',
110
                'title' => __('Upload'),
111
                'className' => 'btn-markup-Upload',
112
                'type' => 'saito-upload',
113
                'handler' => 'upload',
114
            ],
115
        ];
116
    }
117
}
118