/**
  * Overrides InlineEditorPiece to be able to check for equality between markings,
  * where also classes are compared. This also adds the ability to ignore certain
  * classes when comparing (such as classes for what has been edited, etc.)
  * @param $piece InlineEditorPiece Piece or marking to compare with
  * @param $ignoreClasses array Array of classes that should be ignored
  * @return bool 
  */
 public function equals(InlineEditorPiece $piece, array $ignoreClasses = array())
 {
     if ($piece instanceof InlineEditorMarking) {
         $classesA = array_diff($this->classes, $ignoreClasses);
         $classesB = array_diff($piece->classes, $ignoreClasses);
         $diffA = array_diff($classesA, $classesB);
         $diffB = array_diff($classesB, $classesA);
         return parent::equals($piece) && empty($diffA) && empty($diffB);
     } else {
         return parent::equals($piece);
     }
 }
 /**
  * Check whether another piece touches this piece at the start or end.
  * @param $piece InlineEditorPiece
  * @return bool
  */
 public final function touches(InlineEditorPiece $piece)
 {
     return $piece->getStart() == $this->getEnd() || $piece->getEnd() == $this->getStart();
 }