| @@ 68-79 (lines=12) @@ | ||
| 65 | * |
|
| 66 | * @return string |
|
| 67 | */ |
|
| 68 | private function assureValidType($type) |
|
| 69 | { |
|
| 70 | foreach (TailoredAudience::getTypes() as $allowedType) { |
|
| 71 | if ($type === $allowedType) { |
|
| 72 | return $type; |
|
| 73 | } |
|
| 74 | } |
|
| 75 | ||
| 76 | throw new InvalidType( |
|
| 77 | sprintf('"%s" is not a valid type for %s', $type, TailoredAudience::class) |
|
| 78 | ); |
|
| 79 | } |
|
| 80 | } |
|
| 81 | ||
| @@ 182-193 (lines=12) @@ | ||
| 179 | * |
|
| 180 | * @return string |
|
| 181 | */ |
|
| 182 | private function assureValidType($type) |
|
| 183 | { |
|
| 184 | foreach (self::getTypes() as $allowedType) { |
|
| 185 | if ($type === $allowedType) { |
|
| 186 | return $type; |
|
| 187 | } |
|
| 188 | } |
|
| 189 | ||
| 190 | throw new InvalidType( |
|
| 191 | sprintf('"%s" is not a valid type for %s', $type, TailoredAudience::class) |
|
| 192 | ); |
|
| 193 | } |
|
| 194 | } |
|
| 195 | ||