AsseticResource.php 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /*
  3. * This file is part of the Symfony framework.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. namespace Symfony\Bundle\AsseticBundle\Config;
  11. use Assetic\Factory\Resource\ResourceInterface as AsseticResourceInterface;
  12. use Symfony\Component\Config\Resource\ResourceInterface as SymfonyResourceInterface;
  13. /**
  14. * Turns an Assetic resource into a Symfony one.
  15. *
  16. * @author Kris Wallsmith <kris@symfony.com>
  17. */
  18. class AsseticResource implements SymfonyResourceInterface
  19. {
  20. private $resource;
  21. public function __construct(AsseticResourceInterface $resource)
  22. {
  23. $this->resource = $resource;
  24. }
  25. public function __toString()
  26. {
  27. return (string) $this->resource;
  28. }
  29. public function isFresh($timestamp)
  30. {
  31. return $this->resource->isFresh($timestamp);
  32. }
  33. /**
  34. * Returns the Assetic resource.
  35. *
  36. * @return AsseticResourceInterface The wrapped Assetic resource
  37. */
  38. public function getResource()
  39. {
  40. return $this->resource;
  41. }
  42. }