GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 58ff8d...1de4e3 )
by Olivier
01:28
created

StatusCodeNotValid::format_message()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the ICanBoogie package.
5
 *
6
 * (c) Olivier Laviale <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ICanBoogie\HTTP;
13
14
use ICanBoogie\Accessor\AccessorTrait;
15
16
/**
17
 * Exception thrown when the HTTP status code is not valid.
18
 *
19
 * @property-read int $status_code The status code that is not supported.
20
 */
21
class StatusCodeNotValid extends \InvalidArgumentException implements Exception
22
{
23
	use AccessorTrait;
24
25
	private $status_code;
26
27
	protected function get_status_code()
28
	{
29
		return $this->status_code;
30
	}
31
32
	/**
33
	 * @param int $status_code
34
	 * @param string|null $message
35
	 * @param int $code
36
	 * @param \Exception|null $previous
37
	 */
38
	public function __construct($status_code, $message = null, $code = Status::INTERNAL_SERVER_ERROR, \Exception $previous = null)
39
	{
40
		$this->status_code = $status_code;
41
42
		parent::__construct($message ?: $this->format_message($status_code), $code, $previous);
43
	}
44
45
	/**
46
	 * Formats exception message.
47
	 *
48
	 * @param int $status_code
49
	 *
50
	 * @return string
51
	 */
52
	protected function format_message($status_code)
53
	{
54
		return \ICanBoogie\format("Status code not valid: %status_code.", [ 'status_code' => $status_code ]);
55
	}
56
}
57