Completed
Push — master ( a1590e...0af16c )
by Vladimir
02:39
created

DynamicPageView   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 43
ccs 10
cts 10
cp 1
rs 10
c 1
b 0
f 0
wmc 3
lcom 1
cbo 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getContentItems() 0 4 1
A addContentItem() 0 7 1
1
<?php
2
3
/**
4
 * @copyright 2016 Vladimir Jimenez
5
 * @license   https://github.com/allejo/stakx/blob/master/LICENSE.md MIT
6
 */
7
8
namespace allejo\stakx\Object;
9
10
class DynamicPageView extends PageView
11
{
12
    /**
13
     * The Content Items that belong to this Page View. This array will only have elements if it is a dynamic Page View.
14
     *
15
     * @var ContentItem[]
16
     */
17
    private $contentItems;
18
19
    /**
20
     * {@inheritdoc}
21
     */
22 3
    public function __construct($filePath)
23
    {
24 3
        parent::__construct($filePath);
25
26 3
        $this->contentItems = array();
27 3
        $this->type = PageView::DYNAMIC_TYPE;
28 3
    }
29
30
    /**
31
     * Add a ContentItem to this Dynamic PageView
32
     *
33
     * @param ContentItem $contentItem
34
     */
35 3
    public function addContentItem (&$contentItem)
36
    {
37 3
        $filePath = $this->fs->getRelativePath($contentItem->getFilePath());
38
39 3
        $this->contentItems[$filePath] = &$contentItem;
40 3
        $contentItem->setPageView($this);
41 3
    }
42
43
    /**
44
     * Get all of the ContentItems that belong to this Dynamic PageView
45
     *
46
     * @return ContentItem[]
47
     */
48
    public function getContentItems ()
49
    {
50
        return $this->contentItems;
51
    }
52
}