Completed
Pull Request — master (#20)
by Vladimir
02:10
created

DynamicPageView::getContentItems()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
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
    public function __construct($filePath)
23
    {
24
        parent::__construct($filePath);
25
26
        $this->contentItems = array();
27
    }
28
29
    /**
30
     * Add a ContentItem to this Dynamic PageView
31
     *
32
     * @param ContentItem $contentItem
33
     */
34
    public function addContentItem (&$contentItem)
35
    {
36
        $filePath = $this->fs->getRelativePath($contentItem->getFilePath());
37
38
        $this->contentItems[$filePath] = &$contentItem;
39
        $contentItem->setPageView($this);
40
    }
41
42
    /**
43
     * Get all of the ContentItems that belong to this Dynamic PageView
44
     *
45
     * @return ContentItem[]
46
     */
47
    public function getContentItems ()
48
    {
49
        return $this->contentItems;
50
    }
51
}