ActionDto::rules()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 7
ccs 0
cts 7
cp 0
rs 10
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * API for Billing
4
 *
5
 * @link      https://github.com/hiqdev/billing-hiapi
6
 * @package   billing-hiapi
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\billing\hiapi\commands\order;
12
13
use hiqdev\yii\DataMapper\validators\NestedModelValidator;
14
use yii\base\Model;
15
16
class ActionDto extends Model
17
{
18
    public $type;
19
20
    public $target;
21
22
    public $quantity;
23
24
    public function rules()
25
    {
26
        return [
27
            [['type', 'target', 'quantity'], 'required'],
28
            [['target'], NestedModelValidator::class, 'modelClass' => TargetDto::class],
29
            [['quantity'], NestedModelValidator::class, 'modelClass' => QuantityDto::class],
30
            [['type'], 'string'],
31
        ];
32
    }
33
}
34