Passed
Branch master (b73fcd)
by Thomas
02:06
created

ZohoOAuthException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 11
c 1
b 0
f 0
dl 0
loc 31
rs 10
1
<?php
2
namespace Zoho\OAuth\Exception;
3
4
use Exception;
5
6
class ZohoOAuthException extends Exception
7
{
8
9
    protected $message = 'Unknown exception';
10
11
    // Exception message
12
    protected $code = 0;
13
14
    // Unknown
15
    protected $file;
16
17
    // User-defined exception code
18
    protected $line;
19
20
    // Source filename of exception
21
    private $string;
22
23
    // Source line of exception
24
    private $trace;
25
26
    public function __construct($message = null, $code = 0)
27
    {
28
        if (!$message) {
29
            throw new $this('Unknown ' . get_class($this));
30
        }
31
        parent::__construct($message, $code);
32
    }
33
34
    public function __toString()
35
    {
36
        return get_class($this) . " Caused by:'{$this->message}' in {$this->file}({$this->line})\n" . "{$this->getTraceAsString()}";
37
    }
38
}