@@ -103,7 +103,7 @@ |
||
| 103 | 103 | /** |
| 104 | 104 | * Get the services provided by the provider. |
| 105 | 105 | * |
| 106 | - * @return array |
|
| 106 | + * @return string[] |
|
| 107 | 107 | */ |
| 108 | 108 | public function provides() |
| 109 | 109 | { |
@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | public function register() |
| 43 | 43 | { |
| 44 | 44 | $this->mergeConfigFrom(__DIR__.self::PATH, 'jsend'); |
| 45 | - $this->app->singleton(\NilPortugues\Laravel5\JSendSerializer\JSendSerializer::class, function ($app) { |
|
| 45 | + $this->app->singleton(\NilPortugues\Laravel5\JSendSerializer\JSendSerializer::class, function($app) { |
|
| 46 | 46 | $mapping = $app['config']->get('jsend'); |
| 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 JSendSerializer(new JSendTransformer(self::parseRoutes(new Mapper($mapping)))); |
| 51 | 51 | }); |
| 52 | 52 | }); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $mappingProperty->setAccessible(true); |
| 71 | 71 | |
| 72 | 72 | $otherUrls = (array) $mappingProperty->getValue($mapping); |
| 73 | - if(!empty($otherUrls)) { |
|
| 73 | + if (!empty($otherUrls)) { |
|
| 74 | 74 | foreach ($otherUrls as &$url) { |
| 75 | 75 | $url = urldecode(route($url)); |
| 76 | 76 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $mappingProperty->setAccessible(true); |
| 95 | 95 | $value = $mappingProperty->getValue($mapping); |
| 96 | 96 | |
| 97 | - if(!empty($value)) { |
|
| 97 | + if (!empty($value)) { |
|
| 98 | 98 | $value = urldecode(route($value)); |
| 99 | 99 | $mappingProperty->setValue($mapping, $value); |
| 100 | 100 | } |
@@ -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\JSendSerializer\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: 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\JSendSerializer; |
| 12 | 12 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | if (is_subclass_of($value, Model::class, true)) { |
| 61 | 61 | |
| 62 | 62 | $stdClass = (object) $value->getAttributes(); |
| 63 | - $data = $this->serializeData($stdClass); |
|
| 63 | + $data = $this->serializeData($stdClass); |
|
| 64 | 64 | $data[self::CLASS_IDENTIFIER_KEY] = get_class($value); |
| 65 | 65 | |
| 66 | 66 | $methods = $this->getRelationshipMethodsAsPropertyName($value, get_class($value), new ReflectionClass($value)); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | if (is_object($model)) { |
| 110 | 110 | $stdClass = (object) $model->getAttributes(); |
| 111 | - $data = $this->serializeData($stdClass); |
|
| 111 | + $data = $this->serializeData($stdClass); |
|
| 112 | 112 | $data[self::CLASS_IDENTIFIER_KEY] = get_class($model); |
| 113 | 113 | |
| 114 | 114 | $items[] = $data; |
@@ -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\JSendSerializer\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 | ); |