| @@ 485-495 (lines=11) @@ | ||
| 482 | * @return string |
|
| 483 | * @throws \InvalidArgumentException |
|
| 484 | */ |
|
| 485 | public function validatePropertyType($type) |
|
| 486 | { |
|
| 487 | if (!in_array($type, $this->getPropertyTypes())) { |
|
| 488 | throw $this->getException( |
|
| 489 | 'The property type isn\'t valid ("%s" given, expecting one of following: %s)', |
|
| 490 | [$type, implode(', ', $this->getPropertyTypes())] |
|
| 491 | ); |
|
| 492 | } |
|
| 493 | ||
| 494 | return $type; |
|
| 495 | } |
|
| 496 | ||
| 497 | /** |
|
| 498 | * Validates document annotation |
|
| @@ 505-515 (lines=11) @@ | ||
| 502 | * @return string |
|
| 503 | * @throws \InvalidArgumentException |
|
| 504 | */ |
|
| 505 | public function validateDocumentAnnotation($annotation) |
|
| 506 | { |
|
| 507 | if (!in_array($annotation, $this->getDocumentAnnotations())) { |
|
| 508 | throw $this->getException( |
|
| 509 | 'The document annotation isn\'t valid ("%s" given, expecting one of following: %s)', |
|
| 510 | [$annotation, implode(', ', $this->getDocumentAnnotations())] |
|
| 511 | ); |
|
| 512 | } |
|
| 513 | ||
| 514 | return $annotation; |
|
| 515 | } |
|
| 516 | ||
| 517 | /** |
|
| 518 | * Validates property annotation |
|
| @@ 525-535 (lines=11) @@ | ||
| 522 | * @return string |
|
| 523 | * @throws \InvalidArgumentException |
|
| 524 | */ |
|
| 525 | public function validatePropertyAnnotation($annotation) |
|
| 526 | { |
|
| 527 | if (!in_array($annotation, $this->propertyAnnotations)) { |
|
| 528 | throw $this->getException( |
|
| 529 | 'The property annotation isn\'t valid ("%s" given, expecting one of following: %s)', |
|
| 530 | [$annotation, implode(', ', $this->propertyAnnotations)] |
|
| 531 | ); |
|
| 532 | } |
|
| 533 | ||
| 534 | return $annotation; |
|
| 535 | } |
|
| 536 | ||
| 537 | /** |
|
| 538 | * Validates property visibility |
|
| @@ 545-555 (lines=11) @@ | ||
| 542 | * @return string |
|
| 543 | * @throws \InvalidArgumentException When the visibility is not found in the list of allowed ones. |
|
| 544 | */ |
|
| 545 | public function validatePropertyVisibility($visibility) |
|
| 546 | { |
|
| 547 | if (!in_array($visibility, $this->propertyVisibilities)) { |
|
| 548 | throw $this->getException( |
|
| 549 | 'The property visibility isn\'t valid ("%s" given, expecting one of following: %s)', |
|
| 550 | [$visibility, implode(', ', $this->propertyVisibilities)] |
|
| 551 | ); |
|
| 552 | } |
|
| 553 | ||
| 554 | return $visibility; |
|
| 555 | } |
|
| 556 | ||
| 557 | /** |
|
| 558 | * Returns formatted question |
|