Passed
Push — master ( 613a21...fb8a8c )
by Matthew
04:23
created

LocatorFormExtension   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 13
ccs 0
cts 5
cp 0
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateLocatorFormFields() 0 8 3
1
<?php
2
3
namespace Dynamic\Locator\React\Extensions;
4
5
use Dynamic\Locator\LocatorForm;
6
use SilverStripe\Core\Extension;
7
use SilverStripe\Forms\FieldList;
8
9
/**
10
 * Class LocatorFormExtension
11
 * @package Dynamic\Locator\React\Extensions
12
 *
13
 * @property-read LocatorForm|LocatorFormExtension $owner
14
 */
15
class LocatorFormExtension extends Extension
16
{
17
    /**
18
     * @param FieldList $fields
19
     */
20
    public function updateLocatorFormFields($fields)
21
    {
22
        if (!$fields->fieldByName('Address')) {
23
            return;
24
        }
25
26
        $address = $fields->fieldByName('Address');
0 ignored issues
show
Unused Code introduced by
The assignment to $address is dead and can be removed.
Loading history...
27
        if ($this->owner->getController()->Autocomplete) {
0 ignored issues
show
Bug introduced by
The method getController() does not exist on Dynamic\Locator\React\Ex...ns\LocatorFormExtension. ( Ignorable by Annotation )

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

27
        if ($this->owner->/** @scrutinizer ignore-call */ getController()->Autocomplete) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
28
          //  $address->setSchemaComponent('AutoComplete');
29
        }
30
    }
31
}
32