*/
public function isSuccess(): bool;
+ /**
+ * Returns if the URL is permanently gone (return code 410)
+ *
+ * @return bool
+ */
+ public function isGone(): bool;
+
/**
* @return string
*/
*/
private $isSuccess;
+ /**
+ * @var boolean true (if HTTP 410 result) or false
+ */
+ private $isGone;
+
/**
* @var string the URL which was called
*/
$this->parseBodyHeader($result);
$this->checkSuccess();
+ $this->checkGone();
$this->checkRedirect();
$this->checkInfo();
}
}
}
+ private function checkGone()
+ {
+ $this->isGone = $this->returnCode == 410;
+ }
+
private function checkRedirect()
{
if (!array_key_exists('url', $this->info)) {
return $this->isSuccess;
}
+ /** {@inheritDoc} */
+ public function isGone(): bool
+ {
+ return $this->isSuccess;
+ }
+
/** {@inheritDoc} */
public function getUrl(): string
{
private $isTimeout;
/** @var boolean */
private $isSuccess;
+ /** @var boolean */
+ private $isGone;
/**
* @var int the error number or 0 (zero) if no error
*/
$this->errorNumber = $errorNumber;
$this->checkSuccess();
+ $this->checkGone();
$this->checkRedirect($response);
}
}
}
+ private function checkGone()
+ {
+ $this->isGone = $this->getStatusCode() == 410;
+ }
+
private function checkRedirect(ResponseInterface $response)
{
$headersRedirect = $response->getHeader(RedirectMiddleware::HISTORY_HEADER) ?? [];
return $this->isSuccess;
}
+ /** {@inheritDoc} */
+ public function isGone(): bool
+ {
+ return $this->isGone;
+ }
+
/** {@inheritDoc} */
public function getUrl(): string
{
return false;
}
+ if ($curlResult->isGone()) {
+ Logger::notice('URL is permanently gone', ['id' => $contact['id'], 'url' => $contact['poll']]);
+ Contact::remove($contact['id']);
+ return false;
+ }
+
if ($curlResult->redirectIsPermanent()) {
Logger::notice('Poll address permanently changed', [
'id' => $contact['id'],