ILIAS  release_5-2 Revision v5.2.25-18-g3f80b82851
FilterManager.php
Go to the documentation of this file.
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 
12 namespace Assetic;
13 
15 
22 {
23  private $filters = array();
24 
25  public function set($alias, FilterInterface $filter)
26  {
27  $this->checkName($alias);
28 
29  $this->filters[$alias] = $filter;
30  }
31 
32  public function get($alias)
33  {
34  if (!isset($this->filters[$alias])) {
35  throw new \InvalidArgumentException(sprintf('There is no "%s" filter.', $alias));
36  }
37 
38  return $this->filters[$alias];
39  }
40 
41  public function has($alias)
42  {
43  return isset($this->filters[$alias]);
44  }
45 
46  public function getNames()
47  {
48  return array_keys($this->filters);
49  }
50 
58  protected function checkName($name)
59  {
60  if (!ctype_alnum(str_replace('_', '', $name))) {
61  throw new \InvalidArgumentException(sprintf('The name "%s" is invalid.', $name));
62  }
63  }
64 }
Manages the available filters.
A filter manipulates an asset at load and dump.
Create styles array
The data for the language used.
Class CssCacheBustingFilter.
checkName($name)
Checks that a name is valid.