| 1 | <?php |
||
| 5 | class Endpoint |
||
| 6 | { |
||
| 7 | protected $method; |
||
| 8 | protected $uri; |
||
| 9 | protected $transformers; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * Setup a new endpoint. |
||
| 13 | * |
||
| 14 | * @param string |
||
| 15 | * @param string |
||
| 16 | */ |
||
| 17 | 15 | public function __construct($method, $uri) |
|
| 23 | |||
| 24 | /** |
||
| 25 | * Add a transformer to a endpoint response. |
||
| 26 | * |
||
| 27 | * @param Raidros\Storer\Transformer $transformer |
||
| 28 | * @param string $type |
||
| 29 | * |
||
| 30 | * @return Raidros\Storer\Transformer |
||
| 31 | */ |
||
| 32 | 6 | public function transformer(Transformer $transformer, $type = 'response') |
|
| 38 | |||
| 39 | /** |
||
| 40 | * get the endpoint method. |
||
| 41 | * |
||
| 42 | * @return string |
||
| 43 | */ |
||
| 44 | 15 | public function getMethod() |
|
| 48 | |||
| 49 | /** |
||
| 50 | * get the endpoint uri. |
||
| 51 | * |
||
| 52 | * @param array $data |
||
| 53 | * |
||
| 54 | * @return string |
||
| 55 | */ |
||
| 56 | 15 | public function getUri($data = null) |
|
| 64 | |||
| 65 | /** |
||
| 66 | * Get the endpoint transformer. |
||
| 67 | * |
||
| 68 | * @return Raidros\Storer\Transformer |
||
| 69 | */ |
||
| 70 | 15 | public function getTransformer($type = 'response') |
|
| 74 | } |
||
| 75 |