Code Duplication    Length = 11-12 lines in 2 locations

src/Controller.php 2 locations

@@ 127-137 (lines=11) @@
124
     * @param null $callback
125
     * @return \Illuminate\Http\JsonResponse
126
     */
127
    protected function respondWithItem($item, $callback = null)
128
    {
129
        if($callback) {
130
            $builder = $this->prepareBuilder($item);
131
            $item = $callback($builder);
132
        }
133
134
        $rootScope = $this->fractal->item($item, $this->transformer, is_null($this->resourceKey) ? false : $this->resourceKey);
135
136
        return $this->respondWithArray($rootScope->toArray());
137
    }
138
139
    /**
140
     * Returns a json response that indicates the resource was successfully created also
@@ 147-158 (lines=12) @@
144
     * @param null $callback
145
     * @return \Illuminate\Http\JsonResponse
146
     */
147
    protected function respondWithItemCreated($item, $callback = null)
148
    {
149
        if($callback) {
150
            $builder = $this->prepareBuilder($item);
151
            $item = $callback($builder);
152
        }
153
154
        $this->setStatusCode(201);
155
        $rootScope = $this->fractal->item($item, $this->transformer, is_null($this->resourceKey) ? false : $this->resourceKey);
156
157
        return $this->respondWithArray($rootScope->toArray());
158
    }
159
160
    /**
161
     * Returns a json response that contains the specified collection