Code Duplication    Length = 7-7 lines in 2 locations

Apps/Model/Api/Comments/CommentPostAdd.php 1 location

@@ 70-76 (lines=7) @@
67
        }
68
69
        // check if message length is correct
70
        if (Str::length($this->message) < (int)$this->_configs['minLength'] || Str::length($this->message) > (int)$this->_configs['maxLength']) {
71
            throw new JsonException(__('Message length is incorrect. Current: %cur%, min - %min%, max - %max%', [
72
                'cur' => Str::length($this->message),
73
                'min' => $this->_configs['minLength'],
74
                'max' => $this->_configs['maxLength']
75
            ]));
76
        }
77
78
        // guest moderation
79
        if (!App::$User->isAuth() && (bool)$this->_configs['guestModerate']) {

Apps/Model/Api/Comments/CommentAnswerAdd.php 1 location

@@ 70-76 (lines=7) @@
67
        }
68
69
        // check if message length is correct
70
        if (Str::length($this->message) < (int)$this->_configs['minLength'] || Str::length($this->message) > (int)$this->_configs['maxLength']) {
71
            throw new JsonException(__('Message length is incorrect. Current: %cur%, min - %min%, max - %max%', [
72
                'cur' => Str::length($this->message),
73
                'min' => $this->_configs['minLength'],
74
                'max' => $this->_configs['maxLength']
75
            ]));
76
        }
77
78
        $count = CommentPost::where('id', '=', $this->replayTo)->count();
79
        if ($count !== 1) {