forked from swoole/swoole-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
php_swoole_library.h
6621 lines (6566 loc) · 230 KB
/
php_swoole_library.h
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Generated by build-library.php, Please DO NOT modify!
*/
/* $Id: 7891ead72d2b43bb6ded221fca5a8d6764ff82ac */
static const char* swoole_library_source_constants =
"\n"
"/**\n"
" * This file is part of Swoole.\n"
" *\n"
" * @link https://www.swoole.com\n"
" * @contact team@swoole.com\n"
" * @license https://github.com/swoole/library/blob/master/LICENSE\n"
" */\n"
"\n"
"declare(strict_types=1);\n"
"\n"
"define('SWOOLE_LIBRARY', true);\n";
static const char* swoole_library_source_std_exec =
"\n"
"/**\n"
" * This file is part of Swoole.\n"
" *\n"
" * @link https://www.swoole.com\n"
" * @contact team@swoole.com\n"
" * @license https://github.com/swoole/library/blob/master/LICENSE\n"
" */\n"
"\n"
"declare(strict_types=1);\n"
"\n"
"function swoole_exec(string $command, &$output = null, &$returnVar = null)\n"
"{\n"
" $result = Swoole\\Coroutine::exec($command);\n"
" if ($result) {\n"
" $outputList = explode(PHP_EOL, $result['output']);\n"
" foreach ($outputList as &$value) {\n"
" $value = rtrim($value);\n"
" }\n"
" if (($endLine = end($outputList)) === '') {\n"
" array_pop($outputList);\n"
" $endLine = end($outputList);\n"
" }\n"
" if ($output) {\n"
" $output = array_merge($output, $outputList);\n"
" } else {\n"
" $output = $outputList;\n"
" }\n"
" $returnVar = $result['code'];\n"
" return $endLine;\n"
" }\n"
" return false;\n"
"}\n"
"\n"
"function swoole_shell_exec(string $cmd)\n"
"{\n"
" $result = Swoole\\Coroutine::exec($cmd);\n"
" if ($result && $result['output'] !== '') {\n"
" return $result['output'];\n"
" }\n"
" return null;\n"
"}\n";
static const char* swoole_library_source_core_constant =
"\n"
"/**\n"
" * This file is part of Swoole.\n"
" *\n"
" * @link https://www.swoole.com\n"
" * @contact team@swoole.com\n"
" * @license https://github.com/swoole/library/blob/master/LICENSE\n"
" */\n"
"\n"
"declare(strict_types=1);\n"
"\n"
"namespace Swoole;\n"
"\n"
"class Constant\n"
"{\n"
" public const EVENT_RECEIVE = 'receive';\n"
"\n"
" public const EVENT_CONNECT = 'connect';\n"
"\n"
" public const EVENT_CLOSE = 'close';\n"
"\n"
" public const EVENT_PACKET = 'packet';\n"
"\n"
" public const EVENT_REQUEST = 'request';\n"
"\n"
" public const EVENT_MESSAGE = 'message';\n"
"\n"
" public const EVENT_OPEN = 'open';\n"
"\n"
" public const EVENT_HANDSHAKE = 'handshake';\n"
"\n"
" public const EVENT_TASK = 'task';\n"
"\n"
" public const EVENT_FINISH = 'finish';\n"
"\n"
" public const EVENT_START = 'start';\n"
"\n"
" public const EVENT_SHUTDOWN = 'shutdown';\n"
"\n"
" public const EVENT_WORKER_START = 'workerStart';\n"
"\n"
" public const EVENT_WORKER_EXIT = 'workerExit';\n"
"\n"
" public const EVENT_WORKER_ERROR = 'workerError';\n"
"\n"
" public const EVENT_WORKER_STOP = 'workerStop';\n"
"\n"
" public const EVENT_PIPE_MESSAGE = 'pipeMessage';\n"
"\n"
" public const EVENT_MANAGER_START = 'managerStart';\n"
"\n"
" public const EVENT_MANAGER_STOP = 'managerStop';\n"
"\n"
" public const EVENT_ERROR = 'error';\n"
"\n"
" /* {{{ OPTION */\n"
" public const OPTION_DEBUG_MODE = 'debug_mode';\n"
"\n"
" public const OPTION_TRACE_FLAGS = 'trace_flags';\n"
"\n"
" public const OPTION_LOG_FILE = 'log_file';\n"
"\n"
" public const OPTION_LOG_LEVEL = 'log_level';\n"
"\n"
" public const OPTION_LOG_DATE_FORMAT = 'log_date_format';\n"
"\n"
" public const OPTION_LOG_DATE_WITH_MICROSECONDS = 'log_date_with_microseconds';\n"
"\n"
" public const OPTION_LOG_ROTATION = 'log_rotation';\n"
"\n"
" public const OPTION_DISPLAY_ERRORS = 'display_errors';\n"
"\n"
" public const OPTION_DNS_SERVER = 'dns_server';\n"
"\n"
" public const OPTION_SOCKET_SEND_TIMEOUT = 'socket_send_timeout';\n"
"\n"
" public const OPTION_ENABLE_SIGNALFD = 'enable_signalfd';\n"
"\n"
" public const OPTION_WAIT_SIGNAL = 'wait_signal';\n"
"\n"
" public const OPTION_DNS_CACHE_REFRESH_TIME = 'dns_cache_refresh_time';\n"
"\n"
" public const OPTION_SOCKET_BUFFER_SIZE = 'socket_buffer_size';\n"
"\n"
" public const OPTION_THREAD_NUM = 'thread_num';\n"
"\n"
" public const OPTION_MIN_THREAD_NUM = 'min_thread_num';\n"
"\n"
" public const OPTION_MAX_THREAD_NUM = 'max_thread_num';\n"
"\n"
" public const OPTION_SOCKET_DONTWAIT = 'socket_dontwait';\n"
"\n"
" public const OPTION_DNS_LOOKUP_RANDOM = 'dns_lookup_random';\n"
"\n"
" public const OPTION_USE_ASYNC_RESOLVER = 'use_async_resolver';\n"
"\n"
" public const OPTION_ENABLE_COROUTINE = 'enable_coroutine';\n"
"\n"
" public const OPTION_SSL_METHOD = 'ssl_method';\n"
"\n"
" public const OPTION_SSL_PROTOCOLS = 'ssl_protocols';\n"
"\n"
" public const OPTION_SSL_COMPRESS = 'ssl_compress';\n"
"\n"
" public const OPTION_SSL_CERT_FILE = 'ssl_cert_file';\n"
"\n"
" public const OPTION_SSL_KEY_FILE = 'ssl_key_file';\n"
"\n"
" public const OPTION_SSL_PASSPHRASE = 'ssl_passphrase';\n"
"\n"
" public const OPTION_SSL_HOST_NAME = 'ssl_host_name';\n"
"\n"
" public const OPTION_SSL_VERIFY_PEER = 'ssl_verify_peer';\n"
"\n"
" public const OPTION_SSL_ALLOW_SELF_SIGNED = 'ssl_allow_self_signed';\n"
"\n"
" public const OPTION_SSL_CAFILE = 'ssl_cafile';\n"
"\n"
" public const OPTION_SSL_CAPATH = 'ssl_capath';\n"
"\n"
" public const OPTION_SSL_VERIFY_DEPTH = 'ssl_verify_depth';\n"
"\n"
" public const OPTION_OPEN_EOF_CHECK = 'open_eof_check';\n"
"\n"
" public const OPTION_OPEN_EOF_SPLIT = 'open_eof_split';\n"
"\n"
" public const OPTION_PACKAGE_EOF = 'package_eof';\n"
"\n"
" public const OPTION_OPEN_MQTT_PROTOCOL = 'open_mqtt_protocol';\n"
"\n"
" public const OPTION_OPEN_LENGTH_CHECK = 'open_length_check';\n"
"\n"
" public const OPTION_PACKAGE_LENGTH_TYPE = 'package_length_type';\n"
"\n"
" public const OPTION_PACKAGE_LENGTH_OFFSET = 'package_length_offset';\n"
"\n"
" public const OPTION_PACKAGE_BODY_OFFSET = 'package_body_offset';\n"
"\n"
" public const OPTION_PACKAGE_LENGTH_FUNC = 'package_length_func';\n"
"\n"
" public const OPTION_PACKAGE_MAX_LENGTH = 'package_max_length';\n"
"\n"
" public const OPTION_BUFFER_HIGH_WATERMARK = 'buffer_high_watermark';\n"
"\n"
" public const OPTION_BUFFER_LOW_WATERMARK = 'buffer_low_watermark';\n"
"\n"
" public const OPTION_BIND_PORT = 'bind_port';\n"
"\n"
" public const OPTION_BIND_ADDRESS = 'bind_address';\n"
"\n"
" public const OPTION_OPEN_TCP_NODELAY = 'open_tcp_nodelay';\n"
"\n"
" public const OPTION_SOCKS5_HOST = 'socks5_host';\n"
"\n"
" public const OPTION_SOCKS5_PORT = 'socks5_port';\n"
"\n"
" public const OPTION_SOCKS5_USERNAME = 'socks5_username';\n"
"\n"
" public const OPTION_SOCKS5_PASSWORD = 'socks5_password';\n"
"\n"
" public const OPTION_HTTP_PROXY_HOST = 'http_proxy_host';\n"
"\n"
" public const OPTION_HTTP_PROXY_PORT = 'http_proxy_port';\n"
"\n"
" public const OPTION_HTTP_PROXY_USERNAME = 'http_proxy_username';\n"
"\n"
" public const OPTION_HTTP_PROXY_USER = 'http_proxy_user';\n"
"\n"
" public const OPTION_HTTP_PROXY_PASSWORD = 'http_proxy_password';\n"
"\n"
" public const OPTION_TIMEOUT = 'timeout';\n"
"\n"
" public const OPTION_CONNECT_TIMEOUT = 'connect_timeout';\n"
"\n"
" public const OPTION_READ_TIMEOUT = 'read_timeout';\n"
"\n"
" public const OPTION_WRITE_TIMEOUT = 'write_timeout';\n"
"\n"
" public const OPTION_SSL_DISABLE_COMPRESSION = 'ssl_disable_compression';\n"
"\n"
" public const OPTION_MAX_COROUTINE = 'max_coroutine';\n"
"\n"
" public const OPTION_HOOK_FLAGS = 'hook_flags';\n"
"\n"
" public const OPTION_ENABLE_PREEMPTIVE_SCHEDULER = 'enable_preemptive_scheduler';\n"
"\n"
" public const OPTION_C_STACK_SIZE = 'c_stack_size';\n"
"\n"
" public const OPTION_STACK_SIZE = 'stack_size';\n"
"\n"
" public const OPTION_SOCKET_DNS_TIMEOUT = 'socket_dns_timeout';\n"
"\n"
" public const OPTION_SOCKET_CONNECT_TIMEOUT = 'socket_connect_timeout';\n"
"\n"
" public const OPTION_SOCKET_TIMEOUT = 'socket_timeout';\n"
"\n"
" public const OPTION_SOCKET_READ_TIMEOUT = 'socket_read_timeout';\n"
"\n"
" public const OPTION_SOCKET_WRITE_TIMEOUT = 'socket_write_timeout';\n"
"\n"
" public const OPTION_DNS_CACHE_EXPIRE = 'dns_cache_expire';\n"
"\n"
" public const OPTION_DNS_CACHE_CAPACITY = 'dns_cache_capacity';\n"
"\n"
" public const OPTION_AIO_CORE_WORKER_NUM = 'aio_core_worker_num';\n"
"\n"
" public const OPTION_AIO_WORKER_NUM = 'aio_worker_num';\n"
"\n"
" public const OPTION_AIO_MAX_WAIT_TIME = 'aio_max_wait_time';\n"
"\n"
" public const OPTION_AIO_MAX_IDLE_TIME = 'aio_max_idle_time';\n"
"\n"
" public const OPTION_RECONNECT = 'reconnect';\n"
"\n"
" public const OPTION_DEFER = 'defer';\n"
"\n"
" public const OPTION_KEEP_ALIVE = 'keep_alive';\n"
"\n"
" public const OPTION_WEBSOCKET_MASK = 'websocket_mask';\n"
"\n"
" public const OPTION_WEBSOCKET_COMPRESSION = 'websocket_compression';\n"
"\n"
" public const OPTION_HTTP_PARSE_COOKIE = 'http_parse_cookie';\n"
"\n"
" public const OPTION_HTTP_PARSE_POST = 'http_parse_post';\n"
"\n"
" public const OPTION_HTTP_PARSE_FILES = 'http_parse_files';\n"
"\n"
" public const OPTION_HTTP_COMPRESSION = 'http_compression';\n"
"\n"
" public const OPTION_HTTP_COMPRESSION_LEVEL = 'http_compression_level';\n"
"\n"
" public const OPTION_HTTP_GZIP_LEVEL = 'http_gzip_level';\n"
"\n"
" public const OPTION_UPLOAD_TMP_DIR = 'upload_tmp_dir';\n"
"\n"
" public const OPTION_HOST = 'host';\n"
"\n"
" public const OPTION_PORT = 'port';\n"
"\n"
" public const OPTION_SSL = 'ssl';\n"
"\n"
" public const OPTION_USER = 'user';\n"
"\n"
" public const OPTION_PASSWORD = 'password';\n"
"\n"
" public const OPTION_DATABASE = 'database';\n"
"\n"
" public const OPTION_CHARSET = 'charset';\n"
"\n"
" public const OPTION_STRICT_TYPE = 'strict_type';\n"
"\n"
" public const OPTION_FETCH_MODE = 'fetch_mode';\n"
"\n"
" public const OPTION_SERIALIZE = 'serialize';\n"
"\n"
" public const OPTION_COMPATIBILITY_MODE = 'compatibility_mode';\n"
"\n"
" public const OPTION_CHROOT = 'chroot';\n"
"\n"
" public const OPTION_GROUP = 'group';\n"
"\n"
" public const OPTION_DAEMONIZE = 'daemonize';\n"
"\n"
" public const OPTION_PID_FILE = 'pid_file';\n"
"\n"
" public const OPTION_REACTOR_NUM = 'reactor_num';\n"
"\n"
" public const OPTION_SINGLE_THREAD = 'single_thread';\n"
"\n"
" public const OPTION_WORKER_NUM = 'worker_num';\n"
"\n"
" public const OPTION_MAX_WAIT_TIME = 'max_wait_time';\n"
"\n"
" public const OPTION_MAX_QUEUED_BYTES = 'max_queued_bytes';\n"
"\n"
" public const OPTION_MAX_CORO_NUM = 'max_coro_num';\n"
"\n"
" public const OPTION_SEND_TIMEOUT = 'send_timeout';\n"
"\n"
" public const OPTION_DISPATCH_MODE = 'dispatch_mode';\n"
"\n"
" public const OPTION_SEND_YIELD = 'send_yield';\n"
"\n"
" public const OPTION_DISPATCH_FUNC = 'dispatch_func';\n"
"\n"
" public const OPTION_DISCARD_TIMEOUT_REQUEST = 'discard_timeout_request';\n"
"\n"
" public const OPTION_ENABLE_UNSAFE_EVENT = 'enable_unsafe_event';\n"
"\n"
" public const OPTION_ENABLE_DELAY_RECEIVE = 'enable_delay_receive';\n"
"\n"
" public const OPTION_ENABLE_REUSE_PORT = 'enable_reuse_port';\n"
"\n"
" public const OPTION_TASK_USE_OBJECT = 'task_use_object';\n"
"\n"
" public const OPTION_TASK_ENABLE_COROUTINE = 'task_enable_coroutine';\n"
"\n"
" public const OPTION_TASK_WORKER_NUM = 'task_worker_num';\n"
"\n"
" public const OPTION_TASK_IPC_MODE = 'task_ipc_mode';\n"
"\n"
" public const OPTION_TASK_TMPDIR = 'task_tmpdir';\n"
"\n"
" public const OPTION_TASK_MAX_REQUEST = 'task_max_request';\n"
"\n"
" public const OPTION_TASK_MAX_REQUEST_GRACE = 'task_max_request_grace';\n"
"\n"
" public const OPTION_MAX_CONNECTION = 'max_connection';\n"
"\n"
" public const OPTION_MAX_CONN = 'max_conn';\n"
"\n"
" public const OPTION_HEARTBEAT_CHECK_INTERVAL = 'heartbeat_check_interval';\n"
"\n"
" public const OPTION_HEARTBEAT_IDLE_TIME = 'heartbeat_idle_time';\n"
"\n"
" public const OPTION_MAX_REQUEST = 'max_request';\n"
"\n"
" public const OPTION_MAX_REQUEST_GRACE = 'max_request_grace';\n"
"\n"
" public const OPTION_RELOAD_ASYNC = 'reload_async';\n"
"\n"
" public const OPTION_OPEN_CPU_AFFINITY = 'open_cpu_affinity';\n"
"\n"
" public const OPTION_CPU_AFFINITY_IGNORE = 'cpu_affinity_ignore';\n"
"\n"
" public const OPTION_ENABLE_STATIC_HANDLER = 'enable_static_handler';\n"
"\n"
" public const OPTION_DOCUMENT_ROOT = 'document_root';\n"
"\n"
" public const OPTION_HTTP_AUTOINDEX = 'http_autoindex';\n"
"\n"
" public const OPTION_HTTP_INDEX_FILES = 'http_index_files';\n"
"\n"
" public const OPTION_STATIC_HANDLER_LOCATIONS = 'static_handler_locations';\n"
"\n"
" public const OPTION_INPUT_BUFFER_SIZE = 'input_buffer_size';\n"
"\n"
" public const OPTION_BUFFER_INPUT_SIZE = 'buffer_input_size';\n"
"\n"
" public const OPTION_OUTPUT_BUFFER_SIZE = 'output_buffer_size';\n"
"\n"
" public const OPTION_BUFFER_OUTPUT_SIZE = 'buffer_output_size';\n"
"\n"
" public const OPTION_MESSAGE_QUEUE_KEY = 'message_queue_key';\n"
"\n"
" public const OPTION_BACKLOG = 'backlog';\n"
"\n"
" public const OPTION_KERNEL_SOCKET_RECV_BUFFER_SIZE = 'kernel_socket_recv_buffer_size';\n"
"\n"
" public const OPTION_KERNEL_SOCKET_SEND_BUFFER_SIZE = 'kernel_socket_send_buffer_size';\n"
"\n"
" public const OPTION_TCP_DEFER_ACCEPT = 'tcp_defer_accept';\n"
"\n"
" public const OPTION_OPEN_TCP_KEEPALIVE = 'open_tcp_keepalive';\n"
"\n"
" public const OPTION_OPEN_HTTP_PROTOCOL = 'open_http_protocol';\n"
"\n"
" public const OPTION_OPEN_WEBSOCKET_PROTOCOL = 'open_websocket_protocol';\n"
"\n"
" public const OPTION_WEBSOCKET_SUBPROTOCOL = 'websocket_subprotocol';\n"
"\n"
" public const OPTION_OPEN_WEBSOCKET_CLOSE_FRAME = 'open_websocket_close_frame';\n"
"\n"
" public const OPTION_OPEN_HTTP2_PROTOCOL = 'open_http2_protocol';\n"
"\n"
" public const OPTION_OPEN_REDIS_PROTOCOL = 'open_redis_protocol';\n"
"\n"
" public const OPTION_TCP_KEEPIDLE = 'tcp_keepidle';\n"
"\n"
" public const OPTION_TCP_KEEPINTERVAL = 'tcp_keepinterval';\n"
"\n"
" public const OPTION_TCP_KEEPCOUNT = 'tcp_keepcount';\n"
"\n"
" public const OPTION_TCP_FASTOPEN = 'tcp_fastopen';\n"
"\n"
" public const OPTION_PACKAGE_BODY_START = 'package_body_start';\n"
"\n"
" public const OPTION_SSL_CLIENT_CERT_FILE = 'ssl_client_cert_file';\n"
"\n"
" public const OPTION_SSL_PREFER_SERVER_CIPHERS = 'ssl_prefer_server_ciphers';\n"
"\n"
" public const OPTION_SSL_CIPHERS = 'ssl_ciphers';\n"
"\n"
" public const OPTION_SSL_ECDH_CURVE = 'ssl_ecdh_curve';\n"
"\n"
" public const OPTION_SSL_DHPARAM = 'ssl_dhparam';\n"
"\n"
" public const OPTION_OPEN_SSL = 'open_ssl';\n"
"\n"
" public const OPTION_OPEN_FASTCGI_PROTOCOL = 'open_fastcgi_protocol';\n"
"\n"
" /* }}} OPTION */\n"
"}\n";
static const char* swoole_library_source_core_string_object =
"\n"
"/**\n"
" * This file is part of Swoole.\n"
" *\n"
" * @link https://www.swoole.com\n"
" * @contact team@swoole.com\n"
" * @license https://github.com/swoole/library/blob/master/LICENSE\n"
" */\n"
"\n"
"declare(strict_types=1);\n"
"\n"
"namespace Swoole;\n"
"\n"
"class StringObject\n"
"{\n"
" /**\n"
" * @var string\n"
" */\n"
" protected $string;\n"
"\n"
" /**\n"
" * StringObject constructor.\n"
" */\n"
" public function __construct(string $string = '')\n"
" {\n"
" $this->string = $string;\n"
" }\n"
"\n"
" public function __toString(): string\n"
" {\n"
" return $this->string;\n"
" }\n"
"\n"
" public function length(): int\n"
" {\n"
" return strlen($this->string);\n"
" }\n"
"\n"
" /**\n"
" * @return false|int\n"
" */\n"
" public function indexOf(string $needle, int $offset = 0)\n"
" {\n"
" return strpos($this->string, ...func_get_args());\n"
" }\n"
"\n"
" /**\n"
" * @return false|int\n"
" */\n"
" public function lastIndexOf(string $needle, int $offset = 0)\n"
" {\n"
" return strrpos($this->string, ...func_get_args());\n"
" }\n"
"\n"
" /**\n"
" * @return false|int\n"
" */\n"
" public function pos(string $needle, int $offset = 0)\n"
" {\n"
" return strpos($this->string, ...func_get_args());\n"
" }\n"
"\n"
" /**\n"
" * @return false|int\n"
" */\n"
" public function rpos(string $needle, int $offset = 0)\n"
" {\n"
" return strrpos($this->string, ...func_get_args());\n"
" }\n"
"\n"
" /**\n"
" * @return false|int\n"
" */\n"
" public function ipos(string $needle)\n"
" {\n"
" return stripos($this->string, $needle);\n"
" }\n"
"\n"
" /**\n"
" * @return static\n"
" */\n"
" public function lower(): self\n"
" {\n"
" return new static(strtolower($this->string));\n"
" }\n"
"\n"
" /**\n"
" * @return static\n"
" */\n"
" public function upper(): self\n"
" {\n"
" return new static(strtoupper($this->string));\n"
" }\n"
"\n"
" /**\n"
" * @return static\n"
" */\n"
" public function trim(): self\n"
" {\n"
" return new static(trim($this->string));\n"
" }\n"
"\n"
" /**\n"
" * @return static\n"
" */\n"
" public function ltrim(): self\n"
" {\n"
" return new static(ltrim($this->string));\n"
" }\n"
"\n"
" /**\n"
" * @return static\n"
" */\n"
" public function rtrim(): self\n"
" {\n"
" return new static(rtrim($this->string));\n"
" }\n"
"\n"
" /**\n"
" * @return static\n"
" */\n"
" public function substr(int $offset, ?int $length = null)\n"
" {\n"
" return new static(substr($this->string, ...func_get_args()));\n"
" }\n"
"\n"
" public function repeat(int $n): StringObject\n"
" {\n"
" return new static(str_repeat($this->string, $n));\n"
" }\n"
"\n"
" /**\n"
" * @param $str\n"
" */\n"
" public function append($str): StringObject\n"
" {\n"
" if (is_string($str)) {\n"
" $this->string .= $str;\n"
" } else {\n"
" $this->string .= strval($str);\n"
" }\n"
" return $this;\n"
" }\n"
"\n"
" /**\n"
" * @param null|int $count\n"
" * @return static\n"
" */\n"
" public function replace(string $search, string $replace, &$count = null)\n"
" {\n"
" return new static(str_replace($search, $replace, $this->string, $count));\n"
" }\n"
"\n"
" public function startsWith(string $needle): bool\n"
" {\n"
" return strpos($this->string, $needle) === 0;\n"
" }\n"
"\n"
" public function contains(string $subString): bool\n"
" {\n"
" return strpos($this->string, $subString) !== false;\n"
" }\n"
"\n"
" public function endsWith(string $needle): bool\n"
" {\n"
" return strrpos($this->string, $needle) === (strlen($this->string) - strlen($needle));\n"
" }\n"
"\n"
" public function split(string $delimiter, int $limit = PHP_INT_MAX): ArrayObject\n"
" {\n"
" return static::detectArrayType(explode($delimiter, $this->string, $limit));\n"
" }\n"
"\n"
" public function char(int $index): string\n"
" {\n"
" if ($index > strlen($this->string)) {\n"
" return '';\n"
" }\n"
" return $this->string[$index];\n"
" }\n"
"\n"
" /**\n"
" * @return static\n"
" */\n"
" public function chunkSplit(int $chunkLength = 76, string $chunkEnd = '')\n"
" {\n"
" return new static(chunk_split($this->string, ...func_get_args()));\n"
" }\n"
"\n"
" public function chunk(int $splitLength = 1): ArrayObject\n"
" {\n"
" return static::detectArrayType(str_split($this->string, ...func_get_args()));\n"
" }\n"
"\n"
" public function toString(): string\n"
" {\n"
" return $this->string;\n"
" }\n"
"\n"
" protected static function detectArrayType(array $value): ArrayObject\n"
" {\n"
" return new ArrayObject($value);\n"
" }\n"
"}\n";
static const char* swoole_library_source_core_multibyte_string_object =
"\n"
"/**\n"
" * This file is part of Swoole.\n"
" *\n"
" * @link https://www.swoole.com\n"
" * @contact team@swoole.com\n"
" * @license https://github.com/swoole/library/blob/master/LICENSE\n"
" */\n"
"\n"
"declare(strict_types=1);\n"
"\n"
"namespace Swoole;\n"
"\n"
"class MultibyteStringObject extends StringObject\n"
"{\n"
" public function length(): int\n"
" {\n"
" return mb_strlen($this->string);\n"
" }\n"
"\n"
" /**\n"
" * @return false|int\n"
" */\n"
" public function indexOf(string $needle, int $offset = 0, ?string $encoding = null)\n"
" {\n"
" return mb_strpos($this->string, ...func_get_args());\n"
" }\n"
"\n"
" /**\n"
" * @return false|int\n"
" */\n"
" public function lastIndexOf(string $needle, int $offset = 0, ?string $encoding = null)\n"
" {\n"
" return mb_strrpos($this->string, ...func_get_args());\n"
" }\n"
"\n"
" /**\n"
" * @return false|int\n"
" */\n"
" public function pos(string $needle, int $offset = 0, ?string $encoding = null)\n"
" {\n"
" return mb_strpos($this->string, ...func_get_args());\n"
" }\n"
"\n"
" /**\n"
" * @return false|int\n"
" */\n"
" public function rpos(string $needle, int $offset = 0, ?string $encoding = null)\n"
" {\n"
" return mb_strrpos($this->string, ...func_get_args());\n"
" }\n"
"\n"
" /**\n"
" * @return false|int\n"
" */\n"
" public function ipos(string $needle, ?string $encoding = null)\n"
" {\n"
" return mb_stripos($this->string, ...func_get_args());\n"
" }\n"
"\n"
" /**\n"
" * @return static\n"
" */\n"
" public function substr(int $offset, ?int $length = null, ?string $encoding = null)\n"
" {\n"
" return new static(mb_substr($this->string, ...func_get_args()));\n"
" }\n"
"\n"
" public function chunk(int $splitLength = 1, ?int $limit = null): ArrayObject\n"
" {\n"
" return static::detectArrayType(mb_split($this->string, ...func_get_args()));\n"
" }\n"
"}\n";
static const char* swoole_library_source_core_array_object =
"\n"
"/**\n"
" * This file is part of Swoole.\n"
" *\n"
" * @link https://www.swoole.com\n"
" * @contact team@swoole.com\n"
" * @license https://github.com/swoole/library/blob/master/LICENSE\n"
" */\n"
"\n"
"declare(strict_types=1);\n"
"\n"
"namespace Swoole;\n"
"\n"
"use ArrayAccess;\n"
"use Countable;\n"
"use Iterator;\n"
"use RuntimeException;\n"
"use Serializable;\n"
"\n"
"class ArrayObject implements ArrayAccess, Serializable, Countable, Iterator\n"
"{\n"
" /**\n"
" * @var array\n"
" */\n"
" protected $array;\n"
"\n"
" /**\n"
" * ArrayObject constructor.\n"
" */\n"
" public function __construct(array $array = [])\n"
" {\n"
" $this->array = $array;\n"
" }\n"
"\n"
" public function __toArray(): array\n"
" {\n"
" return $this->array;\n"
" }\n"
"\n"
" public function toArray(): array\n"
" {\n"
" return $this->array;\n"
" }\n"
"\n"
" public function isEmpty(): bool\n"
" {\n"
" return empty($this->array);\n"
" }\n"
"\n"
" public function count(): int\n"
" {\n"
" return count($this->array);\n"
" }\n"
"\n"
" /**\n"
" * @return mixed\n"
" */\n"
" public function current()\n"
" {\n"
" return current($this->array);\n"
" }\n"
"\n"
" /**\n"
" * @return mixed\n"
" */\n"
" public function key()\n"
" {\n"
" return key($this->array);\n"
" }\n"
"\n"
" public function valid(): bool\n"
" {\n"
" return array_key_exists($this->key(), $this->array);\n"
" }\n"
"\n"
" /**\n"
" * @return mixed\n"
" */\n"
" public function rewind()\n"
" {\n"
" return reset($this->array);\n"
" }\n"
"\n"
" /**\n"
" * @return mixed\n"
" */\n"
" public function next()\n"
" {\n"
" return next($this->array);\n"
" }\n"
"\n"
" /**\n"
" * @param mixed $key\n"
" * @return ArrayObject|StringObject\n"
" */\n"
" public function get($key)\n"
" {\n"
" return static::detectType($this->array[$key]);\n"
" }\n"
"\n"
" /**\n"
" * @return mixed\n"
" */\n"
" public function last()\n"
" {\n"
" $key = array_key_last($this->array);\n"
" if ($key === null) {\n"
" return null;\n"
" }\n"
" return $this->get($key);\n"
" }\n"
"\n"
" /**\n"
" * @return mixed\n"
" */\n"
" public function first()\n"
" {\n"
" $key = array_key_first($this->array);\n"
" if ($key === null) {\n"
" return null;\n"
" }\n"
" return $this->get($key);\n"
" }\n"
"\n"
" /**\n"
" * @param mixed $key\n"
" * @param mixed $value\n"
" * @return $this\n"
" */\n"
" public function set($key, $value): self\n"
" {\n"
" $this->array[$key] = $value;\n"
" return $this;\n"
" }\n"
"\n"
" /**\n"
" * @param mixed $key\n"
" * @return $this\n"
" */\n"
" public function delete($key): self\n"
" {\n"
" unset($this->array[$key]);\n"
" return $this;\n"
" }\n"
"\n"
" /**\n"
" * @param mixed $value\n"
" * @return $this\n"
" */\n"
" public function remove($value, bool $strict = true, bool $loop = false): self\n"
" {\n"
" do {\n"
" $key = $this->search($value, $strict);\n"
" if ($key === false) {\n"
" break;\n"
" }\n"
" unset($this->array[$key]);\n"
" } while ($loop);\n"
"\n"
" return $this;\n"
" }\n"
"\n"
" /**\n"
" * @return $this\n"
" */\n"
" public function clear(): self\n"
" {\n"
" $this->array = [];\n"
" return $this;\n"
" }\n"
"\n"
" /**\n"
" * @param mixed $key\n"
" * @return null|mixed\n"
" */\n"
" public function offsetGet($key)\n"
" {\n"
" if (!array_key_exists($key, $this->array)) {\n"
" return null;\n"
" }\n"
" return $this->array[$key];\n"
" }\n"
"\n"
" /**\n"
" * @param mixed $key\n"
" * @param mixed $value\n"
" */\n"
" public function offsetSet($key, $value): void\n"
" {\n"
" $this->array[$key] = $value;\n"
" }\n"
"\n"
" /**\n"
" * @param mixed $key\n"
" */\n"
" public function offsetUnset($key): void\n"
" {\n"
" unset($this->array[$key]);\n"
" }\n"
"\n"
" /**\n"
" * @param mixed $key\n"
" * @return bool\n"
" */\n"
" public function offsetExists($key)\n"
" {\n"
" return isset($this->array[$key]);\n"
" }\n"
"\n"
" /**\n"
" * @param mixed $key\n"
" */\n"
" public function exists($key): bool\n"
" {\n"
" return array_key_exists($key, $this->array);\n"
" }\n"
"\n"
" /**\n"
" * @param mixed $value\n"
" */\n"
" public function contains($value, bool $strict = true): bool\n"
" {\n"
" return in_array($value, $this->array, $strict);\n"
" }\n"
"\n"
" /**\n"
" * @param mixed $value\n"
" * @return mixed\n"
" */\n"
" public function indexOf($value, bool $strict = true)\n"
" {\n"
" return $this->search($value, $strict);\n"
" }\n"
"\n"
" /**\n"
" * @param mixed $value\n"
" * @return mixed\n"
" */\n"
" public function lastIndexOf($value, bool $strict = true)\n"
" {\n"
" $array = $this->array;\n"
" for (end($array); ($currentKey = key($array)) !== null; prev($array)) {\n"
" $currentValue = current($array);\n"
" if ($currentValue == $value) {\n"
" if ($strict && $currentValue !== $value) {\n"
" continue;\n"
" }\n"
" break;\n"
" }\n"
" }\n"
" return $currentKey;\n"
" }\n"
"\n"
" /**\n"
" * @param mixed $needle\n"
" * @return mixed\n"
" */\n"
" public function search($needle, bool $strict = true)\n"