protected function verifyLevels(array $levels, bool $constructor = true): array {
$levelsCount = count($levels);
if (count($levels) === 0) {
throw new InvalidArgumentException(sprintf('Argument #%s ($levels) must not be empty', ($constructor) ? $this->getParamPosition() : 1));
}
foreach ($levels as $k => $v) {
if ($v instanceof Level) {
$levels[$k] = $v = $v->value;
}
if (!is_int($v)) {
$type = gettype($v);
$type = ($type === 'object') ? $v::class : $type;
$levelClassName = Level::class;
throw new InvalidArgumentException(sprintf('Value #%s of argument #%s ($levels) must be of type int|%s, %s given', $k + 1, ($constructor) ? $this->getParamPosition() : 1, $levelClassName, $type));
}
if ($v <0||$v> 7) {
throw new RangeException(sprintf('Value #%s of argument #%s ($levels) cannot be %s; it is not in the range 0 - 7', $k + 1, ($constructor) ? $this->getParamPosition() : 1, $v));