Page   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Test Coverage

Coverage 33.33%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 55
ccs 4
cts 12
cp 0.3333
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A getDisplayType() 0 3 1
A getTemplateName() 0 3 1
A getContentItemMatrix() 0 2 1
A isPublic() 0 3 1
A getLanguage() 0 3 1
1
<?php
2
/**
3
 * @copyright Zicht Online <http://zicht.nl>
4
 */
5
namespace Zicht\Bundle\PageBundle\Entity;
6
7
use Zicht\Bundle\PageBundle\Model\ContentItemMatrix;
8
use Zicht\Bundle\PageBundle\Model\PageInterface;
9
use Zicht\Util\Str;
10
11
/**
12
 * Base class for pages.
13
 */
14
abstract class Page implements PageInterface
15
{
16
    /**
17
     * Constructor stub
18
     */
19 7
    public function __construct()
20
    {
21 7
    }
22
23
    /**
24
     * @{inheritDoc}
25
     */
26 1
    public function getTemplateName()
27
    {
28 1
        return Str::infix(Str::rstrip(Str::classname(get_class($this)), 'Page'), '-');
29
    }
30
31
    /**
32
     * May be implemented to support translated pages.
33
     *
34
     * @return null
35
     */
36
    public function getLanguage()
37
    {
38
        return null;
39
    }
40
41
    /**
42
     * Returns the content item matrix for the item.
43
     *
44
     * @return ContentItemMatrix
45
     */
46
    public function getContentItemMatrix()
47
    {
48
    }
49
50
    /**
51
     * A page must be able to display it's own type as a human readable string.
52
     *
53
     * @return string
54
     */
55
    public function getDisplayType()
56
    {
57
        return get_class($this);
58
    }
59
60
    /**
61
     * By default, pages are never public (sane default). If you need your own logic,
62
     * implement it here, the PageVoter will respect this.
63
     *
64
     * @return bool
65
     */
66
    public function isPublic()
67
    {
68
        return false;
69
    }
70
}
71