HasResourceType   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 43
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setResourceType() 0 5 1
A getResourceType() 0 3 1
A fakeResourceType() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VGirol\JsonApiFaker\Factory;
6
7
/**
8
 * Add "type" member to a factory.
9
 */
10
trait HasResourceType
11
{
12
    /**
13
     * The "type" member
14
     *
15
     * @var string|null
16
     */
17
    protected $resourceType;
18
19
    /**
20
     * Set the "type" member.
21
     *
22
     * @param string|null $type
23
     *
24
     * @return static
25
     */
26 84
    public function setResourceType(?string $type)
27
    {
28 84
        $this->resourceType = $type;
29
30 84
        return $this;
31
    }
32
33
    /**
34
     * Get the "type" member.
35
     *
36
     * @return string|null
37
     */
38 18
    public function getResourceType(): ?string
39
    {
40 18
        return $this->resourceType;
41
    }
42
43
    /**
44
     * Fill the "type" member with a fake value.
45
     *
46
     * @return static
47
     */
48 42
    public function fakeResourceType()
49
    {
50 42
        $faker = \Faker\Factory::create();
51
52 42
        return $this->setResourceType($faker->word());
53
    }
54
}
55