ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
Assetic\Extension\Twig\TwigResource Class Reference

A Twig template resource. More...

+ Inheritance diagram for Assetic\Extension\Twig\TwigResource:
+ Collaboration diagram for Assetic\Extension\Twig\TwigResource:

Public Member Functions

 __construct (\Twig_LoaderInterface $loader, $name)
 
 getContent ()
 Returns the content of the resource. More...
 
 isFresh ($timestamp)
 Checks if a timestamp represents the latest resource. More...
 
 __toString ()
 Returns a unique string for the current resource. More...
 

Private Attributes

 $loader
 
 $name
 

Detailed Description

A Twig template resource.

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

Definition at line 21 of file TwigResource.php.

Constructor & Destructor Documentation

◆ __construct()

Assetic\Extension\Twig\TwigResource::__construct ( \Twig_LoaderInterface  $loader,
  $name 
)

Member Function Documentation

◆ __toString()

Assetic\Extension\Twig\TwigResource::__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 50 of file TwigResource.php.

References Assetic\Extension\Twig\TwigResource\$name.

◆ getContent()

Assetic\Extension\Twig\TwigResource::getContent ( )

Returns the content of the resource.

Returns
string The content

Implements Assetic\Factory\Resource\ResourceInterface.

Definition at line 32 of file TwigResource.php.

33  {
34  try {
35  return $this->loader->getSource($this->name);
36  } catch (\Twig_Error_Loader $e) {
37  return '';
38  }
39  }

◆ isFresh()

Assetic\Extension\Twig\TwigResource::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 41 of file TwigResource.php.

References $timestamp.

42  {
43  try {
44  return $this->loader->isFresh($this->name, $timestamp);
45  } catch (\Twig_Error_Loader $e) {
46  return false;
47  }
48  }
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81

Field Documentation

◆ $loader

Assetic\Extension\Twig\TwigResource::$loader
private

Definition at line 23 of file TwigResource.php.

Referenced by Assetic\Extension\Twig\TwigResource\__construct().

◆ $name

Assetic\Extension\Twig\TwigResource::$name
private

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