Code Duplication    Length = 17-19 lines in 2 locations

src/Json/ChainVersioner.php 2 locations

@@ 42-58 (lines=17) @@
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function parseVersion(stdClass $jsonData)
43
    {
44
        /** @var CannotParseVersionException $firstException */
45
        $firstException = null;
46
47
        foreach ($this->versioners as $versioner) {
48
            try {
49
                return $versioner->parseVersion($jsonData);
50
            } catch (CannotParseVersionException $e) {
51
                if (null === $firstException) {
52
                    $firstException = $e;
53
                }
54
            }
55
        }
56
57
        throw $firstException;
58
    }
59
60
    /**
61
     * {@inheritdoc}
@@ 63-81 (lines=19) @@
60
    /**
61
     * {@inheritdoc}
62
     */
63
    public function updateVersion(stdClass $jsonData, $version)
64
    {
65
        /** @var CannotUpdateVersionException $firstException */
66
        $firstException = null;
67
68
        foreach ($this->versioners as $versioner) {
69
            try {
70
                $versioner->updateVersion($jsonData, $version);
71
72
                return;
73
            } catch (CannotUpdateVersionException $e) {
74
                if (null === $firstException) {
75
                    $firstException = $e;
76
                }
77
            }
78
        }
79
80
        throw $firstException;
81
    }
82
}
83