public function single(\Closure $closure)
    {
        if ($this->asset === null) {
            $this->asset = function ($asset = null, $assetManager = null) use ($closure) {
                static $obj;
                if ($obj === null) {
                    $obj = $this->validate($closure($asset, $assetManager));
                }
                return $obj;
            };
        }
        return $this;
    }
public function single(\Closure $closure)
    {
        if ($this->asset === null) {
            $this->asset = function ($asset = null, $assetManager = null) use ($closure) {
                static $obj;
                if ($obj === null) {
                    $obj = $this->validate($closure($asset, $assetManager));
                }
                return $obj;
            };
        }
        return $this;
    }
public function single ( \ Closure $ closure ) { if ( $ this -> asset === null ) { $ this -> asset = function ( $ asset = null , $ assetManager = null ) use ( $ closure ) { static $ obj ; if ( $ obj === null ) { $ obj = $ this -> validate ( $ closure ( $ asset , $ assetManager ) ) ; } return $ obj ; } ; } return $ this ; }
Store an asset in such a way that when it is retrieved it will always return
the same instance.

Here we wrap a closure within a closure and store the returned value (an asset)
of the inner closure within a static variable in the outer closure. This insures
that whenever this Asset is retrieved it will always return the same instance.

<code>
$foo = (new Asset('Foo'))->single(function() {
return new Foo;
});
</code>

@param closure $closure
Store an asset in such a way that when it is retrieved it will always return the same instance .