getIndex(); if ($index < 0 || $index > 100) { throw new \RuntimeException( 'getIndex() must return an integer between 0 and 100', 1415968498 ); } // Find next free position in array while (isset($this->toolbarItems[$index])) { $index++; } $this->toolbarItems[$index] = $toolbarItem; } } ksort($this->toolbarItems); } /** * Get all registered toolbarItems * * @return ToolbarItemInterface[] */ public function getToolbarItems(): array { return $this->toolbarItems; } }