Skip to content

Commit

Permalink
Create cache when requested
Browse files Browse the repository at this point in the history
  • Loading branch information
francoism90 committed Feb 22, 2024
1 parent 47a4ae6 commit feda214
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Discover.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,10 @@ 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->config->cacheDriver->has($this->config->cacheId)
? $this->config->cacheDriver->get($this->config->cacheId)
: $this->cache();
}

return $this->getWithoutCache();
Expand Down

0 comments on commit feda214

Please sign in to comment.