UserFrosting API

AssetLoader

Asset loader class.

Loads an asset from the filesystem.

Tags
author

Alex Weissman (https://alexanderweissman.com)

Table of Contents

$fullPath string
$assets Assets
__construct() Create a new AssetLoader object. mixed
loadAsset() Compute the full filesystem path for the specified relative path (usually extracted from a URL). bool
getContent() Get the raw contents of the currently targeted file. string
getLength() Get the length in bytes of the currently targeted file. int
getType() Get the best-guess MIME type of the currently targeted file, based on the file extension. string

Properties

Methods

__construct()

Create a new AssetLoader object.

public __construct( $assets : Assets ) : mixed
Parameters
$assets : Assets
Return values
mixed

loadAsset()

Compute the full filesystem path for the specified relative path (usually extracted from a URL).

public loadAsset( $relativePath : string ) : bool

Also checks to make sure that the file actually exists.

Parameters
$relativePath : string
Return values
bool

True if the file exists, false otherwise

getContent()

Get the raw contents of the currently targeted file.

public getContent( ) : string
Return values
string

getLength()

Get the length in bytes of the currently targeted file.

public getLength( ) : int
Return values
int

getType()

Get the best-guess MIME type of the currently targeted file, based on the file extension.

public getType( ) : string
Return values
string

Search results