ResourceCheckerInterface.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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;
  11. use Symfony\Component\Config\Resource\ResourceInterface;
  12. /**
  13. * Interface for ResourceCheckers.
  14. *
  15. * When a ResourceCheckerConfigCache instance is checked for freshness, all its associated
  16. * metadata resources are passed to ResourceCheckers. The ResourceCheckers
  17. * can then inspect the resources and decide whether the cache can be considered
  18. * fresh or not.
  19. *
  20. * @author Matthias Pigulla <mp@webfactory.de>
  21. * @author Benjamin Klotz <bk@webfactory.de>
  22. */
  23. interface ResourceCheckerInterface
  24. {
  25. /**
  26. * Queries the ResourceChecker whether it can validate a given
  27. * resource or not.
  28. *
  29. * @return bool True if the ResourceChecker can handle this resource type, false if not
  30. */
  31. public function supports(ResourceInterface $metadata);
  32. /**
  33. * Validates the resource.
  34. *
  35. * @param int $timestamp The timestamp at which the cache associated with this resource was created
  36. *
  37. * @return bool True if the resource has not changed since the given timestamp, false otherwise
  38. */
  39. public function isFresh(ResourceInterface $resource, int $timestamp);
  40. }