-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
Copy pathphp_swoole_library.h
3593 lines (3563 loc) Β· 130 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: 830bfd42fa2c0c4e4f7916eb374d1c0edd58a19d */
static const char* swoole_library_source_constants =
"\n"
"define('SWOOLE_LIBRARY', true);\n";
static const char* swoole_library_source_std_exec =
"\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"
" } else {\n"
" return false;\n"
" }\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"
"declare(strict_types=1);\n"
"\n"
"namespace Swoole;\n"
"\n"
"class Constant\n"
"{\n"
" const EVENT_RECEIVE = 'receive';\n"
" const EVENT_CONNECT = 'connect';\n"
" const EVENT_CLOSE = 'close';\n"
" const EVENT_PACKET = 'packet';\n"
" const EVENT_REQUEST = 'request';\n"
" const EVENT_MESSAGE = 'message';\n"
" const EVENT_OPEN = 'open';\n"
" const EVENT_HANDSHAKE = 'handshake';\n"
" const EVENT_TASK = 'task';\n"
" const EVENT_FINISH = 'finish';\n"
" const EVENT_START = 'start';\n"
" const EVENT_SHUTDOWN = 'shutdown';\n"
" const EVENT_WORKER_START = 'workerStart';\n"
" const EVENT_WORKER_EXIT = 'workerExit';\n"
" const EVENT_WORKER_ERROR = 'workerError';\n"
" const EVENT_WORKER_STOP = 'workerStop';\n"
" const EVENT_PIPE_MESSAGE = 'pipeMessage';\n"
" const EVENT_MANAGER_START = 'managerStart';\n"
" const EVENT_MANAGER_STOP = 'managerStop';\n"
" const EVENT_ERROR = 'error';\n"
"\n"
" /* {{{ OPTION */\n"
" const OPTION_ENABLE_SIGNALFD = 'enable_signalfd';\n"
" const OPTION_DNS_CACHE_REFRESH_TIME = 'dns_cache_refresh_time';\n"
" const OPTION_SOCKET_BUFFER_SIZE = 'socket_buffer_size';\n"
" const OPTION_SOCKET_SEND_TIMEOUT = 'socket_send_timeout';\n"
" const OPTION_LOG_LEVEL = 'log_level';\n"
" const OPTION_THREAD_NUM = 'thread_num';\n"
" const OPTION_MIN_THREAD_NUM = 'min_thread_num';\n"
" const OPTION_MAX_THREAD_NUM = 'max_thread_num';\n"
" const OPTION_DISPLAY_ERRORS = 'display_errors';\n"
" const OPTION_SOCKET_DONTWAIT = 'socket_dontwait';\n"
" const OPTION_DNS_LOOKUP_RANDOM = 'dns_lookup_random';\n"
" const OPTION_DNS_SERVER = 'dns_server';\n"
" const OPTION_USE_ASYNC_RESOLVER = 'use_async_resolver';\n"
" const OPTION_ENABLE_COROUTINE = 'enable_coroutine';\n"
" const OPTION_ENABLE_REUSE_PORT = 'enable_reuse_port';\n"
" const OPTION_SSL_METHOD = 'ssl_method';\n"
" const OPTION_SSL_PROTOCOLS = 'ssl_protocols';\n"
" const OPTION_SSL_COMPRESS = 'ssl_compress';\n"
" const OPTION_SSL_CERT_FILE = 'ssl_cert_file';\n"
" const OPTION_SSL_KEY_FILE = 'ssl_key_file';\n"
" const OPTION_SSL_PASSPHRASE = 'ssl_passphrase';\n"
" const OPTION_SSL_HOST_NAME = 'ssl_host_name';\n"
" const OPTION_SSL_VERIFY_PEER = 'ssl_verify_peer';\n"
" const OPTION_SSL_ALLOW_SELF_SIGNED = 'ssl_allow_self_signed';\n"
" const OPTION_SSL_CAFILE = 'ssl_cafile';\n"
" const OPTION_SSL_CAPATH = 'ssl_capath';\n"
" const OPTION_SSL_VERIFY_DEPTH = 'ssl_verify_depth';\n"
" const OPTION_OPEN_EOF_CHECK = 'open_eof_check';\n"
" const OPTION_OPEN_EOF_SPLIT = 'open_eof_split';\n"
" const OPTION_PACKAGE_EOF = 'package_eof';\n"
" const OPTION_OPEN_MQTT_PROTOCOL = 'open_mqtt_protocol';\n"
" const OPTION_OPEN_LENGTH_CHECK = 'open_length_check';\n"
" const OPTION_PACKAGE_LENGTH_TYPE = 'package_length_type';\n"
" const OPTION_PACKAGE_LENGTH_OFFSET = 'package_length_offset';\n"
" const OPTION_PACKAGE_BODY_OFFSET = 'package_body_offset';\n"
" const OPTION_PACKAGE_LENGTH_FUNC = 'package_length_func';\n"
" const OPTION_PACKAGE_MAX_LENGTH = 'package_max_length';\n"
" const OPTION_BUFFER_HIGH_WATERMARK = 'buffer_high_watermark';\n"
" const OPTION_BUFFER_LOW_WATERMARK = 'buffer_low_watermark';\n"
" const OPTION_BIND_PORT = 'bind_port';\n"
" const OPTION_BIND_ADDRESS = 'bind_address';\n"
" const OPTION_OPEN_TCP_NODELAY = 'open_tcp_nodelay';\n"
" const OPTION_SOCKS5_HOST = 'socks5_host';\n"
" const OPTION_SOCKS5_PORT = 'socks5_port';\n"
" const OPTION_SOCKS5_USERNAME = 'socks5_username';\n"
" const OPTION_SOCKS5_PASSWORD = 'socks5_password';\n"
" const OPTION_HTTP_PROXY_HOST = 'http_proxy_host';\n"
" const OPTION_HTTP_PROXY_PORT = 'http_proxy_port';\n"
" const OPTION_HTTP_PROXY_USERNAME = 'http_proxy_username';\n"
" const OPTION_HTTP_PROXY_USER = 'http_proxy_user';\n"
" const OPTION_HTTP_PROXY_PASSWORD = 'http_proxy_password';\n"
" const OPTION_TIMEOUT = 'timeout';\n"
" const OPTION_CONNECT_TIMEOUT = 'connect_timeout';\n"
" const OPTION_READ_TIMEOUT = 'read_timeout';\n"
" const OPTION_WRITE_TIMEOUT = 'write_timeout';\n"
" const OPTION_SSL_DISABLE_COMPRESSION = 'ssl_disable_compression';\n"
" const OPTION_MAX_COROUTINE = 'max_coroutine';\n"
" const OPTION_HOOK_FLAGS = 'hook_flags';\n"
" const OPTION_C_STACK_SIZE = 'c_stack_size';\n"
" const OPTION_STACK_SIZE = 'stack_size';\n"
" const OPTION_SOCKET_CONNECT_TIMEOUT = 'socket_connect_timeout';\n"
" const OPTION_SOCKET_TIMEOUT = 'socket_timeout';\n"
" const OPTION_SOCKET_READ_TIMEOUT = 'socket_read_timeout';\n"
" const OPTION_SOCKET_WRITE_TIMEOUT = 'socket_write_timeout';\n"
" const OPTION_TRACE_FLAGS = 'trace_flags';\n"
" const OPTION_DNS_CACHE_EXPIRE = 'dns_cache_expire';\n"
" const OPTION_DNS_CACHE_CAPACITY = 'dns_cache_capacity';\n"
" const OPTION_AIO_CORE_WORKER_NUM = 'aio_core_worker_num';\n"
" const OPTION_AIO_WORKER_NUM = 'aio_worker_num';\n"
" const OPTION_AIO_MAX_WAIT_TIME = 'aio_max_wait_time';\n"
" const OPTION_AIO_MAX_IDLE_TIME = 'aio_max_idle_time';\n"
" const OPTION_RECONNECT = 'reconnect';\n"
" const OPTION_DEFER = 'defer';\n"
" const OPTION_KEEP_ALIVE = 'keep_alive';\n"
" const OPTION_WEBSOCKET_MASK = 'websocket_mask';\n"
" const OPTION_WEBSOCKET_COMPRESSION = 'websocket_compression';\n"
" const OPTION_HOST = 'host';\n"
" const OPTION_PORT = 'port';\n"
" const OPTION_SSL = 'ssl';\n"
" const OPTION_USER = 'user';\n"
" const OPTION_PASSWORD = 'password';\n"
" const OPTION_DATABASE = 'database';\n"
" const OPTION_CHARSET = 'charset';\n"
" const OPTION_STRICT_TYPE = 'strict_type';\n"
" const OPTION_FETCH_MODE = 'fetch_mode';\n"
" const OPTION_SERIALIZE = 'serialize';\n"
" const OPTION_COMPATIBILITY_MODE = 'compatibility_mode';\n"
" const OPTION_CHROOT = 'chroot';\n"
" const OPTION_GROUP = 'group';\n"
" const OPTION_DAEMONIZE = 'daemonize';\n"
" const OPTION_DEBUG_MODE = 'debug_mode';\n"
" const OPTION_PID_FILE = 'pid_file';\n"
" const OPTION_REACTOR_NUM = 'reactor_num';\n"
" const OPTION_SINGLE_THREAD = 'single_thread';\n"
" const OPTION_WORKER_NUM = 'worker_num';\n"
" const OPTION_MAX_WAIT_TIME = 'max_wait_time';\n"
" const OPTION_MAX_CORO_NUM = 'max_coro_num';\n"
" const OPTION_SEND_TIMEOUT = 'send_timeout';\n"
" const OPTION_DISPATCH_MODE = 'dispatch_mode';\n"
" const OPTION_SEND_YIELD = 'send_yield';\n"
" const OPTION_DISPATCH_FUNC = 'dispatch_func';\n"
" const OPTION_LOG_FILE = 'log_file';\n"
" const OPTION_DISCARD_TIMEOUT_REQUEST = 'discard_timeout_request';\n"
" const OPTION_ENABLE_UNSAFE_EVENT = 'enable_unsafe_event';\n"
" const OPTION_ENABLE_DELAY_RECEIVE = 'enable_delay_receive';\n"
" const OPTION_TASK_USE_OBJECT = 'task_use_object';\n"
" const OPTION_TASK_ENABLE_COROUTINE = 'task_enable_coroutine';\n"
" const OPTION_TASK_WORKER_NUM = 'task_worker_num';\n"
" const OPTION_TASK_IPC_MODE = 'task_ipc_mode';\n"
" const OPTION_TASK_TMPDIR = 'task_tmpdir';\n"
" const OPTION_TASK_MAX_REQUEST = 'task_max_request';\n"
" const OPTION_TASK_MAX_REQUEST_GRACE = 'task_max_request_grace';\n"
" const OPTION_MAX_CONNECTION = 'max_connection';\n"
" const OPTION_MAX_CONN = 'max_conn';\n"
" const OPTION_HEARTBEAT_CHECK_INTERVAL = 'heartbeat_check_interval';\n"
" const OPTION_HEARTBEAT_IDLE_TIME = 'heartbeat_idle_time';\n"
" const OPTION_MAX_REQUEST = 'max_request';\n"
" const OPTION_MAX_REQUEST_GRACE = 'max_request_grace';\n"
" const OPTION_RELOAD_ASYNC = 'reload_async';\n"
" const OPTION_OPEN_CPU_AFFINITY = 'open_cpu_affinity';\n"
" const OPTION_CPU_AFFINITY_IGNORE = 'cpu_affinity_ignore';\n"
" const OPTION_HTTP_PARSE_COOKIE = 'http_parse_cookie';\n"
" const OPTION_HTTP_PARSE_POST = 'http_parse_post';\n"
" const OPTION_HTTP_PARSE_FILES = 'http_parse_files';\n"
" const OPTION_HTTP_COMPRESSION = 'http_compression';\n"
" const OPTION_HTTP_GZIP_LEVEL = 'http_gzip_level';\n"
" const OPTION_HTTP_COMPRESSION_LEVEL = 'http_compression_level';\n"
" const OPTION_UPLOAD_TMP_DIR = 'upload_tmp_dir';\n"
" const OPTION_ENABLE_STATIC_HANDLER = 'enable_static_handler';\n"
" const OPTION_DOCUMENT_ROOT = 'document_root';\n"
" const OPTION_STATIC_HANDLER_LOCATIONS = 'static_handler_locations';\n"
" const OPTION_BUFFER_INPUT_SIZE = 'buffer_input_size';\n"
" const OPTION_BUFFER_OUTPUT_SIZE = 'buffer_output_size';\n"
" const OPTION_MESSAGE_QUEUE_KEY = 'message_queue_key';\n"
" const OPTION_BACKLOG = 'backlog';\n"
" const OPTION_KERNEL_SOCKET_RECV_BUFFER_SIZE = 'kernel_socket_recv_buffer_size';\n"
" const OPTION_KERNEL_SOCKET_SEND_BUFFER_SIZE = 'kernel_socket_send_buffer_size';\n"
" const OPTION_TCP_DEFER_ACCEPT = 'tcp_defer_accept';\n"
" const OPTION_OPEN_TCP_KEEPALIVE = 'open_tcp_keepalive';\n"
" const OPTION_OPEN_HTTP_PROTOCOL = 'open_http_protocol';\n"
" const OPTION_OPEN_WEBSOCKET_PROTOCOL = 'open_websocket_protocol';\n"
" const OPTION_WEBSOCKET_SUBPROTOCOL = 'websocket_subprotocol';\n"
" const OPTION_OPEN_WEBSOCKET_CLOSE_FRAME = 'open_websocket_close_frame';\n"
" const OPTION_OPEN_HTTP2_PROTOCOL = 'open_http2_protocol';\n"
" const OPTION_OPEN_REDIS_PROTOCOL = 'open_redis_protocol';\n"
" const OPTION_TCP_KEEPIDLE = 'tcp_keepidle';\n"
" const OPTION_TCP_KEEPINTERVAL = 'tcp_keepinterval';\n"
" const OPTION_TCP_KEEPCOUNT = 'tcp_keepcount';\n"
" const OPTION_TCP_FASTOPEN = 'tcp_fastopen';\n"
" const OPTION_PACKAGE_BODY_START = 'package_body_start';\n"
" const OPTION_SSL_CLIENT_CERT_FILE = 'ssl_client_cert_file';\n"
" const OPTION_SSL_PREFER_SERVER_CIPHERS = 'ssl_prefer_server_ciphers';\n"
" const OPTION_SSL_CIPHERS = 'ssl_ciphers';\n"
" const OPTION_SSL_ECDH_CURVE = 'ssl_ecdh_curve';\n"
" const OPTION_SSL_DHPARAM = 'ssl_dhparam';\n"
" const OPTION_OPEN_SSL = 'open_ssl';\n"
" /* }}} OPTION */\n"
"}\n";
static const char* swoole_library_source_core_string_object =
"\n"
"\n"
"namespace Swoole;\n"
"\n"
"class StringObject\n"
"{\n"
" /**\n"
" * @var string\n"
" */\n"
" protected $string;\n"
"\n"
" /**\n"
" * StringObject constructor.\n"
" * @param $string\n"
" */\n"
" public function __construct(string $string = '')\n"
" {\n"
" $this->string = $string;\n"
" }\n"
"\n"
" /**\n"
" * @return int\n"
" */\n"
" public function length(): int\n"
" {\n"
" return strlen($this->string);\n"
" }\n"
"\n"
" /**\n"
" * @param string $needle\n"
" * @param int $offset\n"
" * @return bool|int\n"
" */\n"
" public function indexOf(string $needle, int $offset = 0)\n"
" {\n"
" return strpos($this->string, $needle, $offset);\n"
" }\n"
"\n"
" /**\n"
" * @param string $needle\n"
" * @param int $offset\n"
" * @return bool|int\n"
" */\n"
" public function lastIndexOf(string $needle, int $offset = 0)\n"
" {\n"
" return strrpos($this->string, $needle, $offset);\n"
" }\n"
"\n"
" /**\n"
" * @param string $needle\n"
" * @param int $offset\n"
" * @return bool|int\n"
" */\n"
" public function pos(string $needle, int $offset = 0)\n"
" {\n"
" return strpos($this->string, $needle, $offset);\n"
" }\n"
"\n"
" /**\n"
" * @param string $needle\n"
" * @param int $offset\n"
" * @return bool|int\n"
" */\n"
" public function rpos(string $needle, int $offset = 0)\n"
" {\n"
" return strrpos($this->string, $needle, $offset);\n"
" }\n"
"\n"
" /**\n"
" * @param string $needle\n"
" * @return bool|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 lrim(): 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"
" * @param int $offset\n"
" * @param mixed ...$length\n"
" * @return static\n"
" */\n"
" public function substr(int $offset, ...$length)\n"
" {\n"
" return new static(substr($this->string, $offset, ...$length));\n"
" }\n"
"\n"
" /**\n"
" * @param $n\n"
" * @return StringObject\n"
" */\n"
" public function repeat($n)\n"
" {\n"
" return new static(str_repeat($this->string, $n));\n"
" }\n"
"\n"
" /**\n"
" * @param string $search\n"
" * @param string $replace\n"
" * @param null $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"
" /**\n"
" * @param string $needle\n"
" * @return bool\n"
" */\n"
" public function startsWith(string $needle): bool\n"
" {\n"
" return strpos($this->string, $needle) === 0;\n"
" }\n"
"\n"
" /**\n"
" * @param string $subString\n"
" * @return bool\n"
" */\n"
" public function contains(string $subString): bool\n"
" {\n"
" return strpos($this->string, $subString) !== false;\n"
" }\n"
"\n"
" /**\n"
" * @param string $needle\n"
" * @return bool\n"
" */\n"
" public function endsWith(string $needle): bool\n"
" {\n"
" return strrpos($this->string, $needle) === (strlen($needle) - 1);\n"
" }\n"
"\n"
" /**\n"
" * @param string $delimiter\n"
" * @param int $limit\n"
" * @return ArrayObject\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"
" /**\n"
" * @param int $index\n"
" * @return string\n"
" */\n"
" public function char(int $index): string\n"
" {\n"
" return $this->string[$index];\n"
" }\n"
"\n"
" /**\n"
" * @param int $chunkLength\n"
" * @param string $chunkEnd\n"
" * @return static\n"
" */\n"
" public function chunkSplit(int $chunkLength = 1, string $chunkEnd = '')\n"
" {\n"
" return new static(chunk_split($this->string, $chunkLength, $chunkEnd));\n"
" }\n"
"\n"
" /**\n"
" * @param int $splitLength\n"
" * @return ArrayObject\n"
" */\n"
" public function chunk($splitLength = 1): ArrayObject\n"
" {\n"
" return static::detectArrayType(str_split($this->string, $splitLength));\n"
" }\n"
"\n"
" /**\n"
" * @return string\n"
" */\n"
" public function toString()\n"
" {\n"
" return $this->string;\n"
" }\n"
"\n"
" /**\n"
" * @return string\n"
" */\n"
" public function __toString(): string\n"
" {\n"
" return $this->string;\n"
" }\n"
"\n"
" /**\n"
" * @param array $value\n"
" * @return ArrayObject\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_array_object =
"\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"
" * @param array $array\n"
" */\n"
" public function __construct(array $array = [])\n"
" {\n"
" $this->array = $array;\n"
" }\n"
"\n"
" /**\n"
" * @return bool\n"
" */\n"
" public function isEmpty(): bool\n"
" {\n"
" return empty($this->array);\n"
" }\n"
"\n"
" /**\n"
" * @return int\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"
" /**\n"
" * @return bool\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 $key\n"
" * @return ArrayObject|StringObject|mixed\n"
" */\n"
" public function get($key)\n"
" {\n"
" return static::detectType($this->array[$key]);\n"
" }\n"
"\n"
" /**\n"
" * @param $key\n"
" * @param $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 $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 $value\n"
" * @param bool $strict\n"
" * @param bool $loop\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) {\n"
" unset($this->array[$key]);\n"
" } else {\n"
" break;\n"
" }\n"
" } while ($loop);\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 mixed|null\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)\n"
" {\n"
" $this->array[$key] = $value;\n"
" }\n"
"\n"
" /**\n"
" * @param mixed $key\n"
" */\n"
" public function offsetUnset($key)\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 $key\n"
" * @return bool\n"
" */\n"
" public function exists($key): bool\n"
" {\n"
" return array_key_exists($key, $this->array);\n"
" }\n"
"\n"
" /**\n"
" * @param $value\n"
" * @param bool $strict\n"
" * @return bool\n"
" */\n"
" public function contains($value, bool $strict = true): bool\n"
" {\n"
" return in_array($value, $this->array, $strict);\n"
" }\n"
"\n"
" /**\n"
" * @param $value\n"
" * @param bool $strict\n"
" * @return mixed\n"
" */\n"
" public function indexOf($value, bool $strict = true)\n"
" {\n"
" return $this->search($value, $strict);\n"
" }\n"
"\n"
" /**\n"
" * @param $value\n"
" * @param bool $strict\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 $needle\n"
" * @param $strict\n"
" * @return mixed\n"
" */\n"
" public function search($needle, $strict = true)\n"
" {\n"
" return array_search($needle, $this->array, $strict);\n"
" }\n"
"\n"
" /**\n"
" * @param string $glue\n"
" * @return StringObject\n"
" */\n"
" public function join(string $glue = ''): StringObject\n"
" {\n"
" return static::detectStringType(implode($glue, $this->array));\n"
" }\n"
"\n"
" /**\n"
" * @return StringObject\n"
" */\n"
" public function serialize(): StringObject\n"
" {\n"
" return static::detectStringType(serialize($this->array));\n"
" }\n"
"\n"
" /**\n"
" * @param string $string\n"
" * @return $this\n"
" */\n"
" public function unserialize($string): self\n"
" {\n"
" $this->array = (array)unserialize((string)$string);\n"
" return $this;\n"
" }\n"
"\n"
" /**\n"
" * @return float|int\n"
" */\n"
" public function sum()\n"
" {\n"
" return array_sum($this->array);\n"
" }\n"
"\n"
" /**\n"
" * @return float|int\n"
" */\n"
" public function product()\n"
" {\n"
" return array_product($this->array);\n"
" }\n"
"\n"
" /**\n"
" * @param $value\n"
" * @return int\n"
" */\n"
" public function push($value)\n"
" {\n"
" return array_push($this->array, $value);\n"
" }\n"
"\n"
" /**\n"
" * @param $value\n"
" * @return int\n"
" */\n"
" public function pushBack($value)\n"
" {\n"
" return array_unshift($this->array, $value);\n"
" }\n"
"\n"
" /**\n"
" * @param int $offset\n"
" * @param $value\n"
" * @return $this\n"
" */\n"
" public function insert(int $offset, $value): self\n"
" {\n"
" if (is_array($value) || is_object($value) || is_null($value)) {\n"
" $value = [$value];\n"
" }\n"
" array_splice($this->array, $offset, 0, $value);\n"
" return $this;\n"
" }\n"
"\n"
" /**\n"
" * @return mixed\n"
" */\n"
" public function pop()\n"
" {\n"
" return array_pop($this->array);\n"
" }\n"
"\n"
" /**\n"
" * @return mixed\n"
" */\n"
" public function popFront()\n"
" {\n"
" return array_shift($this->array);\n"
" }\n"
"\n"
" /**\n"
" * @param $offset\n"
" * @param int $length\n"
" * @param bool $preserve_keys\n"
" * @return static\n"
" */\n"
" public function slice($offset, int $length = null, bool $preserve_keys = false): self\n"
" {\n"
" return new static(array_slice($this->array, ...func_get_args()));\n"
" }\n"
"\n"
" /**\n"
" * @return ArrayObject|StringObject|mixed\n"
" */\n"
" public function randomGet()\n"
" {\n"
" return static::detectType($this->array[array_rand($this->array, 1)]);\n"
" }\n"
"\n"
" /**\n"
" * @param $fn callable\n"
" * @return $this\n"
" */\n"
" public function each(callable $fn): self\n"
" {\n"
" if (array_walk($this->array, $fn) === false) {\n"
" throw new RuntimeException('array_walk() failed');\n"
" }\n"
" return $this;\n"
" }\n"
"\n"
" /**\n"
" * @param $fn callable\n"
" * @return static\n"
" */\n"
" public function map(callable $fn): self\n"
" {\n"
" return new static(array_map($fn, $this->array));\n"
" }\n"
"\n"
" /**\n"
" * @param $fn callable\n"
" * @return mixed\n"
" */\n"
" public function reduce(callable $fn)\n"
" {\n"
" return array_reduce($this->array, $fn);\n"
" }\n"
"\n"
" /**\n"
" * @param int $search_value\n"
" * @param bool $strict\n"
" * @return static\n"
" */\n"
" public function keys(int $search_value = null, $strict = false): self\n"
" {\n"
" return new static(array_keys($this->array, $search_value, $strict));\n"
" }\n"
"\n"
" /**\n"
" * @return static\n"
" */\n"
" public function values(): self\n"
" {\n"
" return new static(array_values($this->array));\n"
" }\n"
"\n"
" /**\n"
" * @param $column_key\n"
" * @param mixed ...$index\n"
" * @return static\n"
" */\n"
" public function column($column_key, ...$index): self\n"
" {\n"
" return new static(array_column($this->array, $column_key, ...$index));\n"
" }\n"
"\n"
" /**\n"
" * @param int $sort_flags\n"
" * @return static\n"
" */\n"
" public function unique(int $sort_flags = SORT_STRING): self\n"
" {\n"
" return new static(array_unique($this->array, $sort_flags));\n"
" }\n"
"\n"
" /**\n"
" * @param bool $preserve_keys\n"
" * @return static\n"
" */\n"
" public function reverse(bool $preserve_keys = false): self\n"
" {\n"
" return new static(array_reverse($this->array, $preserve_keys));\n"
" }\n"
"\n"
" /**\n"
" * @param int $size\n"
" * @param bool $preserve_keys\n"
" * @return static\n"
" */\n"
" public function chunk(int $size, bool $preserve_keys = false): self\n"
" {\n"
" return new static(array_chunk($this->array, $size, $preserve_keys));\n"
" }\n"
"\n"
" /**\n"
" * Swap keys and values in an array\n"
" * @return static\n"
" */\n"
" public function flip(): self\n"
" {\n"
" return new static(array_flip($this->array));\n"
" }\n"
"\n"
" /**\n"
" * @param $fn callable\n"
" * @param int $flag\n"
" * @return static\n"
" */\n"
" public function filter(callable $fn, int $flag = 0): self\n"
" {\n"
" return new static(array_filter($this->array, $fn, $flag));\n"
" }\n"
"\n"
" /**\n"
" * | Function name | Sorts by | Maintains key association | Order of sort | Related functions |\n"
" * | :---------------- | :------- | :-------------------------- | :-------------------------- | :---------------- |\n"
" * | array_multisort() | value | associative yes, numeric no | first array or sort options | array_walk() |\n"
" * | asort() | value | yes | low to high | arsort() |\n"
" * | arsort() | value | yes | high to low | asort() |\n"
" * | krsort() | key | yes | high to low | ksort() |\n"
" * | ksort() | key | yes | low to high | asort() |\n"
" * | natcasesort() | value | yes | natural, case insensitive | natsort() |\n"
" * | natsort() | value | yes | natural | natcasesort() |\n"
" * | rsort() | value | no | high to low | sort() |\n"
" * | shuffle() | value | no | random | array_rand() |\n"
" * | sort() | value | no | low to high | rsort() |\n"
" * | uasort() | value | yes | user defined | uksort() |\n"
" * | uksort() | key | yes | user defined | uasort() |\n"
" * | usort() | value | no | user defined | uasort() |\n"
" */\n"
"\n"
" /**\n"
" * @param int $sort_order\n"
" * @param int $sort_flags\n"
" * @return $this\n"
" */\n"
" public function multiSort(int $sort_order = SORT_ASC, int $sort_flags = SORT_REGULAR): self\n"
" {\n"
" if (array_multisort($this->array, $sort_order, $sort_flags) !== true) {\n"
" throw new RuntimeException('array_multisort() failed');\n"
" }\n"
" return $this;\n"
" }\n"
"\n"
" /**\n"
" * @param int $sort_flags\n"
" * @return $this\n"
" */\n"
" public function asort(int $sort_flags = SORT_REGULAR): self\n"
" {\n"
" if (asort($this->array, $sort_flags) !== true) {\n"
" throw new RuntimeException('asort() failed');\n"
" }\n"
" return $this;\n"
" }\n"
"\n"
" /**\n"
" * @param int $sort_flags\n"
" * @return $this\n"
" */\n"
" public function arsort(int $sort_flags = SORT_REGULAR): self\n"
" {\n"
" if (arsort($this->array, $sort_flags) !== true) {\n"
" throw new RuntimeException('arsort() failed');\n"
" }\n"
" return $this;\n"
" }\n"
"\n"
" /**\n"
" * @param int $sort_flags\n"
" * @return $this\n"
" */\n"
" public function krsort(int $sort_flags = SORT_REGULAR): self\n"
" {\n"
" if (krsort($this->array, $sort_flags) !== true) {\n"
" throw new RuntimeException('krsort() failed');\n"
" }\n"
" return $this;\n"
" }\n"
"\n"
" /**\n"
" * @param int $sort_flags\n"
" * @return $this\n"
" */\n"
" public function ksort(int $sort_flags = SORT_REGULAR): self\n"
" {\n"
" if (ksort($this->array, $sort_flags) !== true) {\n"