You are getting your stockItem from the $observer
however you've changed the parameters of your function, therefor $stockItem = $observer->getEvent();
can't get anything because $observer
does not exist...
YouFrom your OP we can see you are using the $observer
inside the lowStockReportSendEmail
function, however the observer is not present here!
Assuming you have the observer, and in that function you create $product
and $toEmailAddress
before calling lowStockReportSendEmail
you should have :
private function lowStockReportSendEmail($observer, $product, $toEmailAddress)
{
$stockItem = $observer->getEvent();
[...]
And in the code that calls the funtion, obviously $this->lowStockReportSendEmail($observer, $product, $toEmailAddress);