| Total Complexity | 61 |
| Total Lines | 458 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
Complex classes like GlobalAccessStruct often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use GlobalAccessStruct, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 12 | class GlobalAccessStruct extends AbstractStructBase |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * The name |
||
| 16 | * @var string |
||
| 17 | */ |
||
| 18 | public $name; |
||
| 19 | /** |
||
| 20 | * The domain |
||
| 21 | * @var bool |
||
| 22 | */ |
||
| 23 | public $domain; |
||
| 24 | /** |
||
| 25 | * The hosting |
||
| 26 | * @var bool |
||
| 27 | */ |
||
| 28 | public $hosting; |
||
| 29 | /** |
||
| 30 | * The email |
||
| 31 | * @var bool |
||
| 32 | */ |
||
| 33 | public $email; |
||
| 34 | /** |
||
| 35 | * The pop |
||
| 36 | * @var bool |
||
| 37 | */ |
||
| 38 | public $pop; |
||
| 39 | /** |
||
| 40 | * The dedicated |
||
| 41 | * @var bool |
||
| 42 | */ |
||
| 43 | public $dedicated; |
||
| 44 | /** |
||
| 45 | * The reverse |
||
| 46 | * @var string |
||
| 47 | */ |
||
| 48 | public $reverse; |
||
| 49 | /** |
||
| 50 | * The alldom |
||
| 51 | * @var bool |
||
| 52 | */ |
||
| 53 | public $alldom; |
||
| 54 | /** |
||
| 55 | * The ssl |
||
| 56 | * @var bool |
||
| 57 | */ |
||
| 58 | public $ssl; |
||
| 59 | /** |
||
| 60 | * The rps |
||
| 61 | * @var bool |
||
| 62 | */ |
||
| 63 | public $rps; |
||
| 64 | /** |
||
| 65 | * The rpsOrphan |
||
| 66 | * @var bool |
||
| 67 | */ |
||
| 68 | public $rpsOrphan; |
||
| 69 | /** |
||
| 70 | * The vs |
||
| 71 | * @var bool |
||
| 72 | */ |
||
| 73 | public $vs; |
||
| 74 | /** |
||
| 75 | * The voip |
||
| 76 | * @var bool |
||
| 77 | */ |
||
| 78 | public $voip; |
||
| 79 | /** |
||
| 80 | * The housing |
||
| 81 | * @var bool |
||
| 82 | */ |
||
| 83 | public $housing; |
||
| 84 | /** |
||
| 85 | * The sqlpriv |
||
| 86 | * @var bool |
||
| 87 | */ |
||
| 88 | public $sqlpriv; |
||
| 89 | /** |
||
| 90 | * Constructor method for globalAccessStruct |
||
| 91 | * @uses GlobalAccessStruct::setName() |
||
| 92 | * @uses GlobalAccessStruct::setDomain() |
||
| 93 | * @uses GlobalAccessStruct::setHosting() |
||
| 94 | * @uses GlobalAccessStruct::setEmail() |
||
| 95 | * @uses GlobalAccessStruct::setPop() |
||
| 96 | * @uses GlobalAccessStruct::setDedicated() |
||
| 97 | * @uses GlobalAccessStruct::setReverse() |
||
| 98 | * @uses GlobalAccessStruct::setAlldom() |
||
| 99 | * @uses GlobalAccessStruct::setSsl() |
||
| 100 | * @uses GlobalAccessStruct::setRps() |
||
| 101 | * @uses GlobalAccessStruct::setRpsOrphan() |
||
| 102 | * @uses GlobalAccessStruct::setVs() |
||
| 103 | * @uses GlobalAccessStruct::setVoip() |
||
| 104 | * @uses GlobalAccessStruct::setHousing() |
||
| 105 | * @uses GlobalAccessStruct::setSqlpriv() |
||
| 106 | * @param string $name |
||
| 107 | * @param bool $domain |
||
| 108 | * @param bool $hosting |
||
| 109 | * @param bool $email |
||
| 110 | * @param bool $pop |
||
| 111 | * @param bool $dedicated |
||
| 112 | * @param string $reverse |
||
| 113 | * @param bool $alldom |
||
| 114 | * @param bool $ssl |
||
| 115 | * @param bool $rps |
||
| 116 | * @param bool $rpsOrphan |
||
| 117 | * @param bool $vs |
||
| 118 | * @param bool $voip |
||
| 119 | * @param bool $housing |
||
| 120 | * @param bool $sqlpriv |
||
| 121 | */ |
||
| 122 | public function __construct($name = null, $domain = null, $hosting = null, $email = null, $pop = null, $dedicated = null, $reverse = null, $alldom = null, $ssl = null, $rps = null, $rpsOrphan = null, $vs = null, $voip = null, $housing = null, $sqlpriv = null) |
||
| 123 | { |
||
| 124 | $this |
||
| 125 | ->setName($name) |
||
| 126 | ->setDomain($domain) |
||
| 127 | ->setHosting($hosting) |
||
| 128 | ->setEmail($email) |
||
| 129 | ->setPop($pop) |
||
| 130 | ->setDedicated($dedicated) |
||
| 131 | ->setReverse($reverse) |
||
| 132 | ->setAlldom($alldom) |
||
| 133 | ->setSsl($ssl) |
||
| 134 | ->setRps($rps) |
||
| 135 | ->setRpsOrphan($rpsOrphan) |
||
| 136 | ->setVs($vs) |
||
| 137 | ->setVoip($voip) |
||
| 138 | ->setHousing($housing) |
||
| 139 | ->setSqlpriv($sqlpriv); |
||
| 140 | } |
||
| 141 | /** |
||
| 142 | * Get name value |
||
| 143 | * @return string|null |
||
| 144 | */ |
||
| 145 | public function getName() |
||
| 146 | { |
||
| 147 | return $this->name; |
||
| 148 | } |
||
| 149 | /** |
||
| 150 | * Set name value |
||
| 151 | * @param string $name |
||
| 152 | * @return \Ovh\StructType\GlobalAccessStruct |
||
| 153 | */ |
||
| 154 | public function setName($name = null) |
||
| 155 | { |
||
| 156 | // validation for constraint: string |
||
| 157 | if (!is_null($name) && !is_string($name)) { |
||
|
|
|||
| 158 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($name, true), gettype($name)), __LINE__); |
||
| 159 | } |
||
| 160 | $this->name = $name; |
||
| 161 | return $this; |
||
| 162 | } |
||
| 163 | /** |
||
| 164 | * Get domain value |
||
| 165 | * @return bool|null |
||
| 166 | */ |
||
| 167 | public function getDomain() |
||
| 168 | { |
||
| 169 | return $this->domain; |
||
| 170 | } |
||
| 171 | /** |
||
| 172 | * Set domain value |
||
| 173 | * @param bool $domain |
||
| 174 | * @return \Ovh\StructType\GlobalAccessStruct |
||
| 175 | */ |
||
| 176 | public function setDomain($domain = null) |
||
| 177 | { |
||
| 178 | // validation for constraint: boolean |
||
| 179 | if (!is_null($domain) && !is_bool($domain)) { |
||
| 180 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($domain, true), gettype($domain)), __LINE__); |
||
| 181 | } |
||
| 182 | $this->domain = $domain; |
||
| 183 | return $this; |
||
| 184 | } |
||
| 185 | /** |
||
| 186 | * Get hosting value |
||
| 187 | * @return bool|null |
||
| 188 | */ |
||
| 189 | public function getHosting() |
||
| 190 | { |
||
| 191 | return $this->hosting; |
||
| 192 | } |
||
| 193 | /** |
||
| 194 | * Set hosting value |
||
| 195 | * @param bool $hosting |
||
| 196 | * @return \Ovh\StructType\GlobalAccessStruct |
||
| 197 | */ |
||
| 198 | public function setHosting($hosting = null) |
||
| 199 | { |
||
| 200 | // validation for constraint: boolean |
||
| 201 | if (!is_null($hosting) && !is_bool($hosting)) { |
||
| 202 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($hosting, true), gettype($hosting)), __LINE__); |
||
| 203 | } |
||
| 204 | $this->hosting = $hosting; |
||
| 205 | return $this; |
||
| 206 | } |
||
| 207 | /** |
||
| 208 | * Get email value |
||
| 209 | * @return bool|null |
||
| 210 | */ |
||
| 211 | public function getEmail() |
||
| 212 | { |
||
| 213 | return $this->email; |
||
| 214 | } |
||
| 215 | /** |
||
| 216 | * Set email value |
||
| 217 | * @param bool $email |
||
| 218 | * @return \Ovh\StructType\GlobalAccessStruct |
||
| 219 | */ |
||
| 220 | public function setEmail($email = null) |
||
| 221 | { |
||
| 222 | // validation for constraint: boolean |
||
| 223 | if (!is_null($email) && !is_bool($email)) { |
||
| 224 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($email, true), gettype($email)), __LINE__); |
||
| 225 | } |
||
| 226 | $this->email = $email; |
||
| 227 | return $this; |
||
| 228 | } |
||
| 229 | /** |
||
| 230 | * Get pop value |
||
| 231 | * @return bool|null |
||
| 232 | */ |
||
| 233 | public function getPop() |
||
| 234 | { |
||
| 235 | return $this->pop; |
||
| 236 | } |
||
| 237 | /** |
||
| 238 | * Set pop value |
||
| 239 | * @param bool $pop |
||
| 240 | * @return \Ovh\StructType\GlobalAccessStruct |
||
| 241 | */ |
||
| 242 | public function setPop($pop = null) |
||
| 243 | { |
||
| 244 | // validation for constraint: boolean |
||
| 245 | if (!is_null($pop) && !is_bool($pop)) { |
||
| 246 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($pop, true), gettype($pop)), __LINE__); |
||
| 247 | } |
||
| 248 | $this->pop = $pop; |
||
| 249 | return $this; |
||
| 250 | } |
||
| 251 | /** |
||
| 252 | * Get dedicated value |
||
| 253 | * @return bool|null |
||
| 254 | */ |
||
| 255 | public function getDedicated() |
||
| 256 | { |
||
| 257 | return $this->dedicated; |
||
| 258 | } |
||
| 259 | /** |
||
| 260 | * Set dedicated value |
||
| 261 | * @param bool $dedicated |
||
| 262 | * @return \Ovh\StructType\GlobalAccessStruct |
||
| 263 | */ |
||
| 264 | public function setDedicated($dedicated = null) |
||
| 265 | { |
||
| 266 | // validation for constraint: boolean |
||
| 267 | if (!is_null($dedicated) && !is_bool($dedicated)) { |
||
| 268 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($dedicated, true), gettype($dedicated)), __LINE__); |
||
| 269 | } |
||
| 270 | $this->dedicated = $dedicated; |
||
| 271 | return $this; |
||
| 272 | } |
||
| 273 | /** |
||
| 274 | * Get reverse value |
||
| 275 | * @return string|null |
||
| 276 | */ |
||
| 277 | public function getReverse() |
||
| 278 | { |
||
| 279 | return $this->reverse; |
||
| 280 | } |
||
| 281 | /** |
||
| 282 | * Set reverse value |
||
| 283 | * @param string $reverse |
||
| 284 | * @return \Ovh\StructType\GlobalAccessStruct |
||
| 285 | */ |
||
| 286 | public function setReverse($reverse = null) |
||
| 287 | { |
||
| 288 | // validation for constraint: string |
||
| 289 | if (!is_null($reverse) && !is_string($reverse)) { |
||
| 290 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a string, %s given', var_export($reverse, true), gettype($reverse)), __LINE__); |
||
| 291 | } |
||
| 292 | $this->reverse = $reverse; |
||
| 293 | return $this; |
||
| 294 | } |
||
| 295 | /** |
||
| 296 | * Get alldom value |
||
| 297 | * @return bool|null |
||
| 298 | */ |
||
| 299 | public function getAlldom() |
||
| 300 | { |
||
| 301 | return $this->alldom; |
||
| 302 | } |
||
| 303 | /** |
||
| 304 | * Set alldom value |
||
| 305 | * @param bool $alldom |
||
| 306 | * @return \Ovh\StructType\GlobalAccessStruct |
||
| 307 | */ |
||
| 308 | public function setAlldom($alldom = null) |
||
| 309 | { |
||
| 310 | // validation for constraint: boolean |
||
| 311 | if (!is_null($alldom) && !is_bool($alldom)) { |
||
| 312 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($alldom, true), gettype($alldom)), __LINE__); |
||
| 313 | } |
||
| 314 | $this->alldom = $alldom; |
||
| 315 | return $this; |
||
| 316 | } |
||
| 317 | /** |
||
| 318 | * Get ssl value |
||
| 319 | * @return bool|null |
||
| 320 | */ |
||
| 321 | public function getSsl() |
||
| 322 | { |
||
| 323 | return $this->ssl; |
||
| 324 | } |
||
| 325 | /** |
||
| 326 | * Set ssl value |
||
| 327 | * @param bool $ssl |
||
| 328 | * @return \Ovh\StructType\GlobalAccessStruct |
||
| 329 | */ |
||
| 330 | public function setSsl($ssl = null) |
||
| 331 | { |
||
| 332 | // validation for constraint: boolean |
||
| 333 | if (!is_null($ssl) && !is_bool($ssl)) { |
||
| 334 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($ssl, true), gettype($ssl)), __LINE__); |
||
| 335 | } |
||
| 336 | $this->ssl = $ssl; |
||
| 337 | return $this; |
||
| 338 | } |
||
| 339 | /** |
||
| 340 | * Get rps value |
||
| 341 | * @return bool|null |
||
| 342 | */ |
||
| 343 | public function getRps() |
||
| 344 | { |
||
| 345 | return $this->rps; |
||
| 346 | } |
||
| 347 | /** |
||
| 348 | * Set rps value |
||
| 349 | * @param bool $rps |
||
| 350 | * @return \Ovh\StructType\GlobalAccessStruct |
||
| 351 | */ |
||
| 352 | public function setRps($rps = null) |
||
| 353 | { |
||
| 354 | // validation for constraint: boolean |
||
| 355 | if (!is_null($rps) && !is_bool($rps)) { |
||
| 356 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($rps, true), gettype($rps)), __LINE__); |
||
| 357 | } |
||
| 358 | $this->rps = $rps; |
||
| 359 | return $this; |
||
| 360 | } |
||
| 361 | /** |
||
| 362 | * Get rpsOrphan value |
||
| 363 | * @return bool|null |
||
| 364 | */ |
||
| 365 | public function getRpsOrphan() |
||
| 366 | { |
||
| 367 | return $this->rpsOrphan; |
||
| 368 | } |
||
| 369 | /** |
||
| 370 | * Set rpsOrphan value |
||
| 371 | * @param bool $rpsOrphan |
||
| 372 | * @return \Ovh\StructType\GlobalAccessStruct |
||
| 373 | */ |
||
| 374 | public function setRpsOrphan($rpsOrphan = null) |
||
| 375 | { |
||
| 376 | // validation for constraint: boolean |
||
| 377 | if (!is_null($rpsOrphan) && !is_bool($rpsOrphan)) { |
||
| 378 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($rpsOrphan, true), gettype($rpsOrphan)), __LINE__); |
||
| 379 | } |
||
| 380 | $this->rpsOrphan = $rpsOrphan; |
||
| 381 | return $this; |
||
| 382 | } |
||
| 383 | /** |
||
| 384 | * Get vs value |
||
| 385 | * @return bool|null |
||
| 386 | */ |
||
| 387 | public function getVs() |
||
| 388 | { |
||
| 389 | return $this->vs; |
||
| 390 | } |
||
| 391 | /** |
||
| 392 | * Set vs value |
||
| 393 | * @param bool $vs |
||
| 394 | * @return \Ovh\StructType\GlobalAccessStruct |
||
| 395 | */ |
||
| 396 | public function setVs($vs = null) |
||
| 397 | { |
||
| 398 | // validation for constraint: boolean |
||
| 399 | if (!is_null($vs) && !is_bool($vs)) { |
||
| 400 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($vs, true), gettype($vs)), __LINE__); |
||
| 401 | } |
||
| 402 | $this->vs = $vs; |
||
| 403 | return $this; |
||
| 404 | } |
||
| 405 | /** |
||
| 406 | * Get voip value |
||
| 407 | * @return bool|null |
||
| 408 | */ |
||
| 409 | public function getVoip() |
||
| 410 | { |
||
| 411 | return $this->voip; |
||
| 412 | } |
||
| 413 | /** |
||
| 414 | * Set voip value |
||
| 415 | * @param bool $voip |
||
| 416 | * @return \Ovh\StructType\GlobalAccessStruct |
||
| 417 | */ |
||
| 418 | public function setVoip($voip = null) |
||
| 426 | } |
||
| 427 | /** |
||
| 428 | * Get housing value |
||
| 429 | * @return bool|null |
||
| 430 | */ |
||
| 431 | public function getHousing() |
||
| 432 | { |
||
| 433 | return $this->housing; |
||
| 434 | } |
||
| 435 | /** |
||
| 436 | * Set housing value |
||
| 437 | * @param bool $housing |
||
| 438 | * @return \Ovh\StructType\GlobalAccessStruct |
||
| 439 | */ |
||
| 440 | public function setHousing($housing = null) |
||
| 441 | { |
||
| 442 | // validation for constraint: boolean |
||
| 443 | if (!is_null($housing) && !is_bool($housing)) { |
||
| 444 | throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide a bool, %s given', var_export($housing, true), gettype($housing)), __LINE__); |
||
| 445 | } |
||
| 446 | $this->housing = $housing; |
||
| 447 | return $this; |
||
| 448 | } |
||
| 449 | /** |
||
| 450 | * Get sqlpriv value |
||
| 451 | * @return bool|null |
||
| 452 | */ |
||
| 453 | public function getSqlpriv() |
||
| 456 | } |
||
| 457 | /** |
||
| 458 | * Set sqlpriv value |
||
| 459 | * @param bool $sqlpriv |
||
| 460 | * @return \Ovh\StructType\GlobalAccessStruct |
||
| 461 | */ |
||
| 462 | public function setSqlpriv($sqlpriv = null) |
||
| 463 | { |
||
| 464 | // validation for constraint: boolean |
||
| 465 | if (!is_null($sqlpriv) && !is_bool($sqlpriv)) { |
||
| 470 | } |
||
| 471 | } |
||
| 472 |