Skip to content

Commit

Permalink
Fixed null parameter warning
Browse files Browse the repository at this point in the history
  • Loading branch information
fballiano committed May 2, 2024
1 parent f21a8e8 commit 687184d
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions app/code/community/Fballiano/ImageCleaner/Helper/Data.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
<?php

/**
* FBalliano
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this Module to
* newer versions in the future.
*
* @category FBalliano
* @package FBalliano_ImageCleaner
* @copyright Copyright (c) 2021 Fabrizio Balliano (http://fabrizioballiano.it)
* @copyright Copyright (c) Fabrizio Balliano (http://fabrizioballiano.com)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
class Fballiano_ImageCleaner_Helper_Data extends Mage_Core_Helper_Abstract
Expand Down Expand Up @@ -83,12 +73,17 @@ public function getAllCSSFiles($dir)
return $result;
}

protected function getBlacklistedPatterns()
protected function getBlacklistedPatterns(): array
{
return preg_split('/\r\n|\r|\n/', Mage::getStoreConfig('admin/fb_image_cleaner/blacklist'));
$blacklist = Mage::getStoreConfig('admin/fb_image_cleaner/blacklist');
if ($blacklist === null) {
return [];
}

return preg_split('/\r\n|\r|\n/', $blacklist);
}

public function isBlacklisted($path, $blacklisted_patterns)
public function isBlacklisted($path, $blacklisted_patterns): bool
{
foreach ($blacklisted_patterns as $blacklisted_pattern) {
if (fnmatch('*/' . $blacklisted_pattern, $path)) return true;
Expand Down

0 comments on commit 687184d

Please sign in to comment.