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

MyException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 19
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A __toString() 0 3 1
A customFunction() 0 3 1
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
}