src/AlterPHP/Component/Behavior/StatusableEntity.php
public static function getStatusBetween($from = null, $to = null, $strict = false, $strictTo = null)
    {
        $statusList = static::getStatusList();

        $strictFrom = $strict;
        $strictTo = isset($strictTo) ? (bool) $strictTo : $strict;

        // Remove status before given $from
        if (isset($from)) {
            static::checkAllowedStatus($from);
            foreach ($statusList as $key => $status) {
                if ($from !== $status) {
                    unset($statusList[$key]);
                } else {
                    if ($strictFrom) {
                        unset($statusList[$key]);
                    }
                    break;
                }
            }
        }

        // Remove status after given $to
        if (isset($to)) {
            static::checkAllowedStatus($to);
            // On inverse l'ordre des statuts
            $statusList = array_reverse($statusList);
            foreach ($statusList as $key => $status) {
                if ($to !== $status) {
                    unset($statusList[$key]);
                } else {
                    if ($strictTo) {
                        unset($statusList[$key]);
                    }
                    break;
                }
            }
            // On inverse l'ordre des statuts
            $statusList = array_reverse($statusList);
        }

        return array_values($statusList);
    }
public static function getStatusBetween($from = null, $to = null, $strict = false, $strictTo = null)
    {
        $statusList = static::getStatusList();

        $strictFrom = $strict;
        $strictTo = isset($strictTo) ? (bool) $strictTo : $strict;

        // Remove status before given $from
        if (isset($from)) {
            static::checkAllowedStatus($from);
            foreach ($statusList as $key => $status) {
                if ($from !== $status) {
                    unset($statusList[$key]);
                } else {
                    if ($strictFrom) {
                        unset($statusList[$key]);
                    }
                    break;
                }
            }
        }

        // Remove status after given $to
        if (isset($to)) {
            static::checkAllowedStatus($to);
            // On inverse l'ordre des statuts
            $statusList = array_reverse($statusList);
            foreach ($statusList as $key => $status) {
                if ($to !== $status) {
                    unset($statusList[$key]);
                } else {
                    if ($strictTo) {
                        unset($statusList[$key]);
                    }
                    break;
                }
            }
            // On inverse l'ordre des statuts
            $statusList = array_reverse($statusList);
        }

        return array_values($statusList);
    }
public static function getStatusBetween ( $ from = null , $ to = null , $ strict = false , $ strictTo = null ) { $ statusList = static :: getStatusList ( ) ; $ strictFrom = $ strict ; $ strictTo = isset ( $ strictTo ) ? ( bool ) $ strictTo : $ strict ; // Remove status before given $from if ( isset ( $ from ) ) { static :: checkAllowedStatus ( $ from ) ; foreach ( $ statusList as $ key => $ status ) { if ( $ from !== $ status ) { unset ( $ statusList [ $ key ] ) ; } else { if ( $ strictFrom ) { unset ( $ statusList [ $ key ] ) ; } break ; } } } // Remove status after given $to if ( isset ( $ to ) ) { static :: checkAllowedStatus ( $ to ) ; // On inverse l'ordre des statuts $ statusList = array_reverse ( $ statusList ) ; foreach ( $ statusList as $ key => $ status ) { if ( $ to !== $ status ) { unset ( $ statusList [ $ key ] ) ; } else { if ( $ strictTo ) { unset ( $ statusList [ $ key ] ) ; } break ; } } // On inverse l'ordre des statuts $ statusList = array_reverse ( $ statusList ) ; } return array_values ( $ statusList ) ; }
Returns list of status between a "from" and a "to" status.

@param string $from
@param string $to
@param bool   $strict   Is lower bound strict (or both bounds if $strictTo is null) ?
@param bool   $strictTo Is higher bound strict ?

@return array
Returns list of status between a from and a to status .