Test Failed
Push — develop ( db5b9c...b55dd4 )
by Paul
17:52
created

SiteReviewsFormWidget::widgetConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 31
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 24
c 0
b 0
f 0
dl 0
loc 31
ccs 0
cts 27
cp 0
rs 9.536
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Widgets;
4
5
use GeminiLabs\SiteReviews\Contracts\ShortcodeContract;
6
use GeminiLabs\SiteReviews\Shortcodes\SiteReviewsFormShortcode;
7
8
class SiteReviewsFormWidget extends Widget
9
{
10
    protected function wConfig(): array
11
    {
12
        return [
13
            'assigned_posts' => [
14
                'description' => esc_html_x('Enter "post_id" to use the Post ID of the current page.', 'admin-text', 'site-reviews'),
15
                'label' => esc_html_x('Assign New Reviews to Pages', 'admin-text', 'site-reviews'),
16
                'type' => 'text',
17
            ],
18
            'assigned_users' => [
19
                'description' => esc_html_x('Enter "user_id" to use the ID of the logged-in user.', 'admin-text', 'site-reviews'),
20
                'label' => esc_html_x('Assign New Reviews to Users', 'admin-text', 'site-reviews'),
21
                'type' => 'text',
22
            ],
23
            'assigned_terms' => [
24
                'label' => esc_html_x('Assign New Reviews to Categories', 'admin-text', 'site-reviews'),
25
                'options' => $this->fieldAssignedTermsOptions(),
26
                'type' => 'select',
27
            ],
28
            'hide' => [
29
                'options' => $this->shortcode->options('hide'),
30
                'type' => 'checkbox',
31
            ],
32
            'id' => [
33
                'description' => esc_html_x('This should be a unique value.', 'admin-text', 'site-reviews'),
34
                'label' => esc_html_x('Custom ID', 'admin-text', 'site-reviews'),
35
                'type' => 'text',
36
            ],
37
            'class' => [
38
                'description' => esc_html_x('Separate multiple classes with spaces.', 'admin-text', 'site-reviews'),
39
                'label' => esc_html_x('Additional CSS classes', 'admin-text', 'site-reviews'),
40
                'type' => 'text',
41
            ],
42
        ];
43
    }
44
45
    protected function wShortcode(): ShortcodeContract
46
    {
47
        return glsr(SiteReviewsFormShortcode::class);
0 ignored issues
show
Bug Best Practice introduced by
The expression return glsr(GeminiLabs\S...wsFormShortcode::class) could return the type callable which is incompatible with the type-hinted return GeminiLabs\SiteReviews\Contracts\ShortcodeContract. Consider adding an additional type-check to rule them out.
Loading history...
48
    }
49
}
50