Completed
Push — master ( 1961b2...5981e3 )
by Andrii
04:35
created

CalculateValueCommand::rules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 0
cts 0
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 2
1
<?php
2
3
namespace hiqdev\billing\hiapi\commands\order;
4
5
class CalculateValueCommand extends \hiapi\commands\Command
6
{
7
    protected $handlerClass = CalculateOrderValueHandler::class;
8
9
    public function rules()
10
    {
11
        return [
12
            ['items', 'each', 'rule' => ['validateItem']],
13
        ];
14
    }
15
16
    public function validateItem($attribute, $params, $validator)
17
    {
18
        var_dump(compact('attribute','params','validator'));
0 ignored issues
show
Security Debugging Code introduced by
var_dump(compact('attrib...params', 'validator')); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
19
        die;
0 ignored issues
show
Coding Style Compatibility introduced by
The method validateItem() contains an exit expression.

An exit expression should only be used in rare cases. For example, if you write a short command line script.

In most cases however, using an exit expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.

Loading history...
20
    }
21
}
22