-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStatus.php
52 lines (43 loc) · 1020 Bytes
/
Status.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
namespace OrviSoft\CouponPerProduct\Model;
class Status
{
/**#@+
* Status values
*/
const STATUS_ENABLED = 1;
const STATUS_DISABLED = 2;
/**
* Retrieve option array
*
* @return string[]
*/
public static function getOptionArray()
{
return [self::STATUS_ENABLED => __('Enabled'), self::STATUS_DISABLED => __('Disabled')];
}
/**
* Retrieve option array with empty value
*
* @return string[]
*/
public function getAllOptions()
{
$result = [];
foreach (self::getOptionArray() as $index => $value) {
$result[] = ['value' => $index, 'label' => $value];
}
return $result;
}
/**
* Retrieve option text by option value
*
* @param string $optionId
* @return string
*/
public function getOptionText($optionId)
{
$options = self::getOptionArray();
return isset($options[$optionId]) ? $options[$optionId] : null;
}
}