This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /** |
||
4 | * @copyright 2017 Vladimir Jimenez |
||
5 | * @license https://github.com/allejo/PhpPulse/blob/master/LICENSE.md MIT |
||
6 | */ |
||
7 | |||
8 | namespace allejo\DaPulse; |
||
9 | |||
10 | use allejo\DaPulse\Exceptions\InvalidColumnException; |
||
11 | use allejo\DaPulse\Objects\ApiObject; |
||
12 | use allejo\DaPulse\Objects\PulseColumnStatusValue as StatusColumn; |
||
13 | |||
14 | /** |
||
15 | * Class PulseColumn |
||
16 | * |
||
17 | * @api |
||
18 | * @package allejo\DaPulse |
||
19 | * @since 0.1.0 |
||
20 | */ |
||
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 Tag = "tag"; |
||
30 | const Text = "text"; |
||
31 | const Timeline = "timerange"; |
||
32 | |||
33 | protected $title; |
||
34 | protected $type; |
||
35 | protected $empty_text; |
||
36 | protected $labels; |
||
37 | protected $board_id; |
||
38 | |||
39 | private $labelsSanityCheck; |
||
40 | |||
41 | /** |
||
42 | * PulseColumn constructor. |
||
43 | * |
||
44 | * @internal |
||
45 | * |
||
46 | * @param array $idOrArray |
||
47 | */ |
||
48 | 40 | public function __construct ($idOrArray) |
|
49 | { |
||
50 | 40 | $this->arrayConstructionOnly = true; |
|
51 | 40 | $this->labelsSanityCheck = false; |
|
52 | |||
53 | 40 | parent::__construct($idOrArray); |
|
54 | 40 | } |
|
55 | |||
56 | public function getId () |
||
57 | { |
||
58 | return $this->id; |
||
59 | } |
||
60 | |||
61 | public function getTitle () |
||
62 | { |
||
63 | $this->lazyLoad(); |
||
64 | |||
65 | return $this->title; |
||
66 | } |
||
67 | |||
68 | 13 | public function getType () |
|
69 | { |
||
70 | 13 | $this->lazyLoad(); |
|
71 | |||
72 | // @todo Workaround due to a bug in DaPulse's API see: https://github.com/allejo/PhpPulse/issues/5 |
||
73 | 13 | if ($this->type === "color") |
|
74 | { |
||
75 | 2 | $this->type = self::Status; |
|
76 | } |
||
77 | |||
78 | 13 | return $this->type; |
|
79 | } |
||
80 | |||
81 | /** |
||
82 | * Get the labels for a Status column type |
||
83 | * |
||
84 | * @throws InvalidColumnException if the column is not a Status column |
||
85 | * |
||
86 | * @since 0.3.0 An InvalidColumnException is thrown when the given column is not a status column |
||
87 | * @since 0.1.0 |
||
88 | * |
||
89 | * @return string[] |
||
90 | */ |
||
91 | 2 | public function getLabels () |
|
92 | { |
||
93 | 2 | if ($this->getType() != PulseColumn::Status) |
|
94 | { |
||
95 | 1 | throw new InvalidColumnException('This column type does not contain labels'); |
|
96 | } |
||
97 | |||
98 | 1 | $this->lazyLoad(); |
|
99 | 1 | $this->sanitizeLabels(); |
|
100 | |||
101 | 1 | return $this->labels; |
|
102 | } |
||
103 | |||
104 | public function getBoardId () |
||
105 | { |
||
106 | $this->lazyLoad(); |
||
107 | |||
108 | return $this->board_id; |
||
109 | } |
||
110 | |||
111 | public function editTitle ($title) |
||
112 | { |
||
113 | $this->editField("title", $title); |
||
114 | } |
||
115 | |||
116 | public function editLabels ($labels) |
||
117 | { |
||
118 | $this->editField("labels", $labels); |
||
119 | } |
||
120 | |||
121 | public function deleteColumn () |
||
122 | { |
||
123 | $this->checkInvalid(); |
||
124 | |||
125 | self::sendDelete($this->getColumnsUrl()); |
||
126 | |||
127 | $this->deletedObject = true; |
||
128 | } |
||
129 | |||
130 | private function editField ($field, $value) |
||
131 | { |
||
132 | $this->checkInvalid(); |
||
133 | |||
134 | $postParams = [ |
||
135 | $field => $value |
||
136 | ]; |
||
137 | |||
138 | self::sendPut($this->getColumnsUrl(), $postParams); |
||
139 | |||
140 | $this->$field = $value; |
||
141 | } |
||
142 | |||
143 | private function getColumnsUrl () |
||
144 | { |
||
145 | return sprintf("%s/%d/columns/%s.json", parent::apiEndpoint(), $this->getBoardId(), $this->getId()); |
||
0 ignored issues
–
show
|
|||
146 | } |
||
147 | |||
148 | /** |
||
149 | * DaPulse will only set labels if it has content |
||
150 | */ |
||
151 | 1 | private function sanitizeLabels () |
|
152 | { |
||
153 | 1 | if ($this->labelsSanityCheck) |
|
154 | { |
||
155 | return; |
||
156 | } |
||
157 | |||
158 | 1 | for ($i = StatusColumn::MIN_VALUE; $i <= StatusColumn::MAX_VALUE; $i++) |
|
159 | { |
||
160 | 1 | !isset($this->labels[$i]) && $this->labels[$i] = ''; |
|
161 | } |
||
162 | |||
163 | 1 | $this->labelsSanityCheck = true; |
|
164 | 1 | } |
|
165 | } |
||
166 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.