class AssetManager extends Twig_Extension implements Twig_Extension_GlobalsInterface (View source)

Attire Asset Manager Class

Traits

Attire Filekit Trait
Attire Extractor Trait

Methods

static bool
rtrim(string $path, string $delimiter = '/')

Right trim a file path.

from FileKit
static bool
haveExtension(string $file)

Check if file have extension.

from FileKit
static bool
isValidFileExtension(string $ext)

Check if the file have a valid extension.

from FileKit
static 
setFileExtension(string $ext)

Set a new file extension.

from FileKit
static string
getFileExtension()

Get current file extension.

from FileKit
static 
initialize(array $options = [])

Class constructor.

static 
setNamespace(string $namespace)

Set namespace.

static 
setManifest(string|array $manifest)

Set manifest.

debug(bool $state = true)

Set debug flag.

static 
addAsset(string $filePath, null|string $namespace = null)

Add an asset to the manager.

static 
setAutoload(array $autoload)

Asset autoloader setter.

static array
getAutoload()

Get the autoloader.

array
getGlobals()

Get the manag globals.

array
getFunctions()

Get the manager functions.

Details

static bool rtrim(string $path, string $delimiter = '/')

Right trim a file path.

Parameters

string $path File path
string $delimiter Path delimiter

Return Value

bool Cleaned path

static bool haveExtension(string $file)

Check if file have extension.

Parameters

string $file Filename

Return Value

bool TRUE if the file have extension defined and is valid else FALSE

static bool isValidFileExtension(string $ext)

Check if the file have a valid extension.

Parameters

string $ext File extension

Return Value

bool TRUE if is valid

static setFileExtension(string $ext)

Set a new file extension.

Parameters

string $ext Set it if is valid

static string getFileExtension()

Get current file extension.

Return Value

string File extension

static initialize(array $options = [])

Class constructor.

Parameters

array $options Class arguments ('namespace, manifest, autoload')

static setNamespace(string $namespace)

Set namespace.

Parameters

string $namespace

static setManifest(string|array $manifest)

Set manifest.

Parameters

string|array $manifest Manifest filepath or an array

debug(bool $state = true)

Set debug flag.

Parameters

bool $state Default: TRUE

static addAsset(string $filePath, null|string $namespace = null)

Add an asset to the manager.

Parameters

string $filePath Asset file path
null|string $namespace Extenstion namespace (js, css)

static setAutoload(array $autoload)

Asset autoloader setter.

Parameters

array $autoload

static array getAutoload()

Get the autoloader.

Return Value

array

array getGlobals()

Get the manag globals.

Return Value

array

array getFunctions()

Get the manager functions.

Return Value

array