DocumentDataUnwrapper   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 0
cbo 2
dl 0
loc 20
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubscribingMethods() 0 9 1
A unwrapData() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the xAPI package.
5
 *
6
 * (c) Christian Flothmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Xabbuh\XApi\Serializer\Handler;
13
14
use JMS\Serializer\Context;
15
use JMS\Serializer\GraphNavigator;
16
use JMS\Serializer\Handler\SubscribingHandlerInterface;
17
use JMS\Serializer\JsonSerializationVisitor;
18
use Xabbuh\XApi\Model\DocumentData;
19
20
/**
21
 * Unwraps the data of an xAPI document during the serialization process.
22
 *
23
 * @author Christian Flothmann <[email protected]>
24
 */
25
class DocumentDataUnwrapper implements SubscribingHandlerInterface
26
{
27
    /**
28
     * {@inheritDoc}
29
     */
30
    public static function getSubscribingMethods()
31
    {
32
        return array(array(
33
            'direction' => GraphNavigator::DIRECTION_SERIALIZATION,
34
            'format' => 'json',
35
            'type' => 'Xabbuh\XApi\Model\DocumentData',
36
            'method' => 'unwrapData',
37
        ));
38
    }
39
40
    public function unwrapData(JsonSerializationVisitor $visitor, DocumentData $document, array $type, Context $context)
0 ignored issues
show
Unused Code introduced by
The parameter $type 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...
Unused Code introduced by
The parameter $context 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...
41
    {
42
        $visitor->setRoot($document->getData());
43
    }
44
}
45