+ /**
+ * Check if a given activity is no longer available
+ *
+ * @param string $url
+ *
+ * @return boolean
+ */
+ public static function isActivityGone(string $url): bool
+ {
+ $curlResult = HTTPSignature::fetchRaw($url, 0);
+
+ if (Network::isUrlBlocked($url)) {
+ return true;
+ }
+
+ // @todo To ensure that the remote system is working correctly, we can check if the "Content-Type" contains JSON
+ if (in_array($curlResult->getReturnCode(), [404])) {
+ return true;
+ }
+
+ $object = json_decode($curlResult->getBody(), true);
+ if (!empty($object)) {
+ $activity = JsonLD::compact($object);
+ if (JsonLD::fetchElement($activity, '@type') == 'as:Tombstone') {
+ return true;
+ }
+ }
+
+ return false;
+ }