Skip to content

Commit

Permalink
Update src/Console/MakeSettingCommand.php
Browse files Browse the repository at this point in the history
Co-authored-by: Oleksandr Moik <50796878+Oleksandr-Moik@users.noreply.github.com>
  • Loading branch information
rubenvanassche and Oleksandr-Moik authored Mar 22, 2024
1 parent e0fe46d commit f50078c
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src/Console/MakeSettingCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,27 +108,27 @@ protected function getPath($name, $path): string
return $path . '/' . $name . '.php';
}

protected function getNamespace($path): string
{
$path = preg_replace(
[
'/^(' . preg_quote(base_path(), '/') . ')/',
'/\//',
],
[
'',
'\\',
],
$path
);

$namespace = implode('\\', array_map(fn ($directory) => ucfirst($directory), explode('\\', $path)));

// Remove leading backslash if present
if (substr($namespace, 0, 1) === '\\') {
$namespace = substr($namespace, 1);
}
protected function getNamespace($path): string
{
$path = preg_replace(
[
'/^(' . preg_quote(base_path(), '/') . ')/',
'/\//',
],
[
'',
'\\',
],
$path
);

return $namespace;
}
$namespace = implode('\\', array_map(fn ($directory) => ucfirst($directory), explode('\\', $path)));

// Remove leading backslash if present
if (substr($namespace, 0, 1) === '\\') {
$namespace = substr($namespace, 1);
}

return $namespace;
}
}

0 comments on commit f50078c

Please sign in to comment.