I'm making some modifications to a plugin and would like to minimize changes to the plugin by keeping the majority of my changes elsewhere. Currently, I'm adding code to a function (method) within a class. I've put my code in a file and call it through a require statement. Where is the recommended location for the file? It's not technically a function, since it's only part of a function. Should it nevertheless be put in extra_functions? Or somewhere else?

Another approach might be to create a notifier-observer, but no notifiers exist in this method. What is involved with adding custom notifiers in the desired places, and locate the plugin mods in observers? Would calling a notifier class within another class method work? (Still uncomfortable with OOP and it's jargon, but learning!).

What is best practice in this case?

Thanks for any advice.