diff --git a/app/Factories/ConfigurationResolverFactory.php b/app/Factories/ConfigurationResolverFactory.php index cc26e50c..03fbd871 100644 --- a/app/Factories/ConfigurationResolverFactory.php +++ b/app/Factories/ConfigurationResolverFactory.php @@ -34,7 +34,9 @@ public static function fromIO($input, $output) { $path = $input->getArgument('path'); - $preset = resolve(ConfigurationJsonRepository::class)->preset(); + $localConfiguration = resolve(ConfigurationJsonRepository::class); + + $preset = $localConfiguration->preset(); if (! in_array($preset, static::$presets)) { abort(1, 'Preset not found.'); @@ -54,7 +56,7 @@ public static function fromIO($input, $output) 'dry-run' => $input->getOption('test'), 'path' => $path, 'path-mode' => ConfigurationResolver::PATH_MODE_OVERRIDE, - 'cache-file' => implode(DIRECTORY_SEPARATOR, [ + 'cache-file' => $localConfiguration->cacheFile() ?? implode(DIRECTORY_SEPARATOR, [ realpath(sys_get_temp_dir()), md5( app()->isProduction() diff --git a/app/Repositories/ConfigurationJsonRepository.php b/app/Repositories/ConfigurationJsonRepository.php index 5d1c7770..7b3e0515 100644 --- a/app/Repositories/ConfigurationJsonRepository.php +++ b/app/Repositories/ConfigurationJsonRepository.php @@ -16,7 +16,7 @@ class ConfigurationJsonRepository ]; /** - * Creates a new Configuration Json Repository instance. + * Create a new Configuration Json Repository instance. * * @param string|null $path * @param string|null $preset @@ -28,7 +28,7 @@ public function __construct(protected $path, protected $preset) } /** - * Gets the finder options. + * Get the finder options. * * @return array|string> */ @@ -40,7 +40,7 @@ public function finder() } /** - * Gets the rules options. + * Get the rules options. * * @return array */ @@ -50,7 +50,17 @@ public function rules() } /** - * Gets the preset option. + * Get the cache file location. + * + * @return string|null + */ + public function cacheFile() + { + return $this->get()['cache-file'] ?? null; + } + + /** + * Get the preset option. * * @return string */ @@ -60,7 +70,7 @@ public function preset() } /** - * Gets the configuration from the "pint.json" file. + * Get the configuration from the "pint.json" file. * * @return array|string> */