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

ElementTrait::ssr()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 4
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' => '#E8FF5E',
32
            'label' => 'SR',
33
            'textColor' => '#201E1D',
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
    static function dependencies()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
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