ResourceInterface.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. /**
  12. * ResourceInterface is the interface that must be implemented by all Resource classes.
  13. *
  14. * @author Fabien Potencier <fabien@symfony.com>
  15. */
  16. interface ResourceInterface
  17. {
  18. /**
  19. * Returns a string representation of the Resource.
  20. *
  21. * This method is necessary to allow for resource de-duplication, for example by means
  22. * of array_unique(). The string returned need not have a particular meaning, but has
  23. * to be identical for different ResourceInterface instances referring to the same
  24. * resource; and it should be unlikely to collide with that of other, unrelated
  25. * resource instances.
  26. *
  27. * @return string A string representation unique to the underlying Resource
  28. */
  29. public function __toString();
  30. /**
  31. * Returns true if the resource has not been updated since the given timestamp.
  32. *
  33. * @param int $timestamp The last time the resource was loaded
  34. *
  35. * @return bool True if the resource has not been updated, false otherwise
  36. *
  37. * @deprecated since 2.8, to be removed in 3.0. If your resource can check itself for
  38. * freshness implement the SelfCheckingResourceInterface instead.
  39. */
  40. public function isFresh($timestamp);
  41. /**
  42. * Returns the tied resource.
  43. *
  44. * @return mixed The resource
  45. *
  46. * @deprecated since 2.8, to be removed in 3.0. As there are many different kinds of resource,
  47. * a single getResource() method does not make sense at the interface level. You
  48. * can still call getResource() on implementing classes, probably after performing
  49. * a type check. If you know the concrete type of Resource at hand, the return value
  50. * of this method may make sense to you.
  51. */
  52. public function getResource();
  53. }