/** * Merge with information from another route. * * @param array $values * @param bool $merge * @return static */ public function setSettings(array $values, $merge = false) { if (isset($values['as'])) { if ($this->name !== null && $merge !== false) { $this->setName($values['as'] . '.' . $this->name); } else { $this->setName($values['as']); } } if (isset($values['prefix'])) { $this->setUrl($values['prefix'] . $this->getUrl()); } parent::setSettings($values, $merge); return $this; }
/** * Export route settings to array so they can be merged with another route. * * @return array */ public function toArray() { $values = []; if ($this->prefix !== null) { $values['prefix'] = $this->getPrefix(); } if ($this->name !== null) { $values['as'] = $this->name; } if (count($this->parameters) > 0) { $values['parameters'] = $this->parameters; } return array_merge($values, parent::toArray()); }