FormCommentModerate   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 8
dl 0
loc 32
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getRecord() 0 3 1
A make() 0 3 1
A __construct() 0 5 1
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