mirror of
https://github.com/there4/markdown-resume.git
synced 2024-12-03 08:59:35 -05:00
Initial commit of Markdown Resume
This includes several vendor libraries: Assetic, LessPHP, Mustache, SmartyPants, Markdown
This commit is contained in:
54
vendor/Assetic/Extension/Twig/TwigResource.php
vendored
Executable file
54
vendor/Assetic/Extension/Twig/TwigResource.php
vendored
Executable file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Assetic package, an OpenSky project.
|
||||
*
|
||||
* (c) 2010-2011 OpenSky Project Inc
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Assetic\Extension\Twig;
|
||||
|
||||
use Assetic\Factory\Resource\ResourceInterface;
|
||||
|
||||
/**
|
||||
* A Twig template resource.
|
||||
*
|
||||
* @author Kris Wallsmith <kris.wallsmith@gmail.com>
|
||||
*/
|
||||
class TwigResource implements ResourceInterface
|
||||
{
|
||||
private $loader;
|
||||
private $name;
|
||||
|
||||
public function __construct(\Twig_LoaderInterface $loader, $name)
|
||||
{
|
||||
$this->loader = $loader;
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
try {
|
||||
return $this->loader->getSource($this->name);
|
||||
} catch (\Twig_Error_Loader $e) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
public function isFresh($timestamp)
|
||||
{
|
||||
try {
|
||||
return $this->loader->isFresh($this->name, $timestamp);
|
||||
} catch (\Twig_Error_Loader $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user