code: static public function isBetterAvailability($stateA, $stateB)
      {
          if ($stateA === $stateB) {
              return false;
          }
  
          switch ($stateA) {
              // 'pending' is better than 'new' or 'closed'
              case static::STATE_PENDING:
                  return in_array($stateB, [static::STATE_NEW, static::STATE_CLOSED], true);
              // 'ready' is better than 'new', 'pending' or 'closed'
              case static::STATE_READY:
                  return in_array($stateB, [static::STATE_NEW, static::STATE_PENDING, static::STATE_CLOSED], true);
          }
  
          return false;
      }
docs: Returns whether the state A has a better availability than the state B.
  
  @param string $stateA
  @param string $stateB
  
  @return bool