Completed
Push — master ( 9e80ab...1774f3 )
by Sebastian
04:55 queued 01:14
created

ExceptionToJsonRenderer   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A toJson() 0 11 1
1
<?php
2
namespace Kartenmacherei\RestFramework\Exception;
3
4
class ExceptionToJsonRenderer
5
{
6
    /**
7
     * @param \Throwable $throwable
8
     * @return string
9
     */
10
    public function toJson(\Throwable $throwable): string
11
    {
12
        return json_encode(
13
            [
14
                'class' => get_class($throwable),
15
                'message' => $throwable->getMessage(),
16
                'file' => $throwable->getFile(),
17
                'line' => $throwable->getLine()
18
            ]
19
        );
20
    }
21
}
22