protected function validateMaxLength($value, string $parameter, array $args = [], array $rules = null, array $context = null): ?string
    {
        if (count($args) == 0) {
            throw new ValidatorConfigException('Validator \'maxLength\' has to have defined maximum value');
        }

        if (!is_numeric($args[0])) {
            throw new ValidatorConfigException('Validator \'maxLength\' has non-numeric value');
        }

        //$value = $this->getValue($parameter);

        $maxLength = (int)$args[0];
        if ($maxLength <= 0) {
            throw new ValidatorConfigException('Validator \'maxLength\' can\'t have value less or equal to zero in its definition');
        }

        if ($value === null) {
            return null;
        }

        if (!is_scalar($value)) {
            return Message::getMessage(Message::PRIMITIVE, [
                'param' => $parameter
            ]);
        }

        $value = trim((string)$value);

        if ($value === '') {
            return null;
        }

        if (mb_strlen($value, Application::getEncoding()) > $maxLength) {
            return Message::getMessage(Message::MAX_LENGTH, [
                'param' => $parameter,
                'max' => $maxLength,
                'value' => $value
            ]);
        }

        return null;
    }