GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Converter   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 43
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A convertToException() 0 13 3
A convertFromException() 0 4 1
A build() 0 4 1
1
<?php
2
3
namespace WebservicesNl\Protocol\Soap\Config\Platform\Webservices;
4
5
use WebservicesNl\Common\Exception\Exception as WebserviceException;
6
use WebservicesNl\Common\Exception\ServerException;
7
use WebservicesNl\Protocol\Soap\Exception\ConverterInterface;
8
9
/**
10
 * Webservice SoapConverter.
11
 *
12
 * Converts generic Soap fault back into PHP exception with Webservices domain logic exceptions.
13
 */
14
class Converter implements ConverterInterface
15
{
16
    /**
17
     * @param \SoapFault $fault
18
     *
19
     * @return WebserviceException
20
     * @throws ServerException
21
     */
22 20
    public function convertToException($fault)
23
    {
24 20
        $errorClassName = isset($fault->{'detail'}->{'errorcode'}) ? $fault->{'detail'}->{'errorcode'} : 'Server';
25 20
        $errorClassFQ = 'WebservicesNl\Common\Exception\\' . str_replace('.', '\\', $errorClassName) . 'Exception';
26
27
        // should we throw an error about throwing an error? or just create a default error?
28 20
        if (!class_exists($errorClassFQ)) {
29 1
            throw new ServerException("Could not convert errorCode: '$errorClassName'");
30
        }
31
32
        /** @var WebserviceException $exception */
33 19
        return new $errorClassFQ($fault->getMessage(), $fault->getCode());
34
    }
35
36
    /**
37
     * @param \Exception $exception
38
     *
39
     * @return void
40
     * @throws \DomainException
41
     */
42 1
    public function convertFromException(\Exception $exception)
43
    {
44 1
        throw new \DomainException('Not yet implemented');
45
    }
46
47
    /**
48
     * Return error (build statically).
49
     *
50
     * @return static
51
     */
52 30
    public static function build()
53
    {
54 30
        return new static();
55
    }
56
}
57