goetas /
xsd2php
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 | namespace Goetas\Xsd\XsdToPhp\Php\Structure; |
||
| 3 | |||
| 4 | class PHPClass |
||
| 5 | { |
||
| 6 | |||
| 7 | protected $name; |
||
| 8 | |||
| 9 | protected $namespace; |
||
| 10 | |||
| 11 | protected $doc; |
||
| 12 | |||
| 13 | 16 | public static function createFromFQCN($className) |
|
| 14 | { |
||
| 15 | 16 | if (($pos = strrpos($className, '\\')) !== false) { |
|
| 16 | return new self(substr($className, $pos + 1), substr($className, 0, $pos)); |
||
| 17 | } else { |
||
| 18 | 16 | return new self($className); |
|
| 19 | } |
||
| 20 | } |
||
| 21 | |||
| 22 | 33 | public function __construct($name = null, $namespace = null) |
|
| 23 | { |
||
| 24 | 33 | $this->name = $name; |
|
| 25 | 33 | $this->namespace = $namespace; |
|
| 26 | 33 | } |
|
| 27 | |||
| 28 | 26 | public function getName() |
|
| 29 | { |
||
| 30 | 26 | return $this->name; |
|
| 31 | } |
||
| 32 | |||
| 33 | 30 | public function setName($name) |
|
| 34 | { |
||
| 35 | 30 | $this->name = $name; |
|
| 36 | 30 | return $this; |
|
| 37 | } |
||
| 38 | |||
| 39 | 27 | public function getNamespace() |
|
| 40 | { |
||
| 41 | 27 | return $this->namespace; |
|
| 42 | } |
||
| 43 | |||
| 44 | 30 | public function setNamespace($namespace) |
|
| 45 | { |
||
| 46 | 30 | $this->namespace = $namespace; |
|
| 47 | 30 | return $this; |
|
| 48 | } |
||
| 49 | |||
| 50 | 8 | public function getDoc() |
|
| 51 | { |
||
| 52 | 8 | return $this->doc; |
|
| 53 | } |
||
| 54 | |||
| 55 | 30 | public function setDoc($doc) |
|
| 56 | { |
||
| 57 | 30 | $this->doc = $doc; |
|
| 58 | 30 | return $this; |
|
| 59 | } |
||
| 60 | |||
| 61 | 1 | public function __toString() |
|
| 62 | { |
||
| 63 | 1 | return $this->getFullName(); |
|
| 64 | } |
||
| 65 | |||
| 66 | 31 | public function getFullName() |
|
| 67 | { |
||
| 68 | 31 | return "{$this->namespace}\\{$this->name}"; |
|
| 69 | } |
||
| 70 | |||
| 71 | protected $checks = array(); |
||
| 72 | |||
| 73 | /** |
||
| 74 | * |
||
| 75 | * @var PHPConstant[] |
||
| 76 | */ |
||
| 77 | protected $constants = array(); |
||
| 78 | |||
| 79 | /** |
||
| 80 | * |
||
| 81 | * @var PHPProperty[] |
||
| 82 | */ |
||
| 83 | protected $properties = array(); |
||
| 84 | |||
| 85 | /** |
||
| 86 | * |
||
| 87 | * @param |
||
| 88 | * $property |
||
| 89 | * @return array |
||
| 90 | */ |
||
| 91 | public function getChecks($property) |
||
| 92 | { |
||
| 93 | return isset($this->checks[$property]) ? $this->checks[$property] : array(); |
||
| 94 | } |
||
| 95 | |||
| 96 | /** |
||
| 97 | * |
||
| 98 | * @param |
||
| 99 | * $property |
||
| 100 | * @param |
||
| 101 | * $check |
||
| 102 | * @param |
||
| 103 | * $value |
||
| 104 | * @return $this |
||
| 105 | */ |
||
| 106 | 1 | public function addCheck($property, $check, $value) |
|
| 107 | { |
||
| 108 | 1 | $this->checks[$property][$check][] = $value; |
|
| 109 | 1 | return $this; |
|
| 110 | } |
||
| 111 | |||
| 112 | /** |
||
| 113 | * |
||
| 114 | * @return PHPProperty[] |
||
| 115 | */ |
||
| 116 | 19 | public function getProperties() |
|
| 117 | { |
||
| 118 | 19 | return $this->properties; |
|
| 119 | } |
||
| 120 | |||
| 121 | /** |
||
| 122 | * |
||
| 123 | * @param string $name |
||
| 124 | * @return boolean |
||
| 125 | */ |
||
| 126 | 8 | public function hasProperty($name) |
|
| 127 | { |
||
| 128 | 8 | return isset($this->properties[$name]); |
|
| 129 | } |
||
| 130 | |||
| 131 | /** |
||
| 132 | * |
||
| 133 | * @param string $name |
||
| 134 | * @return bool |
||
| 135 | */ |
||
| 136 | 8 | public function hasPropertyInHierarchy($name) |
|
| 137 | { |
||
| 138 | 8 | if ($this->hasProperty($name)) { |
|
| 139 | 2 | return true; |
|
| 140 | } |
||
| 141 | 7 | if (($this instanceof PHPClass) && $this->getExtends() && $this->getExtends()->hasPropertyInHierarchy($name)) { |
|
| 142 | return true; |
||
| 143 | } |
||
| 144 | 7 | return false; |
|
| 145 | } |
||
| 146 | |||
| 147 | /** |
||
| 148 | * |
||
| 149 | * @param string $name |
||
| 150 | * @return PHPProperty |
||
| 151 | */ |
||
| 152 | 2 | public function getPropertyInHierarchy($name) |
|
| 153 | { |
||
| 154 | 2 | if ($this->hasProperty($name)) { |
|
| 155 | 2 | return $this->getProperty($name); |
|
| 156 | } |
||
| 157 | if (($this instanceof PHPClass) && $this->getExtends() && $this->getExtends()->hasPropertyInHierarchy($name)) { |
||
| 158 | return $this->getExtends()->getPropertyInHierarchy($name); |
||
| 159 | } |
||
| 160 | return null; |
||
| 161 | } |
||
| 162 | |||
| 163 | /** |
||
| 164 | * |
||
| 165 | * @param string $name |
||
|
0 ignored issues
–
show
|
|||
| 166 | * @return PHPProperty |
||
| 167 | */ |
||
| 168 | 2 | public function getPropertiesInHierarchy() |
|
| 169 | { |
||
| 170 | 2 | $ps = $this->getProperties(); |
|
| 171 | |||
| 172 | 2 | if (($this instanceof PHPClass) && $this->getExtends()) { |
|
| 173 | $ps = array_merge($ps, $this->getExtends()->getPropertiesInHierarchy()); |
||
| 174 | } |
||
| 175 | |||
| 176 | 2 | return $ps; |
|
| 177 | } |
||
| 178 | |||
| 179 | /** |
||
| 180 | * |
||
| 181 | * @param string $name |
||
| 182 | * @return PHPProperty |
||
| 183 | */ |
||
| 184 | 8 | public function getProperty($name) |
|
| 185 | { |
||
| 186 | 8 | return $this->properties[$name]; |
|
| 187 | } |
||
| 188 | |||
| 189 | /** |
||
| 190 | * |
||
| 191 | * @param PHPProperty $property |
||
| 192 | * @return $this |
||
| 193 | */ |
||
| 194 | 30 | public function addProperty(PHPProperty $property) |
|
| 195 | { |
||
| 196 | 30 | $this->properties[$property->getName()] = $property; |
|
| 197 | 30 | return $this; |
|
| 198 | } |
||
| 199 | |||
| 200 | /** |
||
| 201 | * |
||
| 202 | * @var boolean |
||
| 203 | */ |
||
| 204 | protected $abstract; |
||
| 205 | |||
| 206 | /** |
||
| 207 | * |
||
| 208 | * @var PHPClass |
||
| 209 | */ |
||
| 210 | protected $extends; |
||
| 211 | |||
| 212 | /** |
||
| 213 | * |
||
| 214 | * @return PHPClass |
||
| 215 | */ |
||
| 216 | 19 | public function getExtends() |
|
| 217 | { |
||
| 218 | 19 | return $this->extends; |
|
| 219 | } |
||
| 220 | |||
| 221 | /** |
||
| 222 | * |
||
| 223 | * @param PHPClass $extends |
||
| 224 | * @return PHPClass |
||
| 225 | */ |
||
| 226 | 17 | public function setExtends(PHPClass $extends) |
|
| 227 | { |
||
| 228 | 17 | $this->extends = $extends; |
|
| 229 | 17 | return $this; |
|
| 230 | } |
||
| 231 | |||
| 232 | public function getAbstract() |
||
| 233 | { |
||
| 234 | return $this->abstract; |
||
| 235 | } |
||
| 236 | |||
| 237 | 25 | public function setAbstract($abstract) |
|
| 238 | { |
||
| 239 | 25 | $this->abstract = (boolean)$abstract; |
|
| 240 | 25 | return $this; |
|
| 241 | } |
||
| 242 | } |
||
| 243 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.