1212use Magento \Store \Model \StoreManagerInterface ;
1313
1414/**
15- * Class Save
15+ * Category save controller
1616 *
1717 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1818 */
@@ -144,10 +144,10 @@ public function execute()
144144 $ categoryPostData = $ this ->stringToBoolConverting ($ categoryPostData );
145145 $ categoryPostData = $ this ->imagePreprocessing ($ categoryPostData );
146146 $ categoryPostData = $ this ->dateTimePreprocessing ($ category , $ categoryPostData );
147- $ storeId = isset ( $ categoryPostData ['store_id ' ]) ? $ categoryPostData [ ' store_id ' ] : null ;
147+ $ storeId = $ categoryPostData ['store_id ' ] ?? null ;
148148 $ store = $ this ->storeManager ->getStore ($ storeId );
149149 $ this ->storeManager ->setCurrentStore ($ store ->getCode ());
150- $ parentId = isset ( $ categoryPostData ['parent ' ]) ? $ categoryPostData [ ' parent ' ] : null ;
150+ $ parentId = $ categoryPostData ['parent ' ] ?? null ;
151151 if ($ categoryPostData ) {
152152 $ category ->addData ($ categoryPostData );
153153 if ($ parentId ) {
@@ -168,7 +168,7 @@ public function execute()
168168 if (isset ($ categoryPostData ['use_config ' ]) && !empty ($ categoryPostData ['use_config ' ])) {
169169 foreach ($ categoryPostData ['use_config ' ] as $ attributeCode => $ attributeValue ) {
170170 if ($ attributeValue ) {
171- $ useConfig [] = $ attributeCode ;
171+ $ useConfig [] = $ attributeValue ;
172172 $ category ->setData ($ attributeCode , null );
173173 }
174174 }
@@ -220,7 +220,11 @@ public function execute()
220220 __ ('The "%1" attribute is required. Enter and try again. ' , $ attribute )
221221 );
222222 } else {
223- $ this ->messageManager ->addErrorMessage (__ ('Something went wrong while saving the category. ' ));
223+ $ this ->messageManager ->addErrorMessage (
224+ __ (
225+ 'Something went wrong while saving the category. '
226+ )
227+ );
224228 $ this ->logger ->critical ('Something went wrong while saving the category. ' );
225229 $ this ->_getSession ()->setCategoryData ($ categoryPostData );
226230 }
0 commit comments