1 | <?php |
||
18 | class CachingHandler implements BaseLanguageHandler |
||
19 | { |
||
20 | /** |
||
21 | * Inner Language handler. |
||
22 | * |
||
23 | * @var \eZ\Publish\Core\Persistence\Legacy\Content\Language\Handler |
||
24 | */ |
||
25 | protected $innerHandler; |
||
26 | |||
27 | /** |
||
28 | * Language cache. |
||
29 | * |
||
30 | * @var \eZ\Publish\Core\Persistence\Legacy\Content\Language\Cache |
||
31 | */ |
||
32 | protected $languageCache; |
||
33 | |||
34 | /** |
||
35 | * If the cache has already been initialized. |
||
36 | * |
||
37 | * @var bool |
||
38 | */ |
||
39 | protected $isCacheInitialized = false; |
||
40 | |||
41 | /** |
||
42 | * Creates a caching handler around $innerHandler. |
||
43 | * |
||
44 | * @param \eZ\Publish\SPI\Persistence\Content\Language\Handler $innerHandler |
||
45 | */ |
||
46 | public function __construct(BaseLanguageHandler $innerHandler, Cache $languageCache) |
||
51 | |||
52 | /** |
||
53 | * Initializes the cache if necessary. |
||
54 | */ |
||
55 | protected function initializeCache() |
||
65 | |||
66 | /** |
||
67 | * Create a new language. |
||
68 | * |
||
69 | * @param \eZ\Publish\SPI\Persistence\Content\Language\CreateStruct $struct |
||
70 | * |
||
71 | * @return \eZ\Publish\SPI\Persistence\Content\Language |
||
72 | */ |
||
73 | public function create(CreateStruct $struct) |
||
81 | |||
82 | /** |
||
83 | * Update language. |
||
84 | * |
||
85 | * @param \eZ\Publish\SPI\Persistence\Content\Language $language |
||
86 | */ |
||
87 | public function update(Language $language) |
||
93 | |||
94 | /** |
||
95 | * Get language by id. |
||
96 | * |
||
97 | * @param mixed $id |
||
98 | * |
||
99 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If language could not be found by $id |
||
100 | * |
||
101 | * @return \eZ\Publish\SPI\Persistence\Content\Language |
||
102 | */ |
||
103 | public function load($id) |
||
109 | |||
110 | /** |
||
111 | * {@inheritdoc} |
||
112 | */ |
||
113 | public function loadList(array $ids): iterable |
||
119 | |||
120 | /** |
||
121 | * Get language by Language Code (eg: eng-GB). |
||
122 | * |
||
123 | * @param string $languageCode |
||
124 | * |
||
125 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If language could not be found by $languageCode |
||
126 | * |
||
127 | * @return \eZ\Publish\SPI\Persistence\Content\Language |
||
128 | */ |
||
129 | public function loadByLanguageCode($languageCode) |
||
135 | |||
136 | /** |
||
137 | * {@inheritdoc} |
||
138 | */ |
||
139 | public function loadListByLanguageCodes(array $languageCodes): iterable |
||
145 | |||
146 | /** |
||
147 | * Get all languages. |
||
148 | * |
||
149 | * @return \eZ\Publish\SPI\Persistence\Content\Language[] |
||
150 | */ |
||
151 | public function loadAll() |
||
157 | |||
158 | /** |
||
159 | * Delete a language. |
||
160 | * |
||
161 | * @param mixed $id |
||
162 | */ |
||
163 | public function delete($id) |
||
169 | |||
170 | /** |
||
171 | * Clear internal cache. |
||
172 | */ |
||
173 | public function clearCache() |
||
178 | } |
||
179 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.