Passed
Push — develop ( 49b51d...3839fb )
by Paul
26:28
created

ElementorSiteReviews::get_upsale_data()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 9
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Integrations\Elementor\Widgets;
4
5
use Elementor\Controls_Manager;
6
use GeminiLabs\SiteReviews\Shortcodes\SiteReviewsShortcode;
7
8
class ElementorSiteReviews extends ElementorWidget
9
{
10
    public function get_icon(): string
11
    {
12
        return 'eicon-glsr-reviews';
13
    }
14
15
    public static function shortcodeClass(): string
16
    {
17
        return SiteReviewsShortcode::class;
18
    }
19
20
    protected function transformControl(string $name, array $args): array
21
    {
22
        $control = parent::transformControl($name, $args);
23
        if ('pagination' === $name) {
24
            $icons = [
25
                'ajax' => 'eicon eicon-spinner',
26
                'loadmore' => 'eicon eicon-button',
27
                'true' => 'eicon eicon-redo',
28
            ];
29
            $control['label'] = _x('Pagination', 'admin-text', 'site-reviews');
30
            $control['label_block'] = false;
31
            $control['type'] = Controls_Manager::CHOOSE;
32
            foreach ($control['options'] as $key => $value) {
33
                $control['options'][$key] = [
34
                    'icon' => $icons[$key] ?? $icons['ajax'],
35
                    'title' => $value,
36
                ];
37
            }
38
        }
39
        return $control;
40
    }
41
}
42