Completed
Pull Request — master (#6)
by Nick
02:46
created

Content::getBaseUrl()   A

Complexity

Conditions 1
Paths 1

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 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Acquia\LiftClient\Entity;
4
5
use Acquia\LiftClient\Exception\LiftSdkException;
6
7
class Content extends Entity
8
{
9
    /**
10
     * @param array $array
11
     */
12
    public function __construct(array $array = [])
13
    {
14
        // Set content_hub as default content_connector_id when adding content
15
        $array['content_connector_id'] = 'content_hub';
16
        parent::__construct($array);
17
    }
18
19
    /**
20
     * @param string $id
21
     *
22
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
23
     *
24
     * @return \Acquia\LiftClient\Entity\Content
25
     */
26 View Code Duplication
    public function setId($id)
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
27
    {
28
        if (!is_string($id)) {
29
            throw new LiftSdkException('Argument must be an instance of string.');
30
        }
31
        $this['id'] = $id;
32
33
        return $this;
34
    }
35
36
    /**
37
     * Gets the 'id' parameter.
38
     *
39
     * @return string
40
     */
41
    public function getId()
42
    {
43
        return $this->getEntityValue('id', '');
44
    }
45
46
    /**
47
     * @param string $contentConnectorId
48
     *
49
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
50
     *
51
     * @return \Acquia\LiftClient\Entity\Content
52
     */
53 View Code Duplication
    public function setContentConnectorId($contentConnectorId = 'content_hub')
1 ignored issue
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
54
    {
55
        if (!is_string($contentConnectorId)) {
56
            throw new LiftSdkException('Argument must be an instance of string.');
57
        }
58
        $this['content_connector_id'] = $contentConnectorId;
59
60
        return $this;
61
    }
62
63
    /**
64
     * Gets the 'content_connector_id' parameter.
65
     *
66
     * @return string
67
     */
68
    public function getContentConnectorId()
69
    {
70
        return $this->getEntityValue('content_connector_id', 'content_hub');
71
    }
72
73
    /**
74
     * @param string $baseUrl
75
     *
76
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
77
     *
78
     * @return \Acquia\LiftClient\Entity\Content
79
     */
80
    public function setBaseUrl($baseUrl)
81
    {
82
        if (!is_string($baseUrl)) {
83
            throw new LiftSdkException('Argument must be an instance of string.');
84
        }
85
        $this['base_url'] = $baseUrl;
86
87
        return $this;
88
    }
89
90
    /**
91
     * Gets the 'base_url' parameter.
92
     *
93
     * @return string
94
     */
95
    public function getBaseUrl()
96
    {
97
        return $this->getEntityValue('base_url', '');
98
    }
99
100
    /**
101
     * @param ViewMode $viewMode
102
     *
103
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
104
     *
105
     * @return \Acquia\LiftClient\Entity\Content
106
     */
107
    public function setViewMode(ViewMode $viewMode)
108
    {
109
        $this['view_mode'] = $viewMode->getArrayCopy();
110
111
        return $this;
112
    }
113
114
    /**
115
     * Gets the 'id' parameter.
116
     *
117
     * @return viewMode
118
     */
119
    public function getViewMode()
120
    {
121
        $viewMode = $this->getEntityValue('view_mode', []);
122
123
        return new ViewMode($viewMode);
124
    }
125
126
    /**
127
     * Gets the 'error' parameter.
128
     *
129
     * @return string
130
     */
131
    public function getError()
132
    {
133
        return $this->getEntityValue('error', '');
134
    }
135
}
136