Documentation

LazyAssetManager extends AssetManager
in package

A lazy asset manager is a composition of a factory and many formula loaders.

Tags
author

Kris Wallsmith kris.wallsmith@gmail.com

Table of Contents

$assets  : mixed
$factory  : mixed
$formulae  : mixed
$loaded  : mixed
$loaders  : mixed
$loading  : mixed
$resources  : mixed
__construct()  : mixed
Constructor.
addResource()  : mixed
Adds a resource to the asset manager.
clear()  : mixed
Clears all assets.
get()  : AssetInterface
Gets an asset by name.
getFormula()  : array<string|int, mixed>
Returns an asset's formula.
getLastModified()  : mixed
getNames()  : array<string|int, mixed>
Returns an array of asset names.
getResources()  : array<string|int, mixed>
Returns an array of resources.
has()  : bool
Checks if the current asset manager has a certain asset.
hasFormula()  : bool
Checks for an asset formula.
isDebug()  : mixed
load()  : mixed
Loads formulae from resources.
set()  : mixed
Registers an asset to the current asset manager.
setFormula()  : mixed
Sets a formula on the asset manager.
setLoader()  : mixed
Adds a loader to the asset manager.

Properties

Methods

__construct()

Constructor.

public __construct(AssetFactory $factory[, array<string|int, mixed> $loaders = array() ]) : mixed
Parameters
$factory : AssetFactory

The asset factory

$loaders : array<string|int, mixed> = array()

An array of loaders indexed by alias

Return values
mixed

addResource()

Adds a resource to the asset manager.

public addResource(ResourceInterface $resource, string $loader) : mixed
Parameters
$resource : ResourceInterface

A resource

$loader : string

The loader alias for this resource

Return values
mixed

clear()

Clears all assets.

public clear() : mixed
Return values
mixed

getFormula()

Returns an asset's formula.

public getFormula(string $name) : array<string|int, mixed>
Parameters
$name : string

An asset name

Tags
throws
InvalidArgumentException

If there is no formula by that name

Return values
array<string|int, mixed>

The formula

getNames()

Returns an array of asset names.

public getNames() : array<string|int, mixed>
Return values
array<string|int, mixed>

An array of asset names

getResources()

Returns an array of resources.

public getResources() : array<string|int, mixed>
Return values
array<string|int, mixed>

An array of resources

has()

Checks if the current asset manager has a certain asset.

public has(mixed $name) : bool
Parameters
$name : mixed

an asset name

Return values
bool

True if the asset has been set, false if not

hasFormula()

Checks for an asset formula.

public hasFormula(string $name) : bool
Parameters
$name : string

An asset name

Return values
bool

If there is a formula

load()

Loads formulae from resources.

public load() : mixed
Tags
throws
LogicException

If a resource has been added to an invalid loader

Return values
mixed

set()

Registers an asset to the current asset manager.

public set(string $name, AssetInterface $asset) : mixed
Parameters
$name : string

The asset name

$asset : AssetInterface

The asset

Tags
throws
InvalidArgumentException

If the asset name is invalid

Return values
mixed

setFormula()

Sets a formula on the asset manager.

public setFormula(string $name, array<string|int, mixed> $formula) : mixed
Parameters
$name : string

An asset name

$formula : array<string|int, mixed>

A formula

Return values
mixed

Search results