Completed
Push — master ( 7b6a9e...621ea2 )
by Nick
15:23
created

Visibility::getValue()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 2
1
<?php
2
3
namespace Acquia\LiftClient\Entity;
4
5
class Visibility extends \ArrayObject
6
{
7
    use EntityTrait;
8
9
    /**
10
     * @param array $array
11
     */
12
    public function __construct(array $array = [])
13
    {
14
        parent::__construct($array);
15
    }
16
17
    /**
18
     * @param array $pages Specify pages by using their paths. The '*' character
19
     *                     is a wildcard. Example paths are
20
     *                     http://mywebsite.com/user for the current user's page
21
     *                     and http://mywebsite.com/user/* for every user page
22
     *
23
     * @return \Acquia\LiftClient\Entity\Visibility
24
     */
25
    public function setPages(array $pages = [])
26
    {
27
        $this['pages'] = $pages;
28
29
        return $this;
30
    }
31
32
    /**
33
     * Gets the 'pages' parameter.
34
     *
35
     * @return array
36
     */
37
    public function getPages()
38
    {
39
        return $this->getEntityValue('pages', '');
40
    }
41
42
    /**
43
     * @param string $condition Can be 'show' or 'hide'. Any other option will
44
     *                          be ignored
45
     *
46
     * @return \Acquia\LiftClient\Entity\Visibility
47
     */
48
    public function setCondition($condition)
49
    {
50
        if ($condition === 'show' || $condition === 'hide') {
51
            $this['condition'] = $condition;
52
        }
53
54
        return $this;
55
    }
56
57
    /**
58
     * Gets the 'condition' parameter.
59
     *
60
     * @return array
61
     */
62
    public function getCondition()
63
    {
64
        return $this->getEntityValue('condition', '');
65
    }
66
}
67