@@ -328,6 +328,7 @@ public function getFilesCollection($path, $type = null)
328
328
$ item ->setName ($ item ->getBasename ());
329
329
$ item ->setShortName ($ this ->_cmsWysiwygImages ->getShortFilename ($ item ->getBasename ()));
330
330
$ item ->setUrl ($ this ->_cmsWysiwygImages ->getCurrentUrl () . $ item ->getBasename ());
331
+ // phpcs:ignore Magento2.Functions.DiscouragedFunction
331
332
$ item ->setSize (filesize ($ item ->getFilename ()));
332
333
$ item ->setMimeType (\mime_content_type ($ item ->getFilename ()));
333
334
@@ -338,6 +339,7 @@ public function getFilesCollection($path, $type = null)
338
339
$ thumbUrl = $ this ->_backendUrl ->getUrl ('cms/*/thumbnail ' , ['file ' => $ item ->getId ()]);
339
340
}
340
341
342
+ // phpcs:ignore Generic.PHP.NoSilencedErrors
341
343
$ size = @getimagesize ($ item ->getFilename ());
342
344
343
345
if (is_array ($ size )) {
@@ -413,6 +415,7 @@ public function createDirectory($name, $path)
413
415
'id ' => $ this ->_cmsWysiwygImages ->convertPathToId ($ newPath ),
414
416
];
415
417
return $ result ;
418
+ // phpcs:ignore Magento2.Exceptions.ThrowCatch
416
419
} catch (\Magento \Framework \Exception \FileSystemException $ e ) {
417
420
throw new \Magento \Framework \Exception \LocalizedException (__ ('We cannot create a new directory. ' ));
418
421
}
@@ -439,6 +442,7 @@ public function deleteDirectory($path)
439
442
$ this ->_deleteByPath ($ path );
440
443
$ path = $ this ->getThumbnailRoot () . $ this ->_getRelativePathToRoot ($ path );
441
444
$ this ->_deleteByPath ($ path );
445
+ // phpcs:ignore Magento2.Exceptions.ThrowCatch
442
446
} catch (\Magento \Framework \Exception \FileSystemException $ e ) {
443
447
throw new \Magento \Framework \Exception \LocalizedException (
444
448
__ ('We cannot delete directory %1. ' , $ this ->_getRelativePathToRoot ($ path ))
@@ -601,6 +605,7 @@ public function resizeFile($source, $keepRatio = true)
601
605
$ image ->open ($ source );
602
606
$ image ->keepAspectRatio ($ keepRatio );
603
607
$ image ->resize ($ this ->_resizeParameters ['width ' ], $ this ->_resizeParameters ['height ' ]);
608
+ // phpcs:ignore Magento2.Functions.DiscouragedFunction
604
609
$ dest = $ targetDir . '/ ' . pathinfo ($ source , PATHINFO_BASENAME );
605
610
$ image ->save ($ dest );
606
611
if ($ this ->_directory ->isFile ($ this ->_directory ->getRelativePath ($ dest ))) {
@@ -636,6 +641,7 @@ public function getThumbsPath($filePath = false)
636
641
$ thumbnailDir = $ this ->getThumbnailRoot ();
637
642
638
643
if ($ filePath && strpos ($ filePath , $ mediaRootDir ) === 0 ) {
644
+ // phpcs:ignore Magento2.Functions.DiscouragedFunction
639
645
$ thumbnailDir .= dirname (substr ($ filePath , strlen ($ mediaRootDir )));
640
646
}
641
647
@@ -686,6 +692,7 @@ public function isImage($filename)
686
692
if (!$ this ->hasData ('_image_extensions ' )) {
687
693
$ this ->setData ('_image_extensions ' , $ this ->getAllowedExtensions ('image ' ));
688
694
}
695
+ // phpcs:ignore Magento2.Functions.DiscouragedFunction
689
696
$ ext = strtolower (pathinfo ($ filename , PATHINFO_EXTENSION ));
690
697
return in_array ($ ext , $ this ->_getData ('_image_extensions ' ));
691
698
}
0 commit comments