Code Duplication    Length = 11-11 lines in 2 locations

models/Challenge.php 2 locations

@@ 201-211 (lines=11) @@
198
    /**
199
     * @param integer $opponentID
200
     */
201
    public function underCallTimeLimit($clubID, $opponentID)
202
    {
203
        $res = Yii::app()->db->createCommand()
204
            ->select('id, created')
205
            ->from('challenge')
206
            ->where('caller=:cid AND opponent=:oid', [':cid'=>(int)$clubID, ':oid'=>$opponentID])
207
            ->order('created DESC')
208
            ->limit(1)
209
            ->queryRow();
210
        return time() - strtotime($res['created']) <= self::TIME_LIMIT_HOURS * 3600;
211
    }
212
213
    /**
214
     * @param integer $clubID
@@ 216-226 (lines=11) @@
213
    /**
214
     * @param integer $clubID
215
     */
216
    public function underLastCallTimeLimit($clubID)
217
    {
218
        $res = Yii::app()->db->createCommand()
219
            ->select('id, created')
220
            ->from('challenge')
221
            ->where('caller=:cid', [':cid'=>(int)$clubID])
222
            ->order('created DESC')
223
            ->limit(1)
224
            ->queryRow();
225
        return time() - strtotime($res['created']) <= self::TIME_LIMIT_LASTCALL_HOURS * 3600;
226
    }
227
228
    /**
229
     * @param Club $opponent