Test Failed
Pull Request — master (#183)
by
unknown
07:59
created

IsArrayValidator::validate()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 3
nc 2
nop 1
1
<?php
2
3
namespace Ubiquity\contents\validation\validators\basic;
4
5
use Ubiquity\contents\validation\validators\Validator;
6
use Ubiquity\contents\validation\validators\basic\NotEmptyValidator;
7
8
9
class IsArrayValidator extends Validator{
10
11
    public function __construct(){
12
        $this->message("This value must be array");
0 ignored issues
show
Bug introduced by
The method message() does not exist on Ubiquity\contents\valida...\basic\IsArrayValidator. ( Ignorable by Annotation )

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

12
        $this->/** @scrutinizer ignore-call */ 
13
               message("This value must be array");

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...
13
    }
14
15
    public function validate( $value ){
16
        parent::validate($value);
17
        if($this->notEmpty && is_array($value)){
0 ignored issues
show
Bug Best Practice introduced by
The property notEmpty does not exist on Ubiquity\contents\valida...\basic\IsArrayValidator. Did you maybe forget to declare it?
Loading history...
18
            return true;
19
        }
20
        return false;
21
22
    }
23
}