public static function getFood(SR_RealNPC $npc) { foreach ($npc->getInventory() as $item) { if ($item instanceof SR_Food) { return $item; } } }