Passed
Push — master ( c1150e...84b7ab )
by Michael
02:30
created

IdentifierCollectionRelationship::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
dl 8
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
declare(strict_types = 1);
3
4
namespace Mikemirten\Component\JsonApi\Document;
5
6
use Mikemirten\Component\JsonApi\Document\Behaviour\IdentifierCollectionAwareInterface;
7
use Mikemirten\Component\JsonApi\Document\Behaviour\IdentifierCollectionContainer;
8
9
/**
10
 * Identifier Collection Relationship
11
 *
12
 * @see http://jsonapi.org/format/#document-resource-object-relationships
13
 *
14
 * @package Mikemirten\Component\JsonApi\Document
15
 */
16 View Code Duplication
class IdentifierCollectionRelationship extends AbstractRelationship implements IdentifierCollectionAwareInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
{
18
    use IdentifierCollectionContainer;
19
20
    /**
21
     * IdentifierCollectionRelationship constructor.
22
     *
23
     * @param array $metadata
24
     */
25
    public function __construct(array $metadata = [])
26
    {
27
        $this->metadata = $metadata;
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function toArray(): array
34
    {
35
        $data = parent::toArray();
36
37
        $data['data'] = $this->identifiersToArray();
38
39
        return $data;
40
    }
41
}