GoogleAPIPageExtension   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateCMSFields() 0 7 2
1
<?php
2
3
/**
4
 * Class PageExtension
5
 *
6
 * @property Page|GoogleAPIPageExtension $owner
7
 * @property int $VisitCount
8
 * @property string $LastAnalyticsUpdate
9
 */
10
class GoogleAPIPageExtension extends DataExtension
0 ignored issues
show
Bug introduced by
The type DataExtension was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
{
12
    private static $db = [
13
        'VisitCount'          => 'Int',
14
        'LastAnalyticsUpdate' => 'Date'
15
    ];
16
17
    public function updateCMSFields(FieldList $fields)
0 ignored issues
show
Bug introduced by
The type FieldList was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
    {
19
        if ($this->owner->LastAnalyticsUpdate) {
20
            $fields->addFieldToTab('Root.Analytics', ReadonlyField::create('VisitCount', 'Visit count'));
0 ignored issues
show
Bug introduced by
The type ReadonlyField was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
            $fields->addFieldToTab('Root.Analytics', ReadonlyField::create('LastAnalyticsUpdate', 'Last update from Google'));
22
        } else {
23
            $fields->removeByName(array_keys(static::$db));
0 ignored issues
show
Bug introduced by
Since $db is declared private, accessing it with static will lead to errors in possible sub-classes; you can either use self, or increase the visibility of $db to at least protected.
Loading history...
24
        }
25
    }
26
}
27