1 | <?php |
||
21 | final class ThemeSynchronizer implements ThemeSynchronizerInterface |
||
22 | { |
||
23 | /** |
||
24 | * @var ThemeLoaderInterface |
||
25 | */ |
||
26 | private $themeLoader; |
||
27 | |||
28 | /** |
||
29 | * @var ThemeRepositoryInterface |
||
30 | */ |
||
31 | private $themeRepository; |
||
32 | |||
33 | /** |
||
34 | * @var ThemeMergerInterface |
||
35 | */ |
||
36 | private $themeMerger; |
||
37 | |||
38 | /** |
||
39 | * @param ThemeLoaderInterface $themeLoader |
||
40 | * @param ThemeRepositoryInterface $themeRepository |
||
41 | * @param ThemeMergerInterface $themeMerger |
||
42 | */ |
||
43 | public function __construct( |
||
52 | |||
53 | /** |
||
54 | * {@inheritdoc} |
||
55 | */ |
||
56 | public function synchronize() |
||
72 | |||
73 | /** |
||
74 | * @param ThemeInterface[] $existingThemes |
||
75 | * @param ThemeInterface[] $loadedThemes |
||
76 | */ |
||
77 | private function updateThemes(array $existingThemes, array $loadedThemes) |
||
85 | |||
86 | /** |
||
87 | * @param ThemeInterface $theme |
||
88 | */ |
||
89 | private function updateTheme(ThemeInterface $theme) |
||
99 | |||
100 | /** |
||
101 | * @param ThemeInterface[] $persistedThemes |
||
102 | * @param ThemeInterface[] $loadedThemes |
||
103 | * |
||
104 | * @return ThemeInterface[] Removed themes |
||
105 | */ |
||
106 | private function removeAbandonedThemes(array $persistedThemes, array $loadedThemes) |
||
126 | |||
127 | /** |
||
128 | * Removes references to loaded themes, that exists. |
||
129 | * Adds references to existing themes instead (the loaded ones will be merged into them). |
||
130 | * |
||
131 | * @param ThemeInterface[] $existingThemes |
||
132 | * @param ThemeInterface[] $loadedThemes |
||
133 | * |
||
134 | * @return ThemeInterface[] |
||
135 | */ |
||
136 | private function ensureCohesionOfReferencedThemes(array $existingThemes, array $loadedThemes) |
||
158 | } |
||
159 |