Commit b03d22b7 authored by Guillaume Perréal's avatar Guillaume Perréal
Browse files

CS.

parent d9f6ad8c
No related merge requests found
Showing with 39 additions and 26 deletions
+39 -26
<?php declare(strict_types=1); <?php declare(strict_types=1);
/** /*
* This file is part of "irstea/api-metadata".
*
* Copyright (C) 2019 IRSTEA * Copyright (C) 2019 IRSTEA
* All rights reserved.
* *
* @copyright 2019 IRSTEA * This program is free software: you can redistribute it and/or modify it under
* @author guillaume.perreal * the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License and the GNU
* Lesser General Public License along with this program. If not, see
* <https://www.gnu.org/licenses/>.
*/ */
namespace Irstea\ApiMetadata\Bridge\Symfony\Serializer; namespace Irstea\ApiMetadata\Bridge\Symfony\Serializer;
use Assert\Assertion; use Assert\Assertion;
use Irstea\ApiMetadata\Model\PropertyMetadata; use Irstea\ApiMetadata\Model\PropertyMetadata;
use Symfony\Component\Serializer\Exception\CircularReferenceException;
use Symfony\Component\Serializer\Exception\ExceptionInterface;
use Symfony\Component\Serializer\Exception\InvalidArgumentException;
use Symfony\Component\Serializer\Exception\LogicException;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
/** /**
* Class PropertyNormalizer * Class PropertyNormalizer.
*/ */
class PropertyNormalizer implements NormalizerAwareInterface, NormalizerInterface class PropertyNormalizer implements NormalizerAwareInterface, NormalizerInterface
{ {
use NormalizerAwareTrait; use NormalizerAwareTrait;
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function supportsNormalization($data, $format = null) public function supportsNormalization($data, $format = null)
{ {
...@@ -37,14 +42,13 @@ class PropertyNormalizer implements NormalizerAwareInterface, NormalizerInterfac ...@@ -37,14 +42,13 @@ class PropertyNormalizer implements NormalizerAwareInterface, NormalizerInterfac
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function normalize($property, $format = null, array $context = []) public function normalize($property, $format = null, array $context = [])
{ {
Assertion::isInstanceOf($property, PropertyMetadata::class); Assertion::isInstanceOf($property, PropertyMetadata::class);
/** @var PropertyMetadata $property */ /* @var PropertyMetadata $property */
return $this->normalizer->normalize($property->getType(), $format, $context); return $this->normalizer->normalize($property->getType(), $format, $context);
} }
} }
...@@ -26,7 +26,6 @@ use ApiPlatform\Core\Metadata\Property\Factory\PropertyMetadataFactoryInterface; ...@@ -26,7 +26,6 @@ use ApiPlatform\Core\Metadata\Property\Factory\PropertyMetadataFactoryInterface;
use ApiPlatform\Core\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface; use ApiPlatform\Core\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
use Irstea\ApiMetadata\Factory\ContextInterface; use Irstea\ApiMetadata\Factory\ContextInterface;
use Irstea\ApiMetadata\Helper\PropertyInfoType; use Irstea\ApiMetadata\Helper\PropertyInfoType;
use Irstea\ApiMetadata\Model\FormattedStringMetadata;
use Irstea\ApiMetadata\Model\PropertyMetadata; use Irstea\ApiMetadata\Model\PropertyMetadata;
use Irstea\ApiMetadata\Model\ResourceLinkMetadata; use Irstea\ApiMetadata\Model\ResourceLinkMetadata;
use Irstea\ApiMetadata\Model\ResourceMetadata; use Irstea\ApiMetadata\Model\ResourceMetadata;
......
<?php declare(strict_types=1); <?php declare(strict_types=1);
/** /*
* This file is part of "irstea/api-metadata".
*
* Copyright (C) 2019 IRSTEA * Copyright (C) 2019 IRSTEA
* All rights reserved.
* *
* @copyright 2019 IRSTEA * This program is free software: you can redistribute it and/or modify it under
* @author guillaume.perreal * the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License and the GNU
* Lesser General Public License along with this program. If not, see
* <https://www.gnu.org/licenses/>.
*/ */
namespace Irstea\ApiMetadata\Model; namespace Irstea\ApiMetadata\Model;
/** /**
* Class ResourceLinkMetadata * Class ResourceLinkMetadata.
*/ */
class ResourceLinkMetadata implements SimpleTypeInterface class ResourceLinkMetadata implements SimpleTypeInterface
{ {
...@@ -21,6 +30,7 @@ class ResourceLinkMetadata implements SimpleTypeInterface ...@@ -21,6 +30,7 @@ class ResourceLinkMetadata implements SimpleTypeInterface
/** /**
* ResourceLinkMetadata constructor. * ResourceLinkMetadata constructor.
*
* @param ResourceMetadata $target * @param ResourceMetadata $target
*/ */
public function __construct(ResourceMetadata $target) public function __construct(ResourceMetadata $target)
...@@ -29,7 +39,7 @@ class ResourceLinkMetadata implements SimpleTypeInterface ...@@ -29,7 +39,7 @@ class ResourceLinkMetadata implements SimpleTypeInterface
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function getBaseType(): string public function getBaseType(): string
{ {
...@@ -37,7 +47,7 @@ class ResourceLinkMetadata implements SimpleTypeInterface ...@@ -37,7 +47,7 @@ class ResourceLinkMetadata implements SimpleTypeInterface
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function getTypeAttributes(): array public function getTypeAttributes(): array
{ {
...@@ -48,7 +58,7 @@ class ResourceLinkMetadata implements SimpleTypeInterface ...@@ -48,7 +58,7 @@ class ResourceLinkMetadata implements SimpleTypeInterface
} }
/** /**
* @inheritDoc * {@inheritdoc}
*/ */
public function fmap(callable $f) public function fmap(callable $f)
{ {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment