File: D:/HostingSpaces/SBogers10/hem-mechatronics.komma.pro/app/Komma/Base/Enum.php
<?php
namespace App\Komma\Base;
/**
* Class Enum
*
* Provides enumuration values
*
* @package App\Komma\Base
*/
abstract class Enum
{
/**
* @return array All enum items as an array
*/
static function getAsArray() {
return self::getAllEnumConstants();
}
/**
* Check if the passed item is really an enum item that is defined as a constant in this class.
*
* @param $item
* @param bool $strict If true it will only consider a role as valid if it is an int. If it for example is a numeric string it won't consider it valid
* @return bool Returns true if the role is a valid one, false otherwise
*/
static function isValidItem($item, $strict = false) {
return in_array($item, self::getAllEnumConstants(), $strict);
}
/**
* Returns an array representing the defined OrderStatus.
*
* @return array
*/
private static function getAllEnumConstants()
{
$thisClassAsReflectionClass = new \ReflectionClass(static::class);
return $thisClassAsReflectionClass->getConstants();
}
}