kekrozsak/vendor/kriswallsmith/assetic/src/Assetic/Filter/CallablesFilter.php

46 lines
964 B
PHP

<?php
/*
* This file is part of the Assetic package, an OpenSky project.
*
* (c) 2010-2012 OpenSky Project Inc
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Assetic\Filter;
use Assetic\Asset\AssetInterface;
/**
* A filter that wraps callables.
*
* @author Kris Wallsmith <kris.wallsmith@gmail.com>
*/
class CallablesFilter implements FilterInterface
{
private $loader;
private $dumper;
public function __construct($loader = null, $dumper = null)
{
$this->loader = $loader;
$this->dumper = $dumper;
}
public function filterLoad(AssetInterface $asset)
{
if (null !== $callable = $this->loader) {
$callable($asset);
}
}
public function filterDump(AssetInterface $asset)
{
if (null !== $callable = $this->dumper) {
$callable($asset);
}
}
}