FormCommentModerate::getRecord()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace Apps\Model\Admin\Comments;
4
5
use Apps\ActiveRecord\CommentAnswer;
6
use Apps\ActiveRecord\CommentPost;
7
use Ffcms\Core\Arch\Model;
8
9
class FormCommentModerate extends Model
10
{
11
    private $_records;
12
    private $_type;
13
14
    /**
15
     * FormCommentModerate constructor. Pass active record and type of comment system inside.
16
     * @param CommentPost|CommentAnswer $records
17
     * @param string $type
18
     */
19
    public function __construct($records, $type)
20
    {
21
        $this->_records = $records;
22
        $this->_type = $type;
23
        parent::__construct();
24
    }
25
26
    /**
27
     * Accept comments and answers
28
     */
29
    public function make()
30
    {
31
        $this->_records->update(['moderate' => 0]);
32
    }
33
34
    /**
35
     * Get moderated records
36
     * @return object
37
     */
38
    public function getRecord()
39
    {
40
        return $this->_records->get();
41
    }
42
}
43