52 lines
1012 B
PHP
52 lines
1012 B
PHP
<?php
|
|
|
|
namespace Emizentech\Banner\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;
|
|
}
|
|
} |