1 | <?php |
||
21 | class PulseColumn extends ApiObject |
||
22 | { |
||
23 | const API_PREFIX = "boards"; |
||
24 | |||
25 | const Date = "date"; |
||
|
|||
26 | const Numeric = "numeric"; |
||
27 | const Person = "person"; |
||
28 | const Status = "status"; |
||
29 | const Text = "text"; |
||
30 | const Timeline = "timerange"; |
||
31 | |||
32 | protected $title; |
||
33 | protected $type; |
||
34 | protected $empty_text; |
||
35 | protected $labels; |
||
36 | protected $board_id; |
||
37 | |||
38 | private $labelsSanityCheck; |
||
39 | |||
40 | /** |
||
41 | * PulseColumn constructor. |
||
42 | * |
||
43 | * @internal |
||
44 | * |
||
45 | * @param array $idOrArray |
||
46 | */ |
||
47 | 1 | public function __construct ($idOrArray) |
|
54 | |||
55 | public function getId () |
||
59 | |||
60 | public function getTitle () |
||
66 | |||
67 | public function getType () |
||
79 | |||
80 | /** |
||
81 | * Get the labels for a Status column type |
||
82 | * |
||
83 | * @throws InvalidColumnException if the column is not a Status column |
||
84 | * |
||
85 | * @since 0.3.0 An InvalidColumnException is thrown when the given column is not a status column |
||
86 | * @since 0.1.0 |
||
87 | * |
||
88 | * @return string[] |
||
89 | */ |
||
90 | public function getLabels () |
||
102 | |||
103 | public function getBoardId () |
||
104 | { |
||
105 | $this->lazyLoad(); |
||
106 | |||
107 | return $this->board_id; |
||
108 | } |
||
109 | |||
110 | public function editTitle ($title) |
||
111 | { |
||
112 | $this->editField("title", $title); |
||
113 | } |
||
114 | |||
115 | public function editLabels ($labels) |
||
116 | { |
||
117 | $this->editField("labels", $labels); |
||
118 | } |
||
119 | |||
120 | public function deleteColumn () |
||
121 | { |
||
122 | $this->checkInvalid(); |
||
123 | |||
124 | self::sendDelete($this->getColumnsUrl()); |
||
125 | |||
126 | $this->deletedObject = true; |
||
127 | } |
||
128 | |||
129 | private function editField ($field, $value) |
||
130 | { |
||
131 | $this->checkInvalid(); |
||
132 | |||
133 | $postParams = [ |
||
134 | $field => $value |
||
135 | ]; |
||
136 | |||
137 | self::sendPut($this->getColumnsUrl(), $postParams); |
||
138 | |||
139 | $this->$field = $value; |
||
140 | } |
||
141 | |||
142 | private function getColumnsUrl () |
||
143 | { |
||
144 | return sprintf("%s/%d/columns/%s.json", parent::apiEndpoint(), $this->getBoardId(), $this->getId()); |
||
145 | } |
||
146 | |||
147 | /** |
||
148 | * DaPulse will only set labels if it has content |
||
149 | */ |
||
150 | private function sanitizeLabels () |
||
164 | } |