2020-05-15 17:19:03 +00:00
|
|
|
<?php
|
|
|
|
|
2022-04-08 00:38:27 +00:00
|
|
|
namespace MediaWiki\Extension\Notifications\Push;
|
2020-05-15 17:19:03 +00:00
|
|
|
|
|
|
|
use Wikimedia\Timestamp\ConvertibleTimestamp;
|
|
|
|
|
|
|
|
class Subscription {
|
|
|
|
|
|
|
|
/** @var string */
|
|
|
|
private $provider;
|
|
|
|
|
|
|
|
/** @var string */
|
|
|
|
private $token;
|
|
|
|
|
|
|
|
/** @var ConvertibleTimestamp */
|
|
|
|
private $updated;
|
|
|
|
|
2020-08-03 18:27:47 +00:00
|
|
|
/** @var string|null */
|
|
|
|
private $topic;
|
|
|
|
|
2020-05-15 17:19:03 +00:00
|
|
|
/**
|
|
|
|
* Construct a subscription from a DB result row.
|
2020-12-16 21:31:09 +00:00
|
|
|
* @param \stdClass $row echo_push_subscription row from IResultWrapper::fetchRow
|
2020-05-15 17:19:03 +00:00
|
|
|
* @return Subscription
|
|
|
|
*/
|
|
|
|
public static function newFromRow( object $row ) {
|
|
|
|
return new self(
|
2020-06-02 23:20:06 +00:00
|
|
|
$row->epp_name,
|
2020-05-15 17:19:03 +00:00
|
|
|
$row->eps_token,
|
2020-09-08 13:34:54 +00:00
|
|
|
$row->ept_text,
|
2020-05-15 17:19:03 +00:00
|
|
|
new ConvertibleTimestamp( $row->eps_updated )
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-08-03 18:27:47 +00:00
|
|
|
public function __construct( string $provider, string $token, ?string $topic, ConvertibleTimestamp $updated ) {
|
2020-05-15 17:19:03 +00:00
|
|
|
$this->provider = $provider;
|
|
|
|
$this->token = $token;
|
2020-08-03 18:27:47 +00:00
|
|
|
$this->topic = $topic;
|
2020-05-15 17:19:03 +00:00
|
|
|
$this->updated = $updated;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @return string provider */
|
|
|
|
public function getProvider(): string {
|
|
|
|
return $this->provider;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** @return string token */
|
|
|
|
public function getToken(): string {
|
|
|
|
return $this->token;
|
|
|
|
}
|
|
|
|
|
2020-08-03 18:27:47 +00:00
|
|
|
/** @return string|null topic */
|
|
|
|
public function getTopic(): ?string {
|
|
|
|
return $this->topic;
|
|
|
|
}
|
|
|
|
|
2020-05-15 17:19:03 +00:00
|
|
|
/** @return ConvertibleTimestamp last updated timestamp */
|
|
|
|
public function getUpdated(): ConvertibleTimestamp {
|
|
|
|
return $this->updated;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|