AllInstallationsParams.php
1 year ago
CollectionParams.php
1 year ago
CreateCampaignParams.php
1 year ago
DeliveriesCreateParams.php
1 year ago
FrequentFieldValuesParams.php
1 year ago
PatchCampaignParams.php
1 year ago
PatchInstallationParams.php
1 year ago
TrackEventParams.php
1 year ago
TrackEventParams.php
125 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WonderPush\Params; |
| 4 | |
| 5 | if (count(get_included_files()) === 1) { http_response_code(403); exit(); } // Prevent direct access |
| 6 | |
| 7 | use WonderPush\Obj\BaseObject; |
| 8 | |
| 9 | class TrackEventParams extends BaseObject { |
| 10 | |
| 11 | /** @var string */ |
| 12 | private $installationId; |
| 13 | |
| 14 | /** @var string */ |
| 15 | private $userId; |
| 16 | |
| 17 | /** @var array */ |
| 18 | private $custom; |
| 19 | |
| 20 | /** @var string */ |
| 21 | private $type; |
| 22 | |
| 23 | /** |
| 24 | * TrackEventParams constructor. |
| 25 | * @param string $userId |
| 26 | */ |
| 27 | public function __construct($type, $installationId, $userId = '') { |
| 28 | parent::__construct(); |
| 29 | $this->type = $type; |
| 30 | $this->installationId = $installationId; |
| 31 | $this->userId = $userId ? $userId : ''; |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * @return string |
| 36 | */ |
| 37 | public function getType() { |
| 38 | return $this->type; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * @param string $type |
| 43 | * @return TrackEventParams |
| 44 | */ |
| 45 | public function setType($type) { |
| 46 | $this->type = $type; |
| 47 | return $this; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * @return string |
| 52 | */ |
| 53 | public function getInstallationId() { |
| 54 | return $this->installationId; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * @param string $installationId |
| 59 | * @return TrackEventParams |
| 60 | */ |
| 61 | public function setInstallationId($installationId) { |
| 62 | $this->installationId = $installationId; |
| 63 | return $this; |
| 64 | } |
| 65 | |
| 66 | protected function buildDataFromFields() { |
| 67 | return (object) \WonderPush\Util\ArrayUtil::filterNulls(array( |
| 68 | 'installationId' => $this->installationId, |
| 69 | 'userId' => $this->userId, |
| 70 | 'body' => (object) \WonderPush\Util\ArrayUtil::filterNulls(array( |
| 71 | 'type' => $this->type, |
| 72 | 'custom' => $this->custom, |
| 73 | )), |
| 74 | )); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * @return string |
| 79 | */ |
| 80 | public function getUserId() { |
| 81 | return $this->userId; |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * @param string $userId |
| 86 | * @return TrackEventParams |
| 87 | */ |
| 88 | public function setUserId($userId) { |
| 89 | $this->userId = $userId ? $userId : ''; |
| 90 | return $this; |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * @return array |
| 95 | */ |
| 96 | public function getProperties() { |
| 97 | return $this->custom; |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * @param array $properties |
| 102 | * @return TrackEventParams |
| 103 | */ |
| 104 | public function setProperties($properties) { |
| 105 | $this->custom = $properties; |
| 106 | return $this; |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * @return array |
| 111 | */ |
| 112 | public function getCustom() { |
| 113 | return $this->custom; |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * @param array $custom |
| 118 | * @return TrackEventParams |
| 119 | */ |
| 120 | public function setCustom($custom) { |
| 121 | $this->custom = $custom; |
| 122 | return $this; |
| 123 | } |
| 124 | } |
| 125 |