Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/Console/Command/AbstractCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ protected function resetPromptEnvironment(): void

/**
* Safely get environment variable with sanitization
*
* @param string $name
* @return string|null
*/
private function getEnvVar(string $name): ?string
{
Expand All @@ -281,6 +284,9 @@ private function getEnvVar(string $name): ?string

/**
* Securely retrieve environment variable without direct superglobal access
*
* @param string $name
* @return string|null
*/
private function getSecureEnvironmentValue(string $name): ?string
{
Expand Down Expand Up @@ -329,6 +335,10 @@ private function getCachedEnvironmentVariables(): array

/**
* Sanitize environment value based on variable type
*
* @param string $name
* @param string $value
* @return string|null
*/
private function sanitizeEnvironmentValue(string $name, string $value): ?string
{
Expand All @@ -343,6 +353,9 @@ private function sanitizeEnvironmentValue(string $name, string $value): ?string

/**
* Sanitize numeric values (COLUMNS, LINES)
*
* @param string $value
* @return string|null
*/
private function sanitizeNumericValue(string $value): ?string
{
Expand All @@ -352,6 +365,9 @@ private function sanitizeNumericValue(string $value): ?string

/**
* Sanitize terminal type values
*
* @param string $value
* @return string|null
*/
private function sanitizeTermValue(string $value): ?string
{
Expand All @@ -364,6 +380,9 @@ private function sanitizeTermValue(string $value): ?string

/**
* Sanitize boolean-like values
*
* @param string $value
* @return string|null
*/
private function sanitizeBooleanValue(string $value): ?string
{
Expand All @@ -373,6 +392,9 @@ private function sanitizeBooleanValue(string $value): ?string

/**
* Sanitize alphanumeric values
*
* @param string $value
* @return string|null
*/
private function sanitizeAlphanumericValue(string $value): ?string
{
Expand All @@ -385,6 +407,9 @@ private function sanitizeAlphanumericValue(string $value): ?string

/**
* Safely get server variable with sanitization
*
* @param string $name
* @return string|null
*/
private function getServerVar(string $name): ?string
{
Expand All @@ -403,6 +428,10 @@ private function getServerVar(string $name): ?string

/**
* Safely set environment variable with validation
*
* @param string $name
* @param string $value
* @return void
*/
private function setEnvVar(string $name, string $value): void
{
Expand All @@ -419,6 +448,10 @@ private function setEnvVar(string $name, string $value): void

/**
* Securely store environment variable without direct superglobal access
*
* @param string $name
* @param string $value
* @return void
*/
private function setSecureEnvironmentValue(string $name, string $value): void
{
Expand All @@ -436,6 +469,9 @@ private function clearEnvironmentCache(): void

/**
* Securely remove environment variable from cache
*
* @param string $name
* @return void
*/
private function removeSecureEnvironmentValue(string $name): void
{
Expand Down
7 changes: 7 additions & 0 deletions src/Console/Command/Dev/InspectorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ class InspectorCommand extends AbstractCommand
private const XML_PATH_INSPECTOR_ENABLED = 'dev/mageforge_inspector/enabled';
private const ARGUMENT_ACTION = 'action';

/**
* @param WriterInterface $configWriter
* @param State $state
* @param CacheManager $cacheManager
* @param ScopeConfigInterface $scopeConfig
* @param string|null $name
*/
public function __construct(
private readonly WriterInterface $configWriter,
private readonly State $state,
Expand Down
31 changes: 31 additions & 0 deletions src/Console/Command/Hyva/CompatibilityCheckCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,20 @@ class CompatibilityCheckCommand extends AbstractCommand
private const SCOPE_THIRD_PARTY = 'third-party';
private const SCOPE_ALL = 'all';

/**
* @param CompatibilityChecker $compatibilityChecker
*/
public function __construct(
private readonly CompatibilityChecker $compatibilityChecker
) {
parent::__construct();
}

/**
* Configure command options.
*
* @return void
*/
protected function configure(): void
{
$this->setName($this->getCommandName('hyva', 'compatibility:check'))
Expand Down Expand Up @@ -71,6 +79,13 @@ protected function configure(): void
);
}

/**
* Execute compatibility check command.
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function executeCommand(InputInterface $input, OutputInterface $output): int
{
// Check if we're in interactive mode (no options provided)
Expand All @@ -88,6 +103,10 @@ protected function executeCommand(InputInterface $input, OutputInterface $output

/**
* Run interactive mode with Laravel Prompts
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
private function runInteractiveMode(InputInterface $input, OutputInterface $output): int
{
Expand Down Expand Up @@ -168,6 +187,10 @@ private function runInteractiveMode(InputInterface $input, OutputInterface $outp

/**
* Run direct mode with command line options
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
private function runDirectMode(InputInterface $input, OutputInterface $output): int
{
Expand All @@ -183,6 +206,14 @@ private function runDirectMode(InputInterface $input, OutputInterface $output):

/**
* Run the actual compatibility scan
*
* @param bool $showAll
* @param bool $thirdPartyOnly
* @param bool $includeVendor
* @param bool $detailed
* @param bool $incompatibleOnly
* @param OutputInterface $output
* @return int
*/
private function runScan(
bool $showAll,
Expand Down
10 changes: 8 additions & 2 deletions src/Console/Command/System/CheckCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ public function __construct(
}

/**
* {@inheritdoc}
* Configure command.
*
* @return void
*/
protected function configure(): void
{
Expand All @@ -51,7 +53,11 @@ protected function configure(): void
}

/**
* {@inheritdoc}
* Execute command.
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function executeCommand(InputInterface $input, OutputInterface $output): int
{
Expand Down
10 changes: 8 additions & 2 deletions src/Console/Command/System/VersionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public function __construct(
}

/**
* {@inheritdoc}
* Configure command.
*
* @return void
*/
protected function configure(): void
{
Expand All @@ -39,7 +41,11 @@ protected function configure(): void
}

/**
* {@inheritdoc}
* Execute command.
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function executeCommand(InputInterface $input, OutputInterface $output): int
{
Expand Down
10 changes: 8 additions & 2 deletions src/Console/Command/Theme/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ public function __construct(
}

/**
* {@inheritdoc}
* Configure command.
*
* @return void
*/
protected function configure(): void
{
Expand All @@ -54,7 +56,11 @@ protected function configure(): void
}

/**
* {@inheritdoc}
* Execute command.
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function executeCommand(InputInterface $input, OutputInterface $output): int
{
Expand Down
10 changes: 8 additions & 2 deletions src/Console/Command/Theme/CleanCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ public function __construct(
}

/**
* {@inheritdoc}
* Configure command.
*
* @return void
*/
protected function configure(): void
{
Expand All @@ -64,7 +66,11 @@ protected function configure(): void
}

/**
* {@inheritdoc}
* Execute command.
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function executeCommand(InputInterface $input, OutputInterface $output): int
{
Expand Down
10 changes: 8 additions & 2 deletions src/Console/Command/Theme/ListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ public function __construct(
}

/**
* {@inheritdoc}
* Configure command.
*
* @return void
*/
protected function configure(): void
{
Expand All @@ -36,7 +38,11 @@ protected function configure(): void
}

/**
* {@inheritdoc}
* Execute command.
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int
*/
protected function executeCommand(InputInterface $input, OutputInterface $output): int
{
Expand Down
Loading
Loading