Passed
Push — master ( b11de1...a4dac5 )
by eXeCUT
09:39
created

Validate::getLogMessage()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 10
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php
2
namespace execut\import\components\parser\exception;
3
4
5
class Validate extends Exception
6
{
7
    public $errors;
8
    public $attribute = null;
9 1
    public function getLogMessage() {
10 1
        $errors = [];
11 1
        foreach ($this->errors as $value) {
12 1
            $errors[] = implode(', ', $value);
13
        }
14
15 1
        return  \Yii::t('app', 'Column {column} attribute {attribute} validation errors: {errors}', [
16 1
            'attribute' => $this->attribute,
17 1
            'column' => $this->columnNbr,
18 1
            'errors' => implode(', ', $errors),
19
        ]);
20
    }
21 1
    public function getLogCategory() {
22 1
        return 'import.validate.' . $this->columnNbr . '.' . $this->attribute;
23
    }
24
}