@@ -22,10 +22,10 @@ public function register()
2222 $ this ->app ->singleton (DusterConfig::class, function () {
2323 $ input = $ this ->app ->get (InputInterface::class);
2424
25- $ dusterConfig = $ this -> getDusterConfig ();
25+ $ dusterConfig = DusterConfig:: all ();
2626
2727 return new DusterConfig ([
28- 'paths ' => $ input-> getArgument ( ' path ' ),
28+ 'paths ' => Project:: paths ( $ input ),
2929 'lint ' => $ input ->getOption ('lint ' ),
3030 'fix ' => $ input ->getOption ('fix ' ),
3131 'using ' => $ input ->getOption ('using ' ),
@@ -42,7 +42,7 @@ public function register()
4242
4343 $ using = $ input ->getOption ('using ' )
4444 ? explode (', ' , $ input ->getOption ('using ' ))
45- : ['tlint ' , 'phpcs ' , 'php-cs-fixer ' , 'pint ' , ...array_keys ($ this -> getDusterConfig ()['scripts ' ][$ mode ] ?? [])];
45+ : ['tlint ' , 'phpcs ' , 'php-cs-fixer ' , 'pint ' , ...array_keys (DusterConfig:: all ()['scripts ' ][$ mode ] ?? [])];
4646
4747 $ tools = collect ($ using )
4848 ->map (fn ($ using ): Tool => match (trim ($ using )) {
@@ -65,25 +65,9 @@ public function register()
6565 });
6666 }
6767
68- /**
69- * @return array<string, mixed>
70- */
71- private function getDusterConfig (): array
72- {
73- if (file_exists (Project::path () . '/duster.json ' )) {
74- return tap (json_decode (file_get_contents (Project::path () . '/duster.json ' ), true , 512 , JSON_THROW_ON_ERROR ), function ($ configuration ) {
75- if (! is_array ($ configuration )) {
76- abort (1 , 'The configuration file duster.json is not valid JSON. ' );
77- }
78- });
79- }
80-
81- return [];
82- }
83-
8468 private function userScript (string $ mode , string $ scriptName ): ?UserScript
8569 {
86- $ userScript = $ this -> getDusterConfig ()['scripts ' ][$ mode ][$ scriptName ] ?? null ;
70+ $ userScript = DusterConfig:: all ()['scripts ' ][$ mode ][$ scriptName ] ?? null ;
8771
8872 return $ userScript
8973 ? new UserScript ($ scriptName , $ userScript , resolve (DusterConfig::class))
0 commit comments