Test Failed
Pull Request — master (#35)
by
unknown
03:01 queued 30s
created

VideosRequestParameters::setPublicationState()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
dl 0
loc 9
rs 9.6666
c 2
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
namespace MovingImage\Client\VMPro\Entity;
4
5
use MovingImage\Client\VMPro\Util\AccessorTrait;
6
use MovingImage\Meta\Enums\PublicationState;
7
8
/**
9
 * Class VideosRequestParameters.
10
 *
11
 * @method int getVideoId()
12
 * @method VideosRequestParameters setVideoId(int $videoId)
13
 * @method int getChannelId()
14
 * @method VideosRequestParameters setChannelId(int $channelId)
15
 * @method int getOffset()
16
 * @method VideosRequestParameters setOffset(int $offset)
17
 * @method int getLimit()
18
 * @method VideosRequestParameters setLimit(int $limit)
19
 * @method string getOrder()
20
 * @method string getOrderProperty()
21
 * @method VideosRequestParameters setOrderProperty(string $orderProperty)
22
 * @method string getSearchTerm()
23
 * @method VideosRequestParameters setSearchTerm(string $searchTerm)
24
 * @method bool isIncludeCustomMetadata()
25
 * @method VideosRequestParameters setIncludeCustomMetadata(bool $includeCustomMetadata)
26
 * @method string getCustomMetadataField()
27
 * @method VideosRequestParameters setCustomMetadataField(int $customMetadataField)
28
 * @method string getSearchInField()
29
 * @method VideosRequestParameters setSearchInField(string $searchInField)
30
 * @method string getPublicationState()
31
 * @method bool isIncludeKeywords()
32
 * @method VideosRequestParameters setIncludeKeywords(bool $includeKeywords)
33
 * @method VideosRequestParameters setIncludeChannelAssignments(bool $includeChannels)
34
 * @method bool isIncludeSubChannels()
35
 * @method VideosRequestParameters setIncludeSubChannels(bool $includeSubChannels)
36
 *
37
 * @author Omid Rad <[email protected]>
38
 */
39
class VideosRequestParameters
40
{
41
    use AccessorTrait;
42
43
    /**
44
     * @param string $order
45
     *
46
     * @return VideosRequestParameters
47
     */
48
    public function setOrder($order)
49
    {
50
        $pool = ['asc', 'desc'];
51
52
        // Silently ignore wrong values
53
        if (in_array($order, $pool)) {
54
            $this->container['order'] = $order;
55
        }
56
57
        return $this;
58
    }
59
60
    /**
61
     * @param string $publicationState
62
     *
63
     * @return VideosRequestParameters
64
     */
65
    public function setPublicationState($publicationState)
66
    {
67
68
        if (in_array($publicationState, PublicationState::getValues())) {
69
            $this->container['publication_state'] = $publicationState;
70
        }
71
72
        return $this;
73
    }
74
}
75