StringAsset.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /*
  3. * This file is part of the Assetic package, an OpenSky project.
  4. *
  5. * (c) 2010-2011 OpenSky Project Inc
  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 Assetic\Asset;
  11. use Assetic\Filter\FilterInterface;
  12. /**
  13. * Represents a string asset.
  14. *
  15. * @author Kris Wallsmith <kris.wallsmith@gmail.com>
  16. */
  17. class StringAsset extends BaseAsset
  18. {
  19. private $content;
  20. private $lastModified;
  21. /**
  22. * Constructor.
  23. *
  24. * @param string $content The content of the asset
  25. * @param array $filters Filters for the asset
  26. * @param string $sourceRoot The source asset root directory
  27. * @param string $sourcePath The source asset path
  28. */
  29. public function __construct($content, $filters = array(), $sourceRoot = null, $sourcePath = null)
  30. {
  31. $this->content = $content;
  32. parent::__construct($filters, $sourceRoot, $sourcePath);
  33. }
  34. public function load(FilterInterface $additionalFilter = null)
  35. {
  36. $this->doLoad($this->content, $additionalFilter);
  37. }
  38. public function setLastModified($lastModified)
  39. {
  40. $this->lastModified = $lastModified;
  41. }
  42. public function getLastModified()
  43. {
  44. return $this->lastModified;
  45. }
  46. }