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

HasMeta::fakeMeta()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
ccs 4
cts 4
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 HasMeta
8
{
9
    /**
10
     * Undocumented variable
11
     *
12
     * @var array
13
     */
14
    public $meta;
15
16
    /**
17
     * Undocumented function
18
     *
19
     * @param array $meta
20
     *
21
     * @return static
22
     */
23 17
    public function setMeta(array $meta)
24
    {
25 17
        $this->meta = $meta;
26
27 17
        return $this;
28
    }
29
30
    /**
31
     * Undocumented function
32
     *
33
     * @param string $name
34
     * @param mixed $value
35
     *
36
     * @return static
37
     */
38 5
    public function addToMeta(string $name, $value)
39
    {
40 5
        $this->addToObject('meta', $name, $value);
0 ignored issues
show
Bug introduced by
It seems like addToObject() 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

40
        $this->/** @scrutinizer ignore-call */ 
41
               addToObject('meta', $name, $value);
Loading history...
41
42 5
        return $this;
43
    }
44
45
    /**
46
     * Undocumented function
47
     *
48
     * @param integer $count
49
     *
50
     * @return static
51
     */
52 11
    public function fakeMeta($count = 5)
53
    {
54 11
        $this->setMeta(
55 11
            $this->fakeMembers($count)
0 ignored issues
show
Bug introduced by
It seems like fakeMembers() 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

55
            $this->/** @scrutinizer ignore-call */ 
56
                   fakeMembers($count)
Loading history...
56
        );
57
58 11
        return $this;
59
    }
60
}
61