Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikbjorn committed Aug 14, 2014
1 parent 7912fb4 commit 7dacfef
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/LoaderBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,7 @@ public function build()
$this->addDefaultNormalizers();
}

$loader = $this->createNormalizerLoader();

if ($this->configuration) {
$loader = new ProcessorLoader($loader, $this->configuration);
}

$loader = new CacheLoader($loader, $this->resources);
$loader = new CacheLoader($this->createLoaderGraph(), $this->resources);
$loader->setCacheDir($this->cacheDir);
$loader->setDebug($this->debug);

Expand Down Expand Up @@ -135,6 +129,17 @@ public function addDefaultNormalizers()
return $this;
}

private function createLoaderGraph()
{
$loader = $this->createNormalizerLoader();

if ($this->configuration) {
return new ProcessorLoader($loader, $this->configuration);
}

return $loader;
}

private function createNormalizerLoader()
{
return new NormalizerLoader(new DelegatingLoader($this->resolver), $this->normalizer);
Expand Down

0 comments on commit 7dacfef

Please sign in to comment.