ValidatorClass ] */ public function __construct( array $validatorTypes = [] ) { $this->initializeValidatorTypes($validatorTypes); } public function getValidators(): array { return $this->validators; } private function initializeValidatorTypes(array $validatorTypes): void { foreach ($validatorTypes as $type => $validator) { if (!$validator instanceof RestoreValidatorInterface) { throw new \LogicException( sprintf('Validator type must implement %s', RestoreValidatorInterface::class) ); } $this->validators[$type] = $validator; } } }