33
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2024-12-11 21:57:53 +00:00

Joomla code-style fixes

This commit is contained in:
Denis Ryabov 2021-05-11 18:45:51 +03:00
parent 14ba00024a
commit f0184fa74d

View File

@ -48,7 +48,7 @@ class JedcheckerRulesFramework extends JEDcheckerRule
protected $tests = false; protected $tests = false;
protected $regex_leftover_folders; protected $regexLeftoverFolders;
/** /**
* Initiates the file search and check * Initiates the file search and check
@ -58,21 +58,23 @@ class JedcheckerRulesFramework extends JEDcheckerRule
public function check() public function check()
{ {
// Warn about code versioning files included // Warn about code versioning files included
$leftover_folders = $this->params->get('leftover_folders'); $leftoverFolders = $this->params->get('leftover_folders');
$leftover_folders_whitelist = $this->params->get('leftover_folders_whitelist'); $leftoverFoldersWhitelist = $this->params->get('leftover_folders_whitelist');
$this->regex_leftover_folders = ''; $this->regexLeftoverFolders = '';
if (!empty($leftover_folders_whitelist))
if (!empty($leftoverFoldersWhitelist))
{ {
$this->regex_leftover_folders .= '(?!(?:' . str_replace(array(',', '\*'), array('|', '.*'), preg_quote($leftover_folders_whitelist, '/')) . '))'; $this->regexLeftoverFolders .= '(?!(?:' . str_replace(array(',', '\*'), array('|', '.*'), preg_quote($leftoverFoldersWhitelist, '/')) . '))';
} }
$this->regex_leftover_folders .= '(?:' . str_replace(array(',', '\*'), array('|', '.*'), preg_quote($leftover_folders, '/')) . ')';
$regex_leftover_folders = '^' . $this->regex_leftover_folders . '$'; $this->regexLeftoverFolders .= '(?:' . str_replace(array(',', '\*'), array('|', '.*'), preg_quote($leftoverFolders, '/')) . ')';
$regexLeftoverFolders = '^' . $this->regexLeftoverFolders . '$';
// Get matched files and folder (w/o default exclusion list) // Get matched files and folder (w/o default exclusion list)
$folders = JFolder::folders($this->basedir, $regex_leftover_folders, true, true, array(), array()); $folders = JFolder::folders($this->basedir, $regexLeftoverFolders, true, true, array(), array());
$files = JFolder::files($this->basedir, $regex_leftover_folders, true, true, array(), array()); $files = JFolder::files($this->basedir, $regexLeftoverFolders, true, true, array(), array());
if ($folders !== false) if ($folders !== false)
{ {
@ -116,7 +118,7 @@ class JedcheckerRulesFramework extends JEDcheckerRule
*/ */
private function excludeResource($file) private function excludeResource($file)
{ {
return (bool) preg_match('/\/' . $this->regex_leftover_folders . '\//', $file); return (bool) preg_match('/\/' . $this->regexLeftoverFolders . '\//', $file);
} }
/** /**