@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | /** |
63 | 63 | * Returns the total number of results available for the current resource. |
64 | 64 | * |
65 | - * @return callable |
|
65 | + * @return \Closure |
|
66 | 66 | */ |
67 | 67 | protected function totalAmountResourceCallable() |
68 | 68 | { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | /** |
84 | 84 | * Returns a list of resources based on pagination criteria. |
85 | 85 | * |
86 | - * @return callable |
|
86 | + * @return \Closure |
|
87 | 87 | */ |
88 | 88 | protected function listResourceCallable() |
89 | 89 | { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | /** |
119 | 119 | * @param Request $request |
120 | 120 | * |
121 | - * @return callable |
|
121 | + * @return \Closure |
|
122 | 122 | */ |
123 | 123 | protected function findResourceCallable(Request $request) |
124 | 124 | { |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | /** |
149 | 149 | * Reads the input and creates and saves a new Eloquent Model. |
150 | 150 | * |
151 | - * @return callable |
|
151 | + * @return \Closure |
|
152 | 152 | */ |
153 | 153 | protected function createResourceCallable() |
154 | 154 | { |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | } |
199 | 199 | |
200 | 200 | /** |
201 | - * @return callable |
|
201 | + * @return \Closure |
|
202 | 202 | */ |
203 | 203 | protected function updateResourceCallable() |
204 | 204 | { |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | protected function totalAmountResourceCallable() |
68 | 68 | { |
69 | - return function () { |
|
69 | + return function() { |
|
70 | 70 | $idKey = $this->getDataModel()->getKeyName(); |
71 | 71 | |
72 | 72 | return $this->getDataModel()->query()->get([$idKey])->count(); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | protected function listResourceCallable() |
89 | 89 | { |
90 | - return function () { |
|
90 | + return function() { |
|
91 | 91 | return EloquentHelper::paginate($this->serializer, $this->getDataModel()->query())->get(); |
92 | 92 | }; |
93 | 93 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | protected function findResourceCallable(Request $request) |
124 | 124 | { |
125 | - return function () use ($request) { |
|
125 | + return function() use ($request) { |
|
126 | 126 | $idKey = $this->getDataModel()->getKeyName(); |
127 | 127 | |
128 | 128 | return $this->getDataModel()->query()->where($idKey, $request->id)->first(); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | protected function createResourceCallable() |
154 | 154 | { |
155 | - return function (array $data, array $values) { |
|
155 | + return function(array $data, array $values) { |
|
156 | 156 | $model = $this->getDataModel()->newInstance(); |
157 | 157 | |
158 | 158 | foreach ($values as $attribute => $value) { |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | */ |
203 | 203 | protected function updateResourceCallable() |
204 | 204 | { |
205 | - return function (Model $model, array $values, ErrorBag $errorBag) { |
|
205 | + return function(Model $model, array $values, ErrorBag $errorBag) { |
|
206 | 206 | foreach ($values as $attribute => $value) { |
207 | 207 | $model->$attribute = $value; |
208 | 208 | } |
@@ -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,14 +45,14 @@ |
||
45 | 45 | $this->mergeConfigFrom(__DIR__.self::PATH, 'jsonapi'); |
46 | 46 | $this->app->singleton( |
47 | 47 | \NilPortugues\Laravel5\JsonApiSerializer\JsonApiSerializer::class, |
48 | - function ($app) { |
|
48 | + function($app) { |
|
49 | 49 | |
50 | 50 | $mapping = $app['config']->get('jsonapi'); |
51 | 51 | $key = \md5(\json_encode($mapping)); |
52 | 52 | |
53 | 53 | return Cache::rememberForever( |
54 | 54 | $key, |
55 | - function () use ($mapping) { |
|
55 | + function() use ($mapping) { |
|
56 | 56 | return new JsonApiSerializer(new JsonApiTransformer(self::parseRoutes(new Mapper($mapping)))); |
57 | 57 | } |
58 | 58 | ); |
@@ -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 |