Completed
Push — master ( fba866...b10a48 )
by Ori
03:03
created

TableValidationError::getMessage()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 0
1
<?php
2
namespace frictionlessdata\tableschema;
3
4
class TableValidationError extends SchemaValidationError
5
{
6
    const ROW_VALIDATION_FAILED = 21;
7
8
    public function getMessage()
9
    {
10
        switch ($this->code) {
0 ignored issues
show
Bug introduced by
The property code does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
11
            case self::ROW_VALIDATION_FAILED:
12
                return "row {$this->extraDetails["row"]}.{$this->extraDetails["col"]}({$this->extraDetails["val"]}): {$this->extraDetails["error"]}";
0 ignored issues
show
Bug introduced by
The property extraDetails does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
13
            default:
14
                return parent::getMessage();
15
        }
16
    }
17
}
18