PHP Code:
if ($adopt->getCompanion() != "nocompanion") {
$item = new StockItem($adopt->getCompanion());
$item->append(1, $mysidia->user->username);
}
How's that?
Personally, rather than creating getWhatever() functions I'd rather just set the values to public variables at the top of the owned adoptables class file, and then just use $adopt->companion instead of $adopt->getCompanion() but that's just my preference. That way I don't have to write a function and it looks less clunky.