ResourceCheckerInterface.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. * @param ResourceInterface $metadata The resource to be checked for freshness
  30. *
  31. * @return bool True if the ResourceChecker can handle this resource type, false if not
  32. */
  33. public function supports(ResourceInterface $metadata);
  34. /**
  35. * Validates the resource.
  36. *
  37. * @param ResourceInterface $resource The resource to be validated
  38. * @param int $timestamp The timestamp at which the cache associated with this resource was created
  39. *
  40. * @return bool True if the resource has not changed since the given timestamp, false otherwise
  41. */
  42. public function isFresh(ResourceInterface $resource, $timestamp);
  43. }