MiniAsset\AssetCollection::get PHP Method

get() public method

Get an asset from the collection
public get ( string $name ) : null | AssetTarget
$name string The name of the asset you want.
return null | AssetTarget Either null or the asset target.
    public function get($name)
    {
        if (!isset($this->indexed[$name])) {
            return null;
        }
        if (empty($this->indexed[$name])) {
            $this->indexed[$name] = $this->factory->target($name);
        }
        return $this->indexed[$name];
    }

Usage Example

 public function testGet()
 {
     $collection = new AssetCollection(['libs.js', 'all.css'], $this->factory);
     $this->assertNull($collection->get('nope.js'));
     $this->assertInstanceOf('MiniAsset\\AssetTarget', $collection->get('libs.js'));
 }