<?php

namespace App\Modules\Versioner\Application\Check;

use App\Modules\Shared\Domain\Aggregate\AggregateRoot;
use App\Modules\Versioner\Domain\VersionerOutOfVersion;

class VersionChecker
{
    public function __invoke(
        AggregateRoot $aggregate,
        int $version
    ) {
        if ($aggregate->getVersion() !== $version) {
            throw new VersionerOutOfVersion();
        }
    }
}
