You've already forked Php-Template
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 4m18s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 4m30s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 4m21s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 4m35s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 4m21s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 3m13s
37 lines
830 B
PHP
37 lines
830 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Siteworxpro\App\Attributes\Async;
|
|
|
|
use Attribute;
|
|
|
|
/**
|
|
* Attribute to mark a class as a handler for a specific message class in an async workflow.
|
|
*
|
|
* Repeatable: attach multiple times to handle multiple message classes.
|
|
*/
|
|
#[Attribute(Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
|
|
readonly class HandlesMessage
|
|
{
|
|
/**
|
|
* Create a new HandlesMessage attribute.
|
|
*
|
|
* @param class-string $messageClass Fully-qualified class name of the message handled.
|
|
*/
|
|
public function __construct(
|
|
public string $messageClass,
|
|
) {
|
|
}
|
|
|
|
/**
|
|
* Get the fully-qualified message class this handler processes.
|
|
*
|
|
* @return class-string
|
|
*/
|
|
public function getMessageClass(): string
|
|
{
|
|
return $this->messageClass;
|
|
}
|
|
}
|