Skip to content

Commit

Permalink
Merge pull request #271 from Padam87/fix-isfresh
Browse files Browse the repository at this point in the history
Fixed ServiceFilesResource pattern finder
  • Loading branch information
GuilhemN authored May 31, 2017
2 parents 21a2f9b + 9f6dad1 commit bd261ce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Config/ServiceFilesResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,19 @@ class ServiceFilesResource extends InternalResource
private $files;
private $dirs;
private $disableGrep;
private $pattern;

public function __construct(array $files, array $dirs, $disableGrep)
public function __construct(array $files, array $dirs, $disableGrep, $pattern = 'JMS\DiExtraBundle\Annotation')
{
$this->files = $files;
$this->dirs = $dirs;
$this->disableGrep = $disableGrep;
$this->pattern = $pattern;
}

public function isFresh($timestamp)
{
$finder = new PatternFinder('JMS\DiExtraBundle\Annotation', '*.php', $this->disableGrep);
$finder = new PatternFinder($this->pattern, '*.php', $this->disableGrep);
$files = $finder->findFiles($this->dirs);

return !array_diff($files, $this->files) && !array_diff($this->files, $files);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private function handlePattern(ContainerBuilder $container, $directories, $patte
{
$finder = new PatternFinder($pattern, '*.php', $disableGrep);
$files = $finder->findFiles($directories);
$container->addResource(new ServiceFilesResource($files, $directories, $disableGrep));
$container->addResource(new ServiceFilesResource($files, $directories, $disableGrep, $pattern));
foreach ($files as $file) {
$container->addResource(new FileResource($file));
require_once $file;
Expand Down

0 comments on commit bd261ce

Please sign in to comment.