Debian Codegraph @

extensions/Echo/includes/Push/Subscription.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Extension\Notifications\Push;
4
5 use Wikimedia\Timestamp\ConvertibleTimestamp;
6
7 class Subscription {
8
9 /** @var string */
10 private $provider;
11
12 /** @var string */
13 private $token;
14
15 /** @var ConvertibleTimestamp */
16 private $updated;
17
18 /** @var string|null */
19 private $topic;
20
21 /**
22 * Construct a subscription from a DB result row.
23 * @param \stdClass $row echo_push_subscription row from IResultWrapper::fetchRow
24 * @return Subscription
25 */
26 public static function newFromRow( object $row ) {
27 return new self(
28 $row->epp_name,
29 $row->eps_token,
30 $row->ept_text,
31 new ConvertibleTimestamp( $row->eps_updated )
32 );
33 }
34
35 public function __construct( string $provider, string $token, ?string $topic, ConvertibleTimestamp $updated ) {
36 $this->provider = $provider;
37 $this->token = $token;
38 $this->topic = $topic;
39 $this->updated = $updated;
40 }
41
42 /** @return string provider */
43 public function getProvider(): string {
44 return $this->provider;
45 }
46
47 /** @return string token */
48 public function getToken(): string {
49 return $this->token;
50 }
51
52 /** @return string|null topic */
53 public function getTopic(): ?string {
54 return $this->topic;
55 }
56
57 /** @return ConvertibleTimestamp last updated timestamp */
58 public function getUpdated(): ConvertibleTimestamp {
59 return $this->updated;
60 }
61
62 }