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
14abstract class BaseNodeFilter extends BaseProcessFilter
15{
16    private $nodePaths = array();
17
18    public function getNodePaths()
19    {
20        return $this->nodePaths;
21    }
22
23    public function setNodePaths(array $nodePaths)
24    {
25        $this->nodePaths = $nodePaths;
26    }
27
28    public function addNodePath($nodePath)
29    {
30        $this->nodePaths[] = $nodePath;
31    }
32
33    protected function createProcessBuilder(array $arguments = array())
34    {
35        $pb = parent::createProcessBuilder($arguments);
36
37        if ($this->nodePaths) {
38            $this->mergeEnv($pb);
39            $pb->setEnv('NODE_PATH', implode(PATH_SEPARATOR, $this->nodePaths));
40        }
41
42        return $pb;
43    }
44}
45