Completed
Push — master ( 797ebd...09e699 )
by Josef
02:57
created

CancelReservation::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace HelePartnerSyncApi\Method;
4
5
use DateTime;
6
use HelePartnerSyncApi\Validator;
7
8 View Code Duplication
class CancelReservation extends Method
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
9
{
10
11
	/**
12
	 * @return string
13
	 */
14
	public function getName()
15
	{
16
		return 'cancelReservation';
17
	}
18
19
	/**
20
	 * @param array $data
21
	 * @return array
22
	 */
23
	protected function parseRequestData($data)
24
	{
25
		Validator::checkStructure($data, array(
26
			'startDateTime' => Validator::TYPE_DATE_TIME_STRING,
27
			'endDateTime' => Validator::TYPE_DATE_TIME_STRING,
28
			'quantity' => Validator::TYPE_INT,
29
			'parameters' => Validator::TYPE_ARRAY,
30
		));
31
32
		return array(
33
			DateTime::createFromFormat(DateTime::W3C, $data['startDateTime']),
34
			DateTime::createFromFormat(DateTime::W3C, $data['endDateTime']),
35
			$data['quantity'],
36
			$data['parameters'],
37
		);
38
	}
39
40
	/**
41
	 * @param mixed $data
42
	 * @return array
43
	 */
44
	protected function constructResponseData($data)
45
	{
46
		Validator::checkNull($data);
47
48
		return array();
49
	}
50
51
}
52