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