AbstractRule.php
11 months ago
EndpointRule.php
11 months ago
ErrorRule.php
11 months ago
RuleCreator.php
11 months ago
TreeRule.php
11 months ago
RuleCreator.php
27 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Aws\EndpointV2\Rule; |
| 4 | |
| 5 | use Aws\Exception\UnresolvedEndpointException; |
| 6 | |
| 7 | class RuleCreator |
| 8 | { |
| 9 | public static function create($type, $definition) |
| 10 | { |
| 11 | switch ($type) { |
| 12 | case 'endpoint': |
| 13 | return new EndpointRule($definition); |
| 14 | case 'error': |
| 15 | return new ErrorRule($definition); |
| 16 | case 'tree': |
| 17 | return new TreeRule($definition); |
| 18 | default: |
| 19 | throw new UnresolvedEndpointException( |
| 20 | 'Unknown rule type ' . $type . |
| 21 | ' must be of type `endpoint`, `tree` or `error`' |
| 22 | ); |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | |
| 27 |