. */ /** @noinspection PhpMultipleClassDeclarationsInspection */ namespace SP\Domain\Common\Attributes; use Attribute; /** * Class Hydratable */ #[Attribute(Attribute::TARGET_CLASS)] final readonly class Hydratable { private array $targetClass; public function __construct(private string $sourceProperty, array $targetClass) { $this->targetClass = array_filter( $targetClass, static fn(string $class) => class_exists($class) || interface_exists($class) ); } public function getTargetClass(): array { return $this->targetClass; } public function getSourceProperty(): string { return $this->sourceProperty; } }