Skip to content
This repository was archived by the owner on Jan 17, 2022. It is now read-only.

Commit db9d2e5

Browse files
committed
minor improvements
1 parent 1364e5c commit db9d2e5

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

Diff for: src/Skeleton/BaseController.php

+15-18
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ abstract protected function transformer();
7878
/**
7979
* Getter for statusCode.
8080
*
81-
* @return mixed
81+
* @return integer
8282
*/
8383
public function getStatusCode()
8484
{
@@ -103,7 +103,7 @@ public function setStatusCode($statusCode)
103103
* Respond with a given item.
104104
*
105105
* @param $item
106-
* @param $callback
106+
* @param \League\Fractal\TransformerAbstract $callback
107107
*
108108
* @return mixed
109109
*/
@@ -120,7 +120,7 @@ protected function respondWithItem($item, $callback)
120120
* Respond with a given collection.
121121
*
122122
* @param $collection
123-
* @param $callback
123+
* @param \League\Fractal\TransformerAbstract $callback
124124
*
125125
* @return mixed
126126
*/
@@ -149,7 +149,7 @@ protected function respondWithArray(array $array, array $headers = [])
149149
/**
150150
* Response with the current error.
151151
*
152-
* @param $message
152+
* @param string $message
153153
*
154154
* @return mixed
155155
*/
@@ -166,17 +166,14 @@ protected function respondWithError($message)
166166
/**
167167
* Prepare root scope and adds meta.
168168
*
169-
* @param Item $resource
169+
* @param Item|Collection $resource
170170
*
171-
* @return mixed
171+
* @return \League\Fractal\Scope
172172
*/
173173
protected function prepareRootScope($resource)
174174
{
175-
$availableIncludes = $resource->getTransformer()->getAvailableIncludes();
176-
$resource->setMetaValue('available_includes', $availableIncludes);
177-
178-
$defaultIncludes = $resource->getTransformer()->getDefaultIncludes();
179-
$resource->setMetaValue('default_includes', $defaultIncludes);
175+
$resource->setMetaValue('available_includes', $this->transformer->getAvailableIncludes());
176+
$resource->setMetaValue('default_includes', $this->transformer->getDefaultIncludes());
180177

181178
return $this->fractal->createData($resource);
182179
}
@@ -194,7 +191,7 @@ protected function rulesForCreate()
194191
/**
195192
* Get the validation rules for update.
196193
*
197-
* @param $id
194+
* @param integer $id
198195
*
199196
* @return array
200197
*/
@@ -218,7 +215,7 @@ public function errorForbidden($message = 'Forbidden')
218215
/**
219216
* Generate a Response with a 500 HTTP header and a given message.
220217
*
221-
* @param $message
218+
* @param string $message
222219
*
223220
* @return Response
224221
*/
@@ -230,7 +227,7 @@ public function errorInternalError($message = 'Internal Error')
230227
/**
231228
* Generate a Response with a 404 HTTP header and a given message.
232229
*
233-
* @param $message
230+
* @param string $message
234231
*
235232
* @return Response
236233
*/
@@ -242,7 +239,7 @@ public function errorNotFound($message = 'Resource Not Found')
242239
/**
243240
* Generate a Response with a 401 HTTP header and a given message.
244241
*
245-
* @param $message
242+
* @param string $message
246243
*
247244
* @return Response
248245
*/
@@ -254,7 +251,7 @@ public function errorUnauthorized($message = 'Unauthorized')
254251
/**
255252
* Generate a Response with a 400 HTTP header and a given message.
256253
*
257-
* @param $message
254+
* @param string$message
258255
*
259256
* @return Response
260257
*/
@@ -266,7 +263,7 @@ public function errorWrongArgs($message = 'Wrong Arguments')
266263
/**
267264
* Generate a Response with a 501 HTTP header and a given message.
268265
*
269-
* @param $message
266+
* @param string $message
270267
*
271268
* @return Response
272269
*/
@@ -427,7 +424,7 @@ protected function getEagerLoad()
427424
/**
428425
* Get item according to mode.
429426
*
430-
* @param $id
427+
* @param integer $id
431428
* @param array $with
432429
*
433430
* @return mixed

0 commit comments

Comments
 (0)