Passed
Pull Request — master (#25)
by Alexander
14:50
created

ValidatorTestMainModel   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 6
c 1
b 0
f 0
dl 0
loc 19
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A tableName() 0 3 1
A getReferences() 0 3 1
A getValue() 0 4 2
1
<?php
2
namespace Yiisoft\Validator\Tests\data;
3
4
5
use Yiisoft\Validator\DataSetInterface;
6
7
class ValidatorTestMainModel implements DataSetInterface
8
{
9
    public $testMainVal = 1;
10
11
    public function getValue(string $key)
12
    {
13
        if (property_exists(self::class, $key)) {
14
            return $this->$key;
15
        }
16
    }
17
18
    public static function tableName()
19
    {
20
        return 'validator_main';
21
    }
22
23
    public function getReferences()
24
    {
25
        return $this->hasMany(ValidatorTestRefModel::class, ['ref' => 'id']);
0 ignored issues
show
Bug introduced by
The method hasMany() does not exist on Yiisoft\Validator\Tests\...\ValidatorTestMainModel. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

25
        return $this->/** @scrutinizer ignore-call */ hasMany(ValidatorTestRefModel::class, ['ref' => 'id']);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
26
    }
27
}
28