Code Duplication    Length = 21-30 lines in 2 locations

Apps/ActiveRecord/CommentAnswer.php 1 location

@@ 18-38 (lines=21) @@
15
 * @property string $created_at
16
 * @property string $updated_at
17
 */
18
class CommentAnswer extends ActiveModel
19
{
20
21
    /**
22
     * Get user identity
23
     * @return User|null
24
     */
25
    public function getUser()
26
    {
27
        return User::identity($this->user_id);
28
    }
29
30
    /**
31
     * Get comment post object
32
     * @return WallPost|null
33
     */
34
    public function getCommentPost()
35
    {
36
        return CommentPost::where('id', '=', $this->comment_id)->first();
37
    }
38
}

Apps/ActiveRecord/CommentPost.php 1 location

@@ 19-48 (lines=30) @@
16
 * @property string $created_at
17
 * @property string $updated_at
18
 */
19
class CommentPost extends ActiveModel
20
{
21
    /**
22
     * Get user identity
23
     * @return User|null
24
     */
25
    public function getUser()
26
    {
27
        return User::identity($this->user_id);
28
    }
29
30
    /**
31
     * Get comment post->answers relation
32
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
33
     */
34
    public function getAnswer()
35
    {
36
        return $this->hasMany('Apps\\ActiveRecord\\CommentAnswer', 'comment_id');
37
    }
38
39
    /**
40
     * Get answers count for post comment id
41
     * @return int
42
     */
43
    public function getAnswerCount()
44
    {
45
        return CommentAnswer::where('comment_id', '=', $this->id)->count();
46
    }
47
48
}