Completed
Pull Request — master (#8)
by Omid
03:52
created

VideosRequestParameters::setIncludeKeywords()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 2
1
<?php
2
3
namespace MovingImage\Client\VMPro\Entity;
4
5
/**
6
 * Class VideosRequestParameters.
7
 *
8
 * @method int getChannelId()
9
 * @method VideosRequestParameters setChannelId(int $channelId)
10
 * @method int getOffset()
11
 * @method VideosRequestParameters setOffset(int $offset)
12
 * @method int getLimit()
13
 * @method VideosRequestParameters setLimit(int $limit)
14
 * @method string getOrder()
15
 * @method string getOrderProperty()
16
 * @method VideosRequestParameters setOrderProperty(int $orderProperty)
17
 * @method string getSearchTerm()
18
 * @method VideosRequestParameters setSearchTerm(int $searchTerm)
19
 * @method bool isIncludeCustomMetadata()
20
 * @method string getCustomMetadataField()
21
 * @method VideosRequestParameters setCustomMetadataField(int $customMetadataField)
22
 * @method string getSearchInField()
23
 * @method VideosRequestParameters setSearchInField(int $searchInField)
24
 * @method string getPublicationState()
25
 * @method VideosRequestParameters setPublicationState(int $publicationState)
26
 * @method bool isIncludeKeywords()
27
 *
28
 * @author Omid Rad <[email protected]>
29
 */
30
class VideosRequestParameters
31
{
32
    private $container = [];
33
34
    function __get($name)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
35
    {
36
        if (isset($this->container[$name])) {
37
            return $this->container[$name];
38
        }
39
40
        return null;
41
    }
42
43
    /**
44
     * @param $name  string Key
45
     * @param $value string Value
46
     *
47
     * @return VideosRequestParameters
48
     */
49
    public function __set($name, $value)
50
    {
51
        $this->container[$name] = $value;
52
        return $this;
53
    }
54
55
    /**
56
     * @param string $order
57
     * @return VideosRequestParameters
58
     */
59
    public function setOrder($order)
60
    {
61
        $pool = ['asc', 'desc'];
62
63
        // Silently ignore wrong values
64
        if (in_array($order, $pool)) {
65
            $this->container['order'] = $order;
66
        }
67
68
        return $this;
69
    }
70
71
    /**
72
     * @param bool $includeCustomMetadata
73
     * @return VideosRequestParameters
74
     */
75
    public function setIncludeCustomMetadata($includeCustomMetadata)
76
    {
77
        $this->container['includeCustomMetadata'] = boolval($includeCustomMetadata);
78
        return $this;
79
    }
80
81
    /**
82
     * @param bool $includeKeywords
83
     * @return VideosRequestParameters
84
     */
85
    public function setIncludeKeywords($includeKeywords)
86
    {
87
        $this->container['includeKeywords'] = boolval($includeKeywords);
88
        return $this;
89
    }
90
91
    /**
92
     * @return array
93
     */
94
    public function getContainer()
95
    {
96
        return $this->container;
97
    }
98
}
99