Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 487a646

Browse files
committedMar 13, 2023
rename internal message type
1 parent 570b5e8 commit 487a646

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed
 

‎.github/workflows/run-acceptance-tests.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ jobs:
1818
uses: actions/checkout@v3
1919
with:
2020
repository: pubnub/client-engineering-deployment-tools
21-
ref: github-actions
21+
ref: v1
2222
token: ${{ secrets.GH_TOKEN }}
23-
path: client-engineering-deployment-tools
23+
path: .github/.release/actions
2424
- name: Run mock server action
25-
uses: ./client-engineering-deployment-tools/actions/mock-server
25+
uses: ./.github/.release/actions/actions/mock-server
2626
with:
2727
token: ${{ secrets.GH_TOKEN }}
2828
- name: Install Composer dev depenencies

‎src/PubNub/Models/Consumer/PNMessageType.php

+22-15
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,46 @@
44

55
final class PNMessageType
66
{
7-
private $internal = null;
8-
private $custom = null;
9-
10-
public function __construct($custom)
7+
private $pnMessageType = null;
8+
private $messageType = null;
9+
private $typeMapping = [
10+
'0' => 'pn_message',
11+
'1' => 'pn_signal',
12+
'2' => 'pn_object',
13+
'3' => 'pn_message_action',
14+
'4' => 'pn_file',
15+
];
16+
17+
public function __construct($messageType)
1118
{
12-
$this->custom = $custom;
19+
$this->messageType = $messageType;
1320
}
1421

15-
public static function createWithInternal($custom, $internal)
22+
public static function createWithPnMessageType($messageType, $pnMessageType)
1623
{
17-
$messageType = new self($custom);
18-
$messageType->setInternal($internal);
24+
$messageType = new self($messageType);
25+
$messageType->setPnMessageType($pnMessageType);
1926
return $messageType;
2027
}
2128

22-
private function setInternal($internal)
29+
private function setPnMessageType($pnMessageType)
2330
{
24-
$this->internal = $internal;
31+
$this->pnMessageType = $pnMessageType;
2532
return $this;
2633
}
2734

28-
public function getInternal()
35+
public function getPnMessageType()
2936
{
30-
return $this->internal;
37+
return $this->typeMapping[$this->pnMessageType ? $this->pnMessageType : '0'];
3138
}
3239

3340
public function __toString()
3441
{
35-
return $this->custom;
42+
return $this->messageType ? $this->messageType : $this->getPnMessageType();
3643
}
3744

38-
public function getCustom()
45+
public function getMessageType()
3946
{
40-
return $this->custom;
47+
return $this->messageType;
4148
}
4249
}

0 commit comments

Comments
 (0)
Please sign in to comment.