ItsMyComment   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 13
ccs 0
cts 4
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 4 1
1
<?php
2
/**
3
 * ItsMyComment.php
4
 * @author Revin Roman
5
 * @link https://rmrevin.ru
6
 */
7
8
namespace rmrevin\yii\module\Comments\rbac;
9
10
/**
11
 * Class ItsMyComment
12
 * @package rmrevin\yii\module\Comments\rbac
13
 */
14
class ItsMyComment extends \yii\rbac\Rule
15
{
16
17
    public $name = 'comments.its-my-comment';
18
19
    /**
20
     * @inheritdoc
21
     */
22
    public function execute($user, $item, $params)
23
    {
24
        return (int)$user === (int)$params['Comment']->created_by;
25
    }
26
}