mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-26 16:45:01 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -22,10 +22,6 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\ObjectToPopulateTrait;
|
||||
|
||||
use function array_key_exists;
|
||||
use function array_merge;
|
||||
use function count;
|
||||
|
||||
class AccompanyingPeriodResourceNormalizer implements DenormalizerAwareInterface, DenormalizerInterface
|
||||
{
|
||||
use DenormalizerAwareTrait;
|
||||
@@ -42,16 +38,15 @@ class AccompanyingPeriodResourceNormalizer implements DenormalizerAwareInterface
|
||||
throw new Exception\InvalidArgumentException("the key type must be present in data and set to 'accompanying_period_resource'");
|
||||
}
|
||||
|
||||
if (null === $resource && array_key_exists('id', $data)) {
|
||||
if (null === $resource && \array_key_exists('id', $data)) {
|
||||
$resource = $this->repository->find($data['id']);
|
||||
|
||||
if (null === $resource) {
|
||||
throw new Exception\UnexpectedValueException(sprintf('the resource with' .
|
||||
'id %d is not found', $data['id']));
|
||||
throw new Exception\UnexpectedValueException(sprintf('the resource withid %d is not found', $data['id']));
|
||||
}
|
||||
|
||||
// if resource found, available only for read-only
|
||||
if (count($data) > 2) {
|
||||
if (\count($data) > 2) {
|
||||
unset($data['id'], $data['type']);
|
||||
|
||||
throw new Exception\ExtraAttributesException($data);
|
||||
@@ -62,12 +57,12 @@ class AccompanyingPeriodResourceNormalizer implements DenormalizerAwareInterface
|
||||
$resource = new Resource();
|
||||
}
|
||||
|
||||
if (array_key_exists('resource', $data)) {
|
||||
if (\array_key_exists('resource', $data)) {
|
||||
$res = $this->denormalizer->denormalize(
|
||||
$data['resource'],
|
||||
DiscriminatedObjectDenormalizer::TYPE,
|
||||
$format,
|
||||
array_merge(
|
||||
\array_merge(
|
||||
$context,
|
||||
[
|
||||
DiscriminatedObjectDenormalizer::ALLOWED_TYPES => [
|
||||
@@ -80,7 +75,7 @@ class AccompanyingPeriodResourceNormalizer implements DenormalizerAwareInterface
|
||||
$resource->setResource($res);
|
||||
}
|
||||
|
||||
if (array_key_exists('comment', $data)) {
|
||||
if (\array_key_exists('comment', $data)) {
|
||||
$resource->setComment($data['comment']);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user