NotFoundRecord::getModelLabel()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
namespace execut\import\components\parser\exception;
3
4
5
class NotFoundRecord extends Exception
6
{
7
    public $attributes = null;
8
    public $modelClass = null;
9 1
    public function getLogMessage() {
10 1
        $label = $this->getModelLabel();
11 1
        $attributes = [];
12 1
        foreach ($this->attributes as $key => $attribute) {
13 1
            $attributes[] = $key . '=' . $attribute;
14
        }
15
16 1
        return $label . ' with attributes ' . implode(', ', $attributes) . ' not found';
17
    }
18
19 1
    public function getLogCategory() {
20 1
        return 'import.recordNotFound.' . str_replace(' ', '', $this->getModelLabel());
21
    }
22
23
    /**
24
     * @return mixed
25
     */
26 2
    protected function getModelLabel()
27
    {
28 2
        $class = $this->modelClass;
29 2
        return $class;
30
    }
31
}