Code Duplication    Length = 7-7 lines in 2 locations

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

@@ 88-94 (lines=7) @@
85
            ->first();
86
87
        // something is founded :D
88
        if ($query !== null) {
89
            $answerTime = Date::convertToTimestamp($query->created_at);
90
            $delay = $answerTime + $this->_configs['delay'] - time();
91
            if ($delay > 0) { // sounds like config time is not passed now
92
                throw new JsonException(__('Spam protection: please, wait %sec% seconds', ['sec' => $delay]));
93
            }
94
        }
95
96
        return true;
97
    }

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

@@ 93-99 (lines=7) @@
90
            ->first();
91
92
        // check if latest post time for this user is founded
93
        if ($query !== null) {
94
            $postTime = Date::convertToTimestamp($query->created_at);
95
            $delay = $postTime + $this->_configs['delay'] - time();
96
            if ($delay > 0) {
97
                throw new JsonException(__('Spam protection: please, wait %sec% seconds', ['sec' => $delay]));
98
            }
99
        }
100
101
        return true;
102
    }