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