SimpleXMLElementFormatter::format()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace Glooby\Debug\Formatter;
4
5
use Glooby\Debug\Exception\FormatterException;
6
7
/**
8
 * @author Emil Kilhage
9
 */
10
class SimpleXMLElementFormatter implements FormatterInterface
11
{
12
    /**
13
     * @param \SimpleXMLElement $response
14
     * @return string
15
     * @throws FormatterException
16
     */
17
    public function format($response)
18
    {
19
        $response = $response->asXML();
20
21
        if (false === $response) {
22
            throw FormatterException::unableToFormatMessageException();
23
        }
24
25
        return $response;
26
    }
27
}
28