Completed
Push — master ( d70954...669d4a )
by Dmitry
04:38
created

AccountValues::rules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 0
cts 17
cp 0
rs 9.6666
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Hosting Plugin for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-hosting
6
 * @package   hipanel-module-hosting
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\hosting\models;
12
13
use Yii;
14
15
/**
16
 * Class AccountValues
17
 * @package hipanel\modules\hosting\models
18
 */
19
class AccountValues extends \hipanel\base\Model
20
{
21
    use \hipanel\base\ModelTrait;
22
23
    const SCENARIO_DEFAULT = 'dumb';
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public static function tableName()
29
    {
30
        return 'account';
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function rules()
37
    {
38
        return array_merge(parent::rules(), [
39
            [['id'], 'integer'],
40
            [['no_suexec', 'allow_scripts', 'dont_enable_ssi', 'block_send'], 'boolean'],
41
            [
42
                [
43
                    'id', 'per_hour_limit', 'block_send',
44
                    'no_suexec', 'allow_scripts', 'dont_enable_ssi',
45
                    'port', 'global_apache_conf', 'global_nginx_conf',
46
                    'apache_conf', 'nginx_conf', 'nginx_listen',
47
                    'domain_prefix', 'docroot_postfix', 'cgibin_postfix',
48
                ],
49
                'safe',
50
                'on' => ['default', 'set-ghost-options', 'set-mail-settings'],
51
            ],
52
        ]);
53
    }
54
55
    /**
56
     * {@inheritdoc}
57
     */
58
    public function attributeLabels()
59
    {
60
        return $this->mergeAttributeLabels([
61
            'no_suexec'             => Yii::t('hipanel:hosting:account', 'No Suexec'),
62
            'allow_scripts'         => Yii::t('hipanel:hosting:account', 'Allow scripts'),
63
            'dont_enable_ssi'       => Yii::t('hipanel:hosting:account', 'Dont enable Ssi'),
64
            'port'                  => Yii::t('hipanel:hosting:account', 'Port'),
65
            'global_apache_conf'    => Yii::t('hipanel:hosting:account', 'Global Apache configuration'),
66
            'global_nginx_conf'     => Yii::t('hipanel:hosting:account', 'Global Nginx configuration'),
67
            'apache_conf'           => Yii::t('hipanel:hosting:account', 'Apache configuration'),
68
            'nginx_conf'            => Yii::t('hipanel:hosting:account', 'Nginx configuration'),
69
            'domain_prefix'         => Yii::t('hipanel:hosting:account', 'Domain prefix'),
70
            'nginx_listen'          => Yii::t('hipanel:hosting:account', 'Nginx listen'),
71
            'docroot_postfix'       => Yii::t('hipanel:hosting:account', 'Document root postfix'),
72
            'cgibin_postfix'        => Yii::t('hipanel:hosting:account', 'Cgibin postfix'),
73
            'block_send'            => Yii::t('hipanel:hosting', 'Block outgoing post'),
74
            'per_hour_limit'        => Yii::t('hipanel:hosting', 'Maximum letters per hour'),
75
        ]);
76
    }
77
78
    /**
79
     * {@inheritdoc}
80
     */
81
    public static function primaryKey()
82
    {
83
        return ['id'];
84
    }
85
}
86