mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-30 11:25:52 -05:00
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
30 lines
741 B
PHP
30 lines
741 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pterodactyl\Services\Extensions;
|
|
|
|
/**
|
|
* The single container extender installed for a wrapped action contract. It carries no
|
|
* decorators of its own: every resolution asks the registry which ones currently apply.
|
|
*
|
|
* @template TContract of object
|
|
*/
|
|
final readonly class ExtensionActionExtender
|
|
{
|
|
/** @param class-string<TContract> $contract */
|
|
public function __construct(
|
|
private ExtensionActionDecorators $decorators,
|
|
private string $contract,
|
|
) {}
|
|
|
|
/**
|
|
* @param TContract $action
|
|
* @return TContract
|
|
*/
|
|
public function __invoke(object $action): object
|
|
{
|
|
return $this->decorators->decorate($this->contract, $action);
|
|
}
|
|
}
|