src/AlterPHP/Component/Behavior/StatusableEntity.php
public static function getStatusList($withLabelsAsIndexes = false, array $filterStatus = null)
    {
        // Build $statusValues if this is the first call
        if (null === static::$statusValues) {
            static::$statusValues = array();
            $refClass = new \ReflectionClass(get_called_class());
            $classConstants = $refClass->getConstants();
            $className = $refClass->getShortName();

            $constantPrefix = 'STATUS_';
            foreach ($classConstants as $key => $val) {
                if (substr($key, 0, strlen($constantPrefix)) === $constantPrefix) {
                    static::$statusValues[$val] = static::getLowerCaseClassName().'.status.'.$val;
                }
            }
        }

        $statusValues = static::$statusValues;

        // Filter on specified status list
        if (isset($filterStatus)) {
            $statusValues = array_filter($statusValues, function ($key) use ($filterStatus) {
                return in_array($key, $filterStatus);
            }, ARRAY_FILTER_USE_KEY);
        }

        if ($withLabelsAsIndexes) {
            return array_flip($statusValues);
        }

        return array_keys($statusValues);
    }
public static function getStatusList($withLabelsAsIndexes = false, array $filterStatus = null)
    {
        // Build $statusValues if this is the first call
        if (null === static::$statusValues) {
            static::$statusValues = array();
            $refClass = new \ReflectionClass(get_called_class());
            $classConstants = $refClass->getConstants();
            $className = $refClass->getShortName();

            $constantPrefix = 'STATUS_';
            foreach ($classConstants as $key => $val) {
                if (substr($key, 0, strlen($constantPrefix)) === $constantPrefix) {
                    static::$statusValues[$val] = static::getLowerCaseClassName().'.status.'.$val;
                }
            }
        }

        $statusValues = static::$statusValues;

        // Filter on specified status list
        if (isset($filterStatus)) {
            $statusValues = array_filter($statusValues, function ($key) use ($filterStatus) {
                return in_array($key, $filterStatus);
            }, ARRAY_FILTER_USE_KEY);
        }

        if ($withLabelsAsIndexes) {
            return array_flip($statusValues);
        }

        return array_keys($statusValues);
    }
public static function getStatusList ( $ withLabelsAsIndexes = false , array $ filterStatus = null ) { // Build $statusValues if this is the first call if ( null === static :: $ statusValues ) { static :: $ statusValues = array ( ) ; $ refClass = new \ ReflectionClass ( get_called_class ( ) ) ; $ classConstants = $ refClass -> getConstants ( ) ; $ className = $ refClass -> getShortName ( ) ; $ constantPrefix = 'STATUS_' ; foreach ( $ classConstants as $ key => $ val ) { if ( substr ( $ key , 0 , strlen ( $ constantPrefix ) ) === $ constantPrefix ) { static :: $ statusValues [ $ val ] = static :: getLowerCaseClassName ( ) . '.status.' . $ val ; } } } $ statusValues = static :: $ statusValues ; // Filter on specified status list if ( isset ( $ filterStatus ) ) { $ statusValues = array_filter ( $ statusValues , function ( $ key ) use ( $ filterStatus ) { return in_array ( $ key , $ filterStatus ) ; } , ARRAY_FILTER_USE_KEY ) ; } if ( $ withLabelsAsIndexes ) { return array_flip ( $ statusValues ) ; } return array_keys ( $ statusValues ) ; }
Returns status list, with or without labels.

@param bool  $withLabelsAsIndexes
@param array $filterStatus

@return array
Returns status list with or without labels .