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

ResourceIdentifierFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fake() 0 4 1
A toArray() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VGirol\JsonApiFaker\Factory;
6
7
use VGirol\JsonApiFaker\Members;
8
9
class ResourceIdentifierFactory extends BaseFactory
10
{
11
    use HasIdentification;
0 ignored issues
show
Bug introduced by
The trait VGirol\JsonApiFaker\Factory\HasIdentification requires the property $word which is not provided by VGirol\JsonApiFaker\Fact...sourceIdentifierFactory.
Loading history...
12
    use HasMeta;
13
14
    /**
15
     * Undocumented function
16
     *
17
     * @return array|null
18
     */
19 16
    public function toArray(): ?array
20
    {
21 16
        $resource = $this->getIdentification();
22
23 16
        if (isset($this->meta)) {
24 10
            $resource[Members::META] = $this->meta;
25
        }
26
27 16
        return $resource;
28
    }
29
30
    /**
31
     * Undocumented function
32
     *
33
     * @return static
34
     */
35 9
    public function fake()
36
    {
37 9
        return $this->fakeIdentification()
38 9
            ->fakeMeta();
39
    }
40
}
41