Passed
Pull Request — master (#9)
by Matthew
04:12
created

LocatorExtension   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 20
ccs 10
cts 10
cp 1
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateCMSFields() 0 11 1
1
<?php
2
3
namespace Dynamic\Locator\React\Extensions;
4
5
use SilverStripe\Forms\CheckboxField;
6
use SilverStripe\Forms\FieldList;
7
use SilverStripe\Forms\NumericField;
8
use SilverStripe\ORM\DataExtension;
9
10
/**
11
 * Class LocatorExtension
12
 * @package Dynamic\Locator\React\Extensions
13
 */
14
class LocatorExtension extends DataExtension
15
{
16
17
    private static $db = [
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
18
        'DefaultLat' => 'Decimal(10,7)',
19
        'DefaultLng' => 'Decimal(10,7)',
20
        'Clusters' => 'Boolean',
21
    ];
22
23 1
    public function updateCMSFields(FieldList $fields)
24
    {
25 1
        $fields->addFieldsToTab('Root.Settings', [
26 1
            NumericField::create('DefaultLat')
0 ignored issues
show
Bug introduced by
'DefaultLat' of type string is incompatible with the type array expected by parameter $args of SilverStripe\View\ViewableData::create(). ( Ignorable by Annotation )

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

26
            NumericField::create(/** @scrutinizer ignore-type */ 'DefaultLat')
Loading history...
27 1
                ->setTitle('Default Latitude')
28 1
                ->setScale(7),
29 1
            NumericField::create('DefaultLng')
30 1
                ->setTitle('Default Longitude')
31 1
                ->setScale(7),
32 1
            CheckboxField::create('Clusters')
33 1
                ->setRightTitle('Cluster the markers when zoomed out.'),
34
        ]);
35
    }
36
37
}
38