| 1 | <?php |
||
| 8 | class Extension |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * The file extension. |
||
| 12 | * |
||
| 13 | * @var string |
||
| 14 | */ |
||
| 15 | protected $extension; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Constructor. |
||
| 19 | * |
||
| 20 | * @param string $extension A file extension. |
||
| 21 | */ |
||
| 22 | 9 | public function __construct($extension) |
|
| 26 | |||
| 27 | /** |
||
| 28 | * Returns the file extension's preferred MIME type. |
||
| 29 | * |
||
| 30 | * @param bool $strict |
||
| 31 | * (Optional) if true a MappingException is thrown when no mapping is |
||
| 32 | * found, if false it returns 'application/octet-stream' as a default. |
||
| 33 | * Defaults to true. |
||
| 34 | * |
||
| 35 | * @throws MappingException if no mapping found and $strict is true. |
||
| 36 | * |
||
| 37 | * @return string |
||
| 38 | */ |
||
| 39 | 5 | public function getDefaultType($strict = true) |
|
| 43 | |||
| 44 | /** |
||
| 45 | * Returns all the MIME types related to the file extension. |
||
| 46 | * |
||
| 47 | * @param bool $strict |
||
| 48 | * (Optional) if true a MappingException is thrown when no mapping is |
||
| 49 | * found, if false it returns ['application/octet-stream'] as a default. |
||
| 50 | * Defaults to true. |
||
| 51 | * |
||
| 52 | * @throws MappingException if no mapping found and $strict is true. |
||
| 53 | * |
||
| 54 | * @return string[] |
||
| 55 | */ |
||
| 56 | 9 | public function getTypes($strict = true) |
|
| 68 | } |
||
| 69 |