Passed
Push — developer ( b6ebe7...0bf5e9 )
by Mariusz
47:54 queued 29:05
created

Base   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 5
dl 0
loc 50
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
1
<?php
2
/**
3
 * Base file for the connector enabling connection with a specific version of Comarch.
4
 *
5
 * The file is part of the paid functionality. Using the file is allowed only after purchasing a subscription.
6
 * File modification allowed only with the consent of the system producer.
7
 *
8
 * @package Integration
9
 *
10
 * @copyright YetiForce S.A.
11
 * @license   YetiForce Public License 5.0 (licenses/LicenseEN.txt or yetiforce.com)
12
 * @author    Mariusz Krzaczkowski <[email protected]>
13
 */
14
15
namespace App\Integrations\Comarch\Connector;
16
17
/**
18
 * Base class for the connector enabling connection with a specific version of Comarch.
19
 */
20
abstract class Base
21
{
22
	/** @var string Connector name */
23
	const NAME = 'Comarch';
24
	/** @var string Log name */
25
	const LOG_NAME = 'App\Integrations\Comarch';
26
	/** @var \App\Integrations\Comarch\Config Config instance. */
27
	public $config;
28
29
	/**
30
	 * Constructor.
31
	 *
32
	 * @param \App\Integrations\Comarch\Config $config
33
	 */
34
	public function __construct(\App\Integrations\Comarch\Config $config)
35
	{
36
		$this->config = $config;
37
	}
38
39
	/**
40
	 * Authorization.
41
	 *
42
	 * @return void
43
	 */
44
	abstract public function authorize(): void;
45
46
	/**
47
	 * Check if authorized.
48
	 *
49
	 * @return bool
50
	 */
51
	abstract public function isAuthorized(): bool;
52
53
	/**
54
	 * Function to send request.
55
	 *
56
	 * @param string $method
57
	 * @param string $action
58
	 * @param array  $params
59
	 *
60
	 * @return string
61
	 */
62
	abstract public function request(string $method, string $action, array $params = []): string;
63
64
	/**
65
	 * Get information about Comarch ERP.
66
	 *
67
	 * @return array
68
	 */
69
	abstract public function getInfo(): array;
70
}
71