-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserialize-command.php
More file actions
executable file
·51 lines (43 loc) · 1.34 KB
/
Copy pathserialize-command.php
File metadata and controls
executable file
·51 lines (43 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env php
<?php
// phpcs:ignoreFile
namespace MatchBot {
// serializes matchbot CLI command to prepare it to send via SQS
use MatchBot\Application\Messenger\CommandRequest;
use Symfony\Component\Messenger\Envelope;
$command = trim(fgets(STDIN));
$envelope = new Envelope(new CommandRequest($command));
echo addslashes(\serialize($envelope));
echo "\n";
}
namespace MatchBot\Application\Messenger {
// minimal copy of the class to allow serializing without composer installing anything.
class CommandRequest
{
public function __construct(public string $command)
{
}
}
}
namespace Symfony\Component\Messenger {
// minimal copy of the class to allow serializing without composer installing anything.
final class Envelope
{
/**
* @var array<class-string<StampInterface>, list<StampInterface>>
*
* No classes for stamps present in this file, so we can't apply ay stamps here and this copy of
* the constructor does not allow it.
*/
private array $stamps = [];
private object $message;
/**
* @param object|Envelope $message
* @param StampInterface[] $stamps
*/
public function __construct(object $message)
{
$this->message = $message;
}
}
}