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
PatchInstallationParams.php
88 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 PatchInstallationParams 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 | /** |
| 21 | * PatchInstallationParams constructor. |
| 22 | * @param string $userId |
| 23 | */ |
| 24 | public function __construct($installationId, $userId = '') { |
| 25 | parent::__construct(); |
| 26 | $this->installationId = $installationId; |
| 27 | $this->userId = $userId ? $userId : ''; |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * @return string |
| 32 | */ |
| 33 | public function getInstallationId() { |
| 34 | return $this->installationId; |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * @param string $installationId |
| 39 | * @return PatchInstallationParams |
| 40 | */ |
| 41 | public function setInstallationId($installationId) { |
| 42 | $this->installationId = $installationId; |
| 43 | return $this; |
| 44 | } |
| 45 | |
| 46 | protected function buildDataFromFields() { |
| 47 | return (object) \WonderPush\Util\ArrayUtil::filterNulls(array( |
| 48 | 'installationId' => $this->installationId, |
| 49 | 'userId' => $this->userId, |
| 50 | 'body' => (object) \WonderPush\Util\ArrayUtil::filterNulls(array( |
| 51 | 'custom' => $this->custom, |
| 52 | )), |
| 53 | )); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * @return string |
| 58 | */ |
| 59 | public function getUserId() { |
| 60 | return $this->userId; |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * @param string $userId |
| 65 | * @return PatchInstallationParams |
| 66 | */ |
| 67 | public function setUserId($userId) { |
| 68 | $this->userId = $userId ? $userId : ''; |
| 69 | return $this; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * @return array |
| 74 | */ |
| 75 | public function getProperties() { |
| 76 | return $this->custom; |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * @param array $properties |
| 81 | * @return PatchInstallationParams |
| 82 | */ |
| 83 | public function setProperties($properties) { |
| 84 | $this->custom = $properties; |
| 85 | return $this; |
| 86 | } |
| 87 | } |
| 88 |