Skip to content

Commit

Permalink
Check if disabled cache before save file
Browse files Browse the repository at this point in the history
  • Loading branch information
artygrand authored and nikic committed Oct 12, 2016
1 parent 7b15535 commit 0bc7986
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ function cachedDispatcher(callable $routeDefinitionCallback, array $options = []

/** @var RouteCollector $routeCollector */
$dispatchData = $routeCollector->getData();
file_put_contents(
$options['cacheFile'],
'<?php return ' . var_export($dispatchData, true) . ';'
);
if (!$options['cacheDisabled']) {
file_put_contents(
$options['cacheFile'],
'<?php return ' . var_export($dispatchData, true) . ';'
);
}

return new $options['dispatcher']($dispatchData);
}
Expand Down

0 comments on commit 0bc7986

Please sign in to comment.