CwpSiteSummaryExtension::updateVersionModules()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace CWP\CWP\Extensions;
4
5
use SilverStripe\Core\Extension;
6
7
/**
8
 * Extends the site summary report to list the appropriate versions in the report header
9
 */
10
class CwpSiteSummaryExtension extends Extension
11
{
12
    /**
13
     * Updates the modules used for the version label by:
14
     *  - Removing SS Framework
15
     *  - Adding CWP
16
     *  - Relabelling SS CMS
17
     *
18
     * @param array $modules
19
     */
20
    public function updateVersionModules(&$modules)
21
    {
22
        unset($modules['silverstripe/framework']);
23
        $modules = ['cwp/cwp' => 'CWP'] + $modules;
24
        $modules['silverstripe/cms'] = 'SilverStripe CMS';
25
    }
26
27
    /**
28
     * Updates the dropdown filter used to filter supported packages by renaming the labels (replaces the existing
29
     * filter options)
30
     *
31
     * @param GridFieldDropdownFilter $dropdownFilter
0 ignored issues
show
Bug introduced by
The type CWP\CWP\Extensions\GridFieldDropdownFilter 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...
32
     */
33
    public function updateDropdownFilterOptions($dropdownFilter)
34
    {
35
        $dropdownFilter->removeFilterOption('supported');
36
        $dropdownFilter->removeFilterOption('unsupported');
37
38
        $dropdownFilter->addFilterOption(
39
            'supported',
40
            _t(__CLASS__ . '.FilterSupported', 'CWP recipe modules'),
41
            ['Supported' => true]
42
        );
43
        $dropdownFilter->addFilterOption(
44
            'unsupported',
45
            _t(__CLASS__ . '.FilterUnsupported', 'Non CWP modules'),
46
            ['Supported' => false]
47
        );
48
    }
49
}
50