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

ResourceIdentifierFactory::fake()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
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