Test Failed
Push — develop ( 425fc0...4f2be8 )
by Paul
13:11
created

SiteReviewsFormTinymce::fields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 52
Code Lines 35

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 51
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 35
dl 0
loc 52
ccs 51
cts 51
cp 1
rs 9.36
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1

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\Tinymce;
4
5
use GeminiLabs\SiteReviews\Contracts\ShortcodeContract;
6
use GeminiLabs\SiteReviews\Shortcodes\SiteReviewsFormShortcode;
7
8
class SiteReviewsFormTinymce extends TinymceGenerator
9
{
10 1
    public function fields(): array
11
    {
12 1
        return [
13 1
            [
14 1
                'label' => esc_html_x('Assign Pages', 'admin-text', 'site-reviews'),
15 1
                'name' => 'assigned_posts',
16 1
                'tooltip' => sprintf(esc_html_x('Automatically assign reviews to a Post ID. You may also enter %s to use the Post ID of the current page.', 'admin-text', 'site-reviews'), '"post_id"'),
17 1
                'type' => 'textbox',
18 1
            ],
19 1
            [
20 1
                'label' => esc_html_x('Assign Categories', 'admin-text', 'site-reviews'),
21 1
                'name' => 'assigned_terms',
22 1
                'tooltip' => esc_html_x('Automatically assign reviews to a category. You may enter a Term ID or slug.', 'admin-text', 'site-reviews'),
23 1
                'type' => 'textbox',
24 1
            ],
25 1
            [
26 1
                'label' => esc_html_x('Assign Users', 'admin-text', 'site-reviews'),
27 1
                'name' => 'assigned_users',
28 1
                'tooltip' => sprintf(esc_html_x('Automatically assign reviews to a User ID. You may also enter %s to use the ID of the logged-in user.', 'admin-text', 'site-reviews'), '"user_id"'),
29 1
                'type' => 'textbox',
30 1
            ],
31 1
            [
32 1
                'columns' => 2,
33 1
                'items' => $this->hideOptions(),
34 1
                'label' => esc_html_x('Hide', 'admin-text', 'site-reviews'),
35 1
                'layout' => 'grid',
36 1
                'spacing' => 5,
37 1
                'type' => 'container',
38 1
            ],
39 1
            [
40 1
                'label' => esc_html_x('Latest Reviews ID', 'admin-text', 'site-reviews'),
41 1
                'name' => 'reviews_id',
42 1
                'tooltip' => _x('Enter the Custom ID of a Latest Reviews shortcode where the review should be displayed after submission.', 'admin-text', 'site-reviews'),
43 1
                'type' => 'textbox',
44 1
            ],
45 1
            [
46 1
                'label' => esc_html_x('Rating Summary ID', 'admin-text', 'site-reviews'),
47 1
                'name' => 'summary_id',
48 1
                'tooltip' => _x('Enter the Custom ID of a Rating Summary shortcode where the rating values should be updated after submission.', 'admin-text', 'site-reviews'),
49 1
                'type' => 'textbox',
50 1
            ],
51 1
            [
52 1
                'label' => esc_html_x('Custom ID', 'admin-text', 'site-reviews'),
53 1
                'name' => 'id',
54 1
                'tooltip' => esc_html_x('This should be a unique value.', 'admin-text', 'site-reviews'),
55 1
                'type' => 'textbox',
56 1
            ],
57 1
            [
58 1
                'label' => esc_html_x('Additional CSS classes', 'admin-text', 'site-reviews'),
59 1
                'name' => 'class',
60 1
                'tooltip' => esc_html_x('Separate multiple classes with spaces.', 'admin-text', 'site-reviews'),
61 1
                'type' => 'textbox',
62 1
            ],
63 1
        ];
64
    }
65
66 1
    public function shortcode(): ShortcodeContract
67
    {
68 1
        return glsr(SiteReviewsFormShortcode::class);
69
    }
70
}
71