ShiftList::getPropertyMap()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 9
rs 10
1
<?php
2
3
namespace alekciy\ofd\providers\yandex\Request;
4
5
use alekciy\ofd\providers\yandex\Model\Document;
6
use alekciy\ofd\providers\yandex\RequestPage;
7
8
/**
9
 * Список смен заданной ККТ.
10
 */
11
class ShiftList extends RequestPage
12
{
13
	public $method = 'POST';
14
	protected $path = '/v1/docs/aggregations/shifts';
15
16
	/** @var string Начало периода */
17
	public $start = '';
18
19
	/** @var string Окончание периода */
20
	public $end = '';
21
22
	/** @var array Список идентификаторов ККТ, по которым будет построен отчет */
23
	public $cashDeskIdList = [];
24
25
	/** @var array Список идентификаторов компаний, по ККТ (кассам) которых будет построен отчет */
26
	public $companyIdList = [];
27
28
	/** @var array Список идентификаторов точек продаж, по ККТ которых будет построен отчет */
29
	public $outletIdList = [];
30
31
	/** @var array Тип фискального документа (ФД) */
32
	public $documentTypeList = [];
33
34
	/**
35
	 * @inheritDoc
36
	 */
37
	public function getPropertyMap(): array
38
	{
39
		return array_merge(parent::getPropertyMap(), [
40
			'cashDeskIdList'   => ['body' => 'cashbox_ids'],
41
			'companyIdList'    => ['body' => 'company_ids'],
42
			'outletIdList'     => ['body' => 'retail_point_ids'],
43
			'documentTypeList' => ['body' => 'document_types'],
44
			'start'            => ['body' => 'begin'],
45
			'end'              => ['body' => 'end'],
46
		]);
47
	}
48
49
	/**
50
	 * @inheritDoc
51
	 */
52
	public function getRuleList(): array
53
	{
54
		return array_merge(parent::getRuleList(), [
55
			'start' => ['required', ['dateFormat', 'Y-m-d H:i:s']],
56
			'end'   => ['required', ['dateFormat', 'Y-m-d H:i:s']],
57
58
			'cashDeskIdList'   => ['array'],
59
			'companyIdList'    => ['array'],
60
			'outletIdList'     => ['array'],
61
			'documentTypeList' => ['array', ['subset', [
62
				Document::TYPE_OPEN,
63
				Document::TYPE_CLOSE,
64
				Document::TYPE_STATE,
65
				Document::TYPE_CHECK,
66
				Document::TYPE_CHECK_CORRECT,
67
				Document::TYPE_STRICT,
68
				Document::TYPE_STRICT_CORRECT,
69
				Document::TYPE_REGISTRATION,
70
				Document::TYPE_REGISTRATION_CHANGE,
71
				Document::TYPE_FN_CLOSE,
72
			]]],
73
		]);
74
	}
75
}