1 | <?php |
||
23 | class FrameFactory |
||
24 | { |
||
25 | /** |
||
26 | * Configuration for frames creation |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | private $configuration; |
||
31 | |||
32 | public function __construct(array $configuration = []) |
||
36 | |||
37 | /** |
||
38 | * @param int $status One of the close constant code of Frame class. |
||
39 | * @param string $reason A little message that explain why closing. |
||
40 | * @return Frame |
||
41 | */ |
||
42 | public function createCloseFrame(int $status = Frame::CLOSE_NORMAL, string $reason = null) : Frame |
||
56 | |||
57 | /** |
||
58 | * @param string $payload The payload must be the message content of the Ping |
||
59 | * @return Frame |
||
60 | */ |
||
61 | public function createPongFrame(string $payload) : Frame |
||
70 | |||
71 | /** |
||
72 | * Construct a frame with a global configuration. |
||
73 | * |
||
74 | * @param string|null $rawData |
||
75 | * @return Frame |
||
76 | */ |
||
77 | public function createNewFrame(string $rawData = null) |
||
81 | |||
82 | /** |
||
83 | * This generates a string of 4 random bytes. (WebSocket mask according to the RFC) |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | public static function generateMask() : string |
||
91 | } |
||
92 |