Passed
Pull Request — master (#19)
by
unknown
01:50
created

MyException::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 3
1
<?php
2
3
namespace ClashApi\Models
4
{
5
    use Exception;
6
7
    class MyException extends Exception
8
    {
9
        // Redefine the exception so message isn't optional
10
        public function __construct($message, $code = 0, Exception $previous = null) {
11
            // some code
12
        
13
            // make sure everything is assigned properly
14
            parent::__construct($message, $code, $previous);
15
        }
16
17
        // custom string representation of object
18
        public function __toString() {
19
            return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
20
        }
21
22
        public function customFunction() {
23
            echo "A custom function for this type of exception\n";
24
        }
25
    }
26
}