Completed
Push — master ( 2a97e5...e0fa86 )
by Andrii
02:50
created

FeedbackForm   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 48
ccs 0
cts 26
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A attributes() 0 4 1
A attributeLabels() 0 6 1
A rules() 0 8 1
A getDebugUrl() 0 4 1
A getModule() 0 4 1
1
<?php
2
/**
3
 * Health monitoring for Yii2 applications
4
 *
5
 * @link      https://github.com/hiqdev/yii2-monitoring
6
 * @package   yii2-monitoring
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\yii2\monitoring\models;
12
13
use hiqdev\yii2\monitoring\Module;
14
use Yii;
15
use yii\base\Model;
16
17
class FeedbackForm extends Model
18
{
19
    /**
20
     * @var string
21
     */
22
    public $message;
23
24
    /**
25
     * @var string
26
     */
27
    public $email;
28
29
    /**
30
     * @var string
31
     */
32
    public $session_tag;
33
34
    public function attributes()
35
    {
36
        return ['message', 'email', 'session_tag'];
37
    }
38
39
    public function attributeLabels()
40
    {
41
        return [
42
            'message' => Yii::t('monitoring', 'Message'),
43
        ];
44
    }
45
46
    public function rules()
47
    {
48
        return [
49
            [['message'], 'required'],
50
            [['email'], 'safe', 'when' => Yii::$app->user->isGuest],
51
            [['session_tag'], 'safe'],
52
        ];
53
    }
54
55
    public function getDebugUrl()
56
    {
57
        return $this->getModule()->getDebugUrl($this->session_tag);
58
    }
59
60
    public function getModule()
61
    {
62
        return Module::getInstance();
63
    }
64
}
65