DocumentList   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 21
c 1
b 0
f 0
dl 0
loc 42
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getPropertyMap() 0 6 1
A getRuleList() 0 13 1
1
<?php
2
3
namespace alekciy\ofd\providers\taxcom\Request;
4
5
use alekciy\ofd\providers\taxcom\Model\Document;
6
use alekciy\ofd\providers\taxcom\RequestPage;
7
8
/**
9
 * Список документов по смене.
10
 */
11
class DocumentList extends RequestPage
12
{
13
	public $method = 'GET';
14
	protected $path = '/API/v2/DocumentList';
15
16
	/** @var string Заводской номер ФН */
17
	public $fnFactoryNumber = '';
18
19
	/** @var int Номер смены */
20
	public $shiftNumber = 0;
21
22
	/** @var integer[] Тип документа */
23
	public $type = [];
24
25
	/**
26
	 * @inheritDoc
27
	 */
28
	public function getPropertyMap(): array
29
	{
30
		return array_merge(parent::getPropertyMap(), [
31
			'fnFactoryNumber' => ['query' => 'fn'],
32
			'shiftNumber'     => ['query' => 'shift'],
33
			'type'            => ['query' => 'type'],
34
		]);
35
	}
36
37
	/**
38
	 * @inheritDoc
39
	 */
40
	public function getRuleList(): array
41
	{
42
		return array_merge(parent::getRuleList(), [
43
			'fnFactoryNumber' => ['required', ['lengthMin', 1], ['lengthMax', 16]],
44
			'shiftNumber'     => ['required', 'integer', ['min', 0]],
45
			'type'            => ['array', ['subset', [
46
				Document::TYPE_CHECK,
47
				Document::TYPE_CLOSE,
48
				Document::TYPE_STATE,
49
				Document::TYPE_CHECK_CORRECT,
50
				Document::TYPE_STRICT,
51
				Document::TYPE_STRICT_CORRECT,
52
				Document::TYPE_OPEN,
53
			]]],
54
		]);
55
	}
56
}