| @@ 25-49 (lines=25) @@ | ||
| 22 | * @category PHPExif |
|
| 23 | * @package Native |
|
| 24 | */ |
|
| 25 | trait GuardInvalidArgumentsTrait |
|
| 26 | { |
|
| 27 | /** |
|
| 28 | * Guard function for invalid arguments |
|
| 29 | * |
|
| 30 | * @param string $field |
|
| 31 | * @param array $input |
|
| 32 | * @param object $output |
|
| 33 | * |
|
| 34 | * @throws UnsupportedFieldException when asked to map an unsupported field |
|
| 35 | * @throws UnsupportedOutputException when asked to map data on an unsupported output object |
|
| 36 | * |
|
| 37 | * @return void |
|
| 38 | */ |
|
| 39 | private function guardInvalidArguments($field, array $input, $output) |
|
| 40 | { |
|
| 41 | if (!in_array($field, $this->getSupportedFields())) { |
|
| 42 | throw UnsupportedFieldException::forField($field); |
|
| 43 | } |
|
| 44 | ||
| 45 | if (!($output instanceof ExifInterface)) { |
|
| 46 | throw UnsupportedOutputException::forOutput($output); |
|
| 47 | } |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 25-49 (lines=25) @@ | ||
| 22 | * @category PHPExif |
|
| 23 | * @package Native |
|
| 24 | */ |
|
| 25 | trait GuardInvalidArgumentsTrait |
|
| 26 | { |
|
| 27 | /** |
|
| 28 | * Guard function for invalid arguments |
|
| 29 | * |
|
| 30 | * @param string $field |
|
| 31 | * @param array $input |
|
| 32 | * @param object $output |
|
| 33 | * |
|
| 34 | * @throws UnsupportedFieldException when asked to map an unsupported field |
|
| 35 | * @throws UnsupportedOutputException when asked to map data on an unsupported output object |
|
| 36 | * |
|
| 37 | * @return void |
|
| 38 | */ |
|
| 39 | private function guardInvalidArguments($field, array $input, $output) |
|
| 40 | { |
|
| 41 | if (!in_array($field, $this->getSupportedFields())) { |
|
| 42 | throw UnsupportedFieldException::forField($field); |
|
| 43 | } |
|
| 44 | ||
| 45 | if (!($output instanceof IptcInterface)) { |
|
| 46 | throw UnsupportedOutputException::forOutput($output); |
|
| 47 | } |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||