/** * @return \Generator */ public function getIterator() : \Generator { if ($this->needResort) { uasort($this->items, function ($a, $b) { return $this->comparator->compare($a, $b); }); $this->needResort = false; } yield from parent::getIterator(); }
/** * FactorySet constructor. * @param array $items */ public function __construct(array $items = []) { $this->factory = new Factory(); parent::__construct($items); }