AssetLoader
Asset loader class.
Loads an asset from the filesystem.
Tags
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
$fullPath
protected
string
$fullPath
$assets
protected
Assets
$assets
Methods
__construct()
Create a new AssetLoader object.
public
__construct(
$assets :
Assets
)
: mixed
Parameters
- $assets : Assets
Return values
mixedloadAsset()
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
stringgetLength()
Get the length in bytes of the currently targeted file.
public
getLength(
)
: int
Return values
intgetType()
Get the best-guess MIME type of the currently targeted file, based on the file extension.
public
getType(
)
: string