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 | class Kint_Object |
||
4 | { |
||
5 | const ACCESS_NONE = null; |
||
6 | const ACCESS_PUBLIC = 'public'; |
||
7 | const ACCESS_PROTECTED = 'protected'; |
||
8 | const ACCESS_PRIVATE = 'private'; |
||
9 | |||
10 | const OPERATOR_NONE = null; |
||
11 | const OPERATOR_ARRAY = '=>'; |
||
12 | const OPERATOR_OBJECT = '->'; |
||
13 | const OPERATOR_STATIC = '::'; |
||
14 | |||
15 | public $name; |
||
16 | public $type; |
||
17 | public $static = false; |
||
18 | public $const = false; |
||
19 | public $access = self::ACCESS_NONE; |
||
20 | public $owner_class; |
||
21 | public $access_path; |
||
22 | public $operator = self::OPERATOR_NONE; |
||
23 | public $reference = false; |
||
24 | public $size = null; |
||
25 | public $depth = 0; |
||
26 | public $representations = array(); |
||
27 | public $value = null; |
||
28 | public $hints = array(); |
||
29 | |||
30 | public function __construct() |
||
31 | { |
||
32 | } |
||
33 | |||
34 | public function addRepresentation(Kint_Object_Representation $rep, $pos = null) |
||
35 | { |
||
36 | if (isset($this->representations[$rep->name])) { |
||
37 | return false; |
||
38 | } |
||
39 | |||
40 | if ($this->value === null) { |
||
41 | $this->value = $rep; |
||
42 | } |
||
43 | |||
44 | if ($pos === null) { |
||
45 | $this->representations[$rep->name] = $rep; |
||
46 | } else { |
||
47 | $this->representations = array_merge( |
||
48 | array_slice($this->representations, 0, $pos), |
||
49 | array($rep->name => $rep), |
||
50 | array_slice($this->representations, $pos) |
||
51 | ); |
||
52 | } |
||
53 | |||
54 | return true; |
||
55 | } |
||
56 | |||
57 | public function replaceRepresentation(Kint_Object_Representation $rep, $pos = null) |
||
58 | { |
||
59 | if ($pos === null) { |
||
60 | $this->representations[$rep->name] = $rep; |
||
61 | } else { |
||
62 | $this->removeRepresentation($rep->name); |
||
63 | $this->addRepresentation($rep, $pos); |
||
64 | } |
||
65 | } |
||
66 | |||
67 | public function removeRepresentation($name) |
||
68 | { |
||
69 | unset($this->representations[$name]); |
||
70 | } |
||
71 | |||
72 | public function getRepresentation($name) |
||
0 ignored issues
–
show
|
|||
73 | { |
||
74 | if (isset($this->representations[$name])) { |
||
75 | return $this->representations[$name]; |
||
76 | } |
||
77 | } |
||
78 | |||
79 | public function getRepresentations() |
||
80 | { |
||
81 | return $this->representations; |
||
82 | } |
||
83 | |||
84 | public function clearRepresentations() |
||
85 | { |
||
86 | $this->representations = array(); |
||
87 | } |
||
88 | |||
89 | public function getType() |
||
90 | { |
||
91 | return $this->type; |
||
92 | } |
||
93 | |||
94 | public function getModifiers() |
||
95 | { |
||
96 | $out = $this->getAccess(); |
||
97 | |||
98 | if ($this->const) { |
||
99 | $out .= ' const'; |
||
100 | } |
||
101 | |||
102 | if ($this->static) { |
||
103 | $out .= ' static'; |
||
104 | } |
||
105 | |||
106 | if (strlen($out)) { |
||
107 | return ltrim($out); |
||
108 | } |
||
109 | } |
||
110 | |||
111 | public function getAccess() |
||
112 | { |
||
113 | switch ($this->access) { |
||
114 | case self::ACCESS_PRIVATE: |
||
115 | return 'private'; |
||
116 | case self::ACCESS_PROTECTED: |
||
117 | return 'protected'; |
||
118 | case self::ACCESS_PUBLIC: |
||
119 | return 'public'; |
||
120 | } |
||
121 | } |
||
122 | |||
123 | public function getName() |
||
124 | { |
||
125 | return $this->name; |
||
126 | } |
||
127 | |||
128 | public function getOperator() |
||
129 | { |
||
130 | if ($this->operator === self::OPERATOR_ARRAY) { |
||
131 | return '=>'; |
||
132 | } elseif ($this->operator === self::OPERATOR_OBJECT) { |
||
133 | return '->'; |
||
134 | } elseif ($this->operator === self::OPERATOR_STATIC) { |
||
135 | return '::'; |
||
136 | } |
||
137 | |||
138 | return; |
||
139 | } |
||
140 | |||
141 | public function getSize() |
||
142 | { |
||
143 | return $this->size; |
||
144 | } |
||
145 | |||
146 | public function getValueShort() |
||
147 | { |
||
148 | if ($rep = $this->value) { |
||
149 | if ($this->type === 'boolean') { |
||
150 | return $rep->contents ? 'true' : 'false'; |
||
151 | } elseif ($this->type === 'integer' || $this->type === 'double') { |
||
152 | return $rep->contents; |
||
153 | } |
||
154 | } |
||
155 | } |
||
156 | |||
157 | public function getAccessPath() |
||
158 | { |
||
159 | return $this->access_path; |
||
160 | } |
||
161 | |||
162 | public static function blank($name = null, $access_path = null) |
||
163 | { |
||
164 | $o = new self(); |
||
165 | $o->name = $name; |
||
166 | $o->access_path = $name; |
||
167 | if ($access_path) { |
||
168 | $o->access_path = $access_path; |
||
169 | } |
||
170 | |||
171 | return $o; |
||
172 | } |
||
173 | |||
174 | public function transplant(Kint_Object $new) |
||
175 | { |
||
176 | $new->name = $this->name; |
||
177 | $new->size = $this->size; |
||
178 | $new->access_path = $this->access_path; |
||
179 | $new->access = $this->access; |
||
180 | $new->static = $this->static; |
||
181 | $new->const = $this->const; |
||
182 | $new->type = $this->type; |
||
183 | $new->depth = $this->depth; |
||
184 | $new->owner_class = $this->owner_class; |
||
185 | $new->operator = $this->operator; |
||
186 | $new->reference = $this->reference; |
||
187 | $new->value = $this->value; |
||
188 | $new->representations += $this->representations; |
||
189 | $new->hints = array_merge($this->hints, $new->hints); |
||
190 | |||
191 | return $new; |
||
192 | } |
||
193 | |||
194 | public static function isSequential(array $array) |
||
195 | { |
||
196 | return array_keys($array) === range(0, count($array) - 1); |
||
197 | } |
||
198 | |||
199 | public static function sortByAccess(Kint_Object $a, Kint_Object $b) |
||
200 | { |
||
201 | static $sorts = array( |
||
202 | self::ACCESS_PUBLIC => 1, |
||
203 | self::ACCESS_PROTECTED => 2, |
||
204 | self::ACCESS_PRIVATE => 3, |
||
205 | self::ACCESS_NONE => 4, |
||
206 | ); |
||
207 | |||
208 | return $sorts[$a->access] - $sorts[$b->access]; |
||
209 | } |
||
210 | |||
211 | public static function sortByName(Kint_Object $a, Kint_Object $b) |
||
212 | { |
||
213 | $ret = strnatcasecmp($a->name, $b->name); |
||
214 | |||
215 | if ($ret === 0) { |
||
216 | return is_int($a->name) - is_int($b->name); |
||
217 | } |
||
218 | |||
219 | return $ret; |
||
220 | } |
||
221 | } |
||
222 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.