Completed
Pull Request — master (#6)
by Nick
15:48
created

Content::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Acquia\LiftClient\Entity;
4
5
use Acquia\LiftClient\Exception\LiftSdkException;
6
7
class Content extends \ArrayObject
8
{
9
    use EntityTrait;
10
11
  /**
12
   * @param array $array
13
   */
14
  public function __construct(array $array = [])
15
  {
16
      // Set content_hub as default content_connector_id when adding content
17
    $array['content_connector_id'] = 'content_hub';
18
      parent::__construct($array);
19
  }
20
21
  /**
22
   * @param string $id
23
   *
24
   * @throws \Acquia\LiftClient\Exception\LiftSdkException
25
   *
26
   * @return \Acquia\LiftClient\Entity\Content
27
   */
28 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...
29
  {
30
      if (!is_string($id)) {
31
          throw new LiftSdkException('Argument must be an instance of string.');
32
      }
33
      $this['id'] = $id;
34
35
      return $this;
36
  }
37
38
  /**
39
   * Gets the 'id' parameter.
40
   *
41
   * @return string
42
   */
43
  public function getId()
44
  {
45
      return $this->getEntityValue('id', '');
46
  }
47
48
  /**
49
   * @param string $contentConnectorId
50
   *
51
   * @throws \Acquia\LiftClient\Exception\LiftSdkException
52
   *
53
   * @return \Acquia\LiftClient\Entity\Content
54
   */
55 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...
56
  {
57
      if (!is_string($contentConnectorId)) {
58
          throw new LiftSdkException('Argument must be an instance of string.');
59
      }
60
      $this['content_connector_id'] = $contentConnectorId;
61
62
      return $this;
63
  }
64
65
  /**
66
   * Gets the 'content_connector_id' parameter.
67
   *
68
   * @return string
69
   */
70
  public function getContentConnectorId()
71
  {
72
      return $this->getEntityValue('content_connector_id', 'content_hub');
73
  }
74
75
  /**
76
   * @param string $baseUrl
77
   *
78
   * @throws \Acquia\LiftClient\Exception\LiftSdkException
79
   *
80
   * @return \Acquia\LiftClient\Entity\Content
81
   */
82
  public function setBaseUrl($baseUrl)
83
  {
84
      if (!is_string($baseUrl)) {
85
          throw new LiftSdkException('Argument must be an instance of string.');
86
      }
87
      $this['base_url'] = $baseUrl;
88
89
      return $this;
90
  }
91
92
  /**
93
   * Gets the 'base_url' parameter.
94
   *
95
   * @return string
96
   */
97
  public function getBaseUrl()
98
  {
99
      return $this->getEntityValue('base_url', '');
100
  }
101
102
  /**
103
   * Gets the 'error' parameter.
104
   *
105
   * @return string
106
   */
107
  public function getError()
108
  {
109
      return $this->getEntityValue('error', '');
110
  }
111
}
112