Passed
Push — develop ( f6f5f6...710bfb )
by Paul
14:13
created

ControlDefaults::finalizeSelect()   A

Complexity

Conditions 6
Paths 7

Size

Total Lines 27
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 42

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
dl 0
loc 27
ccs 0
cts 21
cp 0
rs 9.0111
c 1
b 0
f 0
cc 6
nc 7
nop 1
crap 42
1
<?php
2
3
namespace GeminiLabs\SiteReviews\Integrations\Flatsome\Defaults;
4
5
use GeminiLabs\SiteReviews\Defaults\DefaultsAbstract;
6
7
class ControlDefaults extends DefaultsAbstract
8
{
9
    /**
10
     * The values that should be cast before sanitization is run.
11
     * This is done before $sanitize and $enums.
12
     */
13
    public array $casts = [
14
        'full_width' => 'bool',
15
    ];
16
17
    /**
18
     * The keys that should be mapped to other keys.
19
     * Keys are mapped before the values are normalized and sanitized.
20
     * Note: Mapped keys should not be included in the defaults!
21
     */
22
    public array $mapped = [
23
        'label' => 'heading',
24
    ];
25
26
    /**
27
     * The values that should be sanitized.
28
     * This is done after $casts and before $enums.
29
     */
30
    public array $sanitize = [
31
        'description' => 'text', // Flatsome does not support HTML in descriptions
32
        'group' => 'text', // Support passing a title instead of a slug
33
        'type' => 'slug',
34
    ];
35
36
    protected function defaults(): array
37
    {
38
        return [
39
            'description' => '',
40
            'full_width' => true,
41
            'group' => 'general',
42
            'label' => '',
43
            'type' => 'text',
44
        ];
45
    }
46
}
47