| 1 | <?php |
||
| 7 | class Accept |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var array |
||
| 11 | */ |
||
| 12 | private $availablesAccepts = []; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | private $default; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @param string $defaultAccept |
||
| 21 | * @param array $availablesAccepts |
||
| 22 | */ |
||
| 23 | public function __construct($defaultAccept, array $availablesAccepts = []) |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @return string |
||
| 31 | */ |
||
| 32 | public function getDefault() |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @param array $accepts |
||
| 39 | * |
||
| 40 | * @return string |
||
| 41 | * |
||
| 42 | * @throws AcceptNotAllowed |
||
| 43 | */ |
||
| 44 | public function getBest(array $accepts) |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @param string $accept |
||
| 61 | * |
||
| 62 | * @return bool |
||
| 63 | */ |
||
| 64 | public function isAllowed($accept) |
||
| 72 | |||
| 73 | public function hasAllowed(array $accepts) |
||
| 87 | } |
||
| 88 |