@@ -37,6 +37,8 @@ public function __construct(
3737 private int $ port = 27420 ,
3838 bool $ isHttps = false ,
3939 private ?PrivateKey $ privateKey = null ,
40+ private string $ localPath = '' ,
41+ private string $ remotePath = '' ,
4042 ?CurlInterface $ curl = null ,
4143 ) {
4244 $ this ->curl = $ curl ?? new Curl ();
@@ -57,6 +59,8 @@ public function getUrl(string $endpoint): string
5759
5860 public function sendMessage (MessageInterface $ message ): void
5961 {
62+ $ message = $ this ->getMessageWithPathMapping ($ message );
63+
6064 try {
6165 $ curl = $ this ->getCurlHandle (
6266 'POST ' ,
@@ -71,6 +75,8 @@ public function sendMessage(MessageInterface $message): void
7175
7276 public function sendPause (MessageInterface $ message ): void
7377 {
78+ $ message = $ this ->getMessageWithPathMapping ($ message );
79+
7480 try {
7581 $ curl = $ this ->getCurlHandle (
7682 'POST ' ,
@@ -167,4 +173,15 @@ private function handleSignature(array $data): void
167173 ];
168174 }
169175 }
176+
177+ private function getMessageWithPathMapping (MessageInterface $ message ): MessageInterface
178+ {
179+ if ($ this ->localPath === '' || $ this ->remotePath === '' ) {
180+ return $ message ;
181+ }
182+
183+ return $ message ->withPath (
184+ str_replace ($ this ->remotePath , $ this ->localPath , $ message ->filePath ())
185+ );
186+ }
170187}
0 commit comments