Comment   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 0
Metric Value
wmc 10
lcom 2
cbo 2
dl 0
loc 63
c 0
b 0
f 0
rs 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A author() 0 4 1
A getAuthor() 0 4 1
A setAuthor() 0 4 1
A event() 0 4 1
A setEvent() 0 4 1
A getEvent() 0 4 1
A getContent() 0 4 1
A setContent() 0 4 1
A getCreatedAt() 0 4 1
1
<?php
2
3
/**
4
 * Storgman - Student Organizations Management
5
 * Copyright (C) 2014-2016, Dejan Angelov <[email protected]>
6
 *
7
 * This file is part of Storgman.
8
 *
9
 * Storgman is free software: you can redistribute it and/or modify
10
 * it under the terms of the GNU General Public License as published by
11
 * the Free Software Foundation, either version 3 of the License, or
12
 * (at your option) any later version.
13
 *
14
 * Storgman is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with Storgman.  If not, see <http://www.gnu.org/licenses/>.
21
 *
22
 * @package Storgman
23
 * @copyright Copyright (C) 2014-2016, Dejan Angelov <[email protected]>
24
 * @license https://github.com/angelov/storgman/blob/master/LICENSE
25
 * @author Dejan Angelov <[email protected]>
26
 */
27
28
namespace Angelov\Storgman\Events\Comments;
29
30
use Angelov\Storgman\Events\Event;
31
use Angelov\Storgman\Members\Member;
32
use Carbon\Carbon;
33
use Illuminate\Database\Eloquent\Model;
34
35
class Comment extends Model
36
{
37
    protected $table = "event_comments";
38
39
    public function getId()
40
    {
41
        return $this->getAttribute('id');
42
    }
43
44
    public function author()
45
    {
46
        return $this->belongsTo(Member::class);
47
    }
48
49
    /**
50
     * @return Member
51
     */
52
    public function getAuthor()
53
    {
54
        return $this->getAttribute('author');
55
    }
56
57
    public function setAuthor(Member $author)
58
    {
59
        $this->author()->associate($author);
60
    }
61
62
    public function event()
63
    {
64
        return $this->belongsTo(Event::class);
65
    }
66
67
    public function setEvent(Event $event)
68
    {
69
        $this->event()->associate($event);
70
    }
71
72
    /**
73
     * @return Event
74
     */
75
    public function getEvent()
76
    {
77
        return $this->getAttribute('event');
78
    }
79
80
    public function getContent()
81
    {
82
        return $this->getAttribute('content');
83
    }
84
85
    public function setContent($content)
86
    {
87
        $this->setAttribute('content', $content);
88
    }
89
90
    /**
91
     * @return Carbon
92
     */
93
    public function getCreatedAt()
94
    {
95
        return $this->getAttribute('created_at');
96
    }
97
}
98