Conditions | 3 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
43 | public function convert($input) |
||
44 | { |
||
45 | if (empty($input)) { |
||
46 | $input = $this->default; |
||
47 | } |
||
48 | |||
49 | if (!in_array($input, $this->taxClasses)) { |
||
50 | throw new UnexpectedValueException( |
||
51 | sprintf( |
||
52 | 'Given Tax-Class: "%s" is not valid. Allowed values: "%s"', |
||
53 | $input, |
||
54 | implode('", "', $this->taxClasses) |
||
55 | ) |
||
56 | ); |
||
57 | } |
||
58 | |||
59 | return array_search($input, $this->taxClasses); |
||
60 | } |
||
61 | } |
||
62 |