HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/veltech.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();
    }
}