Completed
Push — master ( a787fa...dc9af5 )
by Vincent
05:35
created

HasErrors::addError()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VGirol\JsonApiAssert\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
    public function setErrors(array $errors)
23
    {
24
        $this->errors = $errors;
25
26
        return $this;
27
    }
28
29
    /**
30
     * Undocumented function
31
     *
32
     * @param array $error
33
     * @return static
34
     */
35
    public function addError($error)
36
    {
37
        $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
        return $this;
40
    }
41
}
42