Code Duplication    Length = 9-12 lines in 3 locations

components/UserIdentity.php 1 location

@@ 60-68 (lines=9) @@
57
    /**
58
     * @param integer $uid
59
     */
60
    private function playerExists($uid)
61
    {
62
        $foundUid = Yii::app()->db->createCommand()
63
            ->select('uid')
64
            ->from('main')
65
            ->where('uid=:uid', [':uid'=>$uid])
66
            ->queryScalar();
67
        return $foundUid > 0;
68
    }
69
}
70

models/Club.php 1 location

@@ 161-172 (lines=12) @@
158
        $this->name = $name;
159
    }
160
161
    public function getSubjectName()
162
    {
163
        $name = Yii::app()->db->cache(86400)->createCommand()
164
            ->select('name')
165
            ->from('club')
166
            ->where('id=:id', [':id'=>$this->id])
167
            ->queryScalar();
168
        if (!$name) {
169
            $name = '???';
170
        }
171
        return $name;
172
    }
173
174
    public function fetchItems($wouldCompete = false)
175
    {

models/Player.php 1 location

@@ 300-311 (lines=12) @@
297
        $this->user = $user;
298
    }
299
300
    public function getSubjectName()
301
    {
302
        $name = Yii::app()->db->cache(86400)->createCommand()
303
            ->select('user')
304
            ->from('main')
305
            ->where('uid=:uid', [':uid'=>$this->uid])
306
            ->queryScalar();
307
        if (!$name) {
308
            $name = '???';
309
        }
310
        return $name;
311
    }
312
313
    public function setAllAttributes($uid = 0)
314
    {