/** * @param UnitInterface $unit */ private function unitCreated(UnitInterface $unit) { /** @var CreateUnitResponderInterface $responder */ foreach ($this->responders as $responder) { $responder->unitCreated(new CreateUnitResponse($unit->getName())); } }
/** * @param UnitInterface $unit * @return void */ public function update(UnitInterface $unit) { foreach ($this->list as $key => $item) { if ($item->getId() == $unit->getId()) { $this->list[$key] = $unit; break; } } }