Completed
Branch master (933e97)
by Torsten
04:46
created

StatusSubscribingHandler::getSubscribingMethods()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 10

Duplication

Lines 16
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 16
loc 16
c 1
b 0
f 0
ccs 0
cts 10
cp 0
rs 9.4285
cc 2
eloc 10
nc 2
nop 0
crap 6
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Lej\Component\Infrastructure\Serialization;
6
7
use JMS\Serializer\GraphNavigator;
8
use JMS\Serializer\Handler\SubscribingHandlerInterface;
9
use JMS\Serializer\VisitorInterface;
10
use Lej\Component\Domain\Model\Status;
11
12 View Code Duplication
class StatusSubscribingHandler implements SubscribingHandlerInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public static function getSubscribingMethods()
18
    {
19
        $methods = [];
20
        $formats = ['json'];
21
22
        foreach ($formats as $format) {
23
            $methods[] = [
24
                'type' => 'Status',
25
                'format' => $format,
26
                'direction' => GraphNavigator::DIRECTION_SERIALIZATION,
27
                'method' => 'serializeStatus',
28
            ];
29
        }
30
31
        return $methods;
32
    }
33
34
    /**
35
     * @param VisitorInterface $visitor
36
     * @param Status $status
37
     * @return string
38
     */
39 1
    public function serializeStatus(VisitorInterface $visitor, Status $status)
0 ignored issues
show
Unused Code introduced by
The parameter $visitor is not used and could be removed.

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

Loading history...
40
    {
41 1
        return $status->toString();
42
    }
43
}
44