SelfCheckingResourceChecker.php 998 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Config\Resource;
  11. use Symfony\Component\Config\ResourceCheckerInterface;
  12. /**
  13. * Resource checker for instances of SelfCheckingResourceInterface.
  14. *
  15. * As these resources perform the actual check themselves, we can provide
  16. * this class as a standard way of validating them.
  17. *
  18. * @author Matthias Pigulla <mp@webfactory.de>
  19. */
  20. class SelfCheckingResourceChecker implements ResourceCheckerInterface
  21. {
  22. public function supports(ResourceInterface $metadata)
  23. {
  24. return $metadata instanceof SelfCheckingResourceInterface;
  25. }
  26. public function isFresh(ResourceInterface $resource, int $timestamp)
  27. {
  28. /* @var SelfCheckingResourceInterface $resource */
  29. return $resource->isFresh($timestamp);
  30. }
  31. }