*/ final class ObjectCollection extends \ArrayIterator { /** * @return array */ public function toChoices(): array { $choices = []; /** @var ObjectCrate $object */ foreach ($this as $object) { $choices[$object->getName()] = $object->getKey(); } return $choices; } }