1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Product\Ee\Utils\RmaKeys |
5
|
|
|
* |
6
|
|
|
* NOTICE OF LICENSE |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
9
|
|
|
* that is available through the world-wide-web at this URL: |
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
11
|
|
|
* |
12
|
|
|
* PHP version 5 |
13
|
|
|
* |
14
|
|
|
* @author Tim Wagner <[email protected]> |
15
|
|
|
* @copyright 2020 TechDivision GmbH <[email protected]> |
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
17
|
|
|
* @link https://github.com/techdivision/import-product-ee |
18
|
|
|
* @link http://www.techdivision.com |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Product\Ee\Utils; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Utitlity class that provides RMA keys. |
25
|
|
|
* |
26
|
|
|
* @author Tim Wagner <[email protected]> |
27
|
|
|
* @copyright 2020 TechDivision GmbH <[email protected]> |
28
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
29
|
|
|
* @link https://github.com/techdivision/import-product-ee |
30
|
|
|
* @link http://www.techdivision.com |
31
|
|
|
*/ |
32
|
|
|
class RmaKeys implements RmaKeysInterface |
33
|
|
|
{ |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* The available states for the 'is_returnable' colum. |
37
|
|
|
* |
38
|
|
|
* @var array |
39
|
|
|
*/ |
40
|
|
|
protected $returnable = array( |
41
|
|
|
RmaKeysInterface::NOT_RETURNABLE => 0, |
42
|
|
|
RmaKeysInterface::RETURNABLE => 1, |
43
|
|
|
RmaKeysInterface::USE_CONFIG => 2 |
44
|
|
|
); |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Query's whether or not the passed key is valid or not. |
48
|
|
|
* |
49
|
|
|
* @param string $key The key to query for |
50
|
|
|
* |
51
|
|
|
* @return bool TRUE if the passed key is valid, else FALSE |
52
|
|
|
*/ |
53
|
|
|
public function isValid(string $key) : bool |
54
|
|
|
{ |
55
|
|
|
return isset($this->returnable[$key]); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Return's the value for the passed key. |
60
|
|
|
* |
61
|
|
|
* @param string $key The key to return the value for |
62
|
|
|
* |
63
|
|
|
* @return int The value |
64
|
|
|
*/ |
65
|
|
|
public function get(string $key) : int |
66
|
|
|
{ |
67
|
|
|
return isset($this->returnable[$key]) ? $this->returnable[$key] : $this->returnable[RmaKeysInterface::USE_CONFIG]; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Return all available keys. |
72
|
|
|
* |
73
|
|
|
* @return array The array with the available keys |
74
|
|
|
*/ |
75
|
|
|
public function getAll() : array |
76
|
|
|
{ |
77
|
|
|
return $this->returnable; |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|