Code Duplication    Length = 12-13 lines in 2 locations

Serializer/SubscriberEncoder.php 1 location

@@ 47-58 (lines=12) @@
44
     *
45
     * @return Subscriber
46
     */
47
    public function encode($data, $format, array $context = [])
48
    {
49
        $fld = [];
50
        foreach ($data as $key => $value) {
51
            $fld[] = (new SubscriberFieldData(self::FIELDS[$key]))->setValue($value);
52
        }
53
54
        $subscriber = new Subscriber(isset($data['id']) ? $data['id'] : -1);
55
        $subscriber->setFld($fld);
56
57
        return $subscriber;
58
    }
59
60
    /**
61
     * {@inheritdoc}

Serializer/Bridge/Visitor/MindbazSerializationVisitor.php 1 location

@@ 27-39 (lines=13) @@
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function getResult()
28
    {
29
        $data = $this->getRoot();
30
        $fld = [];
31
        foreach ($data as $key => $value) {
32
            $fld[] = (new SubscriberFieldData(SubscriberEncoder::FIELDS[$key]))->setValue($value);
33
        }
34
35
        $subscriber = new Subscriber(isset($data['id']) ? $data['id'] : -1);
36
        $subscriber->setFld($fld);
37
38
        return $subscriber;
39
    }
40
}
41