Skip to content

Commit

Permalink
Storage objects made static
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonferens committed Nov 4, 2024
1 parent 90deca6 commit 2e94512
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/Generators/EnumGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

class EnumGenerator
{
protected Filesystem $cache;
protected static Filesystem $cache;

protected Filesystem $files;
protected static Filesystem $files;

protected ReflectionEnum $reflector;

Expand All @@ -27,11 +27,11 @@ class EnumGenerator
*/
public function __construct(protected ReflectionEnum $enum, protected EnumBuilder $builder)
{
$this->files = Storage::createLocalDriver([
static::$files = Storage::createLocalDriver([
'root' => resource_path(config()->string('paragon.enums.paths.generated')),
]);

$this->cache = Storage::createLocalDriver([
static::$cache = Storage::createLocalDriver([
'root' => storage_path('framework/cache/paragon'),
]);
}
Expand All @@ -42,7 +42,7 @@ public function __invoke(): bool
return false;
}

$this->files->put($this->path(), $this->contents());
static::$files->put($this->path(), $this->contents());

$this->cacheEnum();

Expand Down Expand Up @@ -217,7 +217,7 @@ protected function path(): string

protected function generatedFileExists(): bool
{
return $this->files->exists($this->path());
return static::$files->exists($this->path());
}

/*
Expand All @@ -228,7 +228,7 @@ protected function generatedFileExists(): bool

protected function cached(): bool
{
return $this->cache->get($this->hashFilename()) === $this->hashFile();
return static::$cache->get($this->hashFilename()) === $this->hashFile();
}

protected function hashFilename(): string
Expand All @@ -243,6 +243,6 @@ protected function hashFile(): string

protected function cacheEnum(): void
{
$this->cache->put($this->hashFilename(), $this->hashFile());
static::$cache->put($this->hashFilename(), $this->hashFile());
}
}

0 comments on commit 2e94512

Please sign in to comment.