Completed
Push — master ( 883f28...097345 )
by Vincent
03:45 queued 11s
created

HasErrors::setErrors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
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 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VGirol\JsonApiFaker\Factory;
6
7
trait HasErrors
8
{
9
    /**
10
     * Undocumented variable
11
     *
12
     * @var array
13
     */
14
    public $errors;
15
16
    /**
17
     * Undocumented function
18
     *
19
     * @param array $errors
20
     * @return static
21
     */
22 3
    public function setErrors(array $errors)
23
    {
24 3
        $this->errors = $errors;
25
26 3
        return $this;
27
    }
28
29
    /**
30
     * Undocumented function
31
     *
32
     * @param array $error
33
     * @return static
34
     */
35 1
    public function addError($error)
36
    {
37 1
        $this->addToArray('errors', $error);
0 ignored issues
show
Bug introduced by
It seems like addToArray() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

37
        $this->/** @scrutinizer ignore-call */ 
38
               addToArray('errors', $error);
Loading history...
38
39 1
        return $this;
40
    }
41
42
    /**
43
     * Undocumented function
44
     *
45
     * @return static
46
     */
47
    public function fakeErrors()
48
    {
49
        return $this;
50
    }
51
}
52