@@ -39,8 +39,8 @@ class CustomLoader extends \Magento\Framework\App\Config\Value
3939 * @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList
4040 * @param RandomString $randomString
4141 * @param RandomSuffix $randomSuffix
42- * @param \Magento\Framework\Serialize\Serializer\Json $jsonSerializer
4342 * @param \Magento\Config\Model\ConfigFactory $configFactory
43+ * @param \Magento\Framework\Serialize\Serializer\Json $jsonSerializer
4444 * @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
4545 * @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
4646 * @param array $data
@@ -54,8 +54,8 @@ public function __construct(
5454 \Stape \Gtm \Model \Data \RandomSuffix $ randomSuffix ,
5555 \Magento \Config \Model \ConfigFactory $ configFactory ,
5656 \Magento \Framework \Serialize \Serializer \Json $ jsonSerializer ,
57- \Magento \Framework \Model \ResourceModel \AbstractResource $ resource = null ,
58- \Magento \Framework \Data \Collection \AbstractDb $ resourceCollection = null ,
57+ ? \Magento \Framework \Model \ResourceModel \AbstractResource $ resource = null ,
58+ ? \Magento \Framework \Data \Collection \AbstractDb $ resourceCollection = null ,
5959 array $ data = []
6060 ) {
6161 parent ::__construct ($ context , $ registry , $ config , $ cacheTypeList , $ resource , $ resourceCollection , $ data );
@@ -90,7 +90,9 @@ protected function saveLoaderPrefix()
9090 */
9191 protected function saveContainerIdParams ()
9292 {
93+ // phpcs:disable
9394 parse_str ($ this ->randomSuffix ->generate ($ this ->getValue ()), $ suffix );
95+ // phpcs:enable
9496 $ value = $ this ->jsonSerializer ->serialize ([
9597 'prefix ' => $ this ->randomString ->generate (),
9698 'suffix ' => $ suffix ,
@@ -138,7 +140,11 @@ public function afterSave()
138140
139141 try {
140142
141- $ prefix = $ this ->_config ->getValue (ConfigProvider::XPATH_GTM_LOADER_PREFIX , $ this ->getScope (), $ this ->getScopeId ());
143+ $ prefix = $ this ->_config ->getValue (
144+ ConfigProvider::XPATH_GTM_LOADER_PREFIX ,
145+ $ this ->getScope (),
146+ $ this ->getScopeId ()
147+ );
142148
143149 if (!empty ($ loader ) && empty ($ prefix )) {
144150 $ this ->saveLoaderPrefix ();
@@ -157,11 +163,9 @@ public function afterSave()
157163 if (strlen ($ this ->getValue () ?? '' ) < 1 ) {
158164 $ this ->resetLinkedOptions ();
159165 }
160-
166+ return parent :: afterSave ();
161167 } catch (\Throwable $ e ) {
162-
168+ return parent :: afterSave ();
163169 }
164-
165- return parent ::afterSave ();
166170 }
167171}
0 commit comments