Checks whether this feedback is similar to another

@param FeedbackInterface $feedback
@return boolean
190569
public function isSimilarTo(FeedbackInterface $feedback)
    {
        if (!$feedback instanceof RenderContentOutOfBand) {
            return false;
        }

        return (
            $this->getNode()->getContextPath() === $feedback->getNode()->getContextPath() &&
            $this->getReferenceData() == $feedback->getReferenceData()
        );
    }
1120849
public function isCorrect()
    {
        if ($this->hasCorrectResponse() === true) {
            $correctResponse = $this->getCorrectResponse();

            if ($correctResponse instanceof Comparable) {
                return $correctResponse->equals($this->getValue());
            } else {
                return $correctResponse === $this->getValue();
            }
        }

        return false;
    }
1201244
public function equals($compare)
    {
        if ($compare instanceof self) {
            return ($compare->className == $this->className && $compare->propertyName == $this->propertyName);
        }
        
        return false;
    }
713707
public static function areEqual(&$ref1, &$ref2) : bool
    {
        if ($ref1 !== $ref2) {
            return false;
        }

        if (!self::$secret) {
            self::$secret = new \stdClass();
        }

        $tempStorage = $ref1;

        $ref1     = self::$secret;
        $areEqual = $ref1 === $ref2;

        $ref1 = $tempStorage;

        return $areEqual;
    }
842250
public function equals($compare): bool
    {
        if ($compare instanceof self) {
            return ($this->timestamp() === $compare->timestamp());
        }

        return false;
    }
720906
public function is_related($query) {
        if (parent::is_related($query)) {
            return true;
        }

        $repositories= core_component::get_plugin_list('repository');
        foreach ($repositories as $p => $dir) {
            if (strpos($p, $query) !== false) {
                return true;
            }
        }
        foreach (repository::get_types() as $instance) {
            $title = $instance->get_typename();
            if (strpos(core_text::strtolower($title), $query) !== false) {
                return true;
            }
        }
        return false;
    }
532848
public function equals(PrincipalInterface $another)
    {

        // query whether or not another principal has been passed
        if ($another instanceof PrincipalInterface) {
            $anotherName = $another->getName();
            $equals = false;
            if ($this->name == null) {
                $equals = $anotherName == null;
            } else {
                $equals = $this->name->equals($anotherName);
            }

            // return the flag if the both are equal
            return $equals;
        }

        // return FALSE if they are not equal
        return false;
    }
669822
private function helper_render_feedback($feedback) {

        $o  = '';    // output HTML code
        $o .= $this->output->container_start('feedback feedbackforauthor');
        $o .= $this->output->container_start('header');
        $o .= $this->output->heading(get_string('feedbackby', 'workshop', s(fullname($feedback->get_provider()))), 3, 'title');

        $userpic = $this->output->user_picture($feedback->get_provider(), array('courseid' => $this->page->course->id, 'size' => 32));
        $o .= $this->output->container($userpic, 'picture');
        $o .= $this->output->container_end(); // end of header

        $content = format_text($feedback->get_content(), $feedback->get_format(), array('overflowdiv' => true));
        $o .= $this->output->container($content, 'content');

        $o .= $this->output->container_end();

        return $o;
    }
818093
private function isNullOrEqualsParentData(CharacteristicInterface $characteristic)
    {
        if ($characteristic->isNull()) {
            return true;
        } elseif (null !== $this->parentDatas &&
            null !== $parentCharacteristic = $this->parentDatas->findCharacteristicByIdentifier($characteristic->getIdentifier())) {
            return $parentCharacteristic->equals($characteristic);
        }

        return false;
    }
311424
public function is_feedback_modified(stdClass $grade, stdClass $data) {
        debugging('This plugin (' . $this->get_name() . ') has not overwritten the is_feedback_modified() method.
                Please add this method to your plugin', DEBUG_DEVELOPER);
        return true;
    }
699508
public function isSimilarTo(FeedbackInterface $feedback)
    {
        if (!$feedback instanceof UpdateNodeInfo) {
            return false;
        }

        return $this->getNode()->getContextPath() === $feedback->getNode()->getContextPath();
    }
1330234
public function equals(UserInterface $user)
    {
        return (get_class() === get_class($user)
            && $this->getUsername() === $user->getUsername());
    }
35708
public function equals($compare)
    {
        if ($compare instanceof self) {
            return ($compare->className === $this->className && $compare->methodName === $this->methodName);
        }
        
        return false;
    }
541518
public function is_feedback_modified(stdClass $grade, stdClass $data) {
        global $USER;

        $filekey = null;
        $draftareainfo = null;
        foreach ($data as $key => $value) {
            if (strpos($key, 'files_') === 0 && strpos($key, '_filemanager')) {
                $filekey = $key;
            }
        }
        if (isset($filekey)) {
            $draftareainfo = file_get_draft_area_info($data->$filekey);
            $filecount = $this->count_files($grade->id, ASSIGNFEEDBACK_FILE_FILEAREA);
            if ($filecount != $draftareainfo['filecount']) {
                return true;
            } else {
                // We need to check that the files in the draft area are the same as in the file area.
                $usercontext = context_user::instance($USER->id);
                $fs = get_file_storage();
                $draftfiles = $fs->get_area_files($usercontext->id, 'user', 'draft', $data->$filekey, 'id', true);
                $files = $fs->get_area_files($this->assignment->get_context()->id,
                                     'assignfeedback_file',
                                     ASSIGNFEEDBACK_FILE_FILEAREA,
                                     $grade->id,
                                     'id',
                                     false);
                foreach ($files as $key => $file) {
                    // Flag for recording if we have a matching file.
                    $matchflag = false;
                    foreach ($draftfiles as $draftkey => $draftfile) {
                        if (!$file->is_directory()) {
                            // File name is the same, but it could be a different file with the same name.
                            if ($draftfile->get_filename() == $file->get_filename()) {
                                // If the file name is the same but the content hash is different, or
                                // The file path for the file has changed, then we have a modification.
                                if ($draftfile->get_contenthash() != $file->get_contenthash() ||
                                        $draftfile->get_filepath() != $file->get_filepath()) {
                                    return true;
                                }
                                // These files match. Check the next file.
                                $matchflag = true;
                                // We have a match on the file name so we can move to the next file and not
                                // proceed through the other draftfiles.
                                break;
                            }
                        }
                    }
                    // If the file does not match then there has been a modification.
                    if (!$matchflag) {
                        return true;
                    }
                }
            }
        }
        return false;
    }
122545
public function feedbackAction(Request $request, $id, $feedback, $domain, $identifier)
    {
        $locale = substr($request->getLocale(), 0, 2);  // Make sure to use only the two character locale

        $om = $this->getObjectManager();
        $repository = $om->getRepository('TamagoTipsManagerBundle:TamagoTransUnitMeta');
        $tipMetaData = $repository->findOneBy(['lexikTransUnitId' => $id, 'locale' => $locale, 'identifier' => $identifier]);

        switch ($feedback) {
            case 'like':
                $tipMetaData->setLikes($tipMetaData->getLikes() + 1);
                break;
            case 'dislike':
                $tipMetaData->setDislikes($tipMetaData->getDislikes() + 1);
                break;
        }
        $om->flush();

        $transUnit = $this->getTipTransUnit($locale, $domain, $identifier);
        $translatedTip = $transUnit->getTranslation($locale);

        return $this->render('TamagoTipsManagerBundle:Default:tip.html.twig', [
            'tip' => $translatedTip, 'identifier' => $identifier
        ]);
    }
192294
public function add(FeedbackInterface $feedback)
    {
        foreach ($this->feedbacks as $value) {
            if ($value->isSimilarTo($feedback)) {
                return;
            }
        }

        $this->feedbacks[] = $feedback;
    }
117205
private function _hasEqualSubject(Certificate $cert): bool
    {
        $dn1 = $this->_tbsCertificate->subject();
        $dn2 = $cert->_tbsCertificate->subject();
        return $dn1->equals($dn2);
    }