Skip to content
PHP Ecosystem
Explore

GetAssetsEvent

API reference › Foxy › Event › GetAssetsEvent

final classFoxy\Event\GetAssetsEvent
ExtendsAbstractSolveEvent » Composer\EventDispatcher\Event
Sourcesrc/Event/GetAssetsEvent.php

Allows listeners to contribute asset packages before dependency solving.

MethodDescriptionDefined by
__construct()Creates the asset collection event.GetAssetsEvent
addAsset()Add the asset package.GetAssetsEvent
getAssetDir()Get the directory of mock assets.AbstractSolveEvent
getAssets()Get the map of asset package name and the asset package path.GetAssetsEvent
getPackages()Get the installed Composer packages.AbstractSolveEvent
hasAsset()Check if the asset package is present.GetAssetsEvent
public function __construct(string $assetDir, Composer\Package\PackageInterface[] $packages, mixed[] $assets = [])

Creates the asset collection event.

Parameters

ParameterTypeDescription
$assetDirstringThe directory of mock assets.
$packagesComposer\Package\PackageInterface[]All installed Composer packages.
$assetsmixed[]The map of asset package name and the asset package path.
public function addAsset(string $name, string $path): self

Add the asset package.

Parameters

ParameterTypeDescription
$namestringThe asset package name.
$pathstringAn absolute package manifest path or a ready file: directory reference.

Returns

self

public function getAssets(): array

Get the map of asset package name and the asset package path.

Returns

array

public function hasAsset(string $name): bool

Check if the asset package is present.

Parameters

ParameterTypeDescription
$namestringThe asset package name

Returns

bool