SiteReviewsFormWidget::widgetConfig()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 16
c 0
b 0
f 0
dl 0
loc 21
ccs 0
cts 13
cp 0
rs 9.7333
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 widgetConfig(): 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 Reviews to Pages', 'admin-text', 'site-reviews'),
16
                'type' => 'text',
17
            ],
18
            'assigned_terms' => [
19
                'label' => esc_html_x('Assign Reviews to Categories', 'admin-text', 'site-reviews'),
20
                'description' => esc_html_x('Enter the Term ID or slug of a category.', 'admin-text', 'site-reviews'),
21
                'type' => 'text',
22
            ],
23
            'assigned_users' => [
24
                'description' => esc_html_x('Enter "user_id" to use the ID of the logged-in user.', 'admin-text', 'site-reviews'),
25
                'label' => esc_html_x('Assign Reviews to Users', 'admin-text', 'site-reviews'),
26
                'type' => 'text',
27
            ],
28
            'hide' => [
29
                'options' => $this->shortcode->options('hide'),
30
                'type' => 'checkbox',
31
            ],
32
        ];
33
    }
34
35
    protected function widgetShortcode(): ShortcodeContract
36
    {
37
        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...
38
    }
39
}
40