Test Failed
Push — develop ( c74868...df43c9 )
by Paul
09:13
created

ElementTrait::actions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 2
Metric Value
eloc 3
c 2
b 0
f 2
dl 0
loc 5
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Integrations\Breakdance;
4
5
use GeminiLabs\SiteReviews\Contracts\ShortcodeContract;
6
use GeminiLabs\SiteReviews\Helpers\Arr;
7
8
trait ElementTrait
9
{
10
    /**
11
     * @return array
12
     */
13
    public static function actions()
14
    {
15
        return [
16
            'onMountedElement' => [[
17
                'script' => 'GLSR_init();',
18
            ]],
19
            // 'onPropertyChange' => [[
20
            //     'script' => 'GLSR_init();',
21
            // ]],
22
        ];
23
    }
24
25
    /**
26
     * @return array
27
     */
28
    public static function badge()
29
    {
30
        return [
31
            'backgroundColor' => '',
32
            'label' => ' ', // empty because we use this to display an icon
33
            'textColor' => '',
34
        ];
35
    }
36
37
    abstract public static function bdShortcode(): ShortcodeContract;
38
39
    /**
40
     * @return string
41
     */
42
    public static function category()
43
    {
44
        return glsr()->id;
45
    }
46
47
    public static function dependencies()
48
    {
49
        return [
50
            [
51
                'inlineStyles' => [
52
                    '%%SELECTOR%% a, %%SELECTOR%% button {pointer-events: none}',
53
                ],
54
                'frontendCondition' => "return false;",
55
            ],
56
        ];
57
    }
58
59
    /**
60
     * @return string
61
     */
62
    public static function name()
63
    {
64
        return static::bdShortcode()->name();
65
    }
66
67
    /**
68
     * @return array
69
     */
70
    public static function nestingRule()
71
    {
72
        return [
73
            'type' => 'final',
74
        ];
75
    }
76
77
    /**
78
     * @return string[]
79
     */
80
    public static function propertyPathsToSsrElementWhenValueChanges()
81
    {
82
        return [
83
            'content',
84
        ];
85
    }
86
87
    /**
88
     * @return array
89
     */
90
    public static function settings()
91
    {
92
        return [
93
            'disableAI' => true,
94
        ];
95
    }
96
97
    /**
98
     * @return array[]
99
     */
100
    public static function settingsControls()
101
    {
102
        return [];
103
    }
104
105
    /**
106
     * @param mixed $propertiesData
107
     * @param mixed $parentPropertiesData
108
     * @param bool  $isBuilder
109
     * @param int   $repeaterItemNodeId
110
     *
111
     * @return string
112
     */
113
    public static function ssr($propertiesData, $parentPropertiesData = [], $isBuilder = false, $repeaterItemNodeId = null)
0 ignored issues
show
Unused Code introduced by
The parameter $parentPropertiesData is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

113
    public static function ssr($propertiesData, /** @scrutinizer ignore-unused */ $parentPropertiesData = [], $isBuilder = false, $repeaterItemNodeId = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $repeaterItemNodeId is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

113
    public static function ssr($propertiesData, $parentPropertiesData = [], $isBuilder = false, /** @scrutinizer ignore-unused */ $repeaterItemNodeId = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $isBuilder is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

113
    public static function ssr($propertiesData, $parentPropertiesData = [], /** @scrutinizer ignore-unused */ $isBuilder = false, $repeaterItemNodeId = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
114
    {
115
        $args = static::ssrArgs(Arr::consolidate($propertiesData));
116
        return static::bdShortcode()->build($args, 'breakdance');
117
    }
118
119
    abstract public static function ssrArgs(array $propertiesData): array;
120
121
    /**
122
     * @return string
123
     */
124
    public static function slug()
125
    {
126
        return __CLASS__;
127
    }
128
129
    /**
130
     * @return string
131
     */
132
    public static function template()
133
    {
134
        return '%%SSR%%';
135
    }
136
}
137