1 | <?php |
||
22 | class ConfigurationService extends FluxService implements SingletonInterface { |
||
23 | |||
24 | /** |
||
25 | * @var array |
||
26 | */ |
||
27 | protected $variants = array(); |
||
28 | |||
29 | /** |
||
30 | * @var array |
||
31 | */ |
||
32 | protected $versions = array(); |
||
33 | |||
34 | /** |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $defaults = array(); |
||
38 | |||
39 | /** |
||
40 | * @return void |
||
41 | */ |
||
42 | public function initializeObject() { |
||
46 | |||
47 | /** |
||
48 | * @return void |
||
49 | */ |
||
50 | protected function initializeDefaults() { |
||
54 | |||
55 | /** |
||
56 | * @return void |
||
57 | */ |
||
58 | protected function initializeVariants() { |
||
59 | $variants = (array) $this->getAllRegisteredVariants(); |
||
60 | foreach ($variants as $contentType => $registeredVariantExtensions) { |
||
61 | if (TRUE === empty($registeredVariantExtensions)) { |
||
62 | continue; |
||
63 | } |
||
64 | $this->variants[$contentType] = array(); |
||
65 | foreach ($registeredVariantExtensions as $extensionKeyOrArray) { |
||
66 | $icon = NULL; |
||
67 | $versions = array(); |
||
68 | if (TRUE === is_array($extensionKeyOrArray) && 3 === count($extensionKeyOrArray)) { |
||
69 | list ($extensionKey, $labelReference, $icon) = $extensionKeyOrArray; |
||
70 | } elseif (TRUE === is_array($extensionKeyOrArray) && 2 === count($extensionKeyOrArray)) { |
||
71 | list ($extensionKey, $labelReference) = $extensionKeyOrArray; |
||
72 | } else { |
||
73 | $extensionKey = ExtensionNamingUtility::getExtensionKey($extensionKeyOrArray); |
||
74 | $labelReference = 'moox_core.variantLabel'; |
||
75 | } |
||
76 | $controllerName = 'CoreContent/' . ucfirst($contentType); |
||
77 | $paths = $this->getViewConfigurationForExtensionName($extensionKey); |
||
78 | $templatePaths = new TemplatePaths($paths); |
||
|
|||
79 | $files = $templatePaths->resolveAvailableTemplateFiles($controllerName); |
||
80 | foreach ($files as $file) { |
||
81 | $versions[] = basename($file, '.' . TemplatePaths::DEFAULT_FORMAT); |
||
82 | } |
||
83 | $versions = array_unique($versions); |
||
84 | $this->versions[$contentType] = array($extensionKey => $versions); |
||
85 | $this->variants[$contentType][] = array($extensionKey, $labelReference, $icon); |
||
86 | } |
||
87 | } |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * @return array |
||
92 | */ |
||
93 | public function getDefaults() { |
||
96 | |||
97 | /** |
||
98 | * @return array |
||
99 | */ |
||
100 | public function getAllRegisteredVariants() { |
||
103 | |||
104 | /** |
||
105 | * @param string $contentType |
||
106 | * @return array |
||
107 | */ |
||
108 | public function getVariantExtensionKeysForContentType($contentType) { |
||
114 | |||
115 | /** |
||
116 | * @param string $contentType |
||
117 | * @param string $variant |
||
118 | * @return array |
||
119 | */ |
||
120 | public function getVariantVersions($contentType, $variant) { |
||
126 | |||
127 | /** |
||
128 | * @param string $extensionKey |
||
129 | * @param string $contentType |
||
130 | * @param string $variant |
||
131 | * @param string $version |
||
132 | * @return string |
||
133 | */ |
||
134 | public function resolveTemplateFileForVariant($extensionKey, $contentType, $variant = NULL, $version = NULL) { |
||
141 | |||
142 | /** |
||
143 | * @param string $extension |
||
144 | * @param string $contentType |
||
145 | * @param string $version |
||
146 | * @return string |
||
147 | */ |
||
148 | public function getIconFromVersion($extension, $contentType, $version = NULL) { |
||
163 | |||
164 | } |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: