@@ -99,7 +99,7 @@ |
||
| 99 | 99 | /** |
| 100 | 100 | * Get the services provided by the provider. |
| 101 | 101 | * |
| 102 | - * @return array |
|
| 102 | + * @return string[] |
|
| 103 | 103 | */ |
| 104 | 104 | public function provides() |
| 105 | 105 | { |
@@ -42,11 +42,11 @@ |
||
| 42 | 42 | public function register() |
| 43 | 43 | { |
| 44 | 44 | $this->mergeConfigFrom(__DIR__.self::PATH, 'jsonapi'); |
| 45 | - $this->app->singleton(\NilPortugues\Laravel5\JsonSerializer\JsonSerializer::class, function ($app) { |
|
| 45 | + $this->app->singleton(\NilPortugues\Laravel5\JsonSerializer\JsonSerializer::class, function($app) { |
|
| 46 | 46 | $mapping = $app['config']->get('jsonapi'); |
| 47 | 47 | $key = md5(json_encode($mapping)); |
| 48 | 48 | |
| 49 | - return Cache::rememberForever($key, function () use ($mapping) { |
|
| 49 | + return Cache::rememberForever($key, function() use ($mapping) { |
|
| 50 | 50 | return new JsonSerializer(new JsonTransformer(self::parseRoutes(new Mapper($mapping)))); |
| 51 | 51 | }); |
| 52 | 52 | }); |
@@ -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 | { |
@@ -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: 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\JsonSerializer\Mapper; |
| 12 | 12 | |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Author: Nil Portugués Calderó <[email protected]> |
|
| 4 | - * Date: 8/18/15 |
|
| 5 | - * Time: 11:19 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: 8/18/15 |
|
| 5 | + * Time: 11:19 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\JsonSerializer; |
| 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\JsonSerializer\Mapper; |
| 12 | 12 | |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | $value = $reflection->newInstanceWithoutConstructor(); |
| 40 | 40 | |
| 41 | 41 | if (is_subclass_of($value, Model::class, true)) { |
| 42 | - $attributes = array_merge( |
|
| 42 | + $attributes = array_merge( |
|
| 43 | 43 | Schema::getColumnListing($value->getTable()), |
| 44 | 44 | self::getRelationshipMethodsAsPropertyName($value, $className, $reflection) |
| 45 | 45 | ); |