UnsupportedTypeException   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 27
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 3
A getUnsupportedType() 0 3 1
1
<?php
2
3
namespace Deserializers\Exceptions;
4
5
use Exception;
6
7
/**
8
 * Indicates the objectType specified in the serialization is not supported by a deserializer.
9
 *
10
 * @since 1.0
11
 *
12
 * @license GPL-2.0-or-later
13
 * @author Jeroen De Dauw < [email protected] >
14
 * @author Thiemo Kreuz
15
 */
16
class UnsupportedTypeException extends DeserializationException {
17
18
	private $type;
19
20
	/**
21
	 * @param mixed $type
22
	 * @param string $message
23
	 * @param Exception|null $previous
24
	 */
25 2
	public function __construct( $type, $message = '', Exception $previous = null ) {
26 2
		$this->type = $type;
27
28 2
		if ( $message === '' && is_scalar( $type ) ) {
29 1
			$message = 'Type "' . $type . '" is unsupported';
30
		}
31
32 2
		parent::__construct( $message, $previous );
33 2
	}
34
35
	/**
36
	 * @return mixed
37
	 */
38 2
	public function getUnsupportedType() {
39 2
		return $this->type;
40
	}
41
42
}
43