ILIAS  release_5-2 Revision v5.2.25-18-g3f80b82851
Assetic\Factory\Resource\FileResource Class Reference

A resource is something formulae can be loaded from. More...

+ Inheritance diagram for Assetic\Factory\Resource\FileResource:
+ Collaboration diagram for Assetic\Factory\Resource\FileResource:

Public Member Functions

 __construct ($path)
 Constructor. More...
 
 isFresh ($timestamp)
 Checks if a timestamp represents the latest resource. More...
 
 getContent ()
 Returns the content of the resource. More...
 
 __toString ()
 Returns a unique string for the current resource. More...
 

Private Attributes

 $path
 

Detailed Description

A resource is something formulae can be loaded from.

Author
Kris Wallsmith kris..nosp@m.wall.nosp@m.smith.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Definition at line 19 of file FileResource.php.

Constructor & Destructor Documentation

◆ __construct()

Assetic\Factory\Resource\FileResource::__construct (   $path)

Constructor.

Parameters
string$pathThe path to a file

Definition at line 28 of file FileResource.php.

References Assetic\Factory\Resource\FileResource\$path.

29  {
30  $this->path = $path;
31  }

Member Function Documentation

◆ __toString()

Assetic\Factory\Resource\FileResource::__toString ( )

Returns a unique string for the current resource.

Returns
string A unique string to identity the current resource

Implements Assetic\Factory\Resource\ResourceInterface.

Definition at line 43 of file FileResource.php.

References Assetic\Factory\Resource\FileResource\$path.

◆ getContent()

Assetic\Factory\Resource\FileResource::getContent ( )

Returns the content of the resource.

Returns
string The content

Implements Assetic\Factory\Resource\ResourceInterface.

Definition at line 38 of file FileResource.php.

39  {
40  return file_exists($this->path) ? file_get_contents($this->path) : '';
41  }

◆ isFresh()

Assetic\Factory\Resource\FileResource::isFresh (   $timestamp)

Checks if a timestamp represents the latest resource.

Parameters
integer$timestampA UNIX timestamp
Returns
Boolean True if the timestamp is up to date

Implements Assetic\Factory\Resource\ResourceInterface.

Definition at line 33 of file FileResource.php.

References $timestamp.

34  {
35  return file_exists($this->path) && filemtime($this->path) <= $timestamp;
36  }
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81

Field Documentation

◆ $path

Assetic\Factory\Resource\FileResource::$path
private

The documentation for this class was generated from the following file: