Code Duplication    Length = 7-7 lines in 2 locations

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
    }

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

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