Passed
Pull Request — 1 (#87)
by
unknown
02:47
created

updateDropdownFilterOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 14
rs 9.4285
cc 1
eloc 10
nc 1
nop 1
1
<?php
2
3
/**
4
 * Extends the site summary report to list the appropriate versions in the report header
5
 */
6
class CwpSiteSummaryExtension extends Extension
7
{
8
    /**
9
     * Updates the modules used for the version label by:
10
     *  - Removing SS Framework
11
     *  - Adding CWP
12
     *  - Relabelling SS CMS
13
     *
14
     * @param array $modules
15
     */
16
    public function updateVersionModules(&$modules)
17
    {
18
        unset($modules['silverstripe/framework']);
19
        $modules = ['cwp/cwp' => 'CWP'] + $modules;
20
        $modules['silverstripe/cms'] = 'SilverStripe CMS';
21
    }
22
23
    /**
24
     * Updates the dropdown filter used to filter supported packages by renaming the labels (replaces the existing
25
     * filter options)
26
     *
27
     * @param GridFieldDropdownFilter $dropdownFilter
0 ignored issues
show
Bug introduced by
The type 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...
28
     */
29
    public function updateDropdownFilterOptions($dropdownFilter)
30
    {
31
        $dropdownFilter->removeFilterOption('supported');
32
        $dropdownFilter->removeFilterOption('unsupported');
33
34
        $dropdownFilter->addFilterOption(
35
            'supported',
36
            _t(__CLASS__ . '.FilterSupported', 'CWP recipe modules'),
0 ignored issues
show
Bug introduced by
The function _t was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

36
            /** @scrutinizer ignore-call */ 
37
            _t(__CLASS__ . '.FilterSupported', 'CWP recipe modules'),
Loading history...
37
            ['Supported' => true]
38
        );
39
        $dropdownFilter->addFilterOption(
40
            'unsupported',
41
            _t(__CLASS__ . '.FilterUnsupported', 'Non CWP modules'),
42
            ['Supported' => false]
43
        );
44
    }
45
}
46