ViewCollection   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setViews() 0 9 2
A __construct() 0 3 1
A getViews() 0 3 1
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
}