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

HasIdentification::fakeIdentification()   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
trait HasIdentification
10
{
11
    use HasResourceType;
12
    use HasIdentifier;
13
14
    /**
15
     * Undocumented function
16
     *
17
     * @return array|null
18
     */
19 22
    public function getIdentification(): ?array
20
    {
21 22
        if (!isset($this->id) && !isset($this->resourceType)) {
22 4
            return null;
23
        }
24
25
        return [
26 18
            Members::TYPE => $this->resourceType,
27 18
            Members::ID => strval($this->id)
28
        ];
29
    }
30
31
    /**
32
     * Undocumented function
33
     *
34
     * @return static
35
     */
36 10
    public function fakeIdentification()
37
    {
38 10
        return $this->fakeResourceType()
39 10
            ->fakeIdentifier();
40
    }
41
}
42