keep it BC

This commit is contained in:
Thomas Picquet 2022-01-28 07:37:28 -08:00
parent ebde54f251
commit 11f61af93b

View File

@ -22,12 +22,17 @@ final class Areas
public function __construct(array $properties) public function __construct(array $properties)
{ {
if (!array_key_exists('value', $properties) || !is_array($properties['value'])) {
$properties = array_values($properties);
}
if ([] === $properties) { if ([] === $properties) {
throw new \InvalidArgumentException('An array of areas was expected'); throw new \InvalidArgumentException('An array of areas was expected');
} }
$areas = []; $areas = [];
foreach ($properties as $area) { foreach ($properties['value'] as $area) {
if (!is_string($area)) { if (!is_string($area)) {
throw new \InvalidArgumentException('An area must be given as a string'); throw new \InvalidArgumentException('An area must be given as a string');
} }