1 | <?php |
||
25 | class ThemeDataCollector implements DataCollectorInterface, \Serializable |
||
26 | { |
||
27 | /** |
||
28 | * @var ThemeInterface |
||
29 | */ |
||
30 | private $usedTheme; |
||
31 | |||
32 | /** |
||
33 | * @var ThemeInterface[] |
||
34 | */ |
||
35 | private $themeHierarchy; |
||
36 | |||
37 | /** |
||
38 | * @var ThemeInterface[] |
||
39 | */ |
||
40 | private $allThemes; |
||
41 | |||
42 | /** |
||
43 | * @var ThemeRepositoryInterface |
||
44 | */ |
||
45 | private $themeRepository; |
||
46 | |||
47 | /** |
||
48 | * @var ThemeContextInterface |
||
49 | */ |
||
50 | private $themeContext; |
||
51 | |||
52 | /** |
||
53 | * @param ThemeRepositoryInterface $themeRepository |
||
54 | * @param ThemeContextInterface $themeContext |
||
55 | */ |
||
56 | public function __construct( |
||
57 | ThemeRepositoryInterface $themeRepository, |
||
58 | ThemeContextInterface $themeContext |
||
59 | ) { |
||
60 | $this->themeRepository = $themeRepository; |
||
61 | $this->themeContext = $themeContext; |
||
62 | } |
||
63 | |||
64 | /** |
||
65 | * @return ThemeInterface |
||
66 | */ |
||
67 | public function getUsedTheme() |
||
71 | |||
72 | /** |
||
73 | * @return ThemeInterface[] |
||
74 | */ |
||
75 | public function getThemeHierarchy() |
||
79 | |||
80 | /** |
||
81 | * @return ThemeInterface[] |
||
82 | */ |
||
83 | public function getAllThemes() |
||
87 | |||
88 | /** |
||
89 | * {@inheritdoc} |
||
90 | */ |
||
91 | public function collect(Request $request, Response $response, \Exception $exception = null) |
||
92 | { |
||
93 | $this->usedTheme = $this->themeContext->getTheme(); |
||
94 | $this->themeHierarchy = $this->themeContext->getThemeHierarchy(); |
||
95 | $this->allThemes = $this->themeRepository->findAll(); |
||
96 | } |
||
97 | |||
98 | /** |
||
99 | * {@inheritdoc} |
||
100 | */ |
||
101 | public function serialize() |
||
105 | |||
106 | /** |
||
107 | * {@inheritdoc} |
||
108 | */ |
||
109 | public function unserialize($serialized) |
||
113 | |||
114 | /** |
||
115 | * {@inheritdoc} |
||
116 | */ |
||
117 | public function getName() |
||
121 | } |
||
122 |