Passed
Push — master ( d7fd6a...9124ff )
by Robbie
11:58
created

CwpSearchPage   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A canViewStage() 0 6 2
1
<?php
2
3
/**
4
 * Dummy page to assist with display of search results
5
 */
6
class CwpSearchPage extends 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...
7
	
8
	private static $hide_ancestor = 'CwpSearchPage';
0 ignored issues
show
introduced by
The private property $hide_ancestor is not used, and could be removed.
Loading history...
9
	
10
	public function canViewStage($stage = 'Live', $member = null) {
11
		if(Permission::checkMember($member, 'VIEW_DRAFT_CONTENT')) {
12
			return true;
13
		}
14
		
15
		return parent::canViewStage($stage, $member);
16
	}
17
}
18
19
/**
20
 * Description of SearchPageController
21
 *
22
 * @author dmooyman
23
 */
24
class CwpSearchPage_Controller extends Page_Controller {
0 ignored issues
show
Bug introduced by
The type Page_Controller 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...
25
	
26
	/**
27
	 * Create the dummy search record for this page
28
	 * 
29
	 * @return CwpSearchPage
30
	 */
31
	protected function generateSearchRecord() {
32
		$searchPage = CwpSearchPage::create();
33
		$searchPage->URLSegment = 'search';
34
		$searchPage->Title = _t('SearchForm.SearchResults', 'Search Results');
35
		$searchPage->ID = -1;
36
		return $searchPage;
37
	}
38
	
39
	public function __construct($dataRecord = null) {
40
		if(!$dataRecord) {
41
			$dataRecord = $this->generateSearchRecord();
42
		}
43
		parent::__construct($dataRecord);
44
	}
45
46
}
47