Packages
in package
Helps manage asset URLs.
Tags
Table of Contents
Properties
- $defaultPackage : mixed
- $packages : array<string|int, mixed>
Methods
- __construct() : mixed
- addPackage() : mixed
- 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
array<string|int, 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
addPackage()
public
addPackage(string $name, PackageInterface $package) : mixed
Parameters
- $name : string
- $package : PackageInterface
getPackage()
Returns an asset package.
public
getPackage([string|null $name = null ]) : PackageInterface
Parameters
- $name : string|null = null
-
The name of the package or null for the default package
Tags
Return values
PackageInterfacegetUrl()
Returns the public path.
public
getUrl(string $path[, string|null $packageName = null ]) : string
Absolute paths (i.e. http://...) are returned unmodified.
Parameters
- $path : string
-
A public path
- $packageName : string|null = 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|null $packageName = null ]) : string
Parameters
- $path : string
-
A public path
- $packageName : string|null = null
-
A package name
Return values
stringsetDefaultPackage()
public
setDefaultPackage(PackageInterface $defaultPackage) : mixed
Parameters
- $defaultPackage : PackageInterface