NotFoundRecord   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 11
dl 0
loc 25
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getLogCategory() 0 2 1
A getLogMessage() 0 8 2
A getModelLabel() 0 4 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
}