1818 *
1919 * @category Mage
2020 * @package Mage_Cms
21+ *
22+ * @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
2123 */
2224class Mage_Cms_Model_Wysiwyg_Images_Storage extends Varien_Object
2325{
@@ -44,6 +46,9 @@ class Mage_Cms_Model_Wysiwyg_Images_Storage extends Varien_Object
4446 *
4547 * @param string $path Parent directory path
4648 * @return Varien_Data_Collection_Filesystem
49+ *
50+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
51+ * @SuppressWarnings(PHPMD.NPathComplexity)
4752 */
4853 public function getDirsCollection ($ path )
4954 {
@@ -190,8 +195,8 @@ public function createDirectory($name, $path)
190195 Mage::throwException (Mage::helper ('cms ' )->__ ('A directory with the same name already exists. Please try another folder name. ' ));
191196 }
192197
193- $ io = new Varien_Io_File ();
194- if ($ io ->mkdir ($ newPath )) {
198+ $ file = new Varien_Io_File ();
199+ if ($ file ->mkdir ($ newPath )) {
195200 if (Mage::helper ('core/file_storage_database ' )->checkDbUsage ()) {
196201 $ relativePath = Mage::helper ('core/file_storage_database ' )->getMediaRelativePath ($ newPath );
197202 Mage::getModel ('core/file_storage_directory_database ' )->createRecursive ($ relativePath );
@@ -218,12 +223,12 @@ public function deleteDirectory($path)
218223 $ rootCmp = rtrim ($ this ->getHelper ()->getStorageRoot (), DS );
219224 $ pathCmp = rtrim ($ path , DS );
220225
221- $ io = new Varien_Io_File ();
226+ $ file = new Varien_Io_File ();
222227
223228 if ($ rootCmp == $ pathCmp ) {
224229 Mage::throwException (Mage::helper ('cms ' )->__ (
225230 'Cannot delete root directory %s. ' ,
226- $ io ->getFilteredPath ($ path )
231+ $ file ->getFilteredPath ($ path )
227232 ));
228233 }
229234 if (str_contains ($ pathCmp , chr (0 ))
@@ -235,12 +240,12 @@ public function deleteDirectory($path)
235240 if (Mage::helper ('core/file_storage_database ' )->checkDbUsage ()) {
236241 Mage::getModel ('core/file_storage_directory_database ' )->deleteDirectory ($ path );
237242 }
238- if (!$ io ->rmdir ($ path , true )) {
239- Mage::throwException (Mage::helper ('cms ' )->__ ('Cannot delete directory %s. ' , $ io ->getFilteredPath ($ path )));
243+ if (!$ file ->rmdir ($ path , true )) {
244+ Mage::throwException (Mage::helper ('cms ' )->__ ('Cannot delete directory %s. ' , $ file ->getFilteredPath ($ path )));
240245 }
241246
242247 if (str_starts_with ($ pathCmp , $ rootCmp )) {
243- $ io ->rmdir ($ this ->getThumbnailRoot () . DS . ltrim (substr ($ pathCmp , strlen ($ rootCmp )), '\\/ ' ), true );
248+ $ file ->rmdir ($ this ->getThumbnailRoot () . DS . ltrim (substr ($ pathCmp , strlen ($ rootCmp )), '\\/ ' ), true );
244249 }
245250 }
246251
@@ -252,13 +257,13 @@ public function deleteDirectory($path)
252257 */
253258 public function deleteFile ($ target )
254259 {
255- $ io = new Varien_Io_File ();
256- $ io ->rm ($ target );
260+ $ file = new Varien_Io_File ();
261+ $ file ->rm ($ target );
257262 Mage::helper ('core/file_storage_database ' )->deleteFile ($ target );
258263
259264 $ thumb = $ this ->getThumbnailPath ($ target , true );
260265 if ($ thumb ) {
261- $ io ->rm ($ thumb );
266+ $ file ->rm ($ thumb );
262267 Mage::helper ('core/file_storage_database ' )->deleteFile ($ thumb );
263268 }
264269 return $ this ;
@@ -311,9 +316,11 @@ public function uploadFile($targetPath, $type = null)
311316 /**
312317 * Thumbnail path getter
313318 *
314- * @param string $filePath original file path
319+ * @param string $filePath original file path
315320 * @param bool $checkFile OPTIONAL is it necessary to check file availability
316321 * @return string | false
322+ *
323+ * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
317324 */
318325 public function getThumbnailPath ($ filePath , $ checkFile = false )
319326 {
@@ -333,9 +340,11 @@ public function getThumbnailPath($filePath, $checkFile = false)
333340 /**
334341 * Thumbnail URL getter
335342 *
336- * @param string $filePath original file path
343+ * @param string $filePath original file path
337344 * @param bool $checkFile OPTIONAL is it necessary to check file availability
338345 * @return string|false
346+ *
347+ * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
339348 */
340349 public function getThumbnailUrl ($ filePath , $ checkFile = false )
341350 {
@@ -358,6 +367,8 @@ public function getThumbnailUrl($filePath, $checkFile = false)
358367 * @param string $source Image path to be resized
359368 * @param bool $keepRation Keep aspect ratio or not
360369 * @return bool|string Resized filepath or false if errors were occurred
370+ *
371+ * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
361372 */
362373 public function resizeFile ($ source , $ keepRation = true )
363374 {
@@ -366,11 +377,11 @@ public function resizeFile($source, $keepRation = true)
366377 }
367378
368379 $ targetDir = $ this ->getThumbsPath ($ source );
369- $ io = new Varien_Io_File ();
370- if (!$ io ->isWriteable ($ targetDir )) {
371- $ io ->mkdir ($ targetDir );
380+ $ file = new Varien_Io_File ();
381+ if (!$ file ->isWriteable ($ targetDir )) {
382+ $ file ->mkdir ($ targetDir );
372383 }
373- if (!$ io ->isWriteable ($ targetDir )) {
384+ if (!$ file ->isWriteable ($ targetDir )) {
374385 return false ;
375386 }
376387 $ image = Varien_Image_Adapter::factory ('GD2 ' );
@@ -414,6 +425,8 @@ public function resizeOnTheFly($filename)
414425 *
415426 * @param false|string $filePath Path to the file
416427 * @return string
428+ *
429+ * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
417430 */
418431 public function getThumbsPath ($ filePath = false )
419432 {
@@ -480,6 +493,8 @@ public function getConfigAsArray()
480493 * @param string $key
481494 * @param mixed $default
482495 * @return mixed
496+ *
497+ * @SuppressWarnings(PHPMD.BooleanArgumentFlag)
483498 */
484499 public function getConfigData ($ key , $ default = false )
485500 {
0 commit comments