Code Duplication    Length = 36-36 lines in 2 locations

src/Document/IdentifierCollectionDocument.php 1 location

@@ 16-51 (lines=36) @@
13
 *
14
 * @package Mikemirten\Component\JsonApi\Document
15
 */
16
class IdentifierCollectionDocument extends AbstractDocument implements IdentifierCollectionAwareInterface
17
{
18
    use IdentifierCollectionContainer;
19
20
    /**
21
     * IdentifierCollectionDocument 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
42
    /**
43
     * Cast to a string
44
     *
45
     * @return string
46
     */
47
    public function __toString(): string
48
    {
49
        return 'Document contains a collection of resource-identifiers';
50
    }
51
}

src/Document/IdentifierCollectionRelationship.php 1 location

@@ 16-51 (lines=36) @@
13
 *
14
 * @package Mikemirten\Component\JsonApi\Document
15
 */
16
class IdentifierCollectionRelationship extends AbstractRelationship implements IdentifierCollectionAwareInterface
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
42
    /**
43
     * Cast to a string
44
     *
45
     * @return string
46
     */
47
    public function __toString(): string
48
    {
49
        return 'Relationship contains a collection of resource-identifiers';
50
    }
51
}