DecodingException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php declare(strict_types=1);
2
3
/**
4
* @package   s9e\Bencode
5
* @copyright Copyright (c) The s9e authors
6
* @license   http://www.opensource.org/licenses/mit-license.php The MIT License
7
*/
8
namespace s9e\Bencode\Exceptions;
9
10
use RuntimeException;
11
12
class DecodingException extends RuntimeException
13
{
14
	protected int $offset;
15
16 2
	public function __construct(string $message, int $offset)
17
	{
18 2
		$this->offset = $offset;
19 2
		parent::__construct($message . ' at offset ' . $offset);
20
	}
21
22 1
	public function getOffset(): int
23
	{
24 1
		return $this->offset;
25
	}
26
}