Code Duplication    Length = 12-13 lines in 3 locations

test/Stub/Transformer/JsonApiBookTransformer.php 3 locations

@@ 22-33 (lines=12) @@
19
        return $book;
20
    }
21
22
    public function includeAuthor(array $book)
23
    {
24
        if (!array_key_exists('_author', $book)) {
25
            return;
26
        }
27
28
        if ($book['_author'] === null) {
29
            return $this->null();
30
        }
31
32
        return $this->item($book['_author'], new JsonApiAuthorTransformer(), 'people');
33
    }
34
35
    public function includeAuthorWithMeta(array $book)
36
    {
@@ 35-47 (lines=13) @@
32
        return $this->item($book['_author'], new JsonApiAuthorTransformer(), 'people');
33
    }
34
35
    public function includeAuthorWithMeta(array $book)
36
    {
37
        if (!array_key_exists('_author', $book)) {
38
            return;
39
        }
40
41
        if ($book['_author'] === null) {
42
            return $this->null();
43
        }
44
45
        return $this->item($book['_author'], new JsonApiAuthorTransformer(), 'people')
46
            ->setMeta(['foo' => 'bar']);
47
    }
48
49
    public function includeCoAuthor(array $book)
50
    {
@@ 49-60 (lines=12) @@
46
            ->setMeta(['foo' => 'bar']);
47
    }
48
49
    public function includeCoAuthor(array $book)
50
    {
51
        if (!array_key_exists('_co_author', $book)) {
52
            return;
53
        }
54
55
        if ($book['_co_author'] === null) {
56
            return $this->null();
57
        }
58
59
        return $this->item($book['_co_author'], new JsonApiAuthorTransformer(), 'people');
60
    }
61
}
62