Completed
Branch master (bc5900)
by Vincent
01:31
created

HasJsonapi::fakeJsonapi()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 1
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
use VGirol\JsonApiFaker\Factory\JsonapiFactory;
8
9
/**
10
 * Add "jsonapi" member to a factory.
11
 */
12
trait HasJsonapi
13
{
14
    /**
15
     * The jsonapi object
16
     *
17
     * @var JsonapiFactory
18
     */
19
    public $jsonapi;
20
21
    /**
22
     * Sets the jsonapi object.
23
     *
24
     * @param JsonapiFactory $jsonapi
25
     *
26
     * @return static
27
     */
28 4
    public function setJsonapi($jsonapi)
29
    {
30 4
        $this->jsonapi = $jsonapi;
31
32 4
        return $this;
33
    }
34
35
    /**
36
     * Fill the "jsonapi" object with fake members and values.
37
     *
38
     * @param integer $countMeta The number of meta members to generate.
39
     *
40
     * @return static
41
     */
42 1
    public function fakeJsonapi(int $countMeta = 5)
0 ignored issues
show
Unused Code introduced by
The parameter $countMeta is not used and could be removed. ( Ignorable by Annotation )

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

42
    public function fakeJsonapi(/** @scrutinizer ignore-unused */ int $countMeta = 5)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
43
    {
44 1
        return $this->setJsonapi((new JsonapiFactory)->fake());
45
    }
46
}
47