Skip to content
PHP Ecosystem
Explore

AssetUtil

API reference › Foxy › Util › AssetUtil

final classFoxy\Util\AssetUtil
Sourcesrc/Util/AssetUtil.php

Reads and normalizes asset metadata exposed by Composer packages.

MethodDescriptionDefined by
formatPackage() staticFormat the asset package.AssetUtil
getName() staticGet the name for the asset dependency.AssetUtil
getPath() staticGet the path of asset file.AssetUtil
hasExtraActivation() staticCheck if foxy is enabled in extra section of package.AssetUtil
hasPluginDependency() staticCheck if the package contains assets.AssetUtil
isAsset() staticCheck if the package is available for Foxy.AssetUtil
isProjectActivation() staticCheck if the package is enabled by the project config.AssetUtil
public static function formatPackage(Composer\Package\PackageInterface $package, string $packageName, array $packageValue): array

Format the asset package.

Parameters

ParameterTypeDescription
$packageComposer\Package\PackageInterfaceThe composer package instance.
$packageNamestringThe package name of asset.
$packageValuearrayThe package value of asset.

Returns

array

public static function getName(Composer\Package\PackageInterface $package): string

Get the name for the asset dependency.

Parameters

ParameterTypeDescription
$packageComposer\Package\PackageInterfaceThe package instance.

Returns

string

public static function getPath(Composer\Installer\InstallationManager $installationManager, Foxy\Asset\AssetManagerInterface $assetManager, Composer\Package\PackageInterface $package, array $configPackages = []): string|null

Get the path of asset file.

Parameters

ParameterTypeDescription
$installationManagerComposer\Installer\InstallationManagerThe installation manager.
$assetManagerFoxy\Asset\AssetManagerInterfaceThe asset manager.
$packageComposer\Package\PackageInterfaceThe package instance.
$configPackagesarrayThe packages defined in config.

Returns

string|null

Throws

public static function hasExtraActivation(Composer\Package\PackageInterface $package): bool

Check if foxy is enabled in extra section of package.

Parameters

ParameterTypeDescription
$packageComposer\Package\PackageInterfaceThe package instance.

Returns

bool

public static function hasPluginDependency(Composer\Package\Link[] $requires): bool

Check if the package contains assets.

Parameters

ParameterTypeDescription
$requiresComposer\Package\Link[]The requirement links.

Returns

bool

public static function isAsset(Composer\Package\PackageInterface $package, array $configPackages = []): bool

Check if the package is available for Foxy.

Parameters

ParameterTypeDescription
$packageComposer\Package\PackageInterfaceThe package instance.
$configPackagesarrayThe packages defined in config.

Returns

bool

public static function isProjectActivation(Composer\Package\PackageInterface $package, array $configPackages): bool

Check if the package is enabled by the project config.

Parameters

ParameterTypeDescription
$packageComposer\Package\PackageInterfaceThe package instance.
$configPackagesarrayThe packages defined in config.

Returns

bool