Completed
Push — master ( 63cfe4...886ab6 )
by Nicolaas
01:32
created

code/decorators/SitemapPageDecorator.php (2 issues)

unused private properties.

Unused Code Minor

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
class SitemapPageDecorator extends SiteTreeExtension
4
{
5
6
    /**
7
     * Note, you have to list each class explicitely
8
     * That is, descendants need to be listed as well
9
     * as their parents, to exclude them both.
10
     *
11
     * Includes override excludes.  If you list includes,
12
     * then only those pages will be shown.
13
     * If you dont list includes, then the exclude list will be
14
     * used and if this is empty all page types will be included.
15
     *
16
     * @var Array
17
     */
18
    private static $sitemap_classes_to_exclude = array("ErrorPage");
0 ignored issues
show
The property $sitemap_classes_to_exclude is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
19
20
    /**
21
     * Note, you have to list each class explicitely
22
     * That is, descendants need to be listed as well
23
     * as their parents, to exclude them both.
24
     *
25
     * Includes override excludes.  If you list includes,
26
     * then only those pages will be shown.
27
     * If you dont list includes, then the exclude list will be
28
     * used and if this is empty all page types will be included.
29
     *
30
     * @var Array
31
     */
32
    private static $sitemap_classes_to_include = array();
0 ignored issues
show
The property $sitemap_classes_to_include is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
33
34
    /**
35
     * @return DataList
36
     */
37
    public function SiteMapPages($noParent = false)
38
    {
39
        if ($noParent) {
40
            $parentID = 0;
41
        } else {
42
            $parentID = $this->owner->ID;
43
        }
44
        $filterArray = array(
45
            "ParentID" => $parentID,
46
            "ShowInMenus" => 1,
47
            "ShowInSearch" => 1
48
        );
49
        $excludeArray = array("ClassName" => 'SiteMapPage');
50
        $inc = Config::inst()->get("SitemapPageDecorator", "sitemap_classes_to_include");
51
        $exc = Config::inst()->get("SitemapPageDecorator", "sitemap_classes_to_exclude");
52
        if (is_array($inc) && count($inc)) {
53
            $filterArray["ClassName"] = $inc;
54
        } elseif (is_array($exc) && count($exc)) {
55
            $excludeArray["ClassName"] = $exc;
56
        }
57
        return SiteTree::get()
58
            ->filter($filterArray)
59
            ->exclude($excludeArray);
60
    }
61
}
62