11<?php
22
3- $ local = collect (glob (config_path (" /*.php " )))
4- ->merge (glob (config_path (" **/*.php " )))
3+ $ local = collect (glob (config_path (' /*.php ' )))
4+ ->merge (glob (config_path (' **/*.php ' )))
55 ->map (fn ($ path ) => [
6- (string ) \ Illuminate \Support \Str::of ($ path )
7- ->replace ([config_path (" / " ), " .php " ], "" )
8- ->replace (" / " , " . " ),
9- $ path
6+ (string ) Illuminate \Support \Str::of ($ path )
7+ ->replace ([config_path (' / ' ), ' .php ' ], '' )
8+ ->replace (' / ' , ' . ' ),
9+ $ path,
1010 ]);
1111
12- $ vendor = collect (glob (base_path (" vendor/**/**/config/*.php " )))->map (fn (
12+ $ vendor = collect (glob (base_path (' vendor/**/**/config/*.php ' )))->map (fn (
1313 $ path
1414) => [
15- (string ) \ Illuminate \Support \Str::of ($ path )
16- ->afterLast (" /config/ " )
17- ->replace (" .php " , "" )
18- ->replace (" / " , " . " ),
19- $ path
15+ (string ) Illuminate \Support \Str::of ($ path )
16+ ->afterLast (' /config/ ' )
17+ ->replace (' .php ' , '' )
18+ ->replace (' / ' , ' . ' ),
19+ $ path,
2020]);
2121
2222$ configPaths = $ local
2323 ->merge ($ vendor )
2424 ->groupBy (0 )
25- ->map (fn ($ items )=> $ items ->pluck (1 ));
25+ ->map (fn ($ items ) => $ items ->pluck (1 ));
2626
2727$ cachedContents = [];
2828$ cachedParsed = [];
2929
30- function vsCodeGetConfigValue ($ value , $ key , $ configPaths ) {
31- $ parts = explode (". " , $ key );
30+ function vsCodeGetConfigValue ($ value , $ key , $ configPaths )
31+ {
32+ $ parts = explode ('. ' , $ key );
3233 $ toFind = $ key ;
3334 $ found = null ;
3435
3536 while (count ($ parts ) > 0 ) {
3637 array_pop ($ parts );
37- $ toFind = implode (" . " , $ parts );
38+ $ toFind = implode (' . ' , $ parts );
3839
3940 if ($ configPaths ->has ($ toFind )) {
4041 $ found = $ toFind ;
@@ -56,22 +57,22 @@ function vsCodeGetConfigValue($value, $key, $configPaths) {
5657 $ cachedContents [$ path ] ??= file_get_contents ($ path );
5758 $ cachedParsed [$ path ] ??= token_get_all ($ cachedContents [$ path ]);
5859
59- $ keysToFind = \ Illuminate \Support \Str::of ($ key )
60- ->replaceFirst ($ found , "" )
61- ->ltrim (" . " )
62- ->explode (" . " );
60+ $ keysToFind = Illuminate \Support \Str::of ($ key )
61+ ->replaceFirst ($ found , '' )
62+ ->ltrim (' . ' )
63+ ->explode (' . ' );
6364
6465 if (is_numeric ($ keysToFind ->last ())) {
6566 $ index = $ keysToFind ->pop ();
6667
67- if ($ index !== " 0 " ) {
68+ if ($ index !== ' 0 ' ) {
6869 return null ;
6970 }
7071
71- $ key = collect (explode (" . " , $ key ));
72+ $ key = collect (explode (' . ' , $ key ));
7273 $ key ->pop ();
73- $ key = $ key ->implode (" . " );
74- $ value = " array(...) " ;
74+ $ key = $ key ->implode (' . ' );
75+ $ value = ' array(...) ' ;
7576 }
7677
7778 $ nextKey = $ keysToFind ->shift ();
@@ -80,11 +81,11 @@ function vsCodeGetConfigValue($value, $key, $configPaths) {
8081 $ depth = 0 ;
8182
8283 foreach ($ cachedParsed [$ path ] as $ token ) {
83- if ($ token === " [ " ) {
84+ if ($ token === ' [ ' ) {
8485 $ depth ++;
8586 }
8687
87- if ($ token === " ] " ) {
88+ if ($ token === ' ] ' ) {
8889 $ depth --;
8990 }
9091
@@ -117,14 +118,14 @@ function vsCodeGetConfigValue($value, $key, $configPaths) {
117118 }
118119
119120 return [
120- " name " => $ key ,
121- " value " => $ value ,
122- " file " => $ file === null ? null : str_replace (base_path ('/ ' ), '' , $ file ),
123- " line " => $ line
121+ ' name ' => $ key ,
122+ ' value ' => $ value ,
123+ ' file ' => $ file === null ? null : str_replace (base_path ('/ ' ), '' , $ file ),
124+ ' line ' => $ line,
124125 ];
125126}
126127
127- return collect (\ Illuminate \Support \Arr::dot (config ()->all ()))
128+ return collect (Illuminate \Support \Arr::dot (config ()->all ()))
128129 ->map (fn ($ value , $ key ) => vsCodeGetConfigValue ($ value , $ key , $ configPaths ))
129130 ->filter ()
130131 ->values ();
0 commit comments