If the methods you need to alter are part of an auto-instantiated Service in the PerForm plugin, you might consider using Yii 2 “Behaviors.”
From the docs:
…to attach a behavior dynamically, call the yii\base\Component::attachBehavior()
method of the component to which the behavior is being attached…
Source
So, in a custom Craft module, you might put something like this, in your init
method:
use perfectus\perform\PerForm;
use modules\mymodule\MyBehavior;
// ...
PerForm::$plugin->emailService->attachBehavior('myBehaviorHandle', new MyBehavior);
This gives you a chance to monkey-patch the service with your own functionality… but I can't speak to how inheritance works, or whether you'll be able to call parent::myPatchedMethod($args)
(or, in Behavior-land, $this->owner->myPatchedMethod($args)
) to ensure the least code is duplicated.
Overall, I agree with Indigo: The best way to ensure this will continue to work is to make a PR to the plugin that adds support for events at key moments, and shuttles the right kind of data around to accomplish what you want. This is the only way to ensure you have a stable event API.