@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | /** |
| 136 | 136 | * @param array $value |
| 137 | 137 | * |
| 138 | - * @return mixed|string |
|
| 138 | + * @return string |
|
| 139 | 139 | */ |
| 140 | 140 | private static function calculateRoute(array $value) |
| 141 | 141 | { |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | /** |
| 153 | 153 | * Get the services provided by the provider. |
| 154 | 154 | * |
| 155 | - * @return array |
|
| 155 | + * @return string[] |
|
| 156 | 156 | */ |
| 157 | 157 | public function provides() |
| 158 | 158 | { |
@@ -45,11 +45,11 @@ |
||
| 45 | 45 | $this->mergeConfigFrom(__DIR__.self::PATH, 'jsonapi'); |
| 46 | 46 | $this->app->singleton( |
| 47 | 47 | JsonApiSerializer::class, |
| 48 | - function ($app) { |
|
| 48 | + function($app) { |
|
| 49 | 49 | $mapping = $app['config']->get('jsonapi'); |
| 50 | 50 | $transformer = new JsonApiTransformer(self::parseRoutes(new Mapper($mapping))); |
| 51 | 51 | |
| 52 | - $cacheableConfig = function () use ($transformer) { |
|
| 52 | + $cacheableConfig = function() use ($transformer) { |
|
| 53 | 53 | return new JsonApiSerializer($transformer); |
| 54 | 54 | }; |
| 55 | 55 | |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | /** |
| 16 | 16 | * @param string|array $mappedClass |
| 17 | 17 | * |
| 18 | - * @return array |
|
| 18 | + * @return \NilPortugues\Api\Mapping\Mapping |
|
| 19 | 19 | */ |
| 20 | 20 | protected function buildMapping($mappedClass) |
| 21 | 21 | { |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Author: Nil Portugués Calderó <[email protected]> |
|
| 4 | - * Date: 10/16/15 |
|
| 5 | - * Time: 8:59 PM. |
|
| 6 | - * |
|
| 7 | - * For the full copyright and license information, please view the LICENSE |
|
| 8 | - * file that was distributed with this source code. |
|
| 9 | - */ |
|
| 3 | + * Author: Nil Portugués Calderó <[email protected]> |
|
| 4 | + * Date: 10/16/15 |
|
| 5 | + * Time: 8:59 PM. |
|
| 6 | + * |
|
| 7 | + * For the full copyright and license information, please view the LICENSE |
|
| 8 | + * file that was distributed with this source code. |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | namespace NilPortugues\Laravel5\JsonApiSerializer\Mapper; |
| 12 | 12 | |
@@ -20,7 +20,6 @@ |
||
| 20 | 20 | protected function buildMapping($mappedClass) |
| 21 | 21 | { |
| 22 | 22 | return (\is_string($mappedClass) && \class_exists($mappedClass, true)) ? |
| 23 | - MappingFactory::fromClass($mappedClass) : |
|
| 24 | - MappingFactory::fromArray($mappedClass); |
|
| 23 | + MappingFactory::fromClass($mappedClass) : MappingFactory::fromArray($mappedClass); |
|
| 25 | 24 | } |
| 26 | 25 | } |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Author: Nil Portugués Calderó <[email protected]> |
|
| 4 | - * Date: 11/27/15 |
|
| 5 | - * Time: 7:47 PM. |
|
| 6 | - * |
|
| 7 | - * For the full copyright and license information, please view the LICENSE |
|
| 8 | - * file that was distributed with this source code. |
|
| 9 | - */ |
|
| 3 | + * Author: Nil Portugués Calderó <[email protected]> |
|
| 4 | + * Date: 11/27/15 |
|
| 5 | + * Time: 7:47 PM. |
|
| 6 | + * |
|
| 7 | + * For the full copyright and license information, please view the LICENSE |
|
| 8 | + * file that was distributed with this source code. |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | namespace NilPortugues\Laravel5\JsonApi\Eloquent; |
| 12 | 12 | |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Author: Nil Portugués Calderó <[email protected]> |
|
| 4 | - * Date: 10/16/15 |
|
| 5 | - * Time: 8:59 PM. |
|
| 6 | - * |
|
| 7 | - * For the full copyright and license information, please view the LICENSE |
|
| 8 | - * file that was distributed with this source code. |
|
| 9 | - */ |
|
| 3 | + * Author: Nil Portugués Calderó <[email protected]> |
|
| 4 | + * Date: 10/16/15 |
|
| 5 | + * Time: 8:59 PM. |
|
| 6 | + * |
|
| 7 | + * For the full copyright and license information, please view the LICENSE |
|
| 8 | + * file that was distributed with this source code. |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | namespace NilPortugues\Laravel5\JsonApiSerializer\Mapper; |
| 12 | 12 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | /** |
| 81 | 81 | * Returns the total number of results available for the current resource. |
| 82 | 82 | * |
| 83 | - * @return callable |
|
| 83 | + * @return \Closure |
|
| 84 | 84 | * @codeCoverageIgnore |
| 85 | 85 | */ |
| 86 | 86 | protected function totalAmountResourceCallable() |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | /** |
| 103 | 103 | * Returns a list of resources based on pagination criteria. |
| 104 | 104 | * |
| 105 | - * @return callable |
|
| 105 | + * @return \Closure |
|
| 106 | 106 | * @codeCoverageIgnore |
| 107 | 107 | */ |
| 108 | 108 | protected function listResourceCallable() |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | /** |
| 150 | 150 | * @param Request $request |
| 151 | 151 | * |
| 152 | - * @return callable |
|
| 152 | + * @return \Closure |
|
| 153 | 153 | * @codeCoverageIgnore |
| 154 | 154 | */ |
| 155 | 155 | protected function findResourceCallable(Request $request) |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | /** |
| 184 | 184 | * Reads the input and creates and saves a new Eloquent Model. |
| 185 | 185 | * |
| 186 | - * @return callable |
|
| 186 | + * @return \Closure |
|
| 187 | 187 | * @codeCoverageIgnore |
| 188 | 188 | */ |
| 189 | 189 | protected function createResourceCallable() |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
| 234 | - * @return callable |
|
| 234 | + * @return \Closure |
|
| 235 | 235 | * @codeCoverageIgnore |
| 236 | 236 | */ |
| 237 | 237 | protected function updateResourceCallable() |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | /** |
| 292 | 292 | * @param Request $request |
| 293 | 293 | * |
| 294 | - * @return callable |
|
| 294 | + * @return \Closure |
|
| 295 | 295 | * @codeCoverageIgnore |
| 296 | 296 | */ |
| 297 | 297 | protected function deleteResourceCallable(Request $request) |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | protected function totalAmountResourceCallable() |
| 87 | 87 | { |
| 88 | - return function () { |
|
| 88 | + return function() { |
|
| 89 | 89 | $idKey = $this->getDataModel()->getKeyName(); |
| 90 | 90 | |
| 91 | 91 | return $this->getDataModel()->query()->get([$idKey])->count(); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | protected function listResourceCallable() |
| 109 | 109 | { |
| 110 | - return function () { |
|
| 110 | + return function() { |
|
| 111 | 111 | return EloquentHelper::paginate($this->serializer, $this->getDataModel()->query())->get(); |
| 112 | 112 | }; |
| 113 | 113 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | protected function findResourceCallable(Request $request) |
| 156 | 156 | { |
| 157 | - return function () use ($request) { |
|
| 157 | + return function() use ($request) { |
|
| 158 | 158 | $idKey = $this->getDataModel()->getKeyName(); |
| 159 | 159 | $model = $this->getDataModel()->query()->where($idKey, $request->id)->first(); |
| 160 | 160 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | protected function createResourceCallable() |
| 190 | 190 | { |
| 191 | - return function (array $data, array $values) { |
|
| 191 | + return function(array $data, array $values) { |
|
| 192 | 192 | $model = $this->getDataModel()->newInstance(); |
| 193 | 193 | |
| 194 | 194 | foreach ($values as $attribute => $value) { |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | protected function updateResourceCallable() |
| 238 | 238 | { |
| 239 | - return function (Model $model, array $values, ErrorBag $errorBag) { |
|
| 239 | + return function(Model $model, array $values, ErrorBag $errorBag) { |
|
| 240 | 240 | foreach ($values as $attribute => $value) { |
| 241 | 241 | $model->$attribute = $value; |
| 242 | 242 | } |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | */ |
| 297 | 297 | protected function deleteResourceCallable(Request $request) |
| 298 | 298 | { |
| 299 | - return function () use ($request) { |
|
| 299 | + return function() use ($request) { |
|
| 300 | 300 | $idKey = $this->getDataModel()->getKeyName(); |
| 301 | 301 | $model = $this->getDataModel()->query()->where($idKey, $request->id)->first(); |
| 302 | 302 | |