setIdentifier($identifier); } /** * @return string */ public function getIdentifier() { return $this->identifier; } /** * @param string $identifier * @throws \UnexpectedValueException */ public function setIdentifier($identifier) { if (str_contains($identifier, '__')) { throw new \UnexpectedValueException( 'Identifier "' . $identifier . '" must not contain "__"', 1381597631 ); } $this->identifier = $identifier; } /** * Adds a backend layout to this collection. * * @throws \LogicException */ public function add(BackendLayout $backendLayout) { $identifier = $backendLayout->getIdentifier(); if (str_contains($identifier, '__')) { throw new \UnexpectedValueException( 'BackendLayout Identifier "' . $identifier . '" must not contain "__"', 1381597628 ); } if (isset($this->backendLayouts[$identifier])) { throw new \LogicException( 'Backend Layout ' . $identifier . ' is already defined', 1381559376 ); } $this->backendLayouts[$identifier] = $backendLayout; } /** * Gets a backend layout by (regular) identifier. * * @param string $identifier * @return BackendLayout|null */ public function get($identifier) { $backendLayout = null; if (isset($this->backendLayouts[$identifier])) { $backendLayout = $this->backendLayouts[$identifier]; } return $backendLayout; } /** * Gets all backend layouts in this collection. * * @return array|BackendLayout[] */ public function getAll() { return $this->backendLayouts; } }