File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Locastic \SymfonyTranslationBundle \Factory ;
6+
7+ use Locastic \SymfonyTranslationBundle \Model \Theme ;
8+ use Locastic \SymfonyTranslationBundle \Model \ThemeInterface ;
9+
10+ final class ThemeFactory implements ThemeFactoryInterface
11+ {
12+ public function createNew (string $ name , string $ path ): ThemeInterface
13+ {
14+ return new Theme ($ name , $ path );
15+ }
16+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Locastic \SymfonyTranslationBundle \Factory ;
6+
7+ use Locastic \SymfonyTranslationBundle \Model \ThemeInterface ;
8+
9+ interface ThemeFactoryInterface
10+ {
11+ public function createNew (string $ name , string $ path ): ThemeInterface ;
12+ }
Original file line number Diff line number Diff line change 44
55namespace Locastic \SymfonyTranslationBundle \Provider ;
66
7- use Locastic \SymfonyTranslationBundle \Model \ Theme ;
7+ use Locastic \SymfonyTranslationBundle \Factory \ ThemeFactoryInterface ;
88use Locastic \SymfonyTranslationBundle \Model \ThemeInterface ;
99
1010final class ThemesProvider implements ThemesProviderInterface
1111{
1212 private DefaultTranslationDirectoryProviderInterface $ defaultTranslationDirectoryProvider ;
1313
14- public function __construct (DefaultTranslationDirectoryProviderInterface $ defaultTranslationDirectoryProvider )
15- {
14+ private ThemeFactoryInterface $ themeFactory ;
15+
16+ public function __construct (
17+ DefaultTranslationDirectoryProviderInterface $ defaultTranslationDirectoryProvider ,
18+ ThemeFactoryInterface $ themeFactory
19+ ) {
1620 $ this ->defaultTranslationDirectoryProvider = $ defaultTranslationDirectoryProvider ;
21+ $ this ->themeFactory = $ themeFactory ;
1722 }
1823
1924 public function getAll (): array
@@ -28,6 +33,6 @@ public function findOneByName(string $name): ?ThemeInterface
2833
2934 public function getDefaultTheme (): ThemeInterface
3035 {
31- return new Theme (self ::NAME_DEFAULT , $ this ->defaultTranslationDirectoryProvider ->getDefaultDirectory ());
36+ return $ this -> themeFactory -> createNew (self ::NAME_DEFAULT , $ this ->defaultTranslationDirectoryProvider ->getDefaultDirectory ());
3237 }
3338}
Original file line number Diff line number Diff line change 2323 </service >
2424
2525 <!-- Factories -->
26+ <service id =" Locastic\SymfonyTranslationBundle\Factory\ThemeFactory" />
27+ <service id =" Locastic\SymfonyTranslationBundle\Factory\ThemeFactoryInterface"
28+ alias =" Locastic\SymfonyTranslationBundle\Factory\ThemeFactory" />
29+
2630 <service id =" Locastic\SymfonyTranslationBundle\Factory\TranslationMigrationFactory" />
2731 <service id =" Locastic\SymfonyTranslationBundle\Factory\TranslationMigrationFactoryInterface"
2832 alias =" Locastic\SymfonyTranslationBundle\Factory\TranslationMigrationFactory" />
You can’t perform that action at this time.
0 commit comments