| @@ 19-68 (lines=50) @@ | ||
| 16 | * |
|
| 17 | * @Annotation |
|
| 18 | */ |
|
| 19 | class ResponseType implements DynamoAnnotation |
|
| 20 | { |
|
| 21 | const NAME = 'response_type'; |
|
| 22 | ||
| 23 | /** |
|
| 24 | * @var string |
|
| 25 | */ |
|
| 26 | private $type; |
|
| 27 | ||
| 28 | /** |
|
| 29 | * Constructor |
|
| 30 | * |
|
| 31 | * @param array $params |
|
| 32 | */ |
|
| 33 | public function __construct(array $params) |
|
| 34 | { |
|
| 35 | Tebru\assertThat(isset($params['value']), 'An argument was not passed to a "%s" annotation.', get_class($this)); |
|
| 36 | ||
| 37 | $this->type = $params['value']; |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * @return string |
|
| 42 | */ |
|
| 43 | public function getType() |
|
| 44 | { |
|
| 45 | return $this->type; |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * The name of the annotation or class of annotations |
|
| 50 | * |
|
| 51 | * @return string |
|
| 52 | */ |
|
| 53 | public function getName() |
|
| 54 | { |
|
| 55 | return self::NAME; |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * Whether or not multiple annotations of this type can |
|
| 60 | * be added to a method |
|
| 61 | * |
|
| 62 | * @return bool |
|
| 63 | */ |
|
| 64 | public function allowMultiple() |
|
| 65 | { |
|
| 66 | return false; |
|
| 67 | } |
|
| 68 | } |
|
| 69 | ||
| @@ 25-75 (lines=51) @@ | ||
| 22 | * @Annotation |
|
| 23 | * @Target({"CLASS", "METHOD"}) |
|
| 24 | */ |
|
| 25 | class Returns implements DynamoAnnotation |
|
| 26 | { |
|
| 27 | const NAME = 'returns'; |
|
| 28 | ||
| 29 | /** |
|
| 30 | * @var string $return |
|
| 31 | */ |
|
| 32 | private $return; |
|
| 33 | ||
| 34 | /** |
|
| 35 | * Constructor |
|
| 36 | * |
|
| 37 | * @param array $params |
|
| 38 | * @throws LogicException |
|
| 39 | */ |
|
| 40 | public function __construct(array $params) |
|
| 41 | { |
|
| 42 | Tebru\assertThat(isset($params['value']), 'An argument was not passed to a "%s" annotation.', get_class($this)); |
|
| 43 | ||
| 44 | $this->return = $params['value']; |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * @return string |
|
| 49 | */ |
|
| 50 | public function getReturn() |
|
| 51 | { |
|
| 52 | return $this->return; |
|
| 53 | } |
|
| 54 | ||
| 55 | /** |
|
| 56 | * The name of the annotation or class of annotations |
|
| 57 | * |
|
| 58 | * @return string |
|
| 59 | */ |
|
| 60 | public function getName() |
|
| 61 | { |
|
| 62 | return self::NAME; |
|
| 63 | } |
|
| 64 | ||
| 65 | /** |
|
| 66 | * Whether or not multiple annotations of this type can |
|
| 67 | * be added to a method |
|
| 68 | * |
|
| 69 | * @return bool |
|
| 70 | */ |
|
| 71 | public function allowMultiple() |
|
| 72 | { |
|
| 73 | return false; |
|
| 74 | } |
|
| 75 | } |
|
| 76 | ||