Completed
Pull Request — master (#8)
by Omid
22:57
created

VideosRequestParameters   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 75
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 8
lcom 0
cbo 0
dl 0
loc 75
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __get() 0 8 2
A __set() 0 6 1
A setOrder() 0 11 2
A setIncludeCustomMetadata() 0 6 1
A setIncludeKeywords() 0 6 1
A getContainer() 0 4 1
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
    public function __get($name)
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
53
        return $this;
54
    }
55
56
    /**
57
     * @param string $order
58
     *
59
     * @return VideosRequestParameters
60
     */
61
    public function setOrder($order)
62
    {
63
        $pool = ['asc', 'desc'];
64
65
        // Silently ignore wrong values
66
        if (in_array($order, $pool)) {
67
            $this->container['order'] = $order;
68
        }
69
70
        return $this;
71
    }
72
73
    /**
74
     * @param bool $includeCustomMetadata
75
     *
76
     * @return VideosRequestParameters
77
     */
78
    public function setIncludeCustomMetadata($includeCustomMetadata)
79
    {
80
        $this->container['includeCustomMetadata'] = boolval($includeCustomMetadata);
81
82
        return $this;
83
    }
84
85
    /**
86
     * @param bool $includeKeywords
87
     *
88
     * @return VideosRequestParameters
89
     */
90
    public function setIncludeKeywords($includeKeywords)
91
    {
92
        $this->container['includeKeywords'] = boolval($includeKeywords);
93
94
        return $this;
95
    }
96
97
    /**
98
     * @return array
99
     */
100
    public function getContainer()
101
    {
102
        return $this->container;
103
    }
104
}
105