AssetUtil
API reference › Foxy › Util › AssetUtil
Reads and normalizes asset metadata exposed by Composer packages.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
formatPackage() static | Format the asset package. | AssetUtil |
getName() static | Get the name for the asset dependency. | AssetUtil |
getPath() static | Get the path of asset file. | AssetUtil |
hasExtraActivation() static | Check if foxy is enabled in extra section of package. | AssetUtil |
hasPluginDependency() static | Check if the package contains assets. | AssetUtil |
isAsset() static | Check if the package is available for Foxy. | AssetUtil |
isProjectActivation() static | Check if the package is enabled by the project config. | AssetUtil |
Method details
Section titled “Method details”formatPackage()
Section titled “formatPackage() ”public static function formatPackage(Composer\Package\PackageInterface $package, string $packageName, array $packageValue): arrayFormat the asset package.
Parameters
| Parameter | Type | Description |
|---|---|---|
$package | Composer\ | The composer package instance. |
$packageName | string | The package name of asset. |
$packageValue | array | The package value of asset. |
Returns
array
getName()
Section titled “getName() ”public static function getName(Composer\Package\PackageInterface $package): stringGet the name for the asset dependency.
Parameters
| Parameter | Type | Description |
|---|---|---|
$package | Composer\ | The package instance. |
Returns
string
getPath()
Section titled “getPath() ”public static function getPath(Composer\Installer\InstallationManager $installationManager, Foxy\Asset\AssetManagerInterface $assetManager, Composer\Package\PackageInterface $package, array $configPackages = []): string|nullGet the path of asset file.
Parameters
| Parameter | Type | Description |
|---|---|---|
$installationManager | Composer\ | The installation manager. |
$assetManager | Foxy\ | The asset manager. |
$package | Composer\ | The package instance. |
$configPackages | array | The packages defined in config. |
Returns
string|null
Throws
hasExtraActivation()
Section titled “hasExtraActivation() ”public static function hasExtraActivation(Composer\Package\PackageInterface $package): boolCheck if foxy is enabled in extra section of package.
Parameters
| Parameter | Type | Description |
|---|---|---|
$package | Composer\ | The package instance. |
Returns
bool
hasPluginDependency()
Section titled “hasPluginDependency() ”public static function hasPluginDependency(Composer\Package\Link[] $requires): boolCheck if the package contains assets.
Parameters
| Parameter | Type | Description |
|---|---|---|
$requires | Composer\ | The requirement links. |
Returns
bool
isAsset()
Section titled “isAsset() ”public static function isAsset(Composer\Package\PackageInterface $package, array $configPackages = []): boolCheck if the package is available for Foxy.
Parameters
| Parameter | Type | Description |
|---|---|---|
$package | Composer\ | The package instance. |
$configPackages | array | The packages defined in config. |
Returns
bool
isProjectActivation()
Section titled “isProjectActivation() ”public static function isProjectActivation(Composer\Package\PackageInterface $package, array $configPackages): boolCheck if the package is enabled by the project config.
Parameters
| Parameter | Type | Description |
|---|---|---|
$package | Composer\ | The package instance. |
$configPackages | array | The packages defined in config. |
Returns
bool