Skip to content

Commit 249cc2f

Browse files
committed
Extract helper method
1 parent e3c8441 commit 249cc2f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

packages/framework/src/Foundation/Internal/LoadConfiguration.php

+9-9
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,22 @@ private function loadRuntimeConfiguration(Application $app, RepositoryContract $
8383
{
8484
if ($app->runningInConsole()) {
8585
if ($this->getArgv() !== null) {
86-
// Check if the `--pretty-urls` CLI argument is set, and if so, set the config value accordingly.
87-
if (in_array('--pretty-urls', $this->getArgv(), true)) {
88-
$repository->set('hyde.pretty_urls', true);
89-
}
90-
91-
// Check if the `--no-api` CLI argument is set, and if so, set the config value accordingly.
92-
if (in_array('--no-api', $this->getArgv(), true)) {
93-
$repository->set('hyde.api_calls', false);
94-
}
86+
$this->mergeCommandLineArguments($repository, '--pretty-urls', 'hyde.pretty_urls');
87+
$this->mergeCommandLineArguments($repository, '--no-api', 'hyde.api_calls');
9588
}
9689

9790
$this->mergeRealtimeCompilerEnvironment($repository, 'HYDE_SERVER_DASHBOARD', 'hyde.server.dashboard.enabled');
9891
$this->mergeRealtimeCompilerEnvironment($repository, 'HYDE_PRETTY_URLS', 'hyde.pretty_urls');
9992
}
10093
}
10194

95+
private function mergeCommandLineArguments(RepositoryContract $repository, string $argumentName, string $configKey): void
96+
{
97+
if (in_array($argumentName, $this->getArgv(), true)) {
98+
$repository->set($configKey, true);
99+
}
100+
}
101+
102102
private function mergeRealtimeCompilerEnvironment(RepositoryContract $repository, string $environmentKey, string $configKey): void
103103
{
104104
if ($this->getEnv($environmentKey) !== false) {

0 commit comments

Comments
 (0)