@@ -68,19 +68,20 @@ class Config
6868 private $ serializer ;
6969
7070 /**
71- * @param SerializerInterface $serializer
7271 * @param ScopeConfigInterface $scopeConfig
7372 * @param ModuleListInterface|null $moduleList
73+ * @param SerializerInterface|null $serializer
7474 */
7575 public function __construct (
76- SerializerInterface $ serializer ,
7776 ScopeConfigInterface $ scopeConfig ,
78- ModuleListInterface $ moduleList = null
77+ ModuleListInterface $ moduleList = null ,
78+ SerializerInterface $ serializer = null
7979 ) {
80- $ this ->serializer = $ serializer ;
8180 $ this ->scopeConfig = $ scopeConfig ;
8281 $ this ->moduleList = $ moduleList ?: \Magento \Framework \App \ObjectManager::getInstance ()
8382 ->get (ModuleListInterface::class);
83+ $ this ->serializer = $ serializer ?: \Magento \Framework \App \ObjectManager::getInstance ()
84+ ->get (SerializerInterface::class);
8485 }
8586
8687 /**
@@ -200,16 +201,12 @@ public function getBlockMaxDepth(string $type, $storeId = null): string
200201 public function getAdditionalLinks ($ storeId = null ): array
201202 {
202203 $ data = $ this ->getConfig ('mfhs/additionallinks/links ' , $ storeId );
203-
204- $ additionalLinks = [];
205204 if ($ data ) {
206- $ values = $ this ->serializer ->unserialize ($ data );
207- foreach ($ values as $ item ) {
208- $ additionalLinks [] = $ item ;
209- }
205+ $ additionalLinks = array_values ($ this ->serializer ->unserialize ($ data ));
206+ } else {
207+ $ additionalLinks = [];
210208 }
211209 return $ additionalLinks ;
212-
213210 }
214211
215212 /**
0 commit comments