1<?php
2
3/*
4 * This file is part of the Assetic package, an OpenSky project.
5 *
6 * (c) 2010-2014 OpenSky Project Inc
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Assetic\Filter;
13
14use Assetic\Asset\AssetInterface;
15
16/**
17 * Inserts a separator between assets to prevent merge failures
18 * e.g. missing semicolon at the end of a JS file
19 *
20 * @author Robin McCorkell <rmccorkell@karoshi.org.uk>
21 */
22class SeparatorFilter implements FilterInterface
23{
24    /**
25     * @var string
26     */
27    private $separator;
28
29    /**
30     * Constructor.
31     *
32     * @param string $separator Separator to use between assets
33     */
34    public function __construct($separator = ';')
35    {
36        $this->separator = $separator;
37    }
38
39    public function filterLoad(AssetInterface $asset)
40    {
41    }
42
43    public function filterDump(AssetInterface $asset)
44    {
45        $asset->setContent($asset->getContent() . $this->separator);
46    }
47}
48