| 1 | <?php |
||
| 20 | final class ThemeRepository extends InMemoryRepository implements ThemeRepositoryInterface |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * @param array|ThemeInterface[] $themes Can be an array of serialized themes |
||
| 24 | */ |
||
| 25 | public function __construct(array $themes = []) |
||
| 26 | { |
||
| 27 | parent::__construct(ThemeInterface::class); |
||
| 28 | |||
| 29 | foreach ($themes as $theme) { |
||
| 30 | if (!$theme instanceof ThemeInterface) { |
||
| 31 | $theme = unserialize($theme); |
||
| 32 | } |
||
| 33 | |||
| 34 | $this->add($theme); |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * {@inheritdoc} |
||
| 40 | */ |
||
| 41 | public function find($id) |
||
| 45 | |||
| 46 | /** |
||
| 47 | * {@inheritdoc} |
||
| 48 | */ |
||
| 49 | public function findOneBySlug($slug) |
||
| 53 | |||
| 54 | /** |
||
| 55 | * {@inheritdoc} |
||
| 56 | */ |
||
| 57 | public function findOneByPath($path) |
||
| 68 | } |
||
| 69 |