Passed
Push — master ( 055b76...bacc0b )
by Patrick
01:33 queued 12s
created

SerializerFacade   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 3
c 1
b 0
f 1
dl 0
loc 17
ccs 0
cts 4
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A serialize() 0 3 1
A deserialize() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of forecast.it.fill project.
7
 * (c) Patrick Jaja <[email protected]>
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace ForecastAutomation\Serializer;
13
14
use ForecastAutomation\Kernel\AbstractFacade;
15
use ForecastAutomation\Serializer\Shared\Config\SerializerConstants;
16
17
/**
18
 * @method \ForecastAutomation\Serializer\SerializerFactory getFactory()
19
 */
20
class SerializerFacade extends AbstractFacade
21
{
22
    //ToDo: Support original feature scope ie. normalize attributes path
23
    // see here https://symfony.com/doc/current/components/serializer.html
24
    // https://jmsyst.com/libs/serializer
25
    public function serialize(object|array $dto, string $format = SerializerConstants::FORMAT_JSON): string
0 ignored issues
show
Unused Code introduced by
The parameter $format is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

25
    public function serialize(object|array $dto, /** @scrutinizer ignore-unused */ string $format = SerializerConstants::FORMAT_JSON): string

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
26
    {
27
        return \json_encode((array) $dto, JSON_THROW_ON_ERROR);
28
//        return $this->getFactory()->createSerializer()->serialize($dto, $format);
29
    }
30
31
    public function deserialize(
32
        string $serializedData,
33
//        string $dtoClassPath,
34
        string $format = SerializerConstants::FORMAT_JSON
0 ignored issues
show
Unused Code introduced by
The parameter $format is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

34
        /** @scrutinizer ignore-unused */ string $format = SerializerConstants::FORMAT_JSON

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
35
    ): array {
36
        return \json_decode($serializedData, true, 512, JSON_THROW_ON_ERROR);
37
//        return $this->getFactory()->createSerializer()->deserialize($serializedData, $dtoClassPath, $format);
38
    }
39
}
40