Passed
Push — master ( c7321f...b302b4 )
by Jens
44:31 queued 22:11
created

ConcurrentModificationException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 9
ccs 4
cts 5
cp 0.8
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getCurrentVersion() 0 7 2
1
<?php
2
/**
3
 * @author @jenschude <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Error;
7
8
/**
9
 * Exeption for response with status code 409
10
 * @package Commercetools\Core\Error
11
 * @description
12
 * When trying to update a resource with a version which differs from the version stored at the commercetools
13
 * platform the API will respond with status code 409.
14
 */
15
class ConcurrentModificationException extends ClientErrorException
16
{
17 51
    public function getCurrentVersion()
18
    {
19 51
        $error = $this->getErrorContainer()->getByCode(ConcurrentModificationError::CODE);
20 51
        if ($error instanceof ConcurrentModificationError) {
21 51
            return $error->getCurrentVersion();
22
        }
23
        return null;
24
    }
25
}
26