Stock/Model/StockSubjectStates.php
static public function isBetterState($stateA, $stateB)
    {
        // TODO Find something more explicit than 'better' (availability ?)

        // TODO assert valid states ?

        if ($stateA === static::STATE_IN_STOCK) {
            return $stateB !== static::STATE_IN_STOCK;
        } elseif ($stateA === static::STATE_PRE_ORDER) {
            return $stateB === static::STATE_OUT_OF_STOCK;
        }

        return false;
    }
static public function isBetterState($stateA, $stateB)
    {
        // TODO Find something more explicit than 'better' (availability ?)

        // TODO assert valid states ?

        if ($stateA === static::STATE_IN_STOCK) {
            return $stateB !== static::STATE_IN_STOCK;
        } elseif ($stateA === static::STATE_PRE_ORDER) {
            return $stateB === static::STATE_OUT_OF_STOCK;
        }

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

@param string $stateA
@param string $stateB

@return bool