| 1 | <?php |
||
| 20 | class HalLink |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * The URI represented by this HalLink. |
||
| 24 | * |
||
| 25 | * @var string |
||
| 26 | */ |
||
| 27 | protected $uri; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Any attributes on this link. |
||
| 31 | * |
||
| 32 | * array( |
||
| 33 | * 'templated' => 0, |
||
| 34 | * 'type' => 'application/hal+json', |
||
| 35 | * 'deprecation' => 1, |
||
| 36 | * 'name' => 'latest', |
||
| 37 | * 'profile' => 'http://.../profile/order', |
||
| 38 | * 'title' => 'The latest order', |
||
| 39 | * 'hreflang' => 'en' |
||
| 40 | * ) |
||
| 41 | * |
||
| 42 | * @var array |
||
| 43 | */ |
||
| 44 | protected $attributes; |
||
| 45 | |||
| 46 | /** |
||
| 47 | * The \Nocarrier\HalLink object. |
||
| 48 | * |
||
| 49 | * Supported attributes in Hal (specification section 5). |
||
| 50 | * |
||
| 51 | * @param string $uri |
||
| 52 | * The URI represented by this link. |
||
| 53 | * @param array $attributes |
||
| 54 | * Any additional attributes. |
||
| 55 | */ |
||
| 56 | public function __construct($uri, $attributes) |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Return the URI from this link. |
||
| 64 | * |
||
| 65 | * @return string |
||
| 66 | */ |
||
| 67 | public function getUri() |
||
| 71 | |||
| 72 | /** |
||
| 73 | * Returns the attributes for this link. |
||
| 74 | * |
||
| 75 | * return array |
||
| 76 | */ |
||
| 77 | public function getAttributes() |
||
| 81 | |||
| 82 | /** |
||
| 83 | * The string representation of this link (the URI). |
||
| 84 | * |
||
| 85 | * return string |
||
| 86 | */ |
||
| 87 | public function __toString() |
||
| 91 | } |
||
| 92 |