Stock/Model/StockSubjectModes.php
static public function isBetterMode($modeA, $modeB)
    {
        // TODO Find something more explicit than 'better' (availability ?)

        // TODO assert valid states ?

        if ($modeA === static::MODE_DISABLED) {
            return $modeB !== static::MODE_DISABLED;
        } elseif ($modeA === static::MODE_JUST_IN_TIME) {
            return in_array($modeB, [static::MODE_MANUAL, static::MODE_AUTO], true);
        }

        return false;
    }
static public function isBetterMode($modeA, $modeB)
    {
        // TODO Find something more explicit than 'better' (availability ?)

        // TODO assert valid states ?

        if ($modeA === static::MODE_DISABLED) {
            return $modeB !== static::MODE_DISABLED;
        } elseif ($modeA === static::MODE_JUST_IN_TIME) {
            return in_array($modeB, [static::MODE_MANUAL, static::MODE_AUTO], true);
        }

        return false;
    }
Returns whether the mode A is better than the mode B.

@param string $modeA
@param string $modeB

@return bool