Completed
Push — feature/fix-somescrutinizer-is... ( 03fa6a...7ccc0d )
by Narcotic
09:35
created

HashHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 38
ccs 0
cts 16
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A serializeHashToJson() 0 8 1
A deserializeHashFromJson() 0 8 1
1
<?php
2
/**
3
 * HashHandler class file
4
 */
5
6
namespace Graviton\DocumentBundle\Serializer\Handler;
7
8
use JMS\Serializer\Context;
9
use JMS\Serializer\JsonDeserializationVisitor;
10
use JMS\Serializer\JsonSerializationVisitor;
11
use Graviton\DocumentBundle\Entity\Hash;
12
13
/**
14
 * Hash handler for JMS serializer
15
 *
16
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
17
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
18
 * @link     http://swisscom.ch
19
 */
20
class HashHandler
21
{
22
    /**
23
     * Serialize Hash object
24
     *
25
     * @param JsonSerializationVisitor $visitor Visitor
26
     * @param Hash                     $data    Data
27
     * @param array                    $type    Type
28
     * @param Context                  $context Context
29
     * @return array
30
     */
31
    public function serializeHashToJson(
32
        JsonSerializationVisitor $visitor,
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...
33
        Hash $data,
34
        array $type,
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...
35
        Context $context
0 ignored issues
show
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...
36
    ) {
37
        return $data;
38
    }
39
40
    /**
41
     * Deserialize Hash object
42
     *
43
     * @param JsonDeserializationVisitor $visitor Visitor
44
     * @param array                      $data    Data
45
     * @param array                      $type    Type
46
     * @param Context                    $context Context
47
     * @return Hash
48
     */
49
    public function deserializeHashFromJson(
50
        JsonDeserializationVisitor $visitor,
51
        array $data,
52
        array $type,
53
        Context $context
54
    ) {
55
        return new Hash($visitor->visitArray($data, $type, $context));
56
    }
57
}
58