Added:
- toolbar refactor
This commit is contained in:
19
src/Manager/Toolbar/Factory/ToolbarFactory.php
Normal file
19
src/Manager/Toolbar/Factory/ToolbarFactory.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Manager\Toolbar\Factory;
|
||||
|
||||
use App\Manager\Toolbar\Definition\ChapterListToolbar;
|
||||
use App\Manager\Toolbar\Definition\MangaListToolbar;
|
||||
use App\Manager\Toolbar\Definition\Toolbar;
|
||||
|
||||
class ToolbarFactory
|
||||
{
|
||||
public function createToolbar(string $type): Toolbar
|
||||
{
|
||||
return match ($type) {
|
||||
'manga_list' => new MangaListToolbar(),
|
||||
'chapter_list' => new ChapterListToolbar(),
|
||||
default => throw new \InvalidArgumentException("Unknown toolbar type: $type"),
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user