Credentials   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 11
c 2
b 0
f 0
dl 0
loc 32
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getRuleList() 0 6 1
1
<?php
2
3
namespace alekciy\ofd\providers\yandex;
4
5
use Exception;
6
7
/**
8
 * Необходимые реквизиты доступа к сервису.
9
 *
10
 * Необходимо получить ключи доступа отправьте заявку через форму
11
 * обратной связи (https://yandex.ru/dev/ofd/doc/dg/concepts/troubleshooting-docpage/#troubleshooting) или напишите
12
 * в службу поддержки: [email protected]
13
 *
14
 * @see https://yandex.ru/dev/ofd/doc/dg/concepts/about-docpage/ Руководство пользователя API сервиса «Яндекс.ОФД»
15
 */
16
final class Credentials extends \alekciy\ofd\Credentials
17
{
18
	/** @var string аутентификационный ключ */
19
	public $authenticationKey = '';
20
21
	/** @var string авторизационный ключ */
22
	public $authorizationKey = '';
23
24
	/**
25
	 * @inheritDoc
26
	 */
27
	protected function getRuleList(): array
28
	{
29
		return [
30
			'authenticationKey' => ['required'],
31
			'authorizationKey'  => ['required'],
32
			'domain'            => ['required', ['in', ['api.ofd.yandex.net']]],
33
		];
34
	}
35
36
	/**
37
	 * @param string $domain            Имя домена на котором находится API (api.ofd.yandex.net промышленный).
38
	 * @param string $authenticationKey Аутентификационный ключ.
39
	 * @param string $authorizationKey  Авторизационный ключ.
40
	 * @throws Exception
41
	 */
42
	public function __construct(string $domain, string $authenticationKey, string $authorizationKey)
43
	{
44
		parent::__construct($domain);
45
		$this->authenticationKey = $authenticationKey;
46
		$this->authorizationKey = $authorizationKey;
47
		$this->validate();
48
	}
49
}
50