Completed
Push — master ( 2dde22...660039 )
by Zoltán
02:22
created

Exception   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 0
dl 0
loc 22
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createByFormat() 0 7 2
1
<?php namespace BuildR\Foundation\Exception;
2
3
use \Exception as VanillaException;
4
5
/**
6
 * Base Exception
7
 *
8
 * BuildR PHP Framework
9
 *
10
 * @author Zoltán Borsos <[email protected]>
11
 * @package Foundation
12
 * @subpackage Exception
13
 *
14
 * @copyright    Copyright 2015, Zoltán Borsos.
15
 * @license      https://github.com/Zolli/BuildR/blob/master/LICENSE.md
16
 * @link         https://github.com/Zolli/BuildR
17
 */
18
class Exception extends VanillaException{
19
20
    /**
21
     * Create a new exception with a prepared message. Message is prepared using vsptintf()
22
     * if you provide a format.
23
     *
24
     * @param string $message The exception message
25
     * @param array $format The format elements
26
     * @param int $code Exception code
27
     * @param \Exception $previous Previous exception class
28
     *
29
     * @return \Exception
30
     */
31 3
    public static function createByFormat($message = "", $format = [], $code = 0, VanillaException $previous = NULL) {
32 3
        if(!empty($format)) {
33 1
            $message = vsprintf($message, $format);
34 1
        }
35
36 3
        return new static($message, $code, $previous);
37
    }
38
39
}
40