Completed
Push — master ( 686084...a2bb6b )
by
unknown
9s
created

CwpSearchPage   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
dl 0
loc 13
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A canViewStage() 0 7 2
1
<?php
2
3
namespace CWP\Search;
4
5
use Page;
0 ignored issues
show
Bug introduced by
The type Page 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...
6
use SilverStripe\Security\Permission;
7
use SilverStripe\Versioned\Versioned;
8
9
/**
10
 * Dummy page to assist with display of search results
11
 */
12
class CwpSearchPage extends Page
13
{
14
    private static $hide_ancestor = CwpSearchPage::class;
0 ignored issues
show
introduced by
The private property $hide_ancestor is not used, and could be removed.
Loading history...
15
16
    private static $plural_name = 'Search pages';
0 ignored issues
show
introduced by
The private property $plural_name is not used, and could be removed.
Loading history...
17
18
    public function canViewStage($stage = Versioned::LIVE, $member = null)
19
    {
20
        if (Permission::checkMember($member, 'VIEW_DRAFT_CONTENT')) {
21
            return true;
22
        }
23
24
        return parent::canViewStage($stage, $member);
25
    }
26
}
27