Passed
Push — master ( 37fbce...eb9638 )
by Mihail
09:07
created

CommentAnswer::getCommentPost()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Apps\ActiveRecord;
4
5
use Ffcms\Core\Arch\ActiveModel;
6
7
/**
8
 * Class CommentAnswer. Active record model for comments answers list
9
 * @package Apps\ActiveRecord
10
 * @property int $id
11
 * @property int $comment_id
12
 * @property int $user_id
13
 * @property string $guest_name
14
 * @property string $message
15
 * @property string $created_at
16
 * @property string $updated_at
17
 */
18 View Code Duplication
class CommentAnswer extends ActiveModel
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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
}