Completed
Push — 2.0 ( 9a9bd1...98f64c )
by Olivier
02:55
created

Error::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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;
13
14
/**
15
 * Representation of an error.
16
 *
17
 * @property-read string $format
18
 * @property-read array $args
19
 */
20
class Error implements \JsonSerializable
21
{
22
	/**
23
	 * @var string
24
	 */
25
	public $format;
26
27
	/**
28
	 * @var array
29
	 */
30
	public $args;
31
32
	/**
33
	 * @param string $format
34
	 * @param array $args
35
	 */
36
	public function __construct($format, array $args = [])
37
	{
38
		$this->format = $format;
39
		$this->args = $args;
40
	}
41
42
	/**
43
	 * @inheritdoc
44
	 */
45
	public function __toString()
46
	{
47
		return format($this->format, $this->args);
48
	}
49
50
	/**
51
	 * @inheritdoc
52
	 */
53
	function jsonSerialize()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
54
	{
55
		return (string) $this;
56
	}
57
}
58