Move the Power, Plugin and Module builders into the container. Many more PHP 8 improvments.

This commit is contained in:
2023-01-29 22:12:42 +02:00
parent e6c02a29f6
commit 7edbe20c33
68 changed files with 3443 additions and 1681 deletions

View File

@@ -117,7 +117,7 @@ class Dispenser implements DispenserInterface
* @since 3.2.0
*/
public function set(&$script, string $first, ?string $second = null, ?string $third = null,
array $config = array(), bool $base64 = true, bool $dynamic = true, bool $add = false): bool
array $config = [], bool $base64 = true, bool $dynamic = true, bool $add = false): bool
{
// only load if we have a string
if (!StringHelper::check($script))
@@ -132,7 +132,7 @@ class Dispenser implements DispenserInterface
// check if the script first key is set
if ($second && !isset($this->hub[$first]))
{
$this->hub[$first] = array();
$this->hub[$first] = [];
}
elseif ($add && !$second
&& !isset($this->hub[$first]))
@@ -143,7 +143,7 @@ class Dispenser implements DispenserInterface
if ($second && $third
&& !isset($this->hub[$first][$second]))
{
$this->hub[$first][$second] = array();
$this->hub[$first][$second] = [];
}
elseif ($add && $second && !$third
&& !isset($this->hub[$first][$second]))

View File

@@ -122,7 +122,7 @@ class External implements ExternalInterface
var_dump($string);
}
// target content
$bucket = array();
$bucket = [];
$found = GetHelper::allBetween(
$string, '[EXTERNA' . 'LCODE=', ']'
);
@@ -342,17 +342,9 @@ class External implements ExternalInterface
);
}
}
// add to local bucket
if (isset($this->code[$target_key]))
{
// update the placeholder with the external code string
$bucket[$key] = $this->code[$target_key];
}
else
{
// remove the placeholder
$bucket[$key] = '';
}
$bucket[$key] = $this->code[$target_key] ?? '';
}
/**

View File

@@ -328,15 +328,7 @@ class Extractor implements ExtractorInterface
// make sure we have the path correct (the script file is not in admin path for example)
// there may be more... will nead to keep our eye on this... since files could be moved during install
$file = str_replace('./', '', (string) $file); # TODO (windows path issues)
if ($file !== 'script.php')
{
$path = $target . '/' . $file;
}
else
{
$path = $file;
}
$path = $file !== 'script.php' ? $target . '/' . $file : $file;
// now we go line by line
foreach (new \SplFileObject($file) as $lineNumber => $lineContent)

View File

@@ -130,7 +130,7 @@ class Paths
protected function load()
{
// set the local paths to search
$local_paths = array();
$local_paths = [];
// admin path
$local_paths['admin'] = JPATH_ADMINISTRATOR . '/components/com_'
@@ -213,15 +213,8 @@ class Paths
{
$joomla_modules = array_filter(
array_values($addjoomla_modules),
function ($array) {
// only load the modules whose target association call for it
if (!isset($array['target']) || $array['target'] != 2)
{
return true;
}
return false;
}
// only load the modules whose target association call for it
fn($array): bool => !isset($array['target']) || $array['target'] != 2
);
// if we have values we return IDs
if (ArrayHelper::check($joomla_modules))

View File

@@ -183,7 +183,7 @@ class Gui implements GuiInterface
// get file content
$file_conent = FileHelper::getContent($file);
$guiCode = array();
$guiCode = [];
// we add a new search for the GUI CODE Blocks
$guiCode[] = GetHelper::allBetween(
$file_conent, '/***[JCB' . 'GUI<>', '/***[/JCBGUI' . '$$$$]***/'

View File

@@ -62,7 +62,7 @@ class Hash
$values = GetHelper::allBetween(
$script, 'HASH' . 'STRING((((', '))))'
);
$locker = array();
$locker = [];
// convert them
foreach ($values as $value)
{
@@ -80,7 +80,7 @@ class Hash
$values = GetHelper::allBetween(
$script, 'HASH' . 'FILE((((', '))))'
);
$locker = array();
$locker = [];
// convert them
foreach ($values as $path)
{

View File

@@ -62,7 +62,7 @@ class LockBase implements LockBaseInterface
$values = GetHelper::allBetween(
$script, 'LOCK'.'BASE64((((', '))))'
);
$locker = array();
$locker = [];
// convert them
foreach ($values as $value)
{