/** * {@inheritdoc} */ public function setOption($type, $index, $display = null, $name = null) { if ($parent = $this->getParent()) { return $this->setVariationOption($parent, $type, $index, $display, $name); } if (!($option = $this->getOption($type, $index))) { $option = new Option(); $option->setType($type); $option->setIndex($index); if ($display === null) { $display = $index; } $option->setDisplay($display); if ($name === null) { $name = $display; } $option->setName($name); } else { if ($display !== null) { $option->setDisplay($display); } if ($name !== null) { $option->setName($name); } } $this->addOptionToGroup($option); return $this; }
protected function createOption($display, $name, $type, $index) { $option = new Option(); $option->setDisplay($display); $option->setIndex($index); $option->setName($name); $option->setType($type); return $option; }