diff --git a/src/Commands/Backend/Ignore/ManageCommand.php b/src/Commands/Backend/Ignore/ManageCommand.php
index 0776cb7b..14e0d300 100644
--- a/src/Commands/Backend/Ignore/ManageCommand.php
+++ b/src/Commands/Backend/Ignore/ManageCommand.php
@@ -126,7 +126,7 @@ HELP
if (true === ag_exists($list, (string)$id)) {
$output->writeln(
- replacer(
+ r(
'ERROR: Cannot add [{id}] as it\'s already exists. added at [{date}].',
[
'id' => $id,
@@ -139,7 +139,7 @@ HELP
if (true === ag_exists($list, (string)$id->withQuery(''))) {
$output->writeln(
- replacer(
+ r(
'ERROR: Cannot add [{id}] as [{global}] already exists. added at [{date}].',
[
'id' => (string)$id,
diff --git a/src/Commands/Config/ManageCommand.php b/src/Commands/Config/ManageCommand.php
index 45523903..153239c2 100644
--- a/src/Commands/Config/ManageCommand.php
+++ b/src/Commands/Config/ManageCommand.php
@@ -553,13 +553,13 @@ final class ManageCommand extends Command
TEXT;
- $text = replacer($text, ['type' => $importType]);
+ $text = r($text, ['type' => $importType]);
$question = new ConfirmationQuestion($text . PHP_EOL . '> ', false);
if (true === $helper->ask($input, $output, $question)) {
$output->writeln(
- replacer('Importing {type} from {name}', [
+ r('Importing {type} from {name}', [
'name' => $name,
'type' => $importType
])
diff --git a/src/Commands/State/BackupCommand.php b/src/Commands/State/BackupCommand.php
index 08086732..0894ae04 100644
--- a/src/Commands/State/BackupCommand.php
+++ b/src/Commands/State/BackupCommand.php
@@ -260,7 +260,7 @@ HELP
$fileName = $file;
}
- $fileName = replacer($fileName, [
+ $fileName = r($fileName, [
'backend' => ag($backend, 'name'),
'date' => makeDate()->format('Ymd'),
]);
diff --git a/src/Commands/System/EnvCommand.php b/src/Commands/System/EnvCommand.php
index 4abcc3b8..5fb8fbd1 100644
--- a/src/Commands/System/EnvCommand.php
+++ b/src/Commands/System/EnvCommand.php
@@ -22,7 +22,7 @@ final class EnvCommand extends Command
$this->setName(self::ROUTE)
->setDescription('Show loaded environment variables.')
->setHelp(
- replacer(
+ r(
<<addOption('dry-run', null, InputOption::VALUE_NONE, 'Do not commit changes.')
->addOption('force-reindex', 'f', InputOption::VALUE_NONE, 'Drop existing indexes, and re-create them.')
->setHelp(
- replacer(
+ r(
<<setAliases(['logs'])
->setDescription('View current logs.')
->setHelp(
- replacer(
+ r(
<<setDescription('Create database schema migration file.')
->addArgument('filename', InputArgument::REQUIRED, 'Migration name.')
->setHelp(
- replacer(
+ r(
<<setDescription('Generate php config.')
->addOption('fpm', null, InputOption::VALUE_NONE, 'Generate php-fpm config.')
->setHelp(
- replacer(
+ r(
<<php.ini] and [fpm] pool.
diff --git a/src/Commands/System/PruneCommand.php b/src/Commands/System/PruneCommand.php
index 7b8b6a19..33a65bbe 100644
--- a/src/Commands/System/PruneCommand.php
+++ b/src/Commands/System/PruneCommand.php
@@ -31,7 +31,7 @@ final class PruneCommand extends Command
->addOption('dry-run', null, InputOption::VALUE_NONE, 'Do not perform any actions on files.')
->setDescription('Remove automatically generated files.')
->setHelp(
- replacer(
+ r(
<<addOption('live', null, InputOption::VALUE_NONE, 'See output in real time.')
->setDescription('List & Run scheduled tasks.')
->setHelp(
- replacer(
+ r(
<<writeln(
- replacer('There are no task named [{task}].', [
+ r('There are no task named [{task}].', [
'task' => $task
])
);
@@ -156,7 +156,7 @@ HELP,
if (count($run) < 1) {
$output->writeln(
- replacer('[{datetime}] No task scheduled to run at this time.', [
+ r('[{datetime}] No task scheduled to run at this time.', [
'datetime' => makeDate(),
]),
iOutput::VERBOSITY_VERBOSE
@@ -205,16 +205,16 @@ HELP,
$this->write('--------------------------', $input, $output);
$this->write(
- replacer('Task: {name} (Started: {startDate})', [
+ r('Task: {name} (Started: {startDate})', [
'name' => $task['name'],
'startDate' => $started,
]),
$input,
$output
);
- $this->write(replacer('Command: {cmd}', ['cmd' => $process->getCommandLine()]), $input, $output);
+ $this->write(r('Command: {cmd}', ['cmd' => $process->getCommandLine()]), $input, $output);
$this->write(
- replacer('Exit Code: {code} (Ended: {endDate})', [
+ r('Exit Code: {code} (Ended: {endDate})', [
'code' => $process->getExitCode(),
'endDate' => $ended,
]),
diff --git a/src/Libs/Database/PDO/PDOIndexer.php b/src/Libs/Database/PDO/PDOIndexer.php
index f490a91f..b1930c15 100644
--- a/src/Libs/Database/PDO/PDOIndexer.php
+++ b/src/Libs/Database/PDO/PDOIndexer.php
@@ -47,7 +47,7 @@ final class PDOIndexer
foreach ($this->db->query($sql) as $row) {
$name = ag($row, 'name');
- $query = replacer($drop, ['name' => $name], '${', '}');
+ $query = r($drop, ['name' => $name], '${', '}');
$this->logger->debug('Dropping Index [%(index)].', [
'index' => $name,
'query' => $query,
@@ -62,7 +62,7 @@ final class PDOIndexer
continue;
}
- $query = replacer($insert, [
+ $query = r($insert, [
'name' => sprintf('state_%s', $column),
'expr' => sprintf('"%s"', $column),
], '${', '}');
@@ -78,7 +78,7 @@ final class PDOIndexer
// -- Ensure main parent/guids sub keys are indexed.
foreach (array_keys(Guid::getSupported()) as $subKey) {
foreach ([iState::COLUMN_PARENT, iState::COLUMN_GUIDS] as $column) {
- $query = replacer($insert, [
+ $query = r($insert, [
'name' => sprintf('state_%s_%s', $column, $subKey),
'expr' => sprintf("JSON_EXTRACT(%s,'$.%s')", $column, $subKey),
], '${', '}');
@@ -96,7 +96,7 @@ final class PDOIndexer
// -- Ensure backends metadata.id,metadata.show are indexed
foreach (array_keys(Config::get('servers', [])) as $backend) {
foreach (self::BACKEND_INDEXES as $subKey) {
- $query = replacer($insert, [
+ $query = r($insert, [
'name' => sprintf('state_%s_%s_%s', iState::COLUMN_META_DATA, $backend, $subKey),
'expr' => sprintf("JSON_EXTRACT(%s,'$.%s.%s')", iState::COLUMN_META_DATA, $backend, $subKey),
], '${', '}');
diff --git a/src/Libs/helpers.php b/src/Libs/helpers.php
index 9df8d9f1..612d7b21 100644
--- a/src/Libs/helpers.php
+++ b/src/Libs/helpers.php
@@ -626,8 +626,8 @@ if (false === function_exists('isIgnoredId')) {
}
}
-if (false === function_exists('replacer')) {
- function replacer(string $text, array $context = [], string $tagLeft = '{', string $tagRight = '}'): string
+if (false === function_exists('r')) {
+ function r(string $text, array $context = [], string $tagLeft = '{', string $tagRight = '}'): string
{
if (false === str_contains($text, $tagLeft) || false === str_contains($text, $tagRight)) {
return $text;