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:
60
vendor/Assetic/Factory/Worker/EnsureFilterWorker.php
vendored
Executable file
60
vendor/Assetic/Factory/Worker/EnsureFilterWorker.php
vendored
Executable file
@@ -0,0 +1,60 @@
|
||||
<?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\Factory\Worker;
|
||||
|
||||
use Assetic\Asset\AssetInterface;
|
||||
use Assetic\Filter\FilterInterface;
|
||||
|
||||
/**
|
||||
* Applies a filter to an asset based on a source and/or target path match.
|
||||
*
|
||||
* @author Kris Wallsmith <kris.wallsmith@gmail.com>
|
||||
* @todo A better asset-matcher mechanism
|
||||
*/
|
||||
class EnsureFilterWorker implements WorkerInterface
|
||||
{
|
||||
const CHECK_SOURCE = 1;
|
||||
const CHECK_TARGET = 2;
|
||||
|
||||
private $pattern;
|
||||
private $filter;
|
||||
private $flags;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $pattern A regex for checking the asset's target URL
|
||||
* @param FilterInterface $filter A filter to apply if the regex matches
|
||||
* @param integer $flags Flags for what to check
|
||||
*/
|
||||
public function __construct($pattern, FilterInterface $filter, $flags = null)
|
||||
{
|
||||
if (null === $flags) {
|
||||
$flags = self::CHECK_SOURCE | self::CHECK_TARGET;
|
||||
}
|
||||
|
||||
$this->pattern = $pattern;
|
||||
$this->filter = $filter;
|
||||
$this->flags = $flags;
|
||||
}
|
||||
|
||||
public function process(AssetInterface $asset)
|
||||
{
|
||||
if (
|
||||
(self::CHECK_SOURCE === (self::CHECK_SOURCE & $this->flags) && preg_match($this->pattern, $asset->getSourcePath()))
|
||||
||
|
||||
(self::CHECK_TARGET === (self::CHECK_TARGET & $this->flags) && preg_match($this->pattern, $asset->getTargetPath()))
|
||||
) {
|
||||
$asset->ensureFilter($this->filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
31
vendor/Assetic/Factory/Worker/WorkerInterface.php
vendored
Executable file
31
vendor/Assetic/Factory/Worker/WorkerInterface.php
vendored
Executable file
@@ -0,0 +1,31 @@
|
||||
<?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\Factory\Worker;
|
||||
|
||||
use Assetic\Asset\AssetInterface;
|
||||
|
||||
/**
|
||||
* Assets are passed through factory workers before leaving the factory.
|
||||
*
|
||||
* @author Kris Wallsmith <kris.wallsmith@gmail.com>
|
||||
*/
|
||||
interface WorkerInterface
|
||||
{
|
||||
/**
|
||||
* Processes an asset.
|
||||
*
|
||||
* @param AssetInterface $asset An asset
|
||||
*
|
||||
* @return AssetInterface|null May optionally return a replacement asset
|
||||
*/
|
||||
function process(AssetInterface $asset);
|
||||
}
|
||||
Reference in New Issue
Block a user