Completed
Push — master ( 4ee806...bc5900 )
by Vincent
20:15 queued 11s
created

HasJsonapi   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
dl 0
loc 33
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setJsonapi() 0 5 1
A fakeJsonapi() 0 3 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
    public function setJsonapi($jsonapi)
29
    {
30
        $this->jsonapi = $jsonapi;
31
32
        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
    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
        return $this->setJsonapi((new JsonapiFactory)->fake());
45
    }
46
}
47