/** * @param ActivityObject $actobj The _favored_ notice (which we're "in-reply-to") * @param Notice $stored The _activity_ notice, i.e. the favor itself. */ public static function parseActivityObject(ActivityObject $actobj, Notice $stored) { $local = ActivityUtils::findLocalObject($actobj->getIdentifiers()); if (!$local instanceof Notice) { // $local always returns something, but this was not what we expected. Something is wrong. throw new Exception('Something other than a Notice was returned from findLocalObject'); } $actor = $stored->getProfile(); $object = new Fave(); $object->user_id = $stored->getProfile()->id; $object->notice_id = $local->id; $object->uri = $stored->uri; $object->created = $stored->created; $object->modified = $stored->modified; return $object; }
/** * @param ActivityObject $actobj The _favored_ notice (which we're "in-reply-to") * @param Notice $stored The _activity_ notice, i.e. the favor itself. */ public static function parseActivityObject(ActivityObject $actobj, Notice $stored) { // throws exception if nothing was found, but it could also be a non-Notice... // FIXME: This should only test _one_ URI (and not the links etc.) though a function like this could be useful in other cases $local = ActivityUtils::findLocalObject($actobj->getIdentifiers()); if (!$local instanceof Notice) { // $local always returns something, but this was not what we expected. Something is wrong. throw new Exception('Something other than a Notice was returned from findLocalObject'); } $actor = $stored->getProfile(); $object = new Fave(); $object->user_id = $stored->getProfile()->id; $object->notice_id = $local->id; $object->uri = $stored->uri; $object->created = $stored->created; $object->modified = $stored->modified; return $object; }