protected static function getObjectOrDefaultAppIfNull(Infusionsoft_App $app = null, Infusionsoft_Generated_Base $object = null) { //If an app is explicitly set, skip this... if ($app == null) { //If the object has an app key, return it's app if ($object != null && $object->getAppPoolAppKey() != null) { $app = Infusionsoft_AppPool::getApp($object->getAppPoolAppKey()); } else { $app = Infusionsoft_AppPool::getApp(); } } return $app; }