Skip to content

Commit

Permalink
Merge pull request #18 from francoism90/main
Browse files Browse the repository at this point in the history
Create cache when requested (fixes #17)
  • Loading branch information
rubenvanassche committed Mar 13, 2024
2 parents 47a4ae6 + e8b6491 commit c1ee013
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Discover.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,13 @@ public function useReflection(?string $basePath = null, ?string $rootNamespace =
/** @return array<DiscoveredStructure>|array<string> */
public function get(): array
{
if ($this->config->shouldUseCache() && $this->config->cacheDriver->has($this->config->cacheId)) {
return $this->config->cacheDriver->get($this->config->cacheId);
if (! $this->config->shouldUseCache()) {
return $this->getWithoutCache();
}

return $this->getWithoutCache();
return $this->config->cacheDriver->has($this->config->cacheId)
? $this->config->cacheDriver->get($this->config->cacheId)
: $this->cache();
}

/** @return array<DiscoveredStructure>|array<string> */
Expand Down

0 comments on commit c1ee013

Please sign in to comment.