mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-19 02:23:11 +00:00
composer fix-style
This commit is contained in:
committed by
github-actions[bot]
parent
1353c67516
commit
68688b98fa
+32
-31
@@ -1,40 +1,41 @@
|
||||
<?php
|
||||
|
||||
$local = collect(glob(config_path("/*.php")))
|
||||
->merge(glob(config_path("**/*.php")))
|
||||
$local = collect(glob(config_path('/*.php')))
|
||||
->merge(glob(config_path('**/*.php')))
|
||||
->map(fn ($path) => [
|
||||
(string) \Illuminate\Support\Str::of($path)
|
||||
->replace([config_path("/"), ".php"], "")
|
||||
->replace("/", "."),
|
||||
$path
|
||||
(string) Illuminate\Support\Str::of($path)
|
||||
->replace([config_path('/'), '.php'], '')
|
||||
->replace('/', '.'),
|
||||
$path,
|
||||
]);
|
||||
|
||||
$vendor = collect(glob(base_path("vendor/**/**/config/*.php")))->map(fn (
|
||||
$vendor = collect(glob(base_path('vendor/**/**/config/*.php')))->map(fn (
|
||||
$path
|
||||
) => [
|
||||
(string) \Illuminate\Support\Str::of($path)
|
||||
->afterLast("/config/")
|
||||
->replace(".php", "")
|
||||
->replace("/", "."),
|
||||
$path
|
||||
(string) Illuminate\Support\Str::of($path)
|
||||
->afterLast('/config/')
|
||||
->replace('.php', '')
|
||||
->replace('/', '.'),
|
||||
$path,
|
||||
]);
|
||||
|
||||
$configPaths = $local
|
||||
->merge($vendor)
|
||||
->groupBy(0)
|
||||
->map(fn ($items)=>$items->pluck(1));
|
||||
->map(fn ($items) => $items->pluck(1));
|
||||
|
||||
$cachedContents = [];
|
||||
$cachedParsed = [];
|
||||
|
||||
function vsCodeGetConfigValue($value, $key, $configPaths) {
|
||||
$parts = explode(".", $key);
|
||||
function vsCodeGetConfigValue($value, $key, $configPaths)
|
||||
{
|
||||
$parts = explode('.', $key);
|
||||
$toFind = $key;
|
||||
$found = null;
|
||||
|
||||
while (count($parts) > 0) {
|
||||
array_pop($parts);
|
||||
$toFind = implode(".", $parts);
|
||||
$toFind = implode('.', $parts);
|
||||
|
||||
if ($configPaths->has($toFind)) {
|
||||
$found = $toFind;
|
||||
@@ -56,22 +57,22 @@ function vsCodeGetConfigValue($value, $key, $configPaths) {
|
||||
$cachedContents[$path] ??= file_get_contents($path);
|
||||
$cachedParsed[$path] ??= token_get_all($cachedContents[$path]);
|
||||
|
||||
$keysToFind = \Illuminate\Support\Str::of($key)
|
||||
->replaceFirst($found, "")
|
||||
->ltrim(".")
|
||||
->explode(".");
|
||||
$keysToFind = Illuminate\Support\Str::of($key)
|
||||
->replaceFirst($found, '')
|
||||
->ltrim('.')
|
||||
->explode('.');
|
||||
|
||||
if (is_numeric($keysToFind->last())) {
|
||||
$index = $keysToFind->pop();
|
||||
|
||||
if ($index !== "0") {
|
||||
if ($index !== '0') {
|
||||
return null;
|
||||
}
|
||||
|
||||
$key = collect(explode(".", $key));
|
||||
$key = collect(explode('.', $key));
|
||||
$key->pop();
|
||||
$key = $key->implode(".");
|
||||
$value = "array(...)";
|
||||
$key = $key->implode('.');
|
||||
$value = 'array(...)';
|
||||
}
|
||||
|
||||
$nextKey = $keysToFind->shift();
|
||||
@@ -80,11 +81,11 @@ function vsCodeGetConfigValue($value, $key, $configPaths) {
|
||||
$depth = 0;
|
||||
|
||||
foreach ($cachedParsed[$path] as $token) {
|
||||
if ($token === "[") {
|
||||
if ($token === '[') {
|
||||
$depth++;
|
||||
}
|
||||
|
||||
if ($token === "]") {
|
||||
if ($token === ']') {
|
||||
$depth--;
|
||||
}
|
||||
|
||||
@@ -117,14 +118,14 @@ function vsCodeGetConfigValue($value, $key, $configPaths) {
|
||||
}
|
||||
|
||||
return [
|
||||
"name" => $key,
|
||||
"value" => $value,
|
||||
"file" => $file === null ? null : str_replace(base_path('/'), '', $file),
|
||||
"line" => $line
|
||||
'name' => $key,
|
||||
'value' => $value,
|
||||
'file' => $file === null ? null : str_replace(base_path('/'), '', $file),
|
||||
'line' => $line,
|
||||
];
|
||||
}
|
||||
|
||||
return collect(\Illuminate\Support\Arr::dot(config()->all()))
|
||||
return collect(Illuminate\Support\Arr::dot(config()->all()))
|
||||
->map(fn ($value, $key) => vsCodeGetConfigValue($value, $key, $configPaths))
|
||||
->filter()
|
||||
->values();
|
||||
|
||||
Reference in New Issue
Block a user