Completed
Push — master ( 2a6a78...c2b2ef )
by DELEVOYE
05:24
created

MindbazDeserializationVisitor::decode()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 10
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 10
loc 10
ccs 0
cts 9
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 1
crap 6
1
<?php
2
3
/*
4
 * This file is part of the MindbazBundle package.
5
 *
6
 * (c) David DELEVOYE <[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 Kozikaza\MindbazBundle\Serializer\Bridge\Visitor;
13
14
use JMS\Serializer\GenericDeserializationVisitor;
15
use Kozikaza\MindbazBundle\Serializer\SubscriberEncoder;
16
use mbzSubscriber\Subscriber;
17
18
/**
19
 * @author Vincent Chalamon <[email protected]>
20
 */
21
class MindbazDeserializationVisitor extends GenericDeserializationVisitor
22
{
23
    /**
24
     * @param Subscriber $subscriber
25
     *
26
     * @return array
27
     */
28 View Code Duplication
    protected function decode($subscriber)
0 ignored issues
show
Duplication introduced by
This method 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...
29
    {
30
        $fields = array_flip(SubscriberEncoder::FIELDS);
31
        $data = [];
32
        foreach ($subscriber->getFld() as $fld) {
33
            $data[$fields[$fld->getIdField()]] = $fld->getValue();
34
        }
35
36
        return $data;
37
    }
38
}
39