Packages
in package
Helps manage asset URLs.
Tags
Table of Contents
- $defaultPackage : mixed
- $packages : mixed
- __construct() : mixed
- addPackage() : mixed
- Adds a package.
- getPackage() : PackageInterface
- Returns an asset package.
- getUrl() : string
- Returns the public path.
- getVersion() : string
- Gets the version to add to public URL.
- setDefaultPackage() : mixed
Properties
$defaultPackage
private
mixed
$defaultPackage
$packages
private
mixed
$packages
= []
Methods
__construct()
public
__construct([PackageInterface $defaultPackage = null ][, array<string|int, PackageInterface> $packages = [] ]) : mixed
Parameters
- $defaultPackage : PackageInterface = null
- $packages : array<string|int, PackageInterface> = []
-
Additional packages indexed by name
Return values
mixed —addPackage()
Adds a package.
public
addPackage(string $name, PackageInterface $package) : mixed
Parameters
- $name : string
-
The package name
- $package : PackageInterface
Return values
mixed —getPackage()
Returns an asset package.
public
getPackage([string $name = null ]) : PackageInterface
Parameters
- $name : string = null
-
The name of the package or null for the default package
Tags
Return values
PackageInterface —An asset package
getUrl()
Returns the public path.
public
getUrl(string $path[, string $packageName = null ]) : string
Absolute paths (i.e. http://...) are returned unmodified.
Parameters
- $path : string
-
A public path
- $packageName : string = null
-
The name of the asset package to use
Return values
string —A public path which takes into account the base path and URL path
getVersion()
Gets the version to add to public URL.
public
getVersion(string $path[, string $packageName = null ]) : string
Parameters
- $path : string
-
A public path
- $packageName : string = null
-
A package name
Return values
string —The current version
setDefaultPackage()
public
setDefaultPackage(PackageInterface $defaultPackage) : mixed
Parameters
- $defaultPackage : PackageInterface