Skip to content

Commit

Permalink
rename internal message type
Browse files Browse the repository at this point in the history
  • Loading branch information
seba-aln committed Mar 13, 2023
1 parent 570b5e8 commit 487a646
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 18 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/run-acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
uses: actions/checkout@v3
with:
repository: pubnub/client-engineering-deployment-tools
ref: github-actions
ref: v1
token: ${{ secrets.GH_TOKEN }}
path: client-engineering-deployment-tools
path: .github/.release/actions
- name: Run mock server action
uses: ./client-engineering-deployment-tools/actions/mock-server
uses: ./.github/.release/actions/actions/mock-server
with:
token: ${{ secrets.GH_TOKEN }}
- name: Install Composer dev depenencies
Expand Down
37 changes: 22 additions & 15 deletions src/PubNub/Models/Consumer/PNMessageType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,46 @@

final class PNMessageType
{
private $internal = null;
private $custom = null;

public function __construct($custom)
private $pnMessageType = null;
private $messageType = null;
private $typeMapping = [
'0' => 'pn_message',
'1' => 'pn_signal',
'2' => 'pn_object',
'3' => 'pn_message_action',
'4' => 'pn_file',
];

public function __construct($messageType)
{
$this->custom = $custom;
$this->messageType = $messageType;
}

public static function createWithInternal($custom, $internal)
public static function createWithPnMessageType($messageType, $pnMessageType)
{
$messageType = new self($custom);
$messageType->setInternal($internal);
$messageType = new self($messageType);
$messageType->setPnMessageType($pnMessageType);
return $messageType;
}

private function setInternal($internal)
private function setPnMessageType($pnMessageType)
{
$this->internal = $internal;
$this->pnMessageType = $pnMessageType;
return $this;
}

public function getInternal()
public function getPnMessageType()
{
return $this->internal;
return $this->typeMapping[$this->pnMessageType ? $this->pnMessageType : '0'];
}

public function __toString()
{
return $this->custom;
return $this->messageType ? $this->messageType : $this->getPnMessageType();
}

public function getCustom()
public function getMessageType()
{
return $this->custom;
return $this->messageType;
}
}

0 comments on commit 487a646

Please sign in to comment.