ViewCollection::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Copyright (c) 2017
4
 *
5
 * @package   Majima
6
 * @author    David Neustadt <[email protected]>
7
 * @copyright 2017 David Neustadt
8
 * @license   MIT
9
 */
10
11
namespace Majima\PluginBundle\Components;
12
13
/**
14
 * Class ViewCollection
15
 * @package Majima\PluginBundle\Components
16
 */
17
class ViewCollection
18
{
19
    /**
20
     * @var string|null
21
     */
22
    private $pluginPath;
23
24
    /**
25
     * @var array
26
     */
27
    private $views = [];
28
29
    /**
30
     * ViewCollection constructor.
31
     * @param $pluginPath
32
     */
33
    public function __construct($pluginPath = null)
34
    {
35
        $this->pluginPath = $pluginPath;
36
    }
37
38
    /**
39
     * @return array
40
     */
41
    public function getViews()
42
    {
43
        return $this->views;
44
    }
45
46
    /**
47
     * @param array $views
48
     */
49
    public function setViews($views)
50
    {
51
        foreach ($views as &$view) {
52
            $view = $this->pluginPath . DIRECTORY_SEPARATOR . $view;
53
        }
54
55
        $this->views = array_merge(
56
            $this->getViews(),
57
            $views
58
        );
59
    }
60
}