Adds some PHP 8 ready changes to compiler classes. Adds Server and Crypt classes.
This commit is contained in:
@@ -204,7 +204,7 @@ class Gui implements GuiInterface
|
||||
if (is_array($query) && count($query) >= 3)
|
||||
{
|
||||
// cleanup the newlines around the code
|
||||
$code = trim(str_replace($first_line, '', $code), PHP_EOL)
|
||||
$code = trim(str_replace($first_line, '', (string) $code), PHP_EOL)
|
||||
. PHP_EOL;
|
||||
// set the ID
|
||||
$id = (int) $query[2];
|
||||
@@ -243,14 +243,9 @@ class Gui implements GuiInterface
|
||||
protected function check(string &$code): bool
|
||||
{
|
||||
// check for customcode placeholders
|
||||
if (strpos($code, '$$$$') !== false)
|
||||
{
|
||||
// we do not add GUI wrapper placeholder to code
|
||||
// that already has any customcode placeholders
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
// we do not add GUI wrapper placeholder to code
|
||||
// that already has any customcode placeholders
|
||||
return strpos($code, '$$$$') === false;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -56,7 +56,7 @@ class Hash
|
||||
public function set(string $script): string
|
||||
{
|
||||
// check if we should hash a string
|
||||
if (\strpos($script, 'HASH' . 'STRING((((') !== false)
|
||||
if (strpos($script, 'HASH' . 'STRING((((') !== false)
|
||||
{
|
||||
// get the strings
|
||||
$values = GetHelper::allBetween(
|
||||
@@ -67,14 +67,14 @@ class Hash
|
||||
foreach ($values as $value)
|
||||
{
|
||||
$locker['HASH' . 'STRING((((' . $value . '))))']
|
||||
= \md5($value);
|
||||
= md5((string) $value);
|
||||
}
|
||||
|
||||
// update the script
|
||||
return $this->placeholder->update($script, $locker);
|
||||
}
|
||||
// check if we should hash a file
|
||||
if (\strpos($script, 'HASH' . 'FILE((((') !== false)
|
||||
if (strpos($script, 'HASH' . 'FILE((((') !== false)
|
||||
{
|
||||
// get the strings
|
||||
$values = GetHelper::allBetween(
|
||||
@@ -89,7 +89,7 @@ class Hash
|
||||
{
|
||||
// now we hash the file content
|
||||
$locker['HASH' . 'FILE((((' . $path . '))))']
|
||||
= \md5($value);
|
||||
= md5((string) $value);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -69,8 +69,8 @@ class LockBase implements LockBaseInterface
|
||||
$locker['LOCK'.'BASE64((((' . $value . '))))']
|
||||
= "base64_decode( preg_replace('/\s+/', ''," .
|
||||
PHP_EOL . Indent::_(2) . "'" .
|
||||
\wordwrap(
|
||||
\base64_encode($value), 64, PHP_EOL . Indent::_(2), true
|
||||
wordwrap(
|
||||
base64_encode((string) $value), 64, PHP_EOL . Indent::_(2), true
|
||||
) .
|
||||
"'))";
|
||||
}
|
||||
|
@@ -144,7 +144,7 @@ class InstallScript implements GetScriptInterface
|
||||
else
|
||||
{
|
||||
// get the flight key
|
||||
$flight = str_replace('php_', '', $method);
|
||||
$flight = str_replace('php_', '', (string) $method);
|
||||
// load the script to our bucket
|
||||
$this->{$flight . 'Bucket'}[$type][] = $extension->{$method . '_' . $type};
|
||||
// show that the method is active
|
||||
|
@@ -102,8 +102,8 @@ class Customcode
|
||||
= true;
|
||||
}
|
||||
|
||||
if (strpos($field->javascript_view_footer, "token") !== false
|
||||
|| strpos($field->javascript_view_footer, "task=ajax") !== false)
|
||||
if (strpos((string) $field->javascript_view_footer, "token") !== false
|
||||
|| strpos((string) $field->javascript_view_footer, "task=ajax") !== false)
|
||||
{
|
||||
if (!isset($this->dispenser->hub['token']))
|
||||
{
|
||||
@@ -182,8 +182,8 @@ class Customcode
|
||||
{
|
||||
$field->javascript_views_footer_decoded = true;
|
||||
}
|
||||
if (strpos($field->javascript_views_footer, "token") !== false
|
||||
|| strpos($field->javascript_views_footer, "task=ajax") !== false)
|
||||
if (strpos((string) $field->javascript_views_footer, "token") !== false
|
||||
|| strpos((string) $field->javascript_views_footer, "task=ajax") !== false)
|
||||
{
|
||||
if (!isset($this->dispenser->hub['token']))
|
||||
{
|
||||
|
@@ -196,7 +196,7 @@ class Data
|
||||
$field->type = $field->fieldtype;
|
||||
|
||||
// load the values form params
|
||||
$field->xml = $this->customcode->update(json_decode($field->xml));
|
||||
$field->xml = $this->customcode->update(json_decode((string) $field->xml));
|
||||
|
||||
// check if we have validate (validation rule and set it if found)
|
||||
$this->validation->set($id, $field->xml);
|
||||
@@ -204,7 +204,7 @@ class Data
|
||||
// load the type values form type params
|
||||
$field->properties = (isset($field->properties)
|
||||
&& JsonHelper::check($field->properties))
|
||||
? json_decode($field->properties, true) : null;
|
||||
? json_decode((string) $field->properties, true) : null;
|
||||
if (ArrayHelper::check($field->properties))
|
||||
{
|
||||
$field->properties = array_values($field->properties);
|
||||
@@ -243,13 +243,13 @@ class Data
|
||||
))
|
||||
{
|
||||
$field->initiator_save_key = md5(
|
||||
$field->initiator_on_save_model
|
||||
(string) $field->initiator_on_save_model
|
||||
);
|
||||
$field->initiator_save = explode(
|
||||
PHP_EOL, $this->placeholder->update_(
|
||||
$this->customcode->update(
|
||||
base64_decode(
|
||||
$field->initiator_on_save_model
|
||||
(string) $field->initiator_on_save_model
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -260,13 +260,13 @@ class Data
|
||||
))
|
||||
{
|
||||
$field->initiator_get_key = md5(
|
||||
$field->initiator_on_get_model
|
||||
(string) $field->initiator_on_get_model
|
||||
);
|
||||
$field->initiator_get = explode(
|
||||
PHP_EOL, $this->placeholder->update_(
|
||||
$this->customcode->update(
|
||||
base64_decode(
|
||||
$field->initiator_on_get_model
|
||||
(string) $field->initiator_on_get_model
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -276,14 +276,14 @@ class Data
|
||||
$field->model_field['save'] = explode(
|
||||
PHP_EOL, $this->placeholder->update_(
|
||||
$this->customcode->update(
|
||||
base64_decode($field->on_save_model_field)
|
||||
base64_decode((string) $field->on_save_model_field)
|
||||
)
|
||||
)
|
||||
);
|
||||
$field->model_field['get'] = explode(
|
||||
PHP_EOL, $this->placeholder->update_(
|
||||
$this->customcode->update(
|
||||
base64_decode($field->on_get_model_field)
|
||||
base64_decode((string) $field->on_get_model_field)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@@ -88,7 +88,7 @@ class CoreValidation implements CoreValidationInterface
|
||||
}
|
||||
|
||||
// remove the Rule.php from the name
|
||||
$this->rules = array_map( function ($name) {
|
||||
$this->rules = array_map( function ($name): string {
|
||||
return str_replace(array('./','Rule.php'), '', $name);
|
||||
}, $rules);
|
||||
}
|
||||
@@ -99,7 +99,7 @@ class CoreValidation implements CoreValidationInterface
|
||||
// check if the names should be all lowercase
|
||||
if ($lowercase)
|
||||
{
|
||||
return array_map( function($item) {
|
||||
return array_map( function($item): string {
|
||||
return strtolower($item);
|
||||
}, $this->rules);
|
||||
}
|
||||
|
@@ -53,7 +53,7 @@ class TypeName
|
||||
))
|
||||
{
|
||||
// search for own custom fields
|
||||
if (strpos($field['settings']->type_name, '@') !== false)
|
||||
if (strpos((string) $field['settings']->type_name, '@') !== false)
|
||||
{
|
||||
// set own custom field
|
||||
$field['settings']->own_custom = $field['settings']->type_name;
|
||||
@@ -66,8 +66,8 @@ class TypeName
|
||||
);
|
||||
|
||||
// if custom (we must use the xml value)
|
||||
if (strtolower($type_name) === 'custom'
|
||||
|| strtolower($type_name) === 'customuser')
|
||||
if (strtolower((string) $type_name) === 'custom'
|
||||
|| strtolower((string) $type_name) === 'customuser')
|
||||
{
|
||||
$type = TypeHelper::safe(
|
||||
GetHelper::between(
|
||||
|
@@ -133,7 +133,7 @@ class Validation
|
||||
$this->placeholder->update_(
|
||||
$this->customcode->update(
|
||||
base64_decode(
|
||||
$php_code
|
||||
(string) $php_code
|
||||
)
|
||||
)
|
||||
),
|
||||
|
@@ -166,7 +166,7 @@ class History implements HistoryInterface
|
||||
// check the note
|
||||
if (JsonHelper::check($object->version_note))
|
||||
{
|
||||
$version_note = json_decode($object->version_note, true);
|
||||
$version_note = json_decode((string) $object->version_note, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -183,7 +183,7 @@ class History implements HistoryInterface
|
||||
)) !== false)
|
||||
{
|
||||
// last version that was used to build/compile
|
||||
$this->tmp = json_decode($object->version_data);
|
||||
$this->tmp = json_decode((string) $object->version_data);
|
||||
// remove it from this component
|
||||
unset($version_note['component'][$key]);
|
||||
}
|
||||
|
@@ -104,13 +104,8 @@ class Extractor
|
||||
{
|
||||
// get targets to search for
|
||||
$lang_string_targets = array_filter(
|
||||
$this->config->lang_string_targets, function ($get) use ($content) {
|
||||
if (strpos($content, $get) !== false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
$this->config->lang_string_targets, function ($get) use ($content): bool {
|
||||
return strpos($content, $get) !== false;
|
||||
}
|
||||
);
|
||||
// check if we should continue
|
||||
|
@@ -100,12 +100,7 @@ class Placeholder implements PlaceholderInterface
|
||||
*/
|
||||
public function exist(string $key): bool
|
||||
{
|
||||
if (isset($this->active[$key]) || $this->exist_($key) || $this->exist_h($key))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return isset($this->active[$key]) || $this->exist_($key) || $this->exist_h($key);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -193,11 +188,7 @@ class Placeholder implements PlaceholderInterface
|
||||
*/
|
||||
public function exist_(string $key): bool
|
||||
{
|
||||
if (isset($this->active[Placefix::_($key)]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return isset($this->active[Placefix::_($key)]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -274,11 +265,7 @@ class Placeholder implements PlaceholderInterface
|
||||
*/
|
||||
public function exist_h(string $key): bool
|
||||
{
|
||||
if (isset($this->active[Placefix::_h($key)]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return isset($this->active[Placefix::_h($key)]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -401,7 +388,7 @@ class Placeholder implements PlaceholderInterface
|
||||
elseif (2 == $action) // <-- check if data string has placeholders
|
||||
{
|
||||
$replace = false;
|
||||
foreach ($placeholder as $key => $val)
|
||||
foreach (array_keys($placeholder) as $key)
|
||||
{
|
||||
if (strpos($data, $key) !== false)
|
||||
{
|
||||
@@ -410,7 +397,7 @@ class Placeholder implements PlaceholderInterface
|
||||
}
|
||||
}
|
||||
// only replace if the data has these placeholder values
|
||||
if ($replace === true)
|
||||
if ($replace)
|
||||
{
|
||||
return str_replace(
|
||||
array_keys($placeholder), array_values($placeholder), $data
|
||||
@@ -420,7 +407,7 @@ class Placeholder implements PlaceholderInterface
|
||||
elseif (3 == $action) // <-- remove placeholders not in data string
|
||||
{
|
||||
$replace = $placeholder;
|
||||
foreach ($replace as $key => $val)
|
||||
foreach (array_keys($replace) as $key)
|
||||
{
|
||||
if (strpos($data, $key) === false)
|
||||
{
|
||||
|
@@ -99,7 +99,7 @@ class Reverse
|
||||
{
|
||||
// get local code if set
|
||||
if ($id > 0 && $code = base64_decode(
|
||||
GetHelper::var($table, $id, 'id', $field)
|
||||
(string) GetHelper::var($table, $id, 'id', $field)
|
||||
))
|
||||
{
|
||||
$string = $this->setReverse(
|
||||
@@ -124,13 +124,9 @@ class Reverse
|
||||
{
|
||||
// get targets to search for
|
||||
$lang_string_targets = array_filter(
|
||||
$this->config->lang_string_targets, function ($get) use ($string) {
|
||||
if (strpos($string, $get) !== false)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
$this->config->lang_string_targets,
|
||||
function ($get) use ($string) : bool {
|
||||
return strpos($string, $get) !== false;
|
||||
}
|
||||
);
|
||||
// check if we should continue
|
||||
|
@@ -297,7 +297,7 @@ class Power implements PowerInterface
|
||||
$this->placeholder->update_(
|
||||
$this->customcode->update(
|
||||
base64_decode(
|
||||
$this->active[$guid]->licensing_template
|
||||
(string) $this->active[$guid]->licensing_template
|
||||
)
|
||||
)
|
||||
),
|
||||
@@ -321,7 +321,7 @@ class Power implements PowerInterface
|
||||
$this->placeholder->update_(
|
||||
$this->customcode->update(
|
||||
base64_decode(
|
||||
$this->active[$guid]->head
|
||||
(string) $this->active[$guid]->head
|
||||
)
|
||||
)
|
||||
),
|
||||
@@ -351,7 +351,7 @@ class Power implements PowerInterface
|
||||
$this->placeholder->update_(
|
||||
$this->customcode->update(
|
||||
base64_decode(
|
||||
$this->active[$guid]->main_class_code
|
||||
(string) $this->active[$guid]->main_class_code
|
||||
)
|
||||
)
|
||||
),
|
||||
@@ -391,10 +391,10 @@ class Power implements PowerInterface
|
||||
*
|
||||
* @param string $guid The global unique id of the power
|
||||
*
|
||||
* @return void
|
||||
* @return bool
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function setNamespace(string $guid)
|
||||
protected function setNamespace(string $guid): bool
|
||||
{
|
||||
// set namespace
|
||||
$this->active[$guid]->namespace = $this->placeholder->update_(
|
||||
@@ -407,7 +407,7 @@ class Power implements PowerInterface
|
||||
// we raise an error message
|
||||
$this->app->enqueueMessage(
|
||||
Text::sprintf('COM_COMPONENTBUILDER_HTHREES_NAMESPACE_ERROR_SHTHREEPYOU_MUST_ATLEAST_HAVE_TWO_SECTIONS_IN_YOUR_NAMESPACE_YOU_JUST_HAVE_ONE_THIS_IS_AN_UNACCEPTABLE_ACTION_PLEASE_SEE_A_HREFS_PSRFOURA_FOR_MORE_INFOPPTHIS_S_WAS_THEREFORE_REMOVED_A_HREFSCLICK_HEREA_TO_FIX_THIS_ISSUEP',
|
||||
ucfirst($this->active[$guid]->type), $this->active[$guid]->name, $this->active[$guid]->namespace,
|
||||
ucfirst((string) $this->active[$guid]->type), $this->active[$guid]->name, $this->active[$guid]->namespace,
|
||||
'"https://www.php-fig.org/psr/psr-4/" target="_blank"', $this->active[$guid]->type,
|
||||
$this->fixUrl),
|
||||
'Error'
|
||||
@@ -429,7 +429,7 @@ class Power implements PowerInterface
|
||||
// we raise an error message
|
||||
$this->app->enqueueMessage(
|
||||
Text::sprintf('COM_COMPONENTBUILDER_HTHREES_NAMESPACE_ERROR_SHTHREEPYOU_MUST_ATLEAST_HAVE_TWO_SECTIONS_IN_YOUR_NAMESPACE_YOU_JUST_HAVE_ONE_S_THIS_IS_AN_UNACCEPTABLE_ACTION_PLEASE_SEE_A_HREFS_PSRFOURA_FOR_MORE_INFOPPTHIS_S_WAS_THEREFORE_REMOVED_A_HREFSCLICK_HEREA_TO_FIX_THIS_ISSUEP',
|
||||
ucfirst($this->active[$guid]->type), $this->active[$guid]->name, $this->active[$guid]->namespace,
|
||||
ucfirst((string) $this->active[$guid]->type), $this->active[$guid]->name, $this->active[$guid]->namespace,
|
||||
'"https://www.php-fig.org/psr/psr-4/" target="_blank"', $this->active[$guid]->type,
|
||||
$this->fixUrl),
|
||||
'Error'
|
||||
@@ -472,7 +472,7 @@ class Power implements PowerInterface
|
||||
// we raise an error message
|
||||
$this->app->enqueueMessage(
|
||||
Text::sprintf('COM_COMPONENTBUILDER_PS_NAMING_MISMATCH_ERROR_SPPTHE_S_NAME_IS_BSB_AND_THE_ENDING_FILE_NAME_IN_THE_NAMESPACE_IS_BSB_THIS_IS_BAD_CONVENTION_PLEASE_SEE_A_HREFS_PSRFOURA_FOR_MORE_INFOPPA_HREFSCLICK_HEREA_TO_FIX_THIS_ISSUEP',
|
||||
ucfirst($this->active[$guid]->type), $this->active[$guid]->name, $this->active[$guid]->type, $this->active[$guid]->class_name, $this->active[$guid]->file_name,
|
||||
ucfirst((string) $this->active[$guid]->type), $this->active[$guid]->name, $this->active[$guid]->type, $this->active[$guid]->class_name, $this->active[$guid]->file_name,
|
||||
'"https://www.php-fig.org/psr/psr-4/" target="_blank"',
|
||||
$this->fixUrl),
|
||||
'Error'
|
||||
@@ -533,20 +533,13 @@ class Power implements PowerInterface
|
||||
$this->active[$guid]->use_selection = (isset($this->active[$guid]->use_selection)
|
||||
&& JsonHelper::check(
|
||||
$this->active[$guid]->use_selection
|
||||
)) ? json_decode($this->active[$guid]->use_selection, true) : null;
|
||||
)) ? json_decode((string) $this->active[$guid]->use_selection, true) : null;
|
||||
|
||||
if ($this->active[$guid]->use_selection)
|
||||
{
|
||||
$use = array_values(array_map(function ($u) use(&$as) {
|
||||
// track the AS options
|
||||
if (empty($u['as']))
|
||||
{
|
||||
$as[$u['use']] = 'default';
|
||||
}
|
||||
else
|
||||
{
|
||||
$as[$u['use']] = (string) $u['as'];
|
||||
}
|
||||
$as[$u['use']] = empty($u['as']) ? 'default' : (string) $u['as'];
|
||||
// return the guid
|
||||
return $u['use'];
|
||||
}, $this->active[$guid]->use_selection));
|
||||
@@ -567,7 +560,7 @@ class Power implements PowerInterface
|
||||
$this->active[$guid]->load_selection = (isset($this->active[$guid]->load_selection)
|
||||
&& JsonHelper::check(
|
||||
$this->active[$guid]->load_selection
|
||||
)) ? json_decode($this->active[$guid]->load_selection, true) : null;
|
||||
)) ? json_decode((string) $this->active[$guid]->load_selection, true) : null;
|
||||
|
||||
if ($this->active[$guid]->load_selection)
|
||||
{
|
||||
@@ -594,7 +587,7 @@ class Power implements PowerInterface
|
||||
$_composer = (isset($this->active[$guid]->composer)
|
||||
&& JsonHelper::check(
|
||||
$this->active[$guid]->composer
|
||||
)) ? json_decode($this->active[$guid]->composer, true) : null;
|
||||
)) ? json_decode((string) $this->active[$guid]->composer, true) : null;
|
||||
|
||||
unset($this->active[$guid]->composer);
|
||||
|
||||
@@ -602,46 +595,44 @@ class Power implements PowerInterface
|
||||
{
|
||||
foreach ($_composer as $composer)
|
||||
{
|
||||
if (isset($composer['access_point']) && StringHelper::check($composer['access_point']))
|
||||
if (isset($composer['access_point']) && StringHelper::check($composer['access_point']) &&
|
||||
isset($composer['namespace']) && ArrayHelper::check($composer['namespace']))
|
||||
{
|
||||
if (isset($composer['namespace']) && ArrayHelper::check($composer['namespace']))
|
||||
foreach ($composer['namespace'] as $_namespace)
|
||||
{
|
||||
foreach ($composer['namespace'] as $_namespace)
|
||||
// make sure we have a valid namespace
|
||||
if (isset($_namespace['use']) && StringHelper::check($_namespace['use']) &&
|
||||
strpos((string) $_namespace['use'], '\\') !== false)
|
||||
{
|
||||
// make sure we have a valid namespace
|
||||
if (isset($_namespace['use']) && StringHelper::check($_namespace['use']) &&
|
||||
strpos($_namespace['use'], '\\') !== false)
|
||||
// add the namespace to this access point
|
||||
$as = 'default';
|
||||
if (strpos((string) $_namespace['use'], ' as ') !== false)
|
||||
{
|
||||
// add the namespace to this access point
|
||||
$as = 'default';
|
||||
if (strpos($_namespace['use'], ' as ') !== false)
|
||||
$namespace_as = explode(' as ', (string) $_namespace['use']);
|
||||
// make sure the AS value is set
|
||||
if (count($namespace_as) == 2)
|
||||
{
|
||||
$namespace_as = explode(' as ', $_namespace['use']);
|
||||
// make sure the AS value is set
|
||||
if (count($namespace_as) == 2)
|
||||
{
|
||||
$as = trim(trim($namespace_as[1], ';'));
|
||||
}
|
||||
$namespace = $this->getCleanNamespace($namespace_as[0], false);
|
||||
$as = trim(trim($namespace_as[1], ';'));
|
||||
}
|
||||
else
|
||||
{
|
||||
// trim possible use or ; added to the namespace
|
||||
$namespace = $this->getCleanNamespace($_namespace['use'], false);
|
||||
}
|
||||
|
||||
// check if still valid
|
||||
if (!StringHelper::check($namespace))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// add to the header of the class
|
||||
$this->addToHeader($guid, $this->getUseNamespace($namespace, $as));
|
||||
|
||||
// add composer namespaces for autoloader
|
||||
$this->composer[$namespace] = $composer['access_point'];
|
||||
$namespace = $this->getCleanNamespace($namespace_as[0], false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// trim possible use or ; added to the namespace
|
||||
$namespace = $this->getCleanNamespace($_namespace['use'], false);
|
||||
}
|
||||
|
||||
// check if still valid
|
||||
if (!StringHelper::check($namespace))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// add to the header of the class
|
||||
$this->addToHeader($guid, $this->getUseNamespace($namespace, $as));
|
||||
|
||||
// add composer namespaces for autoloader
|
||||
$this->composer[$namespace] = $composer['access_point'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -667,7 +658,7 @@ class Power implements PowerInterface
|
||||
$this->active[$guid]->implements = (isset($this->active[$guid]->implements)
|
||||
&& JsonHelper::check(
|
||||
$this->active[$guid]->implements
|
||||
)) ? json_decode($this->active[$guid]->implements, true) : null;
|
||||
)) ? json_decode((string) $this->active[$guid]->implements, true) : null;
|
||||
|
||||
if ($this->active[$guid]->implements)
|
||||
{
|
||||
@@ -820,7 +811,7 @@ class Power implements PowerInterface
|
||||
{
|
||||
// check if it is already added manually
|
||||
if (isset($this->active[$guid]->head) &&
|
||||
strpos($this->active[$guid]->head, $string) === false)
|
||||
strpos((string) $this->active[$guid]->head, $string) === false)
|
||||
{
|
||||
$this->active[$guid]->head .= $string . PHP_EOL;
|
||||
}
|
||||
|
@@ -166,10 +166,10 @@ class Infusion
|
||||
if (StringHelper::check($power->description))
|
||||
{
|
||||
// check if this is escaped
|
||||
if (strpos($power->description, '/*') === false)
|
||||
if (strpos((string) $power->description, '/*') === false)
|
||||
{
|
||||
// make this description escaped
|
||||
$power->description = '/**' . PHP_EOL . ' * ' . implode(PHP_EOL . ' * ', explode(PHP_EOL, $power->description)) . PHP_EOL . ' */';
|
||||
$power->description = '/**' . PHP_EOL . ' * ' . implode(PHP_EOL . ' * ', explode(PHP_EOL, (string) $power->description)) . PHP_EOL . ' */';
|
||||
}
|
||||
$code[] = PHP_EOL . $power->description;
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ class Registry extends BaseRegistry
|
||||
// convert all array to []
|
||||
$array = preg_split("/\r\n|\n|\r/", $data);
|
||||
$array = preg_replace(["/\s*array\s\($/", "/\)(,)?$/", "/\s=>\s$/"], [NULL, ']$1', ' => ['], $array);
|
||||
$data = join(PHP_EOL, array_filter(["["] + $array));
|
||||
$data = implode(PHP_EOL, array_filter(["["] + $array));
|
||||
|
||||
// add needed indentation to the last ]
|
||||
$data = preg_replace("/^(\])/m", Indent::_($default) . '$1', $data);
|
||||
@@ -88,7 +88,7 @@ class Registry extends BaseRegistry
|
||||
// update each found space (group) with one indentation
|
||||
foreach (range(1, 11) as $space)
|
||||
{
|
||||
if (strlen($matches[$space]) > 0)
|
||||
if (strlen((string) $matches[$space]) > 0)
|
||||
{
|
||||
$indent .= Indent::_(1);
|
||||
}
|
||||
|
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Service;
|
||||
|
||||
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Database\Load;
|
||||
use VDM\Joomla\Componentbuilder\Database\Insert;
|
||||
|
||||
|
||||
/**
|
||||
* Database Service Provider
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Database implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->alias(Load::class, 'Load')
|
||||
->share('Load', [$this, 'getLoad'], true);
|
||||
|
||||
$container->alias(Insert::class, 'Insert')
|
||||
->share('Insert', [$this, 'getInsert'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Core Load Database
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Load
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getLoad(Container $container): Load
|
||||
{
|
||||
return new Load();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Core Insert Database
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Insert
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getInsert(Container $container): Insert
|
||||
{
|
||||
return new Insert();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Compiler\Service;
|
||||
|
||||
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Server\Model\Load as ServerLoad;
|
||||
|
||||
|
||||
/**
|
||||
* Model Service Provider
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Model implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->alias(ServerLoad::class, 'Model.Server.Load')
|
||||
->share('Model.Server.Load', [$this, 'getServerLoad'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Server Model Server Loader class
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return ServerLoad
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getServerLoad(Container $container): ServerLoad
|
||||
{
|
||||
return new ServerLoad(
|
||||
$container->get('Crypt'),
|
||||
$container->get('Table')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -51,9 +51,9 @@ abstract class Path
|
||||
}
|
||||
}
|
||||
// if just a string
|
||||
elseif (StringHelper::check($values) && strpos($values, '\\') !== false)
|
||||
elseif (StringHelper::check($values) && strpos((string) $values, '\\') !== false)
|
||||
{
|
||||
$values = str_replace('\\', '/', $values);
|
||||
$values = str_replace('\\', '/', (string) $values);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user