<?php

namespace Velis\Test\Dto\Concrete\Validators;

use Attribute;
use Exception;
use Velis\Dto\Validators\BaseValidator;

#[Attribute]
class OtherFieldValue extends BaseValidator
{
    public function __construct(public string $otherFieldName)
    {
    }

    /**
     * @throws Exception
     */
    public function validate($value): bool
    {
        throw new Exception($this->dtoData[$this->otherFieldName]);
    }
}
