Code Duplication    Length = 9-10 lines in 2 locations

app/Ship/core/Abstracts/Transformers/Transformer.php 2 locations

@@ 54-62 (lines=9) @@
51
     *
52
     * @return \League\Fractal\Resource\Item
53
     */
54
    public function item($data, $transformer, $resourceKey = null)
55
    {
56
        // set a default resource key if none is set
57
        if (!$resourceKey && $data) {
58
            $resourceKey = $data->getResourceKey();
59
        }
60
61
        return parent::item($data, $transformer, $resourceKey);
62
    }
63
64
    /**
65
     * @param mixed                       $data
@@ 71-80 (lines=10) @@
68
     *
69
     * @return \League\Fractal\Resource\Collection
70
     */
71
    public function collection($data, $transformer, $resourceKey = null)
72
    {
73
        // set a default resource key if none is set
74
        if (!$resourceKey && $data->isNotEmpty()) {
75
            $obj = $data->first();
76
            $resourceKey = $obj->getResourceKey();
77
        }
78
79
        return parent::collection($data, $transformer, $resourceKey);
80
    }
81
82
    /**
83
     * @param Scope  $scope