class FileResource

A resource is something formulae can be loaded from.

@author Kris Wallsmith <kris.wallsmith@gmail.com>

Hierarchy

Expanded class hierarchy of FileResource

2 files declare their use of FileResource
FileResourceTest.php in drupal/core/vendor/kriswallsmith/assetic/tests/Assetic/Test/Factory/Resource/FileResourceTest.php
FunctionCallsFormulaLoaderTest.php in drupal/core/vendor/kriswallsmith/assetic/tests/Assetic/Test/Factory/Loader/FunctionCallsFormulaLoaderTest.php

File

drupal/core/vendor/kriswallsmith/assetic/src/Assetic/Factory/Resource/FileResource.php, line 19

Namespace

Assetic\Factory\Resource
View source
class FileResource implements ResourceInterface {
  private $path;

  /**
   * Constructor.
   *
   * @param string $path The path to a file
   */
  public function __construct($path) {
    $this->path = $path;
  }
  public function isFresh($timestamp) {
    return file_exists($this->path) && filemtime($this->path) <= $timestamp;
  }
  public function getContent() {
    return file_exists($this->path) ? file_get_contents($this->path) : '';
  }
  public function __toString() {
    return $this->path;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FileResource::$path private property
FileResource::getContent public function Returns the content of the resource. Overrides ResourceInterface::getContent
FileResource::isFresh public function Checks if a timestamp represents the latest resource. Overrides ResourceInterface::isFresh
FileResource::__construct public function Constructor.
FileResource::__toString public function Returns a unique string for the current resource. Overrides ResourceInterface::__toString