Test Failed
Push — develop ( fe7dfd...f4a85b )
by Paul
08:21
created

VcSiteReviewsForm::vcShortcodeSettings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 56
Code Lines 45

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 45
c 1
b 0
f 1
dl 0
loc 56
rs 9.2
cc 1
nc 1
nop 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
3
namespace GeminiLabs\SiteReviews\Integrations\WPBakery;
4
5
use GeminiLabs\SiteReviews\Shortcodes\SiteReviewsFormShortcode;
6
7
class VcSiteReviewsForm extends VcShortcode
8
{
9
    public static function vcShortcodeClass(): string
10
    {
11
        return SiteReviewsFormShortcode::class;
12
    }
13
14
    public static function vcShortcodeIcon(): string
15
    {
16
        return glsr()->url('assets/images/icons/wpbakery/wpbakery-form.svg');
17
    }
18
19
    public static function vcShortcodeSettings(): array
20
    {
21
        return [
22
            'assigned_posts' => [
23
                'type' => 'autocomplete',
24
                'heading' => esc_html_x('Assign New Reviews to Pages', 'admin-text', 'site-reviews'),
25
                'param_name' => 'assigned_posts',
26
                'settings' => [
27
                    'multiple' => true,
28
                    'sortable' => true,
29
                ],
30
            ],
31
            'assigned_terms' => [
32
                'type' => 'autocomplete',
33
                'heading' => esc_html_x('Assign New Reviews to Categories', 'admin-text', 'site-reviews'),
34
                'param_name' => 'assigned_terms',
35
                'settings' => [
36
                    'multiple' => true,
37
                    'sortable' => true,
38
                ],
39
            ],
40
            'assigned_users' => [
41
                'type' => 'autocomplete',
42
                'heading' => esc_html_x('Assign New Reviews to Users', 'admin-text', 'site-reviews'),
43
                'param_name' => 'assigned_users',
44
                'settings' => [
45
                    'multiple' => true,
46
                    'sortable' => true,
47
                ],
48
            ],
49
            'hide' => [
50
                'type' => 'checkbox',
51
                'heading' => esc_html_x('Hide Options', 'admin-text', 'site-reviews'),
52
                'param_name' => 'hide',
53
                'value' => array_flip(static::vcShortcode()->getHideOptions()),
54
            ],
55
            'reviews_id' => [
56
                'type' => 'textfield',
57
                'heading' => esc_html_x('Reviews ID', 'admin-text', 'site-reviews'),
58
                'description' => esc_html_x('Enter the Custom ID of a reviews block, shortcode, or widget where the review should be displayed after submission.', 'admin-text', 'site-reviews'),
59
                'param_name' => 'reviews_id',
60
                'group' => esc_html_x('Advanced', 'admin-text', 'site-reviews'),
61
            ],
62
            'id' => [
63
                'type' => 'textfield',
64
                'heading' => esc_html_x('Custom ID', 'admin-text', 'site-reviews'),
65
                'description' => esc_html_x('This should be a unique value.', 'admin-text', 'site-reviews'),
66
                'param_name' => 'id',
67
                'group' => esc_html_x('Advanced', 'admin-text', 'site-reviews'),
68
            ],
69
            'class' => [
70
                'type' => 'textfield',
71
                'heading' => esc_html_x('Additional CSS classes', 'admin-text', 'site-reviews'),
72
                'description' => esc_html_x('Separate multiple classes with spaces.', 'admin-text', 'site-reviews'),
73
                'param_name' => 'class',
74
                'group' => esc_html_x('Advanced', 'admin-text', 'site-reviews'),
75
            ],
76
        ];
77
    }
78
}
79