Completed
Push — refactoring ( f58f49 )
by Josef
45:19
created

ResponseFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace HelePartnerSyncApi\Response;
4
5
use Exception;
6
use Throwable;
7
8
class ResponseFactory
9
{
10
11
	/**
12
	 * @var string
13
	 */
14
	private $secret;
15
16
	/**
17
	 * @param string $secret
18
	 */
19
	public function __construct($secret)
20
	{
21
		$this->secret = $secret;
22
	}
23
24
	/**
25
	 * @param array $data
26
	 * @return Response
27
	 */
28
	public function createSuccessResponse($data)
29
	{
30
		return new SuccessResponse($this->secret, $data);
31
	}
32
33
	/**
34
	 * @param Exception|Throwable $exception
35
	 * @return Response
36
	 */
37
	public function createErrorResponse($exception)
38
	{
39
		return new ErrorResponse($this->secret, $exception);
40
	}
41
42
}
43