MerchantTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 37
ccs 0
cts 27
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A rules() 0 14 1
A attributeLabels() 0 13 1
1
<?php
2
/**
3
 * Yii2 extension for payment processing with Omnipay, Payum and more later.
4
 *
5
 * @link      https://github.com/hiqdev/yii2-merchant
6
 * @package   yii2-merchant
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\yii2\merchant\models;
12
13
use Yii;
14
15
/**
16
 * Class MerchantTrait.
17
 */
18
trait MerchantTrait
19
{
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function rules()
24
    {
25
        return [
26
            [['name', 'system'],    'string'],
27
            [['purse'],             'string'],
28
            [['method'],            'string'],
29
            [['currency'],          'string'],
30
            [['label'],             'string'],
31
            [['amount', 'fee'],     'number'],
32
            [['commission'],        'number'],
33
            [['invoice_id'],        'number'],
34
            [['action'],            'string'],
35
        ];
36
    }
37
38
    /**
39
     * {@inheritdoc}
40
     */
41
    public function attributeLabels()
42
    {
43
        return [
44
            'name'       => Yii::t('merchant', 'Name'),
45
            'system'     => Yii::t('merchant', 'Payment System'),
46
            'purse'      => Yii::t('merchant', 'Purse'),
47
            'amount'      => Yii::t('merchant', 'Amount'),
48
            'fee'        => Yii::t('merchant', 'Fee'),
49
            'currency'   => Yii::t('merchant', 'Currency'),
50
            'signature'  => Yii::t('merchant', 'Signature'),
51
            'commission' => Yii::t('merchant', 'Commission'),
52
        ];
53
    }
54
}
55