1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* Copyright (c) Ne-Lexa |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view |
9
|
|
|
* the LICENSE file that was distributed with this source code. |
10
|
|
|
* |
11
|
|
|
* @see https://github.com/Ne-Lexa/google-play-scraper |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Nelexa\GPlay\Model; |
15
|
|
|
|
16
|
|
|
use Nelexa\GPlay\GPlayApps; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Contains the developer’s reply to a review in the Google Play store. |
20
|
|
|
* |
21
|
|
|
* @see Review Contains review of application on Google Play store. |
22
|
|
|
* @see GPlayApps::getReviews() Returns reviews of the |
23
|
|
|
* Android app in the Google Play store. |
24
|
|
|
*/ |
25
|
|
|
class ReplyReview implements \JsonSerializable |
26
|
|
|
{ |
27
|
|
|
use JsonSerializableTrait; |
28
|
|
|
|
29
|
|
|
/** @var \DateTimeInterface Reply date. */ |
30
|
|
|
private $date; |
31
|
|
|
|
32
|
|
|
/** @var string Reply text. */ |
33
|
|
|
private $text; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Creates an object with information about the developer’s response |
37
|
|
|
* to a review of an application in the Google Play store. |
38
|
|
|
* |
39
|
|
|
* @param \DateTimeInterface $date reply date |
40
|
|
|
* @param string $text reply text |
41
|
|
|
*/ |
42
|
6 |
|
public function __construct(\DateTimeInterface $date, string $text) |
43
|
|
|
{ |
44
|
6 |
|
$this->date = $date; |
45
|
6 |
|
$this->text = $text; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Returns reply date. |
50
|
|
|
* |
51
|
|
|
* @return \DateTimeInterface reply date |
52
|
|
|
*/ |
53
|
|
|
public function getDate(): \DateTimeInterface |
54
|
|
|
{ |
55
|
|
|
return $this->date; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Returns reply text. |
60
|
|
|
* |
61
|
|
|
* @return string reply text |
62
|
|
|
*/ |
63
|
|
|
public function getText(): string |
64
|
|
|
{ |
65
|
|
|
return $this->text; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Returns class properties as an array. |
70
|
|
|
* |
71
|
|
|
* @return array class properties as an array |
72
|
|
|
*/ |
73
|
|
|
public function asArray(): array |
74
|
|
|
{ |
75
|
|
|
return [ |
76
|
|
|
'date' => $this->date->format(\DateTime::RFC3339), |
77
|
|
|
'timestamp' => $this->date->getTimestamp(), |
78
|
|
|
'text' => $this->text, |
79
|
|
|
]; |
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
|