ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
AssetManager.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 $assets = array();
24 
34  public function get($name)
35  {
36  if (!isset($this->assets[$name])) {
37  throw new \InvalidArgumentException(sprintf('There is no "%s" asset.', $name));
38  }
39 
40  return $this->assets[$name];
41  }
42 
50  public function has($name)
51  {
52  return isset($this->assets[$name]);
53  }
54 
63  public function set($name, AssetInterface $asset)
64  {
65  if (!ctype_alnum(str_replace('_', '', $name))) {
66  throw new \InvalidArgumentException(sprintf('The name "%s" is invalid.', $name));
67  }
68 
69  $this->assets[$name] = $asset;
70  }
71 
77  public function getNames()
78  {
79  return array_keys($this->assets);
80  }
81 
85  public function clear()
86  {
87  $this->assets = array();
88  }
89 }
Manages assets.
getNames()
Returns an array of asset names.
An asset has a mutable URL and content and can be loaded and dumped.
Create styles array
The data for the language used.
clear()
Clears all assets.
Class CssCacheBustingFilter.
has($name)
Checks if the current asset manager has a certain asset.