revert back to more sensible architecture.

This commit is contained in:
Taylor Otwell
2011-09-20 23:14:09 -05:00
parent 47db2ff19b
commit 4525eae25a
33 changed files with 1050 additions and 1558 deletions

View File

@@ -7,25 +7,7 @@ class Asset {
*
* @var array
*/
public $containers = array();
/**
* The HTML writer instance.
*
* @var HTML
*/
protected $html;
/**
* Create a new asset manager instance.
*
* @param HTML $html
* @return void
*/
public function __construct(HTML $html)
{
$this->html = $html;
}
protected static $containers = array();
/**
* Get an asset container instance.
@@ -45,14 +27,14 @@ class Asset {
* @param string $container
* @return Asset_Container
*/
public function container($container = 'default')
public static function container($container = 'default')
{
if ( ! isset($this->containers[$container]))
if ( ! isset(static::$containers[$container]))
{
$this->containers[$container] = new Asset_Container($container, $this->html);
static::$containers[$container] = new Asset_Container($container);
}
return $this->containers[$container];
return static::$containers[$container];
}
/**
@@ -66,9 +48,9 @@ class Asset {
* echo Asset::styles();
* </code>
*/
public function __call($method, $parameters)
public static function __callStatic($method, $parameters)
{
return call_user_func_array(array($this->container(), $method), $parameters);
return call_user_func_array(array(static::container(), $method), $parameters);
}
}
@@ -89,13 +71,6 @@ class Asset_Container {
*/
public $assets = array();
/**
* The HTML writer instance.
*
* @var HTML
*/
protected $html;
/**
* Create a new asset container instance.
*
@@ -103,10 +78,9 @@ class Asset_Container {
* @param HTML $html
* @return void
*/
public function __construct($name, HTML $html)
public function __construct($name)
{
$this->name = $name;
$this->html = $html;
}
/**
@@ -275,7 +249,7 @@ class Asset_Container {
$asset = $this->assets[$group][$name];
return $this->html->$group($asset['source'], $asset['attributes']);
return HTML::$group($asset['source'], $asset['attributes']);
}
/**