Passed
Pull Request — master (#36)
by
unknown
02:24
created

Resource   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A onAfterWrite() 0 5 2
1
<?php
2
3
namespace SilverStripe\CKANRegistry\Model;
4
5
use SilverStripe\ORM\DataObject;
6
7
class Resource extends DataObject
8
{
9
    private static $table_name = 'CKANResource';
0 ignored issues
show
introduced by
The private property $table_name is not used, and could be removed.
Loading history...
10
11
    private static $db = [
0 ignored issues
show
introduced by
The private property $db is not used, and could be removed.
Loading history...
12
        'Name' => 'Varchar',
13
        'Endpoint' => 'Varchar',
14
        'DataSet' => 'Varchar',
15
        'Resource' => 'Varchar',
16
    ];
17
18
    private static $has_many = [
0 ignored issues
show
introduced by
The private property $has_many is not used, and could be removed.
Loading history...
19
        'Fields' => ResourceField::class,
20
        'Filters' => ResourceFilter::class,
21
    ];
22
23
    public function onAfterWrite()
24
    {
25
        if ($this->changed('Resource')) {
0 ignored issues
show
Bug introduced by
The method changed() does not exist on SilverStripe\CKANRegistry\Model\Resource. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

25
        if ($this->/** @scrutinizer ignore-call */ changed('Resource')) {
Loading history...
26
            $this->Fields()->removeAll();
0 ignored issues
show
Bug introduced by
The method Fields() does not exist on SilverStripe\CKANRegistry\Model\Resource. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

26
            $this->/** @scrutinizer ignore-call */ 
27
                   Fields()->removeAll();
Loading history...
27
            $this->Filters()->removeAll();
0 ignored issues
show
Bug introduced by
The method Filters() does not exist on SilverStripe\CKANRegistry\Model\Resource. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

27
            $this->/** @scrutinizer ignore-call */ 
28
                   Filters()->removeAll();
Loading history...
28
        }
29
    }
30
}
31