ClassNameBeautifier   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 9
ccs 0
cts 5
cp 0
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getClassAsTitle() 0 7 1
1
<?php
2
/*
3
 * To change this license header, choose License Headers in Project Properties.
4
 * To change this template file, choose Tools | Templates
5
 * and open the template in the editor.
6
 */
7
8
namespace ByJG\RestServer\Whoops;
9
10
/**
11
 * Description of WhoopsDebugInterface
12
 *
13
 * @author jg
14
 */
15
trait ClassNameBeautifier
16
{
17
    public function getClassAsTitle($ex)
18
    {
19
        $refClass = new \ReflectionClass($ex);
20
21
        $title = str_replace("Exception", "",  $refClass->getShortName());
22
        $title = preg_replace("/([a-z0-9])([A-Z])/", "$1 $2", $title);
23
        return preg_replace("/([a-z])(\d)/", "$1 $2", $title);
24
    }
25
26
}