New upstream version 1.2.0
Ondřej Surý
2 years ago
0 | 0 | <?xml version="1.0" encoding="UTF-8"?> |
1 | <package packagerversion="1.10.12" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> | |
1 | <package packagerversion="1.10.13" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd"> | |
2 | 2 | <name>psr</name> |
3 | 3 | <channel>pecl.php.net</channel> |
4 | 4 | <summary>PSR interfaces</summary> |
11 | 11 | <email>jbboehr@php.net</email> |
12 | 12 | <active>yes</active> |
13 | 13 | </lead> |
14 | <date>2021-04-10</date> | |
15 | <time>10:38:11</time> | |
14 | <date>2021-12-11</date> | |
15 | <time>18:27:48</time> | |
16 | 16 | <version> |
17 | <release>1.1.0</release> | |
18 | <api>1.1.0</api> | |
17 | <release>1.2.0</release> | |
18 | <api>1.2.0</api> | |
19 | 19 | </version> |
20 | 20 | <stability> |
21 | 21 | <release>stable</release> |
23 | 23 | </stability> |
24 | 24 | <license uri="https://opensource.org/licenses/BSD-2-Clause">BSD-2-Clause</license> |
25 | 25 | <notes> |
26 | - Update psr/container to 1.1.1 | |
27 | - Add version ID constants to each header | |
28 | - Use __dllspec(dllimport) where appropriate in php_psr.h on windows | |
26 | - PHP 8.1 compatibility (@Jeckerson) | |
27 | - All classes are now defined in a separate namespace `PsrExt` and aliased into the `Psr` namespace to aid in debuggging compatibility issues for framework maintainers | |
29 | 28 | </notes> |
30 | 29 | <contents> |
31 | 30 | <dir name="/"> |
32 | <file md5sum="cfbe2c6a04dd53fa513264b16d56c697" name="CHANGELOG.md" role="doc" /> | |
31 | <file md5sum="e8fc441a633ca165868a66812d1ef373" name="CHANGELOG.md" role="doc" /> | |
33 | 32 | <file md5sum="3516c2c41b9a8412bd03021bc16ac17d" name="LICENSE.md" role="doc" /> |
34 | <file md5sum="4238a8270ff528fddcb23703144ca7df" name="README.md" role="doc" /> | |
33 | <file md5sum="e5584a829d52cb4571b9d09088571e9f" name="README.md" role="doc" /> | |
35 | 34 | <file md5sum="dcfeb70a7a7510960dfe6946acc007a4" name="config.m4" role="src" /> |
36 | 35 | <file md5sum="d664a106b920d7349548ad78b1cf887e" name="config.w32" role="src" /> |
37 | 36 | <file md5sum="247aea4bef8802859d02b9c5677a5c63" name="php_psr.c" role="src" /> |
38 | <file md5sum="eaeeeae8cee37a3e34e8a5c1a0903ff0" name="php_psr.h" role="src" /> | |
39 | <file md5sum="1132611b69633c707f90d86471c7d597" name="psr_cache.c" role="src" /> | |
40 | <file md5sum="ff4140e6315663e2a500441c030df285" name="psr_cache.h" role="src" /> | |
41 | <file md5sum="e64e06bd4e9f9508237db7e21be50a19" name="psr_container.c" role="src" /> | |
42 | <file md5sum="459ed40875d3ed0413111e4296f58cfe" name="psr_container.h" role="src" /> | |
43 | <file md5sum="150e3261b6fd1dffb6545fc1f86cce40" name="psr_event_dispatcher.c" role="src" /> | |
44 | <file md5sum="f0fca58dfaef1760f062e125dac3b67e" name="psr_event_dispatcher.h" role="src" /> | |
45 | <file md5sum="e3f824b2874bfce89df75af4b2e23934" name="psr_http_client.c" role="src" /> | |
46 | <file md5sum="c4c675259e1ced4d2559f7c3f491f290" name="psr_http_client.h" role="src" /> | |
47 | <file md5sum="acab50e47c4302aede57e873d7549171" name="psr_http_factory.c" role="src" /> | |
48 | <file md5sum="a9b379fb4e10abc7d01a4eb381e83c33" name="psr_http_factory.h" role="src" /> | |
49 | <file md5sum="dc66eb5b3f32e89f6c6b961d3fefc84e" name="psr_http_message.c" role="src" /> | |
50 | <file md5sum="d7b32dcf9b35b9ff54de37003350666f" name="psr_http_message.h" role="src" /> | |
51 | <file md5sum="faa78ade1431f9b26d7f5b68400723df" name="psr_http_server_handler.c" role="src" /> | |
52 | <file md5sum="d5e247d8da08c34d7db050937e3eba5c" name="psr_http_server_handler.h" role="src" /> | |
53 | <file md5sum="aef1a0b17599bf45c30c937b295ea95f" name="psr_http_server_middleware.c" role="src" /> | |
54 | <file md5sum="0927832ec1e8d0c0a1c0324cdfe4d682" name="psr_http_server_middleware.h" role="src" /> | |
55 | <file md5sum="655438d005616144ed13174d5fccd564" name="psr_link.c" role="src" /> | |
56 | <file md5sum="aa2c3a21e14b5aa7a4fe1d49da95c2de" name="psr_link.h" role="src" /> | |
57 | <file md5sum="aca173b4f37d170822e0a4dafb4e2b9e" name="psr_log.c" role="src" /> | |
58 | <file md5sum="d4145e8e2642ac171e68d17117a7a45c" name="psr_log.h" role="src" /> | |
59 | <file md5sum="3c153c7a93f035e38ce2d2de9ebdc2b6" name="psr_simple_cache.c" role="src" /> | |
60 | <file md5sum="d87cf844abd8faec72b3bef74040e4c2" name="psr_simple_cache.h" role="src" /> | |
37 | <file md5sum="389ef45a8fde0263b8ce40053e36599f" name="php_psr.h" role="src" /> | |
38 | <file md5sum="2cb3f22583af9786bd2c3b79bbba133d" name="psr_cache.c" role="src" /> | |
39 | <file md5sum="5354230830a12b91a31207fabe515ebe" name="psr_cache.h" role="src" /> | |
40 | <file md5sum="aaa4c19da1e1be1dfe75da8721637011" name="psr_container.c" role="src" /> | |
41 | <file md5sum="42fc47043163a37ae3773a784847580c" name="psr_container.h" role="src" /> | |
42 | <file md5sum="38a7506e87ef051d9cd3f3766fc4043b" name="psr_event_dispatcher.c" role="src" /> | |
43 | <file md5sum="522d4d052fad274537fda996afb7b6f2" name="psr_event_dispatcher.h" role="src" /> | |
44 | <file md5sum="c2fbd1a0d03872920842b39b50c9d868" name="psr_http_client.c" role="src" /> | |
45 | <file md5sum="4498ce65e2ed3c99f5968055261b2f34" name="psr_http_client.h" role="src" /> | |
46 | <file md5sum="5795540169f05859d01c5a6ab97909e7" name="psr_http_factory.c" role="src" /> | |
47 | <file md5sum="497122130a6497534ea796bad55ffae8" name="psr_http_factory.h" role="src" /> | |
48 | <file md5sum="e591b4b1137514495c5d8e9567817945" name="psr_http_message.c" role="src" /> | |
49 | <file md5sum="3f4e82db466f3c3b5ec6103fd0938d54" name="psr_http_message.h" role="src" /> | |
50 | <file md5sum="663b2d0ad26151a856e6bca2d3448aff" name="psr_http_server_handler.c" role="src" /> | |
51 | <file md5sum="2aa07e545dd7457b6641bd8a961ed635" name="psr_http_server_handler.h" role="src" /> | |
52 | <file md5sum="43d6d1e2fed68441a51e9733efd57d51" name="psr_http_server_middleware.c" role="src" /> | |
53 | <file md5sum="58b65a55d25fdd1c183aff3ff63cd1c7" name="psr_http_server_middleware.h" role="src" /> | |
54 | <file md5sum="bcdac6a3d3efcbb3626c9df75437127c" name="psr_link.c" role="src" /> | |
55 | <file md5sum="a99481415b455ef9731b79be6c96eab2" name="psr_link.h" role="src" /> | |
56 | <file md5sum="1db8cc81b0755dd0722e46582d84e1fa" name="psr_log.c" role="src" /> | |
57 | <file md5sum="5b849a943c23fde6bca1c561efae332d" name="psr_log.h" role="src" /> | |
58 | <file md5sum="ce0ed9add50ef399e5dbacbeef3fd1d6" name="psr_private.h" role="src" /> | |
59 | <file md5sum="2db60ef0f1b1b6fed5294026d2433322" name="psr_simple_cache.c" role="src" /> | |
60 | <file md5sum="ed85fbe2ae62ed698a7fc086ac34dc29" name="psr_simple_cache.h" role="src" /> | |
61 | 61 | <file md5sum="2a92fdacf9f049bf5f2c12cc80ebf0c9" name="tests/PsrLogAbstractLogger.phpt" role="test" /> |
62 | 62 | <file md5sum="4657b077985b34d100c0c89a8df18796" name="tests/PsrContainerContainerInterface.phpt" role="test" /> |
63 | 63 | <file md5sum="b139064c9bdfdebc94041a1503f76284" name="tests/PsrLogLevel.phpt" role="test" /> |
64 | <file md5sum="1fc85cbd9d30e4c62516b3c0f7b0f1d1" name="tests/PsrLogLoggerTrait.phpt" role="test" /> | |
64 | <file md5sum="67bcce964945091514ccbf9400bf8621" name="tests/PsrLogLoggerTrait.phpt" role="test" /> | |
65 | 65 | <file md5sum="ddbe5e4f661d90df003f72607e102807" name="tests/SampleCacheItemPool.inc" role="test" /> |
66 | 66 | <file md5sum="8690dfe100ce3c3cbddfe7c96b590ffd" name="tests/SampleMessage.inc" role="test" /> |
67 | 67 | <file md5sum="d05751e0094071db490b2831ffeea8de" name="tests/SampleRequest.inc" role="test" /> |
69 | 69 | <file md5sum="dcdabdffc206a52b09e6c93e59053928" name="tests/PsrCacheCacheException.phpt" role="test" /> |
70 | 70 | <file md5sum="60bff1060ba847d9849e4862b3e10ea6" name="tests/PsrSimpleCacheCacheInterface.phpt" role="test" /> |
71 | 71 | <file md5sum="ed29e1e374f086b3266ab576ea6be0c4" name="tests/PsrHttpMessageStreamInterface.phpt" role="test" /> |
72 | <file md5sum="2fa84031d64eafdc31b76e21c8a72222" name="tests/PsrHttpMessageRequestInterface.phpt" role="test" /> | |
73 | <file md5sum="5b974e4f4cde6b170fa7deb5fd6cbbe6" name="tests/PsrHttpMessageServerRequestInterface.phpt" role="test" /> | |
74 | <file md5sum="13dbc6abd8607fb9a36b6c8e1abbaf8d" name="tests/PsrCacheCacheItemPoolInterface.phpt" role="test" /> | |
72 | <file md5sum="7b7c7e7ddc3736db6ad2543a8be85f09" name="tests/PsrHttpMessageRequestInterface.phpt" role="test" /> | |
73 | <file md5sum="d0bc0aa1674f8a5306020e3ff20c3036" name="tests/PsrHttpMessageServerRequestInterface.phpt" role="test" /> | |
74 | <file md5sum="240afb38abf642676358f4b2463597c4" name="tests/PsrCacheCacheItemPoolInterface.phpt" role="test" /> | |
75 | 75 | <file md5sum="432b791f7ac450dfb0931be744ee64b1" name="tests/PsrContainerContainerExceptionInterface.phpt" role="test" /> |
76 | 76 | <file md5sum="37356baef3ca61fec76f1d8f0c5eb76d" name="tests/PsrLogNullLogger.phpt" role="test" /> |
77 | 77 | <file md5sum="91f1ec0c412a6bf1055682ccbfac0976" name="tests/PsrHttpMessageUriInterface.phpt" role="test" /> |
78 | 78 | <file md5sum="e6696a3d2595b57992b446acd7a2122c" name="tests/PsrLinkLinkProviderInterface.phpt" role="test" /> |
79 | <file md5sum="a7953050c99837e06239d70b5c465372" name="tests/PsrLogLoggerAwareTrait.phpt" role="test" /> | |
80 | <file md5sum="f2367ba311b3baad589c817154861917" name="tests/PsrLogAbstractLogger_construct.phpt" role="test" /> | |
79 | <file md5sum="656c26ae72e41b3a47da27a2900fd5a7" name="tests/PsrLogLoggerAwareTrait.phpt" role="test" /> | |
80 | <file md5sum="8d59442d721c77a16402769fa853d24b" name="tests/PsrLogAbstractLogger_construct.phpt" role="test" /> | |
81 | 81 | <file md5sum="02074b4add9f8962d4ee8821892dfa50" name="tests/SampleLogger2.inc" role="test" /> |
82 | 82 | <file md5sum="c13f51a23ca4a2230ef6bdabb6f24a2b" name="tests/PsrContainerNotFoundExceptionInterface.phpt" role="test" /> |
83 | 83 | <file md5sum="aeaf337ce4e1c06f9fcf78f3c2e3b2a5" name="tests/PsrLinkEvolvableLinkInterface.phpt" role="test" /> |
84 | 84 | <file md5sum="935b66eef5f1b989fdcef56acc2d793c" name="tests/PsrLinkEvolvableLinkProviderInterface.phpt" role="test" /> |
85 | 85 | <file md5sum="669daf5b358d4d07927291a2a51f8ce8" name="tests/PsrLogInvalidArgumentException.phpt" role="test" /> |
86 | <file md5sum="6946ca11e10469b95ae5ce270cb18cbc" name="tests/PsrHttpMessageMessageInterface.phpt" role="test" /> | |
87 | <file md5sum="7f216d02cb6ebca8d38ded0c0356d166" name="tests/PsrCacheCacheItemInterface.phpt" role="test" /> | |
88 | <file md5sum="87105466473a0fa7c7b37109fb0fc84b" name="tests/PsrLogLoggerInterface.phpt" role="test" /> | |
89 | <file md5sum="bc5b2aea55e0964265399e0fbe80a86b" name="tests/PsrHttpMessageUploadedFileInterface.phpt" role="test" /> | |
90 | <file md5sum="ee089f936b3995d71b8d7b7ad512b3b7" name="tests/PsrHttpMessageResponseInterface.phpt" role="test" /> | |
86 | <file md5sum="ff586e16a4171d344151886fbd70c8d2" name="tests/PsrHttpMessageMessageInterface.phpt" role="test" /> | |
87 | <file md5sum="43778e199b79be3d7b0f49c2769d9697" name="tests/PsrCacheCacheItemInterface.phpt" role="test" /> | |
88 | <file md5sum="ebdba2e418644aebdf12ff07f1a0c69d" name="tests/PsrLogLoggerInterface.phpt" role="test" /> | |
89 | <file md5sum="f3db2ccbb9a2f7e9e1713da05c02f49f" name="tests/PsrHttpMessageUploadedFileInterface.phpt" role="test" /> | |
90 | <file md5sum="2515ea829f4fd73cf31ca0cb852d0253" name="tests/PsrHttpMessageResponseInterface.phpt" role="test" /> | |
91 | 91 | <file md5sum="382753c2666311d149c56bbcd5573e0a" name="tests/SampleCacheItem.inc" role="test" /> |
92 | 92 | <file md5sum="6e3ee1eb0aa66482f7a9580b534f7106" name="tests/SampleServerRequest.inc" role="test" /> |
93 | 93 | <file md5sum="12f16970c3e03d781ef6eac6b1161e61" name="tests/SampleUri.inc" role="test" /> |
94 | 94 | <file md5sum="b5f5bb317983866d94d58ff4b6ab4a1f" name="tests/PsrLinkLinkInterface.phpt" role="test" /> |
95 | 95 | <file md5sum="3ec033283195fc50e6ca96c9944754c4" name="tests/SampleLoggerAware.inc" role="test" /> |
96 | <file md5sum="c5ec8b6f626332a36d4205cd8de7e24e" name="tests/PsrLogLoggerAwareInterface.phpt" role="test" /> | |
96 | <file md5sum="60025f241666ae23ac2f94c363ffdfee" name="tests/PsrLogLoggerAwareInterface.phpt" role="test" /> | |
97 | 97 | <file md5sum="0b96ae44b14722a30697b473669723ac" name="tests/SampleLogger.inc" role="test" /> |
98 | 98 | <file md5sum="b9b3e3b1e67adac295e1a0b6bc73240c" name="tests/SampleResponse.inc" role="test" /> |
99 | 99 | <file md5sum="9cf05273b9680fda0195e863a16596d6" name="tests/phpinfo.phpt" role="test" /> |
101 | 101 | <file md5sum="15f966f40e829917b4de0710e3363d7a" name="tests/PsrCacheInvalidArgumentException.phpt" role="test" /> |
102 | 102 | <file md5sum="0b5f12951c6adf0d2f0ed9eb98e8b2c6" name="tests/PsrSimpleCacheCacheException.phpt" role="test" /> |
103 | 103 | <file md5sum="f6582a1e0177f2521079bf3a41ec9199" name="tests/PsrSimpleCacheInvalidArgumentException.phpt" role="test" /> |
104 | <file md5sum="cd7b4a2f6249afbb0749579869ea1c8d" name="tests/PsrHttpServerMiddlewareInterface.phpt" role="test" /> | |
105 | <file md5sum="867895fbf2dde56b6cce190664636eb4" name="tests/PsrHttpServerRequestHandlerInterface.phpt" role="test" /> | |
104 | <file md5sum="b25fa596b81051b150e6fa759aa084f2" name="tests/PsrHttpServerMiddlewareInterface.phpt" role="test" /> | |
105 | <file md5sum="b4d3f4ad13690c4cb08b182872dfc29e" name="tests/PsrHttpServerRequestHandlerInterface.phpt" role="test" /> | |
106 | 106 | <file md5sum="a9e8771cc28518cf03ac859c4f8ca3ea" name="tests/SampleRequestHandler.inc" role="test" /> |
107 | 107 | <file md5sum="eec0e8ee1ac50d4fe680eafc37402768" name="tests/SampleMiddleware.inc" role="test" /> |
108 | <file md5sum="d57ee0a6e13fb8ac2418c6a843fa4d70" name="tests/PsrHttpMessageRequestFactoryInterface.phpt" role="test" /> | |
109 | <file md5sum="6d517e5440a9d70ad3c5a49c79252f8b" name="tests/PsrHttpMessageResponseFactoryInterface.phpt" role="test" /> | |
110 | <file md5sum="46cee1014bbcc899c7cabdbccc702a31" name="tests/PsrHttpMessageServerRequestFactoryInterface.phpt" role="test" /> | |
111 | <file md5sum="1e4668e69c26eabaaed97f058af78c8b" name="tests/PsrHttpMessageStreamFactoryInterface.phpt" role="test" /> | |
112 | <file md5sum="0fea4a6f5d926da2a7dc474e9d8c7891" name="tests/PsrHttpMessageUploadedFileFactoryInterface.phpt" role="test" /> | |
113 | <file md5sum="71106090a26d415141ec9588f4d06ae5" name="tests/PsrHttpMessageUriFactoryInterface.phpt" role="test" /> | |
108 | <file md5sum="de96c8f44ec164e015c7a7711daf6757" name="tests/PsrHttpMessageRequestFactoryInterface.phpt" role="test" /> | |
109 | <file md5sum="6b8891dcd31fe9723b93d43816bc72ce" name="tests/PsrHttpMessageResponseFactoryInterface.phpt" role="test" /> | |
110 | <file md5sum="0bdac7ee2ee68ee5f7cdc3a8a6f83fdb" name="tests/PsrHttpMessageServerRequestFactoryInterface.phpt" role="test" /> | |
111 | <file md5sum="4b0da67fb8c8734c690c3622023e10ce" name="tests/PsrHttpMessageStreamFactoryInterface.phpt" role="test" /> | |
112 | <file md5sum="1c50d440f51f0a30f235ba3432de9640" name="tests/PsrHttpMessageUploadedFileFactoryInterface.phpt" role="test" /> | |
113 | <file md5sum="afae7b3025aabad336356739053d46d1" name="tests/PsrHttpMessageUriFactoryInterface.phpt" role="test" /> | |
114 | 114 | <file md5sum="eef057673add8e0ae3a7307bb0937866" name="tests/SampleRequestFactory.inc" role="test" /> |
115 | 115 | <file md5sum="ffcf0c3a728162ce64b8bc5c61e86960" name="tests/SampleResponseFactory.inc" role="test" /> |
116 | 116 | <file md5sum="9063bc05108128ed5e17dc28a3079490" name="tests/SampleServerRequestFactory.inc" role="test" /> |
118 | 118 | <file md5sum="9ae28be7c36ee923113fd763d91c06a6" name="tests/SampleUploadedFileFactory.inc" role="test" /> |
119 | 119 | <file md5sum="64533c550a5b41bc51cff5ab2bc010e9" name="tests/SampleUriFactory.inc" role="test" /> |
120 | 120 | <file md5sum="7a749852cc5f4b6bb2a1c613bbcf9af8" name="tests/PsrHttpClientClientExceptionInterface.phpt" role="test" /> |
121 | <file md5sum="b0ba411ea5adcd614046c5525f83908b" name="tests/PsrHttpClientClientInterface.phpt" role="test" /> | |
121 | <file md5sum="501a2dd9115f5a939f5fdca4e8fb3e50" name="tests/PsrHttpClientClientInterface.phpt" role="test" /> | |
122 | 122 | <file md5sum="1b0db51a35fe3949baba05cbccfcf1e4" name="tests/PsrHttpClientNetworkExceptionInterface.phpt" role="test" /> |
123 | 123 | <file md5sum="6404ab360a90bfb4348d84f7f68bdae4" name="tests/PsrHttpClientRequestExceptionInterface.phpt" role="test" /> |
124 | 124 | <file md5sum="aa37236bbd6bd49ce21f9316a1a33ecb" name="tests/SampleClient.inc" role="test" /> |
125 | 125 | <file md5sum="513edcb34ee2d7cd1f3e7be4efe41675" name="tests/skip.inc" role="test" /> |
126 | 126 | <file md5sum="5bfd171fb006731521663c5012b589e3" name="tests/skip_lt_php72.inc" role="test" /> |
127 | 127 | <file md5sum="d5be04e40cbf08748f63d001f9e67c47" name="tests/phpinfo_lt_php72.phpt" role="test" /> |
128 | <file md5sum="f08e6067ff692844441bdacf86d7d762" name="tests/PsrEventDispatcherEventDispatcherInterface.phpt" role="test" /> | |
129 | <file md5sum="357017b62b093e95e775b684d01ba52b" name="tests/PsrEventDispatcherListenerProviderInterface.phpt" role="test" /> | |
130 | <file md5sum="87092b7fb4dc006966fa00c67477a40f" name="tests/PsrEventDispatcherStoppableEventInterface.phpt" role="test" /> | |
128 | <file md5sum="cb86c0556d9609f6144c8efc099d9afd" name="tests/PsrEventDispatcherEventDispatcherInterface.phpt" role="test" /> | |
129 | <file md5sum="ee370b9b86e491082b04f4b6ef482ec6" name="tests/PsrEventDispatcherListenerProviderInterface.phpt" role="test" /> | |
130 | <file md5sum="4715d14c9649ed13ba565cdded25820b" name="tests/PsrEventDispatcherStoppableEventInterface.phpt" role="test" /> | |
131 | 131 | <file md5sum="57f3bd2af2db678240f22ba65cf53ae0" name="tests/SampleEventDispatcher.inc" role="test" /> |
132 | 132 | <file md5sum="54469c86396798f4b5d3da997d88ace4" name="tests/SampleListenerProvider.inc" role="test" /> |
133 | 133 | <file md5sum="6c80f0f584d064b767f7942a5074a1f2" name="tests/SampleStoppableEvent.inc" role="test" /> |
138 | 138 | <dependencies> |
139 | 139 | <required> |
140 | 140 | <php> |
141 | <min>7.0.0</min> | |
141 | <min>7.3.0</min> | |
142 | 142 | </php> |
143 | 143 | <pearinstaller> |
144 | 144 | <min>1.4.1</min> |
0 | # Changelog | |
1 | ||
2 | All Notable changes to `php-psr` will be documented in this file. | |
3 | ||
4 | Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles. | |
5 | ||
6 | ## [1.1.0] - 2021-04-10 | |
7 | ||
8 | ### Changed | |
9 | - Update psr/container to 1.1.1 | |
10 | ||
11 | ### Added | |
12 | - Version ID constants to each header | |
13 | ||
14 | ### Fixed | |
15 | - Use __dllspec(dllimport) where appropriate in php_psr.h on windows | |
16 | ||
17 | ## [1.0.1] - 2020-11-12 | |
18 | ||
19 | ### Fixed | |
20 | - Test failures on PHP 8 in psr-http-client and psr-http-message due to changes in inheritance | |
21 | - Compile failures with clang | |
22 | - Compatibility with API changes to PHP 8 in psr-log (@remicollet) | |
23 | - Report proper default value in reflection for LoggerInterface - PHP 8 only ([GH-78](https://github.com/jbboehr/php-psr/issues/78)) | |
24 | ||
25 | ## [1.0.0] - 2020-02-18 | |
26 | ||
27 | ### Changed | |
28 | - Drop max PHP version constraint in package.xml | |
29 | ||
30 | ## [0.7.0] - 2019-08-12 | |
31 | ||
32 | ### Added | |
33 | - Preliminary PHP 7.4 and 8.0 (master) support | |
34 | - PSR-14 Event Dispatcher support | |
35 | ||
36 | ### Removed | |
37 | - PHP 5 support | |
38 | ||
39 | ## [0.6.1] - 2018-11-13 | |
40 | ||
41 | ### Fixed | |
42 | - Test failures on PHP 5.6 | |
43 | ||
44 | ## [0.6.0] - 2018-11-11 | |
45 | ||
46 | ### Added | |
47 | - PSR-18 HTTP Client support | |
48 | ||
49 | ## [0.5.1] - 2018-10-29 | |
50 | ||
51 | ### Fixed | |
52 | - `Psr\Http\Message\ServerRequestInterface` did not actually extend `Psr\Http\Message\RequestInterface` | |
53 | ||
54 | ## [0.5.0] - 2018-09-10 | |
55 | ||
56 | ### Added | |
57 | - PSR-17 HTTP Factories support | |
58 | - Whitelist PHP 7.3 | |
59 | ||
60 | ## [0.4.0] - 2018-03-05 | |
61 | ||
62 | ### Added | |
63 | - PSR-15 HTTP Handlers support | |
64 | ||
65 | ## [0.3.0] - 2018-02-08 | |
66 | ||
67 | ### Added | |
68 | - PSR-11 Container support | |
69 | - PSR-13 Link support | |
70 | - PSR-16 Simple Cache support | |
71 | - Windows support | |
72 | ||
73 | ### Removed | |
74 | - No longer run CI against PHP 5 due to lack of support in libraries | |
75 | ||
76 | ### Fixed | |
77 | - TypeError when no argument is passed to methods in AbstractLogger | |
78 | ||
79 | ## [0.2.3] - 2016-05-05 | |
80 | ||
81 | ### Changed | |
82 | - Changed the license from `LGPLv3` to `Simplified BSD License` | |
83 | - Move PHP5/7 compatibility macros into separate header | |
84 | ||
85 | ## [0.2.2] - 2016-03-16 | |
86 | ||
87 | ### Added | |
88 | - arginfo for interfaces in headers | |
89 | ||
90 | ### Fixed | |
91 | - Memory leak in Psr\Log\AbstractLogger::log() | |
92 | ||
93 | ## [0.2.1] - 2015-12-15 | |
94 | ||
95 | ### Changed | |
96 | - PSR-6 [psr/cache](https://github.com/php-fig/cache) v1.0.0 is released without changes to interfaces since commit [4908941](https://github.com/php-fig/cache/commit/4908941) | |
97 | - Test PSR-6 interfaces against Stash v1.0.0-dev branch | |
98 | ||
99 | ### Fixed | |
100 | - Memory leak in Psr\Log\AbstractLogger::log() with PHP7 | |
101 | ||
102 | ## [0.2.0] - 2015-12-09 | |
103 | ||
104 | ### Changed | |
105 | - Update PSR-6 interfaces for commits up to [4908941](https://github.com/php-fig/cache/commit/4908941) | |
106 | ||
107 | ### Fixed | |
108 | - Invalid read in Psr\Log\AbstractLogger::log() | |
109 | ||
110 | ## 0.1.0 - 2015-08-07 | |
111 | ||
112 | ### Added | |
113 | - PSR-3 [psr/log](https://github.com/php-fig/log) v1.0.0 interfaces and classes | |
114 | - PSR-6 [commit 2b812a4](https://github.com/php-fig/fig-standards/commit/2b812a4) interfaces | |
115 | - PSR-7 [psr/http-message](https://github.com/php-fig/http-message) v1.0.0 interfaces | |
116 | ||
117 | ||
118 | [Unreleased]: https://github.com/jbboehr/php-psr/compare/v1.1.0...HEAD | |
119 | [1.1.0]: https://github.com/jbboehr/php-psr/compare/v1.0.1...v1.1.0 | |
120 | [1.0.1]: https://github.com/jbboehr/php-psr/compare/v1.0.0...v1.0.1 | |
121 | [1.0.0]: https://github.com/jbboehr/php-psr/compare/v0.7.0...v1.0.0 | |
122 | [0.7.0]: https://github.com/jbboehr/php-psr/compare/v0.6.1...v0.7.0 | |
123 | [0.6.1]: https://github.com/jbboehr/php-psr/compare/v0.6.0...v0.6.1 | |
124 | [0.6.0]: https://github.com/jbboehr/php-psr/compare/v0.5.1...v0.6.0 | |
125 | [0.5.1]: https://github.com/jbboehr/php-psr/compare/v0.5.0...v0.5.1 | |
126 | [0.5.0]: https://github.com/jbboehr/php-psr/compare/v0.4.0...v0.5.0 | |
127 | [0.4.0]: https://github.com/jbboehr/php-psr/compare/v0.3.0...v0.4.0 | |
128 | [0.3.0]: https://github.com/jbboehr/php-psr/compare/v0.2.3...v0.3.0 | |
129 | [0.2.3]: https://github.com/jbboehr/php-psr/compare/v0.2.2...v0.2.3 | |
130 | [0.2.2]: https://github.com/jbboehr/php-psr/compare/v0.2.1...v0.2.2 | |
131 | [0.2.1]: https://github.com/jbboehr/php-psr/compare/v0.2.0...v0.2.1 | |
132 | [0.2.0]: https://github.com/jbboehr/php-psr/compare/v0.1.0...v0.2.0 |
0 | Simplified BSD License | |
1 | ====================== | |
2 | ||
3 | _Copyright © 2016-2018 John Boehr_ | |
4 | _All rights reserved._ | |
5 | ||
6 | Redistribution and use in source and binary forms, with or without | |
7 | modification, are permitted provided that the following conditions are met: | |
8 | ||
9 | 1. Redistributions of source code must retain the above copyright notice, this | |
10 | list of conditions and the following disclaimer. | |
11 | 2. Redistributions in binary form must reproduce the above copyright notice, | |
12 | this list of conditions and the following disclaimer in the documentation | |
13 | and/or other materials provided with the distribution. | |
14 | ||
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND | |
16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | |
19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | ||
26 | The views and conclusions contained in the software and documentation are those | |
27 | of the authors and should not be interpreted as representing official policies, | |
28 | either expressed or implied, of the FreeBSD Project. |
0 | ||
1 | # php-psr | |
2 | ||
3 | [![GitHub Linux Build Status](https://github.com/jbboehr/php-psr/workflows/linux/badge.svg)](https://github.com/jbboehr/php-psr/actions?query=workflow%3Alinux) | |
4 | [![GitHub OSX Build Status](https://github.com/jbboehr/php-psr/workflows/osx/badge.svg)](https://github.com/jbboehr/php-psr/actions?query=workflow%3Aosx) | |
5 | [![GitHub Windows Build Status](https://github.com/jbboehr/php-psr/workflows/windows/badge.svg)](https://github.com/jbboehr/php-psr/actions?query=workflow%3Awindows) | |
6 | [![GitHub Docker Build Status](https://github.com/jbboehr/php-psr/workflows/docker/badge.svg)](https://github.com/jbboehr/php-psr/actions?query=workflow%3Adocker) | |
7 | [![Appveyor Build Status][:badge-appveyor:]][:build-appveyor:] | |
8 | [![Coverage Status][:badge-coveralls:]][:build-coveralls:] | |
9 | [![License][:badge-license:]][:ext-license:] | |
10 | ||
11 | ||
12 | ||
13 | This PHP extension provides the interfaces from the [PSR][:psr-fig:] standards as established by the [PHP-FIG][:php-fig:] group. | |
14 | You can use interfaces provided by this extension in another extension easily - see this [example][:example:]. | |
15 | ||
16 | ## Interfaces | |
17 | ||
18 | | PSR | Reference | Tested against | | |
19 | | --- | --- | --- | | |
20 | | [PSR-3][:psr-3:] | [psr/log][:psr-log:] [*](#psrlogunimpl) | [monolog][:monolog:] | | |
21 | | [PSR-6][:psr-6:] | [psr/cache][:psr-cache:] | [psx-cache][:psx-cache:] | | |
22 | | [PSR-7][:psr-7:] | [psr/http-message][:psr-http-message:] | [laminas-diactoros](https://github.com/laminas/laminas-diactoros) | | |
23 | | [PSR-11][:psr-11:] | [psr/container][:psr-container:] | [psx-dependency][:psx-dependency:] | | |
24 | | [PSR-13][:psr-13:] | [psr/link][:psr-link:] | [php-fig/link-util][:link-util:] | | |
25 | | [PSR-14][:psr-14:] | [psr/event-dispatcher][:psr-event-dispatcher:] | [tukio][:tukio:] | | |
26 | | [PSR-15][:psr-15:] | [psr/http-server-handler][:psr-http-server-handler:] | [equip/dispatch][:dispatch:] | | |
27 | | [PSR-15][:psr-15:] | [psr/http-server-middleware][:psr-http-server-middleware:] | [middleware/request-handler][:request-handler:] | | |
28 | | [PSR-16][:psr-16:] | [psr/simple-cache][:psr-simple-cache:] | [psx-cache][:psx-cache:] | | |
29 | | [PSR-17][:psr-17:] | [psr/http-factory][:psr-http-factory:] | [http-interop/http-factory-guzzle][:http-factory-guzzle:] | | |
30 | | [PSR-18][:psr-18:] | [psr/http-client][:psr-http-client:] | [ricardofiorani/guzzle-psr18-adapter][:guzzle-psr18-adapter:] | | |
31 | ||
32 | ## Installation | |
33 | ||
34 | ### Linux / macOS | |
35 | ||
36 | Prerequisite packages are: | |
37 | ||
38 | - PHP development headers and tools | |
39 | - `gcc` >= 4.4 | `clang` >= 3.x | `vc` >= 11 | |
40 | - GNU `make` >= 3.81 | |
41 | - `automake` | |
42 | - `autoconf` | |
43 | ||
44 | You will need the PHP development headers. If PHP was manually installed, these should be available by default. Otherwise, you will need to fetch them from a repository. | |
45 | ||
46 | ```bash | |
47 | git clone https://github.com/jbboehr/php-psr.git | |
48 | cd php-psr | |
49 | phpize | |
50 | ./configure | |
51 | make | |
52 | make test | |
53 | sudo make install | |
54 | ``` | |
55 | ||
56 | If you have specific PHP versions running: | |
57 | ||
58 | ```bash | |
59 | git clone https://github.com/jbboehr/php-psr.git | |
60 | cd php-psr | |
61 | /usr/local/bin/phpize | |
62 | ./configure --with-php-config=/usr/local/bin/php-config | |
63 | make | |
64 | make test | |
65 | sudo make install | |
66 | ``` | |
67 | ||
68 | Add the extension to your *php.ini*: | |
69 | ||
70 | ```ini | |
71 | echo extension=psr.so | tee -a /path/to/your/php.ini | |
72 | ``` | |
73 | ||
74 | Finally, _restart the web server_. | |
75 | ||
76 | ### PECL / Windows | |
77 | ||
78 | You may also be able to install this extension via [PECL][:pecl-psr:]: | |
79 | ||
80 | ```bash | |
81 | pecl install psr | |
82 | ``` | |
83 | ||
84 | or by downloading a DLL from [PECL][:pecl-psr:] or [windows.php.net][:windows-psr:] and placing it in the appropriate directory. | |
85 | ||
86 | ### Nix / NixOS | |
87 | ||
88 | ```bash | |
89 | nix-env -i -f https://github.com/jbboehr/php-psr/archive/master.tar.gz | |
90 | ``` | |
91 | ||
92 | with a custom version of PHP: | |
93 | ||
94 | ```bash | |
95 | nix-env -i -f https://github.com/jbboehr/php-psr/archive/master.tar.gz --arg php '(import <nixpkgs> {}).php71' | |
96 | ``` | |
97 | ||
98 | or, in a `.nix` file: | |
99 | ||
100 | ```nix | |
101 | (import <nixpkgs> {}).callPackage (import (fetchTarball { | |
102 | url = https://github.com/jbboehr/php-psr/archive/v1.0.0.tar.gz; | |
103 | sha256 = "12237b392rz224r4d8p6pwnldpl2bfrvpcim5947avjd49sn8ss4"; | |
104 | })) {} | |
105 | ``` | |
106 | ||
107 | ### Using with composer | |
108 | ||
109 | In your project, you can prevent the installation of the unnecessary composer packages provided by this extension by adding the following to your `composer.json`. You will need to make sure the extension is installed and enabled in your PHP configuration. You may also want to consider leaving them installed to provide stubs to your IDE. This configuration is not suitable for a library published to packagist. | |
110 | ||
111 | <a name="psrlogunimpl">Note:</a> `LoggerInterfaceTest` and `TestLogger` from `psr/log` are not implemented. If you use these classes, you should keep `psr/log` installed ([discussion](https://github.com/jbboehr/php-psr/issues/57)). | |
112 | ||
113 | ```json | |
114 | { | |
115 | "name": "sample/app", | |
116 | "require": { | |
117 | "ext-psr": "*" | |
118 | }, | |
119 | "provide": { | |
120 | "psr/log": "^1", | |
121 | "psr/cache": "^1", | |
122 | "psr/http-message": "^1", | |
123 | "psr/container": "^1", | |
124 | "psr/link": "^1", | |
125 | "psr/event-dispatcher": "^1", | |
126 | "psr/http-server-handler": "^1", | |
127 | "psr/http-server-middleware": "^1", | |
128 | "psr/simple-cache": "^1", | |
129 | "psr/http-factory": "^1", | |
130 | "psr/http-client": "^1" | |
131 | }, | |
132 | } | |
133 | ``` | |
134 | ||
135 | This will use this PHP extension instead of downloading from packagist. | |
136 | ||
137 | ## Credits | |
138 | ||
139 | * [@sergeyklay][:github-sergeyklay:] - Appveyor and documentation improvements | |
140 | * [@flyinghail][:github-flyinghail:] - PSR-14, PSR-15, PSR-17, and PSR-18 support | |
141 | * [@Jan-E][:github-jan-e:] - Original appveyor template | |
142 | * [All Contributors](https://github.com/jbboehr/php-psr/graphs/contributors) | |
143 | ||
144 | ## License | |
145 | ||
146 | This project is open source software licensed under the Simplified BSD License. | |
147 | See the [LICENSE.md][:ext-license:] file for more information. | |
148 | ||
149 | PSR Interfaces: Copyright (c) 2012-present [PHP Framework Interoperability Group][:php-fig:]. | |
150 | ||
151 | [:psr-fig:]: https://www.php-fig.org/psr | |
152 | [:php-fig:]: https://www.php-fig.org | |
153 | [:pecl-psr:]: https://pecl.php.net/package/psr | |
154 | [:badge-appveyor:]: https://ci.appveyor.com/api/projects/status/x1ymkqggy1mkl0ux/branch/master?svg=true | |
155 | [:badge-coveralls:]: https://coveralls.io/repos/jbboehr/php-psr/badge.svg?branch=master&service=github | |
156 | [:badge-license:]: https://img.shields.io/badge/license-BSD-brightgreen.svg | |
157 | [:build-appveyor:]: https://ci.appveyor.com/project/jbboehr/php-psr/branch/master | |
158 | [:build-coveralls:]: https://coveralls.io/github/jbboehr/php-psr?branch=master | |
159 | [:ext-license:]: https://github.com/jbboehr/php-psr/blob/master/LICENSE.md | |
160 | [:example:]: https://github.com/jbboehr/php-handlebars/blob/v0.7.1/impl.c#L213-L215 | |
161 | [:psr-3:]: http://www.php-fig.org/psr/psr-3 | |
162 | [:psr-log:]: https://github.com/php-fig/log | |
163 | [:monolog:]: https://github.com/Seldaek/monolog | |
164 | [:psr-6:]: https://www.php-fig.org/psr/psr-6 | |
165 | [:psr-cache:]: https://github.com/php-fig/cache | |
166 | [:psx-cache:]: https://github.com/apioo/psx-cache | |
167 | [:psr-7:]: https://www.php-fig.org/psr/psr-7 | |
168 | [:psr-http-message:]: https://github.com/php-fig/http-message | |
169 | [:psr-11:]: https://www.php-fig.org/psr/psr-11 | |
170 | [:psr-container:]: https://github.com/php-fig/container | |
171 | [:psx-dependency:]: https://github.com/apioo/psx-dependency | |
172 | [:psr-13:]: https://www.php-fig.org/psr/psr-13 | |
173 | [:psr-link:]: https://github.com/php-fig/link | |
174 | [:link-util:]: https://github.com/php-fig/link-util | |
175 | [:psr-16:]: https://www.php-fig.org/psr/psr-16 | |
176 | [:psr-simple-cache:]: https://github.com/php-fig/simple-cache | |
177 | [:windows-psr:]: http://windows.php.net/downloads/pecl/releases/psr/ | |
178 | [:github-sergeyklay:]: https://github.com/sergeyklay | |
179 | [:github-jan-e:]: https://github.com/Jan-E | |
180 | [:github-flyinghail:]: https://github.com/flyinghail | |
181 | [:psr-15:]: http://www.php-fig.org/psr/psr-15 | |
182 | [:psr-http-server-handler:]: https://github.com/php-fig/http-server-handler | |
183 | [:psr-http-server-middleware:]: https://github.com/php-fig/http-server-middleware | |
184 | [:dispatch:]: https://github.com/equip/dispatch | |
185 | [:request-handler:]: https://github.com/middlewares/request-handler | |
186 | [:psr-17:]: https://www.php-fig.org/psr/psr-17 | |
187 | [:psr-http-factory:]: https://github.com/php-fig/http-factory | |
188 | [:http-factory-guzzle:]: https://github.com/http-interop/http-factory-guzzle | |
189 | [:psr-18:]: https://www.php-fig.org/psr/psr-18 | |
190 | [:psr-http-client:]: https://github.com/php-fig/http-client | |
191 | [:guzzle-psr18-adapter:]: https://github.com/ricardofiorani/guzzle-psr18-adapter | |
192 | [:psr-14:]: http://www.php-fig.org/psr/psr-14 | |
193 | [:psr-event-dispatcher:]: https://github.com/php-fig/event-dispatcher | |
194 | [:tukio:]: https://github.com/Crell/Tukio.git |
0 | dnl vim: tabstop=4:softtabstop=4:shiftwidth=4:expandtab | |
1 | ||
2 | dnl PSR -------------------------------------------------------------------------- | |
3 | PHP_ARG_ENABLE(psr, whether to enable psr support, | |
4 | [ --enable-psr Enable PSR support]) | |
5 | ||
6 | dnl MAIN ------------------------------------------------------------------------- | |
7 | if test "$PHP_PSR" != "no"; then | |
8 | AH_BOTTOM([ | |
9 | #ifdef __clang__ | |
10 | #include "main/php_config.h" | |
11 | #/**/undef/**/ HAVE_ASM_GOTO | |
12 | #endif | |
13 | ]) | |
14 | AC_DEFINE(HAVE_PSR, 1, [Whether you have PSR]) | |
15 | PHP_NEW_EXTENSION(psr, php_psr.c psr_cache.c psr_container.c psr_http_message.c psr_link.c psr_log.c psr_simple_cache.c psr_http_server_handler.c psr_http_server_middleware.c psr_http_factory.c psr_http_client.c psr_event_dispatcher.c, $ext_shared) | |
16 | PHP_INSTALL_HEADERS([ext/psr], [php_psr.h psr_cache.h psr_container.h psr_http_message.h psr_link.h psr_log.h psr_simple_cache.h psr_http_server_handler.h psr_http_server_middleware.h psr_http_factory.h psr_http_client.h psr_event_dispatcher.h]) | |
17 | fi |
0 | // vim:ft=javascript | |
1 | ||
2 | ARG_ENABLE("psr", "Enable psr support", "no"); | |
3 | ||
4 | if (PHP_PSR != "no") { | |
5 | AC_DEFINE("HAVE_PSR", 1, "Have PSR Support"); | |
6 | EXTENSION("psr", "php_psr.c psr_cache.c psr_container.c psr_http_message.c psr_link.c psr_log.c psr_simple_cache.c psr_http_server_handler.c psr_http_server_middleware.c psr_http_factory.c psr_http_client.c psr_event_dispatcher.c"); | |
7 | ADD_FLAG("CFLAGS_PSR", "/D PHP_PSR_EXPORTS=1"); | |
8 | PHP_INSTALL_HEADERS("ext\\psr", "php_psr.h psr_cache.h psr_container.h psr_http_message.h psr_link.h psr_log.h psr_simple_cache.h psr_http_server_handler.h psr_http_server_middleware.h psr_http_factory.h psr_http_client.h psr_event_dispatcher.h") | |
9 | } |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include "php_ini.h" | |
7 | #include "ext/standard/info.h" | |
8 | #include "ext/spl/spl_exceptions.h" | |
9 | #include "zend_API.h" | |
10 | #include "zend_interfaces.h" | |
11 | ||
12 | #include "php_psr.h" | |
13 | #include "psr_cache.h" | |
14 | #include "psr_container.h" | |
15 | #include "psr_http_message.h" | |
16 | #include "psr_link.h" | |
17 | #include "psr_log.h" | |
18 | #include "psr_simple_cache.h" | |
19 | #include "psr_http_server_handler.h" | |
20 | #include "psr_http_server_middleware.h" | |
21 | #include "psr_http_factory.h" | |
22 | #include "psr_http_client.h" | |
23 | #include "psr_event_dispatcher.h" | |
24 | ||
25 | static PHP_MINIT_FUNCTION(psr) | |
26 | { | |
27 | PHP_MINIT(psr_cache)(INIT_FUNC_ARGS_PASSTHRU); | |
28 | PHP_MINIT(psr_container)(INIT_FUNC_ARGS_PASSTHRU); | |
29 | PHP_MINIT(psr_http_message)(INIT_FUNC_ARGS_PASSTHRU); | |
30 | PHP_MINIT(psr_link)(INIT_FUNC_ARGS_PASSTHRU); | |
31 | PHP_MINIT(psr_log)(INIT_FUNC_ARGS_PASSTHRU); | |
32 | PHP_MINIT(psr_simple_cache)(INIT_FUNC_ARGS_PASSTHRU); | |
33 | PHP_MINIT(psr_http_server_handler)(INIT_FUNC_ARGS_PASSTHRU); | |
34 | PHP_MINIT(psr_http_server_middleware)(INIT_FUNC_ARGS_PASSTHRU); | |
35 | PHP_MINIT(psr_http_factory)(INIT_FUNC_ARGS_PASSTHRU); | |
36 | PHP_MINIT(psr_http_client)(INIT_FUNC_ARGS_PASSTHRU); | |
37 | #if PHP_VERSION_ID >= 70200 | |
38 | PHP_MINIT(psr_event_dispatcher)(INIT_FUNC_ARGS_PASSTHRU); | |
39 | #endif | |
40 | return SUCCESS; | |
41 | } | |
42 | ||
43 | static PHP_MINFO_FUNCTION(psr) | |
44 | { | |
45 | php_info_print_table_start(); | |
46 | php_info_print_table_row(2, "Version", PHP_PSR_VERSION); | |
47 | php_info_print_table_row(2, "Released", PHP_PSR_RELEASE); | |
48 | php_info_print_table_row(2, "Authors", PHP_PSR_AUTHORS); | |
49 | php_info_print_table_row(2, "PSR-3 Log Version", PHP_PSR_LOG_VERSION); | |
50 | php_info_print_table_row(2, "PSR-6 Cache Version", PHP_PSR_CACHE_VERSION); | |
51 | php_info_print_table_row(2, "PSR-7 Http Message Version", PHP_PSR_HTTP_MESSAGE_VERSION); | |
52 | php_info_print_table_row(2, "PSR-11 Container Version", PHP_PSR_CONTAINER_VERSION); | |
53 | php_info_print_table_row(2, "PSR-13 Link Version", PHP_PSR_LOG_VERSION); | |
54 | #if PHP_VERSION_ID >= 70200 | |
55 | php_info_print_table_row(2, "PSR-14 Event Dispatcher", PHP_PSR_EVENT_DISPATCHER_VERSION); | |
56 | #endif | |
57 | php_info_print_table_row(2, "PSR-15 HTTP Handlers (Server Handler)", PHP_PSR_HTTP_SERVER_HANDLER_VERSION); | |
58 | php_info_print_table_row(2, "PSR-15 HTTP Handlers (Middleware)", PHP_PSR_HTTP_SERVER_MIDDLEWARE_VERSION); | |
59 | php_info_print_table_row(2, "PSR-16 Simple Cache Version", PHP_PSR_SIMPLE_CACHE_VERSION); | |
60 | php_info_print_table_row(2, "PSR-17 HTTP Factories", PHP_PSR_HTTP_FACTORY_VERSION); | |
61 | php_info_print_table_row(2, "PSR-18 HTTP Client", PHP_PSR_HTTP_CLIENT_VERSION); | |
62 | php_info_print_table_end(); | |
63 | } | |
64 | ||
65 | static const zend_module_dep psr_deps[] = { | |
66 | ZEND_MOD_REQUIRED("spl") | |
67 | ZEND_MOD_END | |
68 | }; | |
69 | ||
70 | zend_module_entry psr_module_entry = { | |
71 | STANDARD_MODULE_HEADER_EX, | |
72 | NULL, | |
73 | psr_deps, | |
74 | PHP_PSR_NAME, /* Name */ | |
75 | NULL, /* Functions */ | |
76 | PHP_MINIT(psr), /* MINIT */ | |
77 | NULL, /* MSHUTDOWN */ | |
78 | NULL, /* RINIT */ | |
79 | NULL, /* RSHUTDOWN */ | |
80 | PHP_MINFO(psr), /* MINFO */ | |
81 | PHP_PSR_VERSION, /* Version */ | |
82 | STANDARD_MODULE_PROPERTIES | |
83 | }; | |
84 | ||
85 | #ifdef COMPILE_DL_PSR | |
86 | ZEND_GET_MODULE(psr) // Common for all PHP extensions which are build as shared modules | |
87 | #endif | |
88 | ||
89 | /* | |
90 | * Local variables: | |
91 | * tab-width: 4 | |
92 | * c-basic-offset: 4 | |
93 | * End: | |
94 | * vim600: fdm=marker | |
95 | * vim: et sw=4 ts=4 | |
96 | */ |
0 | ||
1 | #ifndef PHP_PSR_H | |
2 | #define PHP_PSR_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_ini.h" | |
6 | #include "ext/standard/info.h" | |
7 | ||
8 | #ifdef ZTS | |
9 | #include "TSRM.h" | |
10 | #endif | |
11 | ||
12 | #ifdef PHP_WIN32 | |
13 | # ifdef PHP_PSR_EXPORTS | |
14 | # define PHP_PSR_API __declspec(dllexport) | |
15 | # else | |
16 | # define PHP_PSR_API __declspec(dllimport) | |
17 | # endif | |
18 | #elif defined(__GNUC__) && __GNUC__ >= 4 | |
19 | # define PHP_PSR_API __attribute__ ((visibility("default"))) | |
20 | #else | |
21 | # define PHP_PSR_API | |
22 | #endif | |
23 | ||
24 | #define PHP_PSR_NAME "psr" | |
25 | #define PHP_PSR_VERSION "1.1.0" | |
26 | #define PHP_PSR_VERSION_ID 10100 | |
27 | #define PHP_PSR_RELEASE "2021-04-10" | |
28 | #define PHP_PSR_AUTHORS "John Boehr <jbboehr@gmail.com> (lead)" | |
29 | ||
30 | #define PHP_PSR_ABSTRACT_ME(c, f) PHP_ABSTRACT_ME(c, f, arginfo_ ## c ## _ ## f) | |
31 | #define PHP_PSR_ABSTRACT_ME_WITH_FLAGS(c, f, fl) ZEND_FENTRY(f, NULL, arginfo_ ## c ## _ ## f, fl) | |
32 | #define PHP_PSR_BEGIN_ARG_INFO(c, f, n) ZEND_BEGIN_ARG_INFO_EX(arginfo_ ## c ## _ ## f, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, n) | |
33 | #define PHP_PSR_END_ARG_INFO ZEND_END_ARG_INFO | |
34 | #define REGISTER_PSR_CLASS_CONST_STRING(ce, const_name, value) \ | |
35 | zend_declare_class_constant_stringl(ce, const_name, sizeof(const_name)-1, value, sizeof(value)-1); | |
36 | ||
37 | #ifdef ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX | |
38 | #define PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(c, f, n, cn, an) ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_ ## c ## _ ## f, ZEND_RETURN_VALUE, n, cn, an) | |
39 | #define PHP_PSR_BEGIN_ARG_WITH_RETURN_TYPE_INFO(c, f, n, t, an) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ ## c ## _ ## f, ZEND_RETURN_VALUE, n, t, an) | |
40 | #else | |
41 | #define PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(c, f, n, cn, an) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ ## c ## _ ## f, ZEND_RETURN_VALUE, n, IS_OBJECT, #cn, an) | |
42 | #define PHP_PSR_BEGIN_ARG_WITH_RETURN_TYPE_INFO(c, f, n, t, an) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ ## c ## _ ## f, ZEND_RETURN_VALUE, n, t, NULL, an) | |
43 | #endif | |
44 | ||
45 | extern zend_module_entry psr_module_entry; | |
46 | #define phpext_psr_ptr &psr_module_entry | |
47 | ||
48 | #endif /* PHP_PSR_H */ | |
49 | ||
50 | /* | |
51 | * Local variables: | |
52 | * tab-width: 4 | |
53 | * c-basic-offset: 4 | |
54 | * End: | |
55 | * vim600: fdm=marker | |
56 | * vim: et sw=4 ts=4 | |
57 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include "php_ini.h" | |
7 | #include "ext/standard/info.h" | |
8 | #include "ext/spl/spl_exceptions.h" | |
9 | #include "zend_API.h" | |
10 | #include "zend_interfaces.h" | |
11 | ||
12 | #include "php_psr.h" | |
13 | #include "psr_cache.h" | |
14 | ||
15 | /* {{{ CacheException ------------------------------------------------------- */ | |
16 | ||
17 | PHP_PSR_API zend_class_entry * PsrCacheCacheException_ce_ptr; | |
18 | ||
19 | static zend_always_inline void php_psr_register_CacheException(INIT_FUNC_ARGS) | |
20 | { | |
21 | zend_class_entry ce; | |
22 | INIT_CLASS_ENTRY(ce, "Psr\\Cache\\CacheException", NULL); | |
23 | PsrCacheCacheException_ce_ptr = zend_register_internal_interface(&ce); | |
24 | } | |
25 | ||
26 | /* }}} ---------------------------------------------------------------------- */ | |
27 | /* {{{ CacheItemInterface --------------------------------------------------- */ | |
28 | ||
29 | PHP_PSR_API zend_class_entry * PsrCacheCacheItemInterface_ce_ptr; | |
30 | ||
31 | static zend_function_entry PsrCacheCacheItemInterface_methods[] = { | |
32 | PHP_PSR_ABSTRACT_ME(PsrCacheCacheItemInterface, getKey) | |
33 | PHP_PSR_ABSTRACT_ME(PsrCacheCacheItemInterface, get) | |
34 | PHP_PSR_ABSTRACT_ME(PsrCacheCacheItemInterface, isHit) | |
35 | PHP_PSR_ABSTRACT_ME(PsrCacheCacheItemInterface, set) | |
36 | PHP_PSR_ABSTRACT_ME(PsrCacheCacheItemInterface, expiresAt) | |
37 | PHP_PSR_ABSTRACT_ME(PsrCacheCacheItemInterface, expiresAfter) | |
38 | PHP_FE_END | |
39 | }; | |
40 | ||
41 | static zend_always_inline void php_psr_register_CacheItemInterface(INIT_FUNC_ARGS) | |
42 | { | |
43 | zend_class_entry ce; | |
44 | INIT_CLASS_ENTRY(ce, "Psr\\Cache\\CacheItemInterface", PsrCacheCacheItemInterface_methods); | |
45 | PsrCacheCacheItemInterface_ce_ptr = zend_register_internal_interface(&ce); | |
46 | } | |
47 | ||
48 | /* }}} ---------------------------------------------------------------------- */ | |
49 | /* {{{ CacheItemPoolInterface ----------------------------------------------- */ | |
50 | ||
51 | PHP_PSR_API zend_class_entry * PsrCacheCacheItemPoolInterface_ce_ptr; | |
52 | ||
53 | static zend_function_entry PsrCacheCacheItemPoolInterface_methods[] = { | |
54 | PHP_PSR_ABSTRACT_ME(PsrCacheCacheItemPoolInterface, getItem) | |
55 | PHP_PSR_ABSTRACT_ME(PsrCacheCacheItemPoolInterface, getItems) | |
56 | PHP_PSR_ABSTRACT_ME(PsrCacheCacheItemPoolInterface, hasItem) | |
57 | PHP_PSR_ABSTRACT_ME(PsrCacheCacheItemPoolInterface, clear) | |
58 | PHP_PSR_ABSTRACT_ME(PsrCacheCacheItemPoolInterface, deleteItem) | |
59 | PHP_PSR_ABSTRACT_ME(PsrCacheCacheItemPoolInterface, deleteItems) | |
60 | PHP_PSR_ABSTRACT_ME(PsrCacheCacheItemPoolInterface, save) | |
61 | PHP_PSR_ABSTRACT_ME(PsrCacheCacheItemPoolInterface, saveDeferred) | |
62 | PHP_PSR_ABSTRACT_ME(PsrCacheCacheItemPoolInterface, commit) | |
63 | PHP_FE_END | |
64 | }; | |
65 | ||
66 | static zend_always_inline void php_psr_register_CacheItemPoolInterface(INIT_FUNC_ARGS) | |
67 | { | |
68 | zend_class_entry ce; | |
69 | INIT_CLASS_ENTRY(ce, "Psr\\Cache\\CacheItemPoolInterface", PsrCacheCacheItemPoolInterface_methods); | |
70 | PsrCacheCacheItemPoolInterface_ce_ptr = zend_register_internal_interface(&ce); | |
71 | } | |
72 | ||
73 | /* }}} ---------------------------------------------------------------------- */ | |
74 | /* {{{ InvalidArgumentException --------------------------------------------- */ | |
75 | ||
76 | PHP_PSR_API zend_class_entry * PsrCacheInvalidArgumentException_ce_ptr; | |
77 | ||
78 | static zend_always_inline void php_psr_register_InvalidArgumentException(INIT_FUNC_ARGS) | |
79 | { | |
80 | zend_class_entry ce; | |
81 | INIT_CLASS_ENTRY(ce, "Psr\\Cache\\InvalidArgumentException", NULL); | |
82 | PsrCacheInvalidArgumentException_ce_ptr = zend_register_internal_interface(&ce); | |
83 | zend_class_implements(PsrCacheInvalidArgumentException_ce_ptr, 1, PsrCacheCacheException_ce_ptr); | |
84 | } | |
85 | ||
86 | /* }}} ---------------------------------------------------------------------- */ | |
87 | ||
88 | /* {{{ PHP_MINIT_FUNCTION */ | |
89 | PHP_MINIT_FUNCTION(psr_cache) | |
90 | { | |
91 | php_psr_register_CacheException(INIT_FUNC_ARGS_PASSTHRU); | |
92 | php_psr_register_CacheItemInterface(INIT_FUNC_ARGS_PASSTHRU); | |
93 | php_psr_register_CacheItemPoolInterface(INIT_FUNC_ARGS_PASSTHRU); | |
94 | php_psr_register_InvalidArgumentException(INIT_FUNC_ARGS_PASSTHRU); | |
95 | ||
96 | return SUCCESS; | |
97 | } | |
98 | /* }}} */ | |
99 | ||
100 | /* | |
101 | * Local variables: | |
102 | * tab-width: 4 | |
103 | * c-basic-offset: 4 | |
104 | * End: | |
105 | * vim600: fdm=marker | |
106 | * vim: et sw=4 ts=4 | |
107 | */ |
0 | ||
1 | #ifndef PSR_CACHE_H | |
2 | #define PSR_CACHE_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_psr.h" | |
6 | ||
7 | #define PHP_PSR_CACHE_VERSION "1.0.0" | |
8 | #define PHP_PSR_CACHE_VERSION_ID 10000 | |
9 | ||
10 | extern PHP_PSR_API zend_class_entry * PsrCacheCacheItemInterface_ce_ptr; | |
11 | extern PHP_PSR_API zend_class_entry * PsrCacheCacheItemPoolInterface_ce_ptr; | |
12 | extern PHP_PSR_API zend_class_entry * PsrCacheInvalidArgumentException_ce_ptr; | |
13 | extern PHP_PSR_API zend_class_entry * PsrCacheCacheException_ce_ptr; | |
14 | ||
15 | extern PHP_MINIT_FUNCTION(psr_cache); | |
16 | ||
17 | PHP_PSR_BEGIN_ARG_INFO(PsrCacheCacheItemInterface, getKey, 0) | |
18 | PHP_PSR_END_ARG_INFO() | |
19 | ||
20 | PHP_PSR_BEGIN_ARG_INFO(PsrCacheCacheItemInterface, get, 0) | |
21 | PHP_PSR_END_ARG_INFO() | |
22 | ||
23 | PHP_PSR_BEGIN_ARG_INFO(PsrCacheCacheItemInterface, isHit, 0) | |
24 | PHP_PSR_END_ARG_INFO() | |
25 | ||
26 | PHP_PSR_BEGIN_ARG_INFO(PsrCacheCacheItemInterface, set, 1) | |
27 | ZEND_ARG_INFO(0, value) | |
28 | PHP_PSR_END_ARG_INFO() | |
29 | ||
30 | PHP_PSR_BEGIN_ARG_INFO(PsrCacheCacheItemInterface, expiresAt, 1) | |
31 | ZEND_ARG_INFO(0, expiration) | |
32 | PHP_PSR_END_ARG_INFO() | |
33 | ||
34 | PHP_PSR_BEGIN_ARG_INFO(PsrCacheCacheItemInterface, expiresAfter, 1) | |
35 | ZEND_ARG_INFO(0, time) | |
36 | PHP_PSR_END_ARG_INFO() | |
37 | ||
38 | PHP_PSR_BEGIN_ARG_INFO(PsrCacheCacheItemPoolInterface, getItem, 1) | |
39 | ZEND_ARG_INFO(0, key) | |
40 | PHP_PSR_END_ARG_INFO() | |
41 | ||
42 | PHP_PSR_BEGIN_ARG_INFO(PsrCacheCacheItemPoolInterface, getItems, 0) | |
43 | ZEND_ARG_ARRAY_INFO(0, keys, 0) | |
44 | PHP_PSR_END_ARG_INFO() | |
45 | ||
46 | PHP_PSR_BEGIN_ARG_INFO(PsrCacheCacheItemPoolInterface, hasItem, 1) | |
47 | ZEND_ARG_INFO(0, key) | |
48 | PHP_PSR_END_ARG_INFO() | |
49 | ||
50 | PHP_PSR_BEGIN_ARG_INFO(PsrCacheCacheItemPoolInterface, clear, 0) | |
51 | PHP_PSR_END_ARG_INFO() | |
52 | ||
53 | PHP_PSR_BEGIN_ARG_INFO(PsrCacheCacheItemPoolInterface, deleteItem, 1) | |
54 | ZEND_ARG_INFO(0, key) | |
55 | PHP_PSR_END_ARG_INFO() | |
56 | ||
57 | PHP_PSR_BEGIN_ARG_INFO(PsrCacheCacheItemPoolInterface, deleteItems, 1) | |
58 | ZEND_ARG_ARRAY_INFO(0, keys, 0) | |
59 | PHP_PSR_END_ARG_INFO() | |
60 | ||
61 | PHP_PSR_BEGIN_ARG_INFO(PsrCacheCacheItemPoolInterface, save, 1) | |
62 | ZEND_ARG_OBJ_INFO(0, logger, Psr\\Cache\\CacheItemInterface, 0) | |
63 | PHP_PSR_END_ARG_INFO() | |
64 | ||
65 | PHP_PSR_BEGIN_ARG_INFO(PsrCacheCacheItemPoolInterface, saveDeferred, 1) | |
66 | ZEND_ARG_OBJ_INFO(0, logger, Psr\\Cache\\CacheItemInterface, 0) | |
67 | PHP_PSR_END_ARG_INFO() | |
68 | ||
69 | PHP_PSR_BEGIN_ARG_INFO(PsrCacheCacheItemPoolInterface, commit, 0) | |
70 | PHP_PSR_END_ARG_INFO() | |
71 | ||
72 | #endif /* PSR_CACHE_H */ | |
73 | ||
74 | /* | |
75 | * Local variables: | |
76 | * tab-width: 4 | |
77 | * c-basic-offset: 4 | |
78 | * End: | |
79 | * vim600: fdm=marker | |
80 | * vim: et sw=4 ts=4 | |
81 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include <Zend/zend_exceptions.h> | |
7 | #include "php_psr.h" | |
8 | #include "psr_container.h" | |
9 | ||
10 | /* {{{ ContainerExceptionInterface ------------------------------------------ */ | |
11 | ||
12 | PHP_PSR_API zend_class_entry * PsrContainerContainerExceptionInterface_ce_ptr; | |
13 | ||
14 | static zend_always_inline void php_psr_register_PsrContainerContainerExceptionInterface(INIT_FUNC_ARGS) | |
15 | { | |
16 | zend_class_entry ce; | |
17 | INIT_CLASS_ENTRY(ce, "Psr\\Container\\ContainerExceptionInterface", NULL); | |
18 | PsrContainerContainerExceptionInterface_ce_ptr = zend_register_internal_interface(&ce); | |
19 | } | |
20 | ||
21 | /* }}} ---------------------------------------------------------------------- */ | |
22 | /* {{{ ContainerInterface --------------------------------------------------- */ | |
23 | ||
24 | PHP_PSR_API zend_class_entry * PsrContainerContainerInterface_ce_ptr; | |
25 | ||
26 | static zend_function_entry PsrContainerContainerInterface_methods[] = { | |
27 | PHP_PSR_ABSTRACT_ME_WITH_FLAGS(PsrContainerContainerInterface, get, ZEND_ACC_PUBLIC | ZEND_ACC_ABSTRACT | ZEND_ACC_STRICT_TYPES) | |
28 | PHP_PSR_ABSTRACT_ME_WITH_FLAGS(PsrContainerContainerInterface, has, ZEND_ACC_PUBLIC | ZEND_ACC_ABSTRACT | ZEND_ACC_STRICT_TYPES) | |
29 | PHP_FE_END | |
30 | }; | |
31 | ||
32 | static zend_always_inline void php_psr_register_PsrContainerContainerInterface(INIT_FUNC_ARGS) | |
33 | { | |
34 | zend_class_entry ce; | |
35 | INIT_CLASS_ENTRY(ce, "Psr\\Container\\ContainerInterface", PsrContainerContainerInterface_methods); | |
36 | PsrContainerContainerInterface_ce_ptr = zend_register_internal_interface(&ce); | |
37 | } | |
38 | ||
39 | /* }}} ---------------------------------------------------------------------- */ | |
40 | /* {{{ NotFoundException ---------------------------------------------------- */ | |
41 | ||
42 | PHP_PSR_API zend_class_entry * PsrContainerNotFoundExceptionInterface_ce_ptr; | |
43 | ||
44 | static zend_always_inline void php_psr_register_PsrContainerNotFoundExceptionInterface(INIT_FUNC_ARGS) | |
45 | { | |
46 | zend_class_entry ce; | |
47 | INIT_CLASS_ENTRY(ce, "Psr\\Container\\NotFoundExceptionInterface", NULL); | |
48 | PsrContainerNotFoundExceptionInterface_ce_ptr = zend_register_internal_interface(&ce); | |
49 | zend_class_implements(PsrContainerNotFoundExceptionInterface_ce_ptr, 1, PsrContainerContainerExceptionInterface_ce_ptr); | |
50 | } | |
51 | ||
52 | /* }}} ---------------------------------------------------------------------- */ | |
53 | ||
54 | /* {{{ PHP_MINIT_FUNCTION */ | |
55 | PHP_MINIT_FUNCTION(psr_container) | |
56 | { | |
57 | php_psr_register_PsrContainerContainerExceptionInterface(INIT_FUNC_ARGS_PASSTHRU); | |
58 | php_psr_register_PsrContainerContainerInterface(INIT_FUNC_ARGS_PASSTHRU); | |
59 | php_psr_register_PsrContainerNotFoundExceptionInterface(INIT_FUNC_ARGS_PASSTHRU); | |
60 | ||
61 | return SUCCESS; | |
62 | } | |
63 | /* }}} */ | |
64 | ||
65 | /* | |
66 | * Local variables: | |
67 | * tab-width: 4 | |
68 | * c-basic-offset: 4 | |
69 | * End: | |
70 | * vim600: fdm=marker | |
71 | * vim: et sw=4 ts=4 | |
72 | */ |
0 | ||
1 | #ifndef PSR_CONTAINER_H | |
2 | #define PSR_CONTAINER_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_psr.h" | |
6 | ||
7 | #define PHP_PSR_CONTAINER_VERSION "1.1.1" | |
8 | #define PHP_PSR_CONTAINER_VERSION_ID 10101 | |
9 | ||
10 | extern PHP_PSR_API zend_class_entry * PsrContainerContainerExceptionInterface_ce_ptr; | |
11 | extern PHP_PSR_API zend_class_entry * PsrContainerContainerInterface_ce_ptr; | |
12 | extern PHP_PSR_API zend_class_entry * PsrContainerNotFoundExceptionInterface_ce_ptr; | |
13 | ||
14 | extern PHP_MINIT_FUNCTION(psr_container); | |
15 | ||
16 | PHP_PSR_BEGIN_ARG_INFO(PsrContainerContainerInterface, get, 1) | |
17 | ZEND_ARG_TYPE_INFO(0, id, IS_STRING, 0) | |
18 | PHP_PSR_END_ARG_INFO() | |
19 | ||
20 | PHP_PSR_BEGIN_ARG_INFO(PsrContainerContainerInterface, has, 1) | |
21 | ZEND_ARG_TYPE_INFO(0, id, IS_STRING, 0) | |
22 | PHP_PSR_END_ARG_INFO() | |
23 | ||
24 | #endif /* PSR_CONTAINER_H */ | |
25 | ||
26 | /* | |
27 | * Local variables: | |
28 | * tab-width: 4 | |
29 | * c-basic-offset: 4 | |
30 | * End: | |
31 | * vim600: fdm=marker | |
32 | * vim: et sw=4 ts=4 | |
33 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include "php_psr.h" | |
7 | #include "psr_event_dispatcher.h" | |
8 | ||
9 | #if PHP_VERSION_ID >= 70200 | |
10 | /* {{{ Psr\EventDispatcher\EventDispatcherInterface */ | |
11 | ||
12 | PHP_PSR_API zend_class_entry * PsrEventDispatcherEventDispatcherInterface_ce_ptr; | |
13 | ||
14 | static zend_function_entry PsrEventDispatcherEventDispatcherInterface_methods[] = { | |
15 | PHP_PSR_ABSTRACT_ME(PsrEventDispatcherEventDispatcherInterface, dispatch) | |
16 | PHP_FE_END | |
17 | }; | |
18 | ||
19 | static zend_always_inline void php_psr_register_PsrEventDispatcherEventDispatcherInterface(INIT_FUNC_ARGS) | |
20 | { | |
21 | zend_class_entry ce; | |
22 | INIT_CLASS_ENTRY(ce, "Psr\\EventDispatcher\\EventDispatcherInterface", PsrEventDispatcherEventDispatcherInterface_methods); | |
23 | PsrEventDispatcherEventDispatcherInterface_ce_ptr = zend_register_internal_interface(&ce); | |
24 | } | |
25 | ||
26 | /* }}} Psr\EventDispatcher\EventDispatcherInterface */ | |
27 | /* {{{ Psr\EventDispatcher\ListenerProviderInterface */ | |
28 | ||
29 | PHP_PSR_API zend_class_entry * PsrEventDispatcherListenerProviderInterface_ce_ptr; | |
30 | ||
31 | static zend_function_entry PsrEventDispatcherListenerProviderInterface_methods[] = { | |
32 | PHP_PSR_ABSTRACT_ME(PsrEventDispatcherListenerProviderInterface, getListenersForEvent) | |
33 | PHP_FE_END | |
34 | }; | |
35 | ||
36 | static zend_always_inline void php_psr_register_PsrEventDispatcherListenerProviderInterface(INIT_FUNC_ARGS) | |
37 | { | |
38 | zend_class_entry ce; | |
39 | INIT_CLASS_ENTRY(ce, "Psr\\EventDispatcher\\ListenerProviderInterface", PsrEventDispatcherListenerProviderInterface_methods); | |
40 | PsrEventDispatcherListenerProviderInterface_ce_ptr = zend_register_internal_interface(&ce); | |
41 | } | |
42 | ||
43 | /* }}} Psr\EventDispatcher\ListenerProviderInterface */ | |
44 | /* {{{ Psr\EventDispatcher\StoppableEventInterface */ | |
45 | ||
46 | PHP_PSR_API zend_class_entry * PsrEventDispatcherStoppableEventInterface_ce_ptr; | |
47 | ||
48 | static zend_function_entry PsrEventDispatcherStoppableEventInterface_methods[] = { | |
49 | PHP_PSR_ABSTRACT_ME(PsrEventDispatcherStoppableEventInterface, isPropagationStopped) | |
50 | PHP_FE_END | |
51 | }; | |
52 | ||
53 | static zend_always_inline void php_psr_register_PsrEventDispatcherStoppableEventInterface(INIT_FUNC_ARGS) | |
54 | { | |
55 | zend_class_entry ce; | |
56 | INIT_CLASS_ENTRY(ce, "Psr\\EventDispatcher\\StoppableEventInterface", PsrEventDispatcherStoppableEventInterface_methods); | |
57 | PsrEventDispatcherStoppableEventInterface_ce_ptr = zend_register_internal_interface(&ce); | |
58 | } | |
59 | ||
60 | /* }}} Psr\EventDispatcher\StoppableEventInterface */ | |
61 | #endif | |
62 | ||
63 | /* {{{ PHP_MINIT_FUNCTION */ | |
64 | PHP_MINIT_FUNCTION(psr_event_dispatcher) | |
65 | { | |
66 | #if PHP_VERSION_ID >= 70200 | |
67 | php_psr_register_PsrEventDispatcherEventDispatcherInterface(INIT_FUNC_ARGS_PASSTHRU); | |
68 | php_psr_register_PsrEventDispatcherListenerProviderInterface(INIT_FUNC_ARGS_PASSTHRU); | |
69 | php_psr_register_PsrEventDispatcherStoppableEventInterface(INIT_FUNC_ARGS_PASSTHRU); | |
70 | #endif | |
71 | ||
72 | return SUCCESS; | |
73 | } | |
74 | /* }}} */ | |
75 | ||
76 | /* | |
77 | * Local variables: | |
78 | * tab-width: 4 | |
79 | * c-basic-offset: 4 | |
80 | * End: | |
81 | * vim600: fdm=marker | |
82 | * vim: et sw=4 ts=4 | |
83 | */ |
0 | ||
1 | #ifndef PSR_EVENT_DISPATCHER_H | |
2 | #define PSR_EVENT_DISPATCHER_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_psr.h" | |
6 | ||
7 | #if PHP_VERSION_ID >= 70200 | |
8 | #define PHP_PSR_EVENT_DISPATCHER_VERSION "1.0.0" | |
9 | #define PHP_PSR_EVENT_DISPATCHER_VERSION_ID 10000 | |
10 | ||
11 | extern PHP_PSR_API zend_class_entry * PsrEventDispatcherEventDispatcherInterface_ce_ptr; | |
12 | extern PHP_PSR_API zend_class_entry * PsrEventDispatcherListenerProviderInterface_ce_ptr; | |
13 | extern PHP_PSR_API zend_class_entry * PsrEventDispatcherStoppableEventInterface_ce_ptr; | |
14 | ||
15 | extern PHP_MINIT_FUNCTION(psr_event_dispatcher); | |
16 | ||
17 | PHP_PSR_BEGIN_ARG_INFO(PsrEventDispatcherEventDispatcherInterface, dispatch, 1) | |
18 | ZEND_ARG_TYPE_INFO(0, event, IS_OBJECT, 0) | |
19 | PHP_PSR_END_ARG_INFO() | |
20 | ||
21 | PHP_PSR_BEGIN_ARG_WITH_RETURN_TYPE_INFO(PsrEventDispatcherListenerProviderInterface, getListenersForEvent, 1, IS_ITERABLE, 0) | |
22 | ZEND_ARG_TYPE_INFO(0, event, IS_OBJECT, 0) | |
23 | PHP_PSR_END_ARG_INFO() | |
24 | ||
25 | PHP_PSR_BEGIN_ARG_WITH_RETURN_TYPE_INFO(PsrEventDispatcherStoppableEventInterface, isPropagationStopped, 0, _IS_BOOL, 0) | |
26 | PHP_PSR_END_ARG_INFO() | |
27 | #endif | |
28 | ||
29 | #endif /* PSR_EVENT_DISPATCHER_H */ | |
30 | ||
31 | /* | |
32 | * Local variables: | |
33 | * tab-width: 4 | |
34 | * c-basic-offset: 4 | |
35 | * End: | |
36 | * vim600: fdm=marker | |
37 | * vim: et sw=4 ts=4 | |
38 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include <Zend/zend_exceptions.h> | |
7 | #include "php_psr.h" | |
8 | #include "psr_http_client.h" | |
9 | ||
10 | /* {{{ Psr\Http\Client\ClientInterface */ | |
11 | ||
12 | PHP_PSR_API zend_class_entry * PsrHttpClientClientInterface_ce_ptr; | |
13 | ||
14 | static zend_function_entry PsrHttpClientClientInterface_methods[] = { | |
15 | PHP_PSR_ABSTRACT_ME(PsrHttpClientClientInterface, sendRequest) | |
16 | PHP_FE_END | |
17 | }; | |
18 | ||
19 | static zend_always_inline void php_psr_register_PsrHttpClientClientInterface(INIT_FUNC_ARGS) | |
20 | { | |
21 | zend_class_entry ce; | |
22 | INIT_CLASS_ENTRY(ce, "Psr\\Http\\Client\\ClientInterface", PsrHttpClientClientInterface_methods); | |
23 | PsrHttpClientClientInterface_ce_ptr = zend_register_internal_interface(&ce); | |
24 | } | |
25 | ||
26 | /* }}} Psr\Http\Client\ClientInterface */ | |
27 | /* {{{ Psr\Http\Client\ClientExceptionInterface */ | |
28 | ||
29 | PHP_PSR_API zend_class_entry * PsrHttpClientClientExceptionInterface_ce_ptr; | |
30 | ||
31 | static zend_always_inline void php_psr_register_PsrHttpClientClientExceptionInterface(INIT_FUNC_ARGS) | |
32 | { | |
33 | zend_class_entry ce; | |
34 | INIT_CLASS_ENTRY(ce, "Psr\\Http\\Client\\ClientExceptionInterface", NULL); | |
35 | PsrHttpClientClientExceptionInterface_ce_ptr = zend_register_internal_interface(&ce); | |
36 | zend_class_implements(PsrHttpClientClientExceptionInterface_ce_ptr, 1, zend_ce_throwable); | |
37 | } | |
38 | ||
39 | /* }}} Psr\Http\Client\ClientExceptionInterface */ | |
40 | /* {{{ Psr\Http\Client\NetworkExceptionInterface */ | |
41 | ||
42 | PHP_PSR_API zend_class_entry * PsrHttpClientNetworkExceptionInterface_ce_ptr; | |
43 | ||
44 | static zend_function_entry PsrHttpClientNetworkExceptionInterface_methods[] = { | |
45 | PHP_PSR_ABSTRACT_ME(PsrHttpClientNetworkExceptionInterface, getRequest) | |
46 | PHP_FE_END | |
47 | }; | |
48 | ||
49 | static zend_always_inline void php_psr_register_PsrHttpClientNetworkExceptionInterface(INIT_FUNC_ARGS) | |
50 | { | |
51 | zend_class_entry ce; | |
52 | INIT_CLASS_ENTRY(ce, "Psr\\Http\\Client\\NetworkExceptionInterface", PsrHttpClientNetworkExceptionInterface_methods); | |
53 | PsrHttpClientNetworkExceptionInterface_ce_ptr = zend_register_internal_interface(&ce); | |
54 | zend_class_implements(PsrHttpClientNetworkExceptionInterface_ce_ptr, 1, PsrHttpClientClientExceptionInterface_ce_ptr); | |
55 | } | |
56 | ||
57 | /* }}} Psr\Http\Client\NetworkExceptionInterface */ | |
58 | /* {{{ Psr\Http\Client\RequestExceptionInterface */ | |
59 | ||
60 | PHP_PSR_API zend_class_entry * PsrHttpClientRequestExceptionInterface_ce_ptr; | |
61 | ||
62 | static zend_function_entry PsrHttpClientRequestExceptionInterface_methods[] = { | |
63 | PHP_PSR_ABSTRACT_ME(PsrHttpClientRequestExceptionInterface, getRequest) | |
64 | PHP_FE_END | |
65 | }; | |
66 | ||
67 | static zend_always_inline void php_psr_register_PsrHttpClientRequestExceptionInterface(INIT_FUNC_ARGS) | |
68 | { | |
69 | zend_class_entry ce; | |
70 | INIT_CLASS_ENTRY(ce, "Psr\\Http\\Client\\RequestExceptionInterface", PsrHttpClientRequestExceptionInterface_methods); | |
71 | PsrHttpClientRequestExceptionInterface_ce_ptr = zend_register_internal_interface(&ce); | |
72 | zend_class_implements(PsrHttpClientRequestExceptionInterface_ce_ptr, 1, PsrHttpClientClientExceptionInterface_ce_ptr); | |
73 | } | |
74 | ||
75 | /* }}} Psr\Http\Client\RequestExceptionInterface */ | |
76 | ||
77 | /* {{{ PHP_MINIT_FUNCTION */ | |
78 | PHP_MINIT_FUNCTION(psr_http_client) | |
79 | { | |
80 | php_psr_register_PsrHttpClientClientInterface(INIT_FUNC_ARGS_PASSTHRU); | |
81 | php_psr_register_PsrHttpClientClientExceptionInterface(INIT_FUNC_ARGS_PASSTHRU); | |
82 | php_psr_register_PsrHttpClientNetworkExceptionInterface(INIT_FUNC_ARGS_PASSTHRU); | |
83 | php_psr_register_PsrHttpClientRequestExceptionInterface(INIT_FUNC_ARGS_PASSTHRU); | |
84 | ||
85 | return SUCCESS; | |
86 | } | |
87 | /* }}} */ | |
88 | ||
89 | /* | |
90 | * Local variables: | |
91 | * tab-width: 4 | |
92 | * c-basic-offset: 4 | |
93 | * End: | |
94 | * vim600: fdm=marker | |
95 | * vim: et sw=4 ts=4 | |
96 | */ |
0 | ||
1 | #ifndef PSR_HTTP_CLIENT_H | |
2 | #define PSR_HTTP_CLIENT_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_psr.h" | |
6 | ||
7 | #define PHP_PSR_HTTP_CLIENT_VERSION "1.0.0" | |
8 | #define PHP_PSR_HTTP_CLIENT_VERSION_ID 10000 | |
9 | ||
10 | extern PHP_PSR_API zend_class_entry * PsrHttpClientClientInterface_ce_ptr; | |
11 | extern PHP_PSR_API zend_class_entry * PsrHttpClientClientExceptionInterface_ce_ptr; | |
12 | extern PHP_PSR_API zend_class_entry * PsrHttpClientNetworkExceptionInterface_ce_ptr; | |
13 | extern PHP_PSR_API zend_class_entry * PsrHttpClientRequestExceptionInterface_ce_ptr; | |
14 | ||
15 | extern PHP_MINIT_FUNCTION(psr_http_client); | |
16 | ||
17 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(PsrHttpClientClientInterface, sendRequest, 1, Psr\\Http\\Message\\ResponseInterface, 0) | |
18 | ZEND_ARG_OBJ_INFO(0, request, Psr\\Http\\Message\\RequestInterface, 0) | |
19 | PHP_PSR_END_ARG_INFO() | |
20 | ||
21 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(PsrHttpClientNetworkExceptionInterface, getRequest, 0, Psr\\Http\\Message\\RequestInterface, 0) | |
22 | PHP_PSR_END_ARG_INFO() | |
23 | ||
24 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(PsrHttpClientRequestExceptionInterface, getRequest, 0, Psr\\Http\\Message\\RequestInterface, 0) | |
25 | PHP_PSR_END_ARG_INFO() | |
26 | ||
27 | #endif /* PSR_HTTP_CLIENT_H */ | |
28 | ||
29 | /* | |
30 | * Local variables: | |
31 | * tab-width: 4 | |
32 | * c-basic-offset: 4 | |
33 | * End: | |
34 | * vim600: fdm=marker | |
35 | * vim: et sw=4 ts=4 | |
36 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include "php_psr.h" | |
7 | #include "psr_http_factory.h" | |
8 | ||
9 | /* {{{ Psr\Http\Message\RequestFactoryInterface */ | |
10 | ||
11 | PHP_PSR_API zend_class_entry * PsrHttpMessageRequestFactoryInterface_ce_ptr; | |
12 | ||
13 | static zend_function_entry PsrHttpMessageRequestFactoryInterface_methods[] = { | |
14 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageRequestFactoryInterface, createRequest) | |
15 | PHP_FE_END | |
16 | }; | |
17 | ||
18 | static zend_always_inline void php_psr_register_PsrHttpMessageRequestFactoryInterface(INIT_FUNC_ARGS) | |
19 | { | |
20 | zend_class_entry ce; | |
21 | INIT_CLASS_ENTRY(ce, "Psr\\Http\\Message\\RequestFactoryInterface", PsrHttpMessageRequestFactoryInterface_methods); | |
22 | PsrHttpMessageRequestFactoryInterface_ce_ptr = zend_register_internal_interface(&ce); | |
23 | } | |
24 | ||
25 | /* }}} Psr\Http\Message\RequestFactoryInterface */ | |
26 | /* {{{ Psr\Http\Message\ResponseFactoryInterface */ | |
27 | ||
28 | PHP_PSR_API zend_class_entry * PsrHttpMessageResponseFactoryInterface_ce_ptr; | |
29 | ||
30 | static zend_function_entry PsrHttpMessageResponseFactoryInterface_methods[] = { | |
31 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageResponseFactoryInterface, createResponse) | |
32 | PHP_FE_END | |
33 | }; | |
34 | ||
35 | static zend_always_inline void php_psr_register_PsrHttpMessageResponseFactoryInterface(INIT_FUNC_ARGS) | |
36 | { | |
37 | zend_class_entry ce; | |
38 | INIT_CLASS_ENTRY(ce, "Psr\\Http\\Message\\ResponseFactoryInterface", PsrHttpMessageResponseFactoryInterface_methods); | |
39 | PsrHttpMessageResponseFactoryInterface_ce_ptr = zend_register_internal_interface(&ce); | |
40 | } | |
41 | ||
42 | /* }}} Psr\Http\Message\ResponseFactoryInterface */ | |
43 | /* {{{ Psr\Http\Message\ServerRequestFactoryInterface */ | |
44 | ||
45 | PHP_PSR_API zend_class_entry * PsrHttpMessageServerRequestFactoryInterface_ce_ptr; | |
46 | ||
47 | static zend_function_entry PsrHttpMessageServerRequestFactoryInterface_methods[] = { | |
48 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageServerRequestFactoryInterface, createServerRequest) | |
49 | PHP_FE_END | |
50 | }; | |
51 | ||
52 | static zend_always_inline void php_psr_register_PsrHttpMessageServerRequestFactoryInterface(INIT_FUNC_ARGS) | |
53 | { | |
54 | zend_class_entry ce; | |
55 | INIT_CLASS_ENTRY(ce, "Psr\\Http\\Message\\ServerRequestFactoryInterface", PsrHttpMessageServerRequestFactoryInterface_methods); | |
56 | PsrHttpMessageServerRequestFactoryInterface_ce_ptr = zend_register_internal_interface(&ce); | |
57 | } | |
58 | ||
59 | /* }}} Psr\Http\Message\ServerRequestFactoryInterface */ | |
60 | /* {{{ Psr\Http\Message\StreamFactoryInterface */ | |
61 | ||
62 | PHP_PSR_API zend_class_entry * PsrHttpMessageStreamFactoryInterface_ce_ptr; | |
63 | ||
64 | static zend_function_entry PsrHttpMessageStreamFactoryInterface_methods[] = { | |
65 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageStreamFactoryInterface, createStream) | |
66 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageStreamFactoryInterface, createStreamFromFile) | |
67 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageStreamFactoryInterface, createStreamFromResource) | |
68 | PHP_FE_END | |
69 | }; | |
70 | ||
71 | static zend_always_inline void php_psr_register_PsrHttpMessageStreamFactoryInterface(INIT_FUNC_ARGS) | |
72 | { | |
73 | zend_class_entry ce; | |
74 | INIT_CLASS_ENTRY(ce, "Psr\\Http\\Message\\StreamFactoryInterface", PsrHttpMessageStreamFactoryInterface_methods); | |
75 | PsrHttpMessageStreamFactoryInterface_ce_ptr = zend_register_internal_interface(&ce); | |
76 | } | |
77 | ||
78 | /* }}} Psr\Http\Message\StreamFactoryInterface */ | |
79 | /* {{{ Psr\Http\Message\UploadedFileFactoryInterface */ | |
80 | ||
81 | PHP_PSR_API zend_class_entry * PsrHttpMessageUploadedFileFactoryInterface_ce_ptr; | |
82 | ||
83 | static zend_function_entry PsrHttpMessageUploadedFileFactoryInterface_methods[] = { | |
84 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUploadedFileFactoryInterface, createUploadedFile) | |
85 | PHP_FE_END | |
86 | }; | |
87 | ||
88 | static zend_always_inline void php_psr_register_PsrHttpMessageUploadedFileFactoryInterface(INIT_FUNC_ARGS) | |
89 | { | |
90 | zend_class_entry ce; | |
91 | INIT_CLASS_ENTRY(ce, "Psr\\Http\\Message\\UploadedFileFactoryInterface", PsrHttpMessageUploadedFileFactoryInterface_methods); | |
92 | PsrHttpMessageUploadedFileFactoryInterface_ce_ptr = zend_register_internal_interface(&ce); | |
93 | } | |
94 | ||
95 | /* }}} Psr\Http\Message\UploadedFileFactoryInterface */ | |
96 | /* {{{ Psr\Http\Message\UriFactoryInterface */ | |
97 | ||
98 | PHP_PSR_API zend_class_entry * PsrHttpMessageUriFactoryInterface_ce_ptr; | |
99 | ||
100 | static zend_function_entry PsrHttpMessageUriFactoryInterface_methods[] = { | |
101 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUriFactoryInterface, createUri) | |
102 | PHP_FE_END | |
103 | }; | |
104 | ||
105 | static zend_always_inline void php_psr_register_PsrHttpMessageUriFactoryInterface(INIT_FUNC_ARGS) | |
106 | { | |
107 | zend_class_entry ce; | |
108 | INIT_CLASS_ENTRY(ce, "Psr\\Http\\Message\\UriFactoryInterface", PsrHttpMessageUriFactoryInterface_methods); | |
109 | PsrHttpMessageUriFactoryInterface_ce_ptr = zend_register_internal_interface(&ce); | |
110 | } | |
111 | ||
112 | /* }}} Psr\Http\Message\UriFactoryInterface */ | |
113 | ||
114 | /* {{{ PHP_MINIT_FUNCTION */ | |
115 | PHP_MINIT_FUNCTION(psr_http_factory) | |
116 | { | |
117 | php_psr_register_PsrHttpMessageRequestFactoryInterface(INIT_FUNC_ARGS_PASSTHRU); | |
118 | php_psr_register_PsrHttpMessageResponseFactoryInterface(INIT_FUNC_ARGS_PASSTHRU); | |
119 | php_psr_register_PsrHttpMessageServerRequestFactoryInterface(INIT_FUNC_ARGS_PASSTHRU); | |
120 | php_psr_register_PsrHttpMessageStreamFactoryInterface(INIT_FUNC_ARGS_PASSTHRU); | |
121 | php_psr_register_PsrHttpMessageUploadedFileFactoryInterface(INIT_FUNC_ARGS_PASSTHRU); | |
122 | php_psr_register_PsrHttpMessageUriFactoryInterface(INIT_FUNC_ARGS_PASSTHRU); | |
123 | ||
124 | return SUCCESS; | |
125 | } | |
126 | /* }}} */ | |
127 | ||
128 | /* | |
129 | * Local variables: | |
130 | * tab-width: 4 | |
131 | * c-basic-offset: 4 | |
132 | * End: | |
133 | * vim600: fdm=marker | |
134 | * vim: et sw=4 ts=4 | |
135 | */ |
0 | ||
1 | #ifndef PSR_HTTP_FACTORY_H | |
2 | #define PSR_HTTP_FACTORY_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_psr.h" | |
6 | ||
7 | #define PHP_PSR_HTTP_FACTORY_VERSION "1.0.0" | |
8 | #define PHP_PSR_HTTP_FACTORY_VERSION_ID 10000 | |
9 | ||
10 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageRequestFactoryInterface_ce_ptr; | |
11 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageResponseFactoryInterface_ce_ptr; | |
12 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageServerRequestFactoryInterface_ce_ptr; | |
13 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageStreamFactoryInterface_ce_ptr; | |
14 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageUploadedFileFactoryInterface_ce_ptr; | |
15 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageUriFactoryInterface_ce_ptr; | |
16 | ||
17 | extern PHP_MINIT_FUNCTION(psr_http_factory); | |
18 | ||
19 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(PsrHttpMessageRequestFactoryInterface, createRequest, 2, Psr\\Http\\Message\\RequestInterface, 0) | |
20 | ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0) | |
21 | ZEND_ARG_INFO(0, uri) | |
22 | PHP_PSR_END_ARG_INFO() | |
23 | ||
24 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(PsrHttpMessageResponseFactoryInterface, createResponse, 0, Psr\\Http\\Message\\ResponseInterface, 0) | |
25 | ZEND_ARG_TYPE_INFO(0, code, IS_LONG, 0) | |
26 | ZEND_ARG_TYPE_INFO(0, reasonPhrase, IS_STRING, 0) | |
27 | PHP_PSR_END_ARG_INFO() | |
28 | ||
29 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(PsrHttpMessageServerRequestFactoryInterface, createServerRequest, 2, Psr\\Http\\Message\\ServerRequestInterface, 0) | |
30 | ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0) | |
31 | ZEND_ARG_INFO(0, uri) | |
32 | ZEND_ARG_ARRAY_INFO(0, serverParams, 0) | |
33 | PHP_PSR_END_ARG_INFO() | |
34 | ||
35 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(PsrHttpMessageStreamFactoryInterface, createStream, 0, Psr\\Http\\Message\\StreamInterface, 0) | |
36 | ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0) | |
37 | PHP_PSR_END_ARG_INFO() | |
38 | ||
39 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(PsrHttpMessageStreamFactoryInterface, createStreamFromFile, 1, Psr\\Http\\Message\\StreamInterface, 0) | |
40 | ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) | |
41 | ZEND_ARG_TYPE_INFO(0, mode, IS_STRING, 0) | |
42 | PHP_PSR_END_ARG_INFO() | |
43 | ||
44 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(PsrHttpMessageStreamFactoryInterface, createStreamFromResource, 1, Psr\\Http\\Message\\StreamInterface, 0) | |
45 | ZEND_ARG_INFO(0, resouce) | |
46 | PHP_PSR_END_ARG_INFO() | |
47 | ||
48 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(PsrHttpMessageUploadedFileFactoryInterface, createUploadedFile, 1, Psr\\Http\\Message\\UploadedFileInterface, 0) | |
49 | ZEND_ARG_OBJ_INFO(0, stream, Psr\\Http\\Message\\StreamInterface, 0) | |
50 | ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 1) | |
51 | ZEND_ARG_TYPE_INFO(0, error, IS_LONG, 0) | |
52 | ZEND_ARG_TYPE_INFO(0, clientFilename, IS_STRING, 1) | |
53 | ZEND_ARG_TYPE_INFO(0, clientMediaType, IS_STRING, 1) | |
54 | PHP_PSR_END_ARG_INFO() | |
55 | ||
56 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(PsrHttpMessageUriFactoryInterface, createUri, 0, Psr\\Http\\Message\\UriInterface, 0) | |
57 | ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 0) | |
58 | PHP_PSR_END_ARG_INFO() | |
59 | ||
60 | #endif /* PSR_HTTP_FACTORY_H */ | |
61 | ||
62 | /* | |
63 | * Local variables: | |
64 | * tab-width: 4 | |
65 | * c-basic-offset: 4 | |
66 | * End: | |
67 | * vim600: fdm=marker | |
68 | * vim: et sw=4 ts=4 | |
69 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include "php_ini.h" | |
7 | #include "ext/standard/info.h" | |
8 | #include "ext/spl/spl_exceptions.h" | |
9 | #include "zend_API.h" | |
10 | #include "zend_interfaces.h" | |
11 | ||
12 | #include "php_psr.h" | |
13 | #include "psr_http_message.h" | |
14 | ||
15 | /* {{{ Psr\Http\Message\MessageInterface */ | |
16 | ||
17 | PHP_PSR_API zend_class_entry * PsrHttpMessageMessageInterface_ce_ptr; | |
18 | ||
19 | static zend_function_entry PsrHttpMessageMessageInterface_methods[] = { | |
20 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageMessageInterface, getProtocolVersion) | |
21 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageMessageInterface, withProtocolVersion) | |
22 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageMessageInterface, getHeaders) | |
23 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageMessageInterface, hasHeader) | |
24 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageMessageInterface, getHeader) | |
25 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageMessageInterface, getHeaderLine) | |
26 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageMessageInterface, withHeader) | |
27 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageMessageInterface, withAddedHeader) | |
28 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageMessageInterface, withoutHeader) | |
29 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageMessageInterface, getBody) | |
30 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageMessageInterface, withBody) | |
31 | PHP_FE_END | |
32 | }; | |
33 | ||
34 | static zend_always_inline void php_register_PsrHttpMessageMessageInterface(INIT_FUNC_ARGS) | |
35 | { | |
36 | zend_class_entry ce; | |
37 | INIT_CLASS_ENTRY(ce, "Psr\\Http\\Message\\MessageInterface", PsrHttpMessageMessageInterface_methods); | |
38 | PsrHttpMessageMessageInterface_ce_ptr = zend_register_internal_interface(&ce); | |
39 | } | |
40 | ||
41 | /* }}} Psr\Http\Message\MessageInterface */ | |
42 | /* {{{ Psr\Http\Message\RequestInterface */ | |
43 | ||
44 | PHP_PSR_API zend_class_entry * PsrHttpMessageRequestInterface_ce_ptr; | |
45 | ||
46 | static zend_function_entry PsrHttpMessageRequestInterface_methods[] = { | |
47 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageRequestInterface, getRequestTarget) | |
48 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageRequestInterface, withRequestTarget) | |
49 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageRequestInterface, getMethod) | |
50 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageRequestInterface, withMethod) | |
51 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageRequestInterface, getUri) | |
52 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageRequestInterface, withUri) | |
53 | PHP_FE_END | |
54 | }; | |
55 | ||
56 | static zend_always_inline void php_register_PsrHttpMessageRequestInterface(INIT_FUNC_ARGS) | |
57 | { | |
58 | zend_class_entry ce; | |
59 | INIT_CLASS_ENTRY(ce, "Psr\\Http\\Message\\RequestInterface", PsrHttpMessageRequestInterface_methods); | |
60 | PsrHttpMessageRequestInterface_ce_ptr = zend_register_internal_interface(&ce); | |
61 | // @todo make sure this is right | |
62 | zend_class_implements(PsrHttpMessageRequestInterface_ce_ptr, 1, PsrHttpMessageMessageInterface_ce_ptr); | |
63 | } | |
64 | ||
65 | /* }}} Psr\Http\Message\RequestInterface */ | |
66 | /* {{{ Psr\Http\Message\ResponseInterface */ | |
67 | ||
68 | PHP_PSR_API zend_class_entry * PsrHttpMessageResponseInterface_ce_ptr; | |
69 | ||
70 | static zend_function_entry PsrHttpMessageResponseInterface_methods[] = { | |
71 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageResponseInterface, getStatusCode) | |
72 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageResponseInterface, withStatus) | |
73 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageResponseInterface, getReasonPhrase) | |
74 | PHP_FE_END | |
75 | }; | |
76 | ||
77 | static zend_always_inline void php_register_PsrHttpMessageResponseInterface(INIT_FUNC_ARGS) | |
78 | { | |
79 | zend_class_entry ce; | |
80 | INIT_CLASS_ENTRY(ce, "Psr\\Http\\Message\\ResponseInterface", PsrHttpMessageResponseInterface_methods); | |
81 | PsrHttpMessageResponseInterface_ce_ptr = zend_register_internal_interface(&ce); | |
82 | zend_class_implements(PsrHttpMessageResponseInterface_ce_ptr, 1, PsrHttpMessageMessageInterface_ce_ptr); | |
83 | } | |
84 | ||
85 | /* }}} Psr\Http\Message\ResponseInterface */ | |
86 | /* {{{ Psr\Http\Message\ServerRequestInterface */ | |
87 | ||
88 | PHP_PSR_API zend_class_entry * PsrHttpMessageServerRequestInterface_ce_ptr; | |
89 | ||
90 | static zend_function_entry PsrHttpMessageServerRequestInterface_methods[] = { | |
91 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageServerRequestInterface, getServerParams) | |
92 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageServerRequestInterface, getCookieParams) | |
93 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageServerRequestInterface, withCookieParams) | |
94 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageServerRequestInterface, getQueryParams) | |
95 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageServerRequestInterface, withQueryParams) | |
96 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageServerRequestInterface, getUploadedFiles) | |
97 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageServerRequestInterface, withUploadedFiles) | |
98 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageServerRequestInterface, getParsedBody) | |
99 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageServerRequestInterface, withParsedBody) | |
100 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageServerRequestInterface, getAttributes) | |
101 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageServerRequestInterface, getAttribute) | |
102 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageServerRequestInterface, withAttribute) | |
103 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageServerRequestInterface, withoutAttribute) | |
104 | PHP_FE_END | |
105 | }; | |
106 | ||
107 | static zend_always_inline void php_register_PsrHttpMessageServerRequestInterface(INIT_FUNC_ARGS) | |
108 | { | |
109 | zend_class_entry ce; | |
110 | INIT_CLASS_ENTRY(ce, "Psr\\Http\\Message\\ServerRequestInterface", PsrHttpMessageServerRequestInterface_methods); | |
111 | PsrHttpMessageServerRequestInterface_ce_ptr = zend_register_internal_interface(&ce); | |
112 | zend_class_implements(PsrHttpMessageServerRequestInterface_ce_ptr, 1, PsrHttpMessageRequestInterface_ce_ptr); | |
113 | } | |
114 | ||
115 | /* }}} Psr\Http\Message\ServerRequestInterface */ | |
116 | /* {{{ Psr\Http\Message\StreamInterface */ | |
117 | ||
118 | PHP_PSR_API zend_class_entry * PsrHttpMessageStreamInterface_ce_ptr; | |
119 | ||
120 | static zend_function_entry PsrHttpMessageStreamInterface_methods[] = { | |
121 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageStreamInterface, __toString) | |
122 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageStreamInterface, close) | |
123 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageStreamInterface, detach) | |
124 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageStreamInterface, getSize) | |
125 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageStreamInterface, tell) | |
126 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageStreamInterface, eof) | |
127 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageStreamInterface, isSeekable) | |
128 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageStreamInterface, seek) | |
129 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageStreamInterface, rewind) | |
130 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageStreamInterface, isWritable) | |
131 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageStreamInterface, write) | |
132 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageStreamInterface, isReadable) | |
133 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageStreamInterface, read) | |
134 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageStreamInterface, getContents) | |
135 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageStreamInterface, getMetadata) | |
136 | PHP_FE_END | |
137 | }; | |
138 | ||
139 | static zend_always_inline void php_register_PsrHttpMessageStreamInterface(INIT_FUNC_ARGS) | |
140 | { | |
141 | zend_class_entry ce; | |
142 | INIT_CLASS_ENTRY(ce, "Psr\\Http\\Message\\StreamInterface", PsrHttpMessageStreamInterface_methods); | |
143 | PsrHttpMessageStreamInterface_ce_ptr = zend_register_internal_interface(&ce); | |
144 | } | |
145 | ||
146 | /* }}} Psr\Http\Message\StreamInterface */ | |
147 | /* {{{ Psr\Http\Message\UploadedFileInterface */ | |
148 | ||
149 | PHP_PSR_API zend_class_entry * PsrHttpMessageUploadedFileInterface_ce_ptr; | |
150 | ||
151 | static zend_function_entry PsrHttpMessageUploadedFileInterface_methods[] = { | |
152 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUploadedFileInterface, getStream) | |
153 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUploadedFileInterface, moveTo) | |
154 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUploadedFileInterface, getSize) | |
155 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUploadedFileInterface, getError) | |
156 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUploadedFileInterface, getClientFilename) | |
157 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUploadedFileInterface, getClientMediaType) | |
158 | PHP_FE_END | |
159 | }; | |
160 | ||
161 | static zend_always_inline void php_register_PsrHttpMessageUploadedFileInterface(INIT_FUNC_ARGS) | |
162 | { | |
163 | zend_class_entry ce; | |
164 | INIT_CLASS_ENTRY(ce, "Psr\\Http\\Message\\UploadedFileInterface", PsrHttpMessageUploadedFileInterface_methods); | |
165 | PsrHttpMessageUploadedFileInterface_ce_ptr = zend_register_internal_interface(&ce); | |
166 | } | |
167 | ||
168 | /* }}} Psr\Http\Message\UploadedFileInterface */ | |
169 | /* {{{ Psr\Http\Message\UriInterface */ | |
170 | ||
171 | PHP_PSR_API zend_class_entry * PsrHttpMessageUriInterface_ce_ptr; | |
172 | ||
173 | static zend_function_entry PsrHttpMessageUriInterface_methods[] = { | |
174 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUriInterface, getScheme) | |
175 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUriInterface, getAuthority) | |
176 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUriInterface, getUserInfo) | |
177 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUriInterface, getHost) | |
178 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUriInterface, getPort) | |
179 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUriInterface, getPath) | |
180 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUriInterface, getQuery) | |
181 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUriInterface, getFragment) | |
182 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUriInterface, withScheme) | |
183 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUriInterface, withUserInfo) | |
184 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUriInterface, withHost) | |
185 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUriInterface, withPort) | |
186 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUriInterface, withPath) | |
187 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUriInterface, withQuery) | |
188 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUriInterface, withFragment) | |
189 | PHP_PSR_ABSTRACT_ME(PsrHttpMessageUriInterface, __toString) | |
190 | PHP_FE_END | |
191 | }; | |
192 | ||
193 | static zend_always_inline void php_register_PsrHttpMessageUriInterface(INIT_FUNC_ARGS) | |
194 | { | |
195 | zend_class_entry ce; | |
196 | INIT_CLASS_ENTRY(ce, "Psr\\Http\\Message\\UriInterface", PsrHttpMessageUriInterface_methods); | |
197 | PsrHttpMessageUriInterface_ce_ptr = zend_register_internal_interface(&ce); | |
198 | } | |
199 | ||
200 | /* }}} Psr\Http\Message\UriInterface */ | |
201 | ||
202 | /* {{{ PHP_MINIT_FUNCTION */ | |
203 | PHP_MINIT_FUNCTION(psr_http_message) | |
204 | { | |
205 | php_register_PsrHttpMessageMessageInterface(INIT_FUNC_ARGS_PASSTHRU); | |
206 | php_register_PsrHttpMessageRequestInterface(INIT_FUNC_ARGS_PASSTHRU); | |
207 | php_register_PsrHttpMessageResponseInterface(INIT_FUNC_ARGS_PASSTHRU); | |
208 | php_register_PsrHttpMessageServerRequestInterface(INIT_FUNC_ARGS_PASSTHRU); | |
209 | php_register_PsrHttpMessageStreamInterface(INIT_FUNC_ARGS_PASSTHRU); | |
210 | php_register_PsrHttpMessageUploadedFileInterface(INIT_FUNC_ARGS_PASSTHRU); | |
211 | php_register_PsrHttpMessageUriInterface(INIT_FUNC_ARGS_PASSTHRU); | |
212 | return SUCCESS; | |
213 | } | |
214 | /* }}} */ | |
215 | ||
216 | /* | |
217 | * Local variables: | |
218 | * tab-width: 4 | |
219 | * c-basic-offset: 4 | |
220 | * End: | |
221 | * vim600: fdm=marker | |
222 | * vim: et sw=4 ts=4 | |
223 | */ |
0 | ||
1 | #ifndef PSR_HTTP_MESSAGE_H | |
2 | #define PSR_HTTP_MESSAGE_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_psr.h" | |
6 | ||
7 | #define PHP_PSR_HTTP_MESSAGE_VERSION "1.0.0" | |
8 | #define PHP_PSR_HTTP_MESSAGE_VERSION_ID 10000 | |
9 | ||
10 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageMessageInterface_ce_ptr; | |
11 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageRequestInterface_ce_ptr; | |
12 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageResponseInterface_ce_ptr; | |
13 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageServerRequestInterface_ce_ptr; | |
14 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageStreamInterface_ce_ptr; | |
15 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageUploadedFileInterface_ce_ptr; | |
16 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageUriInterface_ce_ptr; | |
17 | ||
18 | extern PHP_MINIT_FUNCTION(psr_http_message); | |
19 | ||
20 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageMessageInterface, getProtocolVersion, 0) | |
21 | PHP_PSR_END_ARG_INFO() | |
22 | ||
23 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageMessageInterface, withProtocolVersion, 1) | |
24 | ZEND_ARG_INFO(0, version) | |
25 | PHP_PSR_END_ARG_INFO() | |
26 | ||
27 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageMessageInterface, getHeaders, 0) | |
28 | PHP_PSR_END_ARG_INFO() | |
29 | ||
30 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageMessageInterface, hasHeader, 1) | |
31 | ZEND_ARG_INFO(0, name) | |
32 | PHP_PSR_END_ARG_INFO() | |
33 | ||
34 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageMessageInterface, getHeader, 1) | |
35 | ZEND_ARG_INFO(0, name) | |
36 | PHP_PSR_END_ARG_INFO() | |
37 | ||
38 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageMessageInterface, getHeaderLine, 1) | |
39 | ZEND_ARG_INFO(0, name) | |
40 | PHP_PSR_END_ARG_INFO() | |
41 | ||
42 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageMessageInterface, withHeader, 2) | |
43 | ZEND_ARG_INFO(0, name) | |
44 | ZEND_ARG_INFO(0, value) | |
45 | PHP_PSR_END_ARG_INFO() | |
46 | ||
47 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageMessageInterface, withAddedHeader, 2) | |
48 | ZEND_ARG_INFO(0, name) | |
49 | ZEND_ARG_INFO(0, value) | |
50 | PHP_PSR_END_ARG_INFO() | |
51 | ||
52 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageMessageInterface, withoutHeader, 1) | |
53 | ZEND_ARG_INFO(0, name) | |
54 | PHP_PSR_END_ARG_INFO() | |
55 | ||
56 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageMessageInterface, getBody, 0) | |
57 | PHP_PSR_END_ARG_INFO() | |
58 | ||
59 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageMessageInterface, withBody, 1) | |
60 | ZEND_ARG_OBJ_INFO(0, body, Psr\\Http\\Message\\StreamInterface, 0) | |
61 | PHP_PSR_END_ARG_INFO() | |
62 | ||
63 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageRequestInterface, getRequestTarget, 0) | |
64 | PHP_PSR_END_ARG_INFO() | |
65 | ||
66 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageRequestInterface, withRequestTarget, 1) | |
67 | ZEND_ARG_INFO(0, requestTarget) | |
68 | PHP_PSR_END_ARG_INFO() | |
69 | ||
70 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageRequestInterface, getMethod, 0) | |
71 | PHP_PSR_END_ARG_INFO() | |
72 | ||
73 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageRequestInterface, withMethod, 1) | |
74 | ZEND_ARG_INFO(0, method) | |
75 | PHP_PSR_END_ARG_INFO() | |
76 | ||
77 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageRequestInterface, getUri, 0) | |
78 | PHP_PSR_END_ARG_INFO() | |
79 | ||
80 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageRequestInterface, withUri, 1) | |
81 | ZEND_ARG_OBJ_INFO(0, uri, Psr\\Http\\Message\\UriInterface, 0) | |
82 | ZEND_ARG_INFO(0, preserveHost) | |
83 | PHP_PSR_END_ARG_INFO() | |
84 | ||
85 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageResponseInterface, getStatusCode, 0) | |
86 | PHP_PSR_END_ARG_INFO() | |
87 | ||
88 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageResponseInterface, withStatus, 1) | |
89 | ZEND_ARG_INFO(0, code) | |
90 | ZEND_ARG_INFO(0, reasonPhrase) | |
91 | PHP_PSR_END_ARG_INFO() | |
92 | ||
93 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageResponseInterface, getReasonPhrase, 0) | |
94 | PHP_PSR_END_ARG_INFO() | |
95 | ||
96 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageServerRequestInterface, getServerParams, 0) | |
97 | PHP_PSR_END_ARG_INFO() | |
98 | ||
99 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageServerRequestInterface, getCookieParams, 0) | |
100 | PHP_PSR_END_ARG_INFO() | |
101 | ||
102 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageServerRequestInterface, withCookieParams, 1) | |
103 | ZEND_ARG_ARRAY_INFO(0, cookies, 0) | |
104 | PHP_PSR_END_ARG_INFO() | |
105 | ||
106 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageServerRequestInterface, getQueryParams, 0) | |
107 | PHP_PSR_END_ARG_INFO() | |
108 | ||
109 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageServerRequestInterface, withQueryParams, 1) | |
110 | ZEND_ARG_ARRAY_INFO(0, query, 0) | |
111 | PHP_PSR_END_ARG_INFO() | |
112 | ||
113 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageServerRequestInterface, getUploadedFiles, 0) | |
114 | PHP_PSR_END_ARG_INFO() | |
115 | ||
116 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageServerRequestInterface, withUploadedFiles, 1) | |
117 | ZEND_ARG_ARRAY_INFO(0, uploadedFiles, 0) | |
118 | PHP_PSR_END_ARG_INFO() | |
119 | ||
120 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageServerRequestInterface, getParsedBody, 0) | |
121 | PHP_PSR_END_ARG_INFO() | |
122 | ||
123 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageServerRequestInterface, withParsedBody, 1) | |
124 | ZEND_ARG_INFO(0, parsedBody) | |
125 | PHP_PSR_END_ARG_INFO() | |
126 | ||
127 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageServerRequestInterface, getAttributes, 0) | |
128 | PHP_PSR_END_ARG_INFO() | |
129 | ||
130 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageServerRequestInterface, getAttribute, 1) | |
131 | ZEND_ARG_INFO(0, name) | |
132 | ZEND_ARG_INFO(0, default) | |
133 | PHP_PSR_END_ARG_INFO() | |
134 | ||
135 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageServerRequestInterface, withAttribute, 2) | |
136 | ZEND_ARG_INFO(0, name) | |
137 | ZEND_ARG_INFO(0, value) | |
138 | PHP_PSR_END_ARG_INFO() | |
139 | ||
140 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageServerRequestInterface, withoutAttribute, 1) | |
141 | ZEND_ARG_INFO(0, name) | |
142 | PHP_PSR_END_ARG_INFO() | |
143 | ||
144 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageStreamInterface, __toString, 0) | |
145 | PHP_PSR_END_ARG_INFO() | |
146 | ||
147 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageStreamInterface, close, 0) | |
148 | PHP_PSR_END_ARG_INFO() | |
149 | ||
150 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageStreamInterface, detach, 0) | |
151 | PHP_PSR_END_ARG_INFO() | |
152 | ||
153 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageStreamInterface, getSize, 0) | |
154 | PHP_PSR_END_ARG_INFO() | |
155 | ||
156 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageStreamInterface, tell, 0) | |
157 | PHP_PSR_END_ARG_INFO() | |
158 | ||
159 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageStreamInterface, eof, 0) | |
160 | PHP_PSR_END_ARG_INFO() | |
161 | ||
162 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageStreamInterface, isSeekable, 0) | |
163 | PHP_PSR_END_ARG_INFO() | |
164 | ||
165 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageStreamInterface, seek, 1) | |
166 | ZEND_ARG_INFO(0, offset) | |
167 | ZEND_ARG_INFO(0, whence) | |
168 | PHP_PSR_END_ARG_INFO() | |
169 | ||
170 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageStreamInterface, rewind, 0) | |
171 | PHP_PSR_END_ARG_INFO() | |
172 | ||
173 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageStreamInterface, isWritable, 0) | |
174 | PHP_PSR_END_ARG_INFO() | |
175 | ||
176 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageStreamInterface, write, 1) | |
177 | ZEND_ARG_INFO(0, string) | |
178 | PHP_PSR_END_ARG_INFO() | |
179 | ||
180 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageStreamInterface, isReadable, 0) | |
181 | PHP_PSR_END_ARG_INFO() | |
182 | ||
183 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageStreamInterface, read, 1) | |
184 | ZEND_ARG_INFO(0, length) | |
185 | PHP_PSR_END_ARG_INFO() | |
186 | ||
187 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageStreamInterface, getContents, 0) | |
188 | PHP_PSR_END_ARG_INFO() | |
189 | ||
190 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageStreamInterface, getMetadata, 0) | |
191 | ZEND_ARG_INFO(0, key) | |
192 | PHP_PSR_END_ARG_INFO() | |
193 | ||
194 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUploadedFileInterface, getStream, 0) | |
195 | PHP_PSR_END_ARG_INFO() | |
196 | ||
197 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUploadedFileInterface, moveTo, 1) | |
198 | ZEND_ARG_INFO(0, targetPath) | |
199 | PHP_PSR_END_ARG_INFO() | |
200 | ||
201 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUploadedFileInterface, getSize, 0) | |
202 | PHP_PSR_END_ARG_INFO() | |
203 | ||
204 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUploadedFileInterface, getError, 0) | |
205 | PHP_PSR_END_ARG_INFO() | |
206 | ||
207 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUploadedFileInterface, getClientFilename, 0) | |
208 | PHP_PSR_END_ARG_INFO() | |
209 | ||
210 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUploadedFileInterface, getClientMediaType, 0) | |
211 | PHP_PSR_END_ARG_INFO() | |
212 | ||
213 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUriInterface, getScheme, 0) | |
214 | PHP_PSR_END_ARG_INFO() | |
215 | ||
216 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUriInterface, getAuthority, 0) | |
217 | PHP_PSR_END_ARG_INFO() | |
218 | ||
219 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUriInterface, getUserInfo, 0) | |
220 | PHP_PSR_END_ARG_INFO() | |
221 | ||
222 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUriInterface, getHost, 0) | |
223 | PHP_PSR_END_ARG_INFO() | |
224 | ||
225 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUriInterface, getPort, 0) | |
226 | PHP_PSR_END_ARG_INFO() | |
227 | ||
228 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUriInterface, getPath, 0) | |
229 | PHP_PSR_END_ARG_INFO() | |
230 | ||
231 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUriInterface, getQuery, 0) | |
232 | PHP_PSR_END_ARG_INFO() | |
233 | ||
234 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUriInterface, getFragment, 0) | |
235 | PHP_PSR_END_ARG_INFO() | |
236 | ||
237 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUriInterface, withScheme, 1) | |
238 | ZEND_ARG_INFO(0, scheme) | |
239 | PHP_PSR_END_ARG_INFO() | |
240 | ||
241 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUriInterface, withUserInfo, 1) | |
242 | ZEND_ARG_INFO(0, user) | |
243 | ZEND_ARG_INFO(0, password) | |
244 | PHP_PSR_END_ARG_INFO() | |
245 | ||
246 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUriInterface, withHost, 1) | |
247 | ZEND_ARG_INFO(0, host) | |
248 | PHP_PSR_END_ARG_INFO() | |
249 | ||
250 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUriInterface, withPort, 1) | |
251 | ZEND_ARG_INFO(0, port) | |
252 | PHP_PSR_END_ARG_INFO() | |
253 | ||
254 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUriInterface, withPath, 1) | |
255 | ZEND_ARG_INFO(0, path) | |
256 | PHP_PSR_END_ARG_INFO() | |
257 | ||
258 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUriInterface, withQuery, 1) | |
259 | ZEND_ARG_INFO(0, query) | |
260 | PHP_PSR_END_ARG_INFO() | |
261 | ||
262 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUriInterface, withFragment, 1) | |
263 | ZEND_ARG_INFO(0, fragment) | |
264 | PHP_PSR_END_ARG_INFO() | |
265 | ||
266 | PHP_PSR_BEGIN_ARG_INFO(PsrHttpMessageUriInterface, __toString, 0) | |
267 | PHP_PSR_END_ARG_INFO() | |
268 | ||
269 | #endif /* PSR_HTTP_MESSAGE_H */ | |
270 | ||
271 | /* | |
272 | * Local variables: | |
273 | * tab-width: 4 | |
274 | * c-basic-offset: 4 | |
275 | * End: | |
276 | * vim600: fdm=marker | |
277 | * vim: et sw=4 ts=4 | |
278 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include "php_psr.h" | |
7 | #include "psr_http_server_handler.h" | |
8 | ||
9 | /* {{{ RequestHandlerInterface ---------------------------------------------- */ | |
10 | ||
11 | PHP_PSR_API zend_class_entry * PsrHttpServerRequestHandlerInterface_ce_ptr; | |
12 | ||
13 | static zend_function_entry PsrHttpServerRequestHandlerInterface_methods[] = { | |
14 | PHP_PSR_ABSTRACT_ME(PsrHttpServerRequestHandlerInterface, handle) | |
15 | PHP_FE_END | |
16 | }; | |
17 | ||
18 | static zend_always_inline void php_psr_register_PsrHttpServerRequestHandlerInterface(INIT_FUNC_ARGS) | |
19 | { | |
20 | zend_class_entry ce; | |
21 | INIT_CLASS_ENTRY(ce, "Psr\\Http\\Server\\RequestHandlerInterface", PsrHttpServerRequestHandlerInterface_methods); | |
22 | PsrHttpServerRequestHandlerInterface_ce_ptr = zend_register_internal_interface(&ce); | |
23 | } | |
24 | ||
25 | /* }}} ---------------------------------------------------------------------- */ | |
26 | ||
27 | /* {{{ PHP_MINIT_FUNCTION */ | |
28 | PHP_MINIT_FUNCTION(psr_http_server_handler) | |
29 | { | |
30 | php_psr_register_PsrHttpServerRequestHandlerInterface(INIT_FUNC_ARGS_PASSTHRU); | |
31 | ||
32 | return SUCCESS; | |
33 | } | |
34 | /* }}} */ | |
35 | ||
36 | /* | |
37 | * Local variables: | |
38 | * tab-width: 4 | |
39 | * c-basic-offset: 4 | |
40 | * End: | |
41 | * vim600: fdm=marker | |
42 | * vim: et sw=4 ts=4 | |
43 | */ |
0 | #ifndef PSR_HTTP_SERVER_HANDLER_H | |
1 | #define PSR_HTTP_SERVER_HANDLER_H | |
2 | ||
3 | #include "php.h" | |
4 | #include "php_psr.h" | |
5 | ||
6 | #define PHP_PSR_HTTP_SERVER_HANDLER_VERSION "1.0.0" | |
7 | #define PHP_PSR_HTTP_SERVER_HANDLER_VERSION_ID 10000 | |
8 | ||
9 | extern PHP_MINIT_FUNCTION(psr_http_server_handler); | |
10 | ||
11 | extern PHP_PSR_API zend_class_entry * PsrHttpServerRequestHandlerInterface_ce_ptr; | |
12 | ||
13 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(PsrHttpServerRequestHandlerInterface, handle, 1, Psr\\Http\\Message\\ResponseInterface, 0) | |
14 | ZEND_ARG_OBJ_INFO(0, request, Psr\\Http\\Message\\ServerRequestInterface, 0) | |
15 | PHP_PSR_END_ARG_INFO() | |
16 | ||
17 | #endif /* PSR_HTTP_SERVER_HANDLER_H */ | |
18 | ||
19 | /* | |
20 | * Local variables: | |
21 | * tab-width: 4 | |
22 | * c-basic-offset: 4 | |
23 | * End: | |
24 | * vim600: fdm=marker | |
25 | * vim: et sw=4 ts=4 | |
26 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include "php_psr.h" | |
7 | #include "psr_http_server_middleware.h" | |
8 | ||
9 | /* {{{ MiddlewareInterface -------------------------------------------------- */ | |
10 | ||
11 | PHP_PSR_API zend_class_entry * PsrHttpServerMiddlewareInterface_ce_ptr; | |
12 | ||
13 | static zend_function_entry PsrHttpServerMiddlewareInterface_methods[] = { | |
14 | PHP_PSR_ABSTRACT_ME(PsrHttpServerMiddlewareInterface, process) | |
15 | PHP_FE_END | |
16 | }; | |
17 | ||
18 | static zend_always_inline void php_psr_register_PsrHttpServerMiddlewareInterface(INIT_FUNC_ARGS) | |
19 | { | |
20 | zend_class_entry ce; | |
21 | INIT_CLASS_ENTRY(ce, "Psr\\Http\\Server\\MiddlewareInterface", PsrHttpServerMiddlewareInterface_methods); | |
22 | PsrHttpServerMiddlewareInterface_ce_ptr = zend_register_internal_interface(&ce); | |
23 | } | |
24 | ||
25 | /* }}} ---------------------------------------------------------------------- */ | |
26 | ||
27 | /* {{{ PHP_MINIT_FUNCTION */ | |
28 | PHP_MINIT_FUNCTION(psr_http_server_middleware) | |
29 | { | |
30 | php_psr_register_PsrHttpServerMiddlewareInterface(INIT_FUNC_ARGS_PASSTHRU); | |
31 | ||
32 | return SUCCESS; | |
33 | } | |
34 | /* }}} */ | |
35 | ||
36 | /* | |
37 | * Local variables: | |
38 | * tab-width: 4 | |
39 | * c-basic-offset: 4 | |
40 | * End: | |
41 | * vim600: fdm=marker | |
42 | * vim: et sw=4 ts=4 | |
43 | */ |
0 | #ifndef PSR_HTTP_SERVER_MIDDLEWARE_H | |
1 | #define PSR_HTTP_SERVER_MIDDLEWARE_H | |
2 | ||
3 | #include "php.h" | |
4 | #include "php_psr.h" | |
5 | ||
6 | #define PHP_PSR_HTTP_SERVER_MIDDLEWARE_VERSION "1.0.0" | |
7 | #define PHP_PSR_HTTP_SERVER_MIDDLEWARE_VERSION_ID 10000 | |
8 | ||
9 | extern PHP_MINIT_FUNCTION(psr_http_server_middleware); | |
10 | ||
11 | extern PHP_PSR_API zend_class_entry * PsrHttpServerMiddlewareInterface_ce_ptr; | |
12 | ||
13 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(PsrHttpServerMiddlewareInterface, process, 2, Psr\\Http\\Message\\ResponseInterface, 0) | |
14 | ZEND_ARG_OBJ_INFO(0, request, Psr\\Http\\Message\\ServerRequestInterface, 0) | |
15 | ZEND_ARG_OBJ_INFO(0, handler, Psr\\Http\\Server\\RequestHandlerInterface, 0) | |
16 | PHP_PSR_END_ARG_INFO() | |
17 | ||
18 | #endif /* PSR_HTTP_SERVER_MIDDLEWARE_H */ | |
19 | ||
20 | /* | |
21 | * Local variables: | |
22 | * tab-width: 4 | |
23 | * c-basic-offset: 4 | |
24 | * End: | |
25 | * vim600: fdm=marker | |
26 | * vim: et sw=4 ts=4 | |
27 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | ||
7 | #include "php_psr.h" | |
8 | #include "psr_link.h" | |
9 | ||
10 | /* {{{ EvolvableLinkInterface ----------------------------------------------- */ | |
11 | ||
12 | PHP_PSR_API zend_class_entry * PsrLinkEvolvableLinkInterface_ce_ptr; | |
13 | ||
14 | static zend_function_entry PsrLinkEvolvableLinkInterface_methods[] = { | |
15 | PHP_PSR_ABSTRACT_ME(PsrLinkEvolvableLinkInterface, withHref) | |
16 | PHP_PSR_ABSTRACT_ME(PsrLinkEvolvableLinkInterface, withRel) | |
17 | PHP_PSR_ABSTRACT_ME(PsrLinkEvolvableLinkInterface, withoutRel) | |
18 | PHP_PSR_ABSTRACT_ME(PsrLinkEvolvableLinkInterface, withAttribute) | |
19 | PHP_PSR_ABSTRACT_ME(PsrLinkEvolvableLinkInterface, withoutAttribute) | |
20 | PHP_FE_END | |
21 | }; | |
22 | ||
23 | static zend_always_inline void php_psr_register_PsrLinkEvolvableLinkInterface(INIT_FUNC_ARGS) | |
24 | { | |
25 | zend_class_entry ce; | |
26 | INIT_CLASS_ENTRY(ce, "Psr\\Link\\EvolvableLinkInterface", PsrLinkEvolvableLinkInterface_methods); | |
27 | PsrLinkEvolvableLinkInterface_ce_ptr = zend_register_internal_interface(&ce); | |
28 | zend_class_implements(PsrLinkEvolvableLinkInterface_ce_ptr, 1, PsrLinkLinkInterface_ce_ptr); | |
29 | } | |
30 | ||
31 | /* }}} ---------------------------------------------------------------------- */ | |
32 | /* {{{ PsrLinkEvolvableLinkProviderInterface -------------------------------- */ | |
33 | ||
34 | PHP_PSR_API zend_class_entry * PsrLinkEvolvableLinkProviderInterface_ce_ptr; | |
35 | ||
36 | static zend_function_entry PsrLinkEvolvableLinkProviderInterface_methods[] = { | |
37 | PHP_PSR_ABSTRACT_ME(PsrLinkEvolvableLinkProviderInterface, withLink) | |
38 | PHP_PSR_ABSTRACT_ME(PsrLinkEvolvableLinkProviderInterface, withoutLink) | |
39 | PHP_FE_END | |
40 | }; | |
41 | ||
42 | static zend_always_inline void php_psr_register_PsrLinkEvolvableLinkProviderInterface(INIT_FUNC_ARGS) | |
43 | { | |
44 | zend_class_entry ce; | |
45 | INIT_CLASS_ENTRY(ce, "Psr\\Link\\EvolvableLinkProviderInterface", PsrLinkEvolvableLinkProviderInterface_methods); | |
46 | PsrLinkEvolvableLinkProviderInterface_ce_ptr = zend_register_internal_interface(&ce); | |
47 | zend_class_implements(PsrLinkEvolvableLinkProviderInterface_ce_ptr, 1, PsrLinkLinkProviderInterface_ce_ptr); | |
48 | } | |
49 | ||
50 | /* }}} ---------------------------------------------------------------------- */ | |
51 | /* {{{ PsrLinkLinkInterface -------------------------------- */ | |
52 | ||
53 | PHP_PSR_API zend_class_entry * PsrLinkLinkInterface_ce_ptr; | |
54 | ||
55 | static zend_function_entry PsrLinkLinkInterface_methods[] = { | |
56 | PHP_PSR_ABSTRACT_ME(PsrLinkLinkInterface, getHref) | |
57 | PHP_PSR_ABSTRACT_ME(PsrLinkLinkInterface, isTemplated) | |
58 | PHP_PSR_ABSTRACT_ME(PsrLinkLinkInterface, getRels) | |
59 | PHP_PSR_ABSTRACT_ME(PsrLinkLinkInterface, getAttributes) | |
60 | PHP_FE_END | |
61 | }; | |
62 | ||
63 | static zend_always_inline void php_psr_register_PsrLinkLinkInterface(INIT_FUNC_ARGS) | |
64 | { | |
65 | zend_class_entry ce; | |
66 | INIT_CLASS_ENTRY(ce, "Psr\\Link\\LinkInterface", PsrLinkLinkInterface_methods); | |
67 | PsrLinkLinkInterface_ce_ptr = zend_register_internal_interface(&ce); | |
68 | } | |
69 | ||
70 | /* }}} ---------------------------------------------------------------------- */ | |
71 | /* {{{ LinkProviderInterface ------------------------------------------------ */ | |
72 | ||
73 | PHP_PSR_API zend_class_entry * PsrLinkLinkProviderInterface_ce_ptr; | |
74 | ||
75 | static zend_function_entry PsrLinkLinkProviderInterface_methods[] = { | |
76 | PHP_PSR_ABSTRACT_ME(PsrLinkLinkProviderInterface, getLinks) | |
77 | PHP_PSR_ABSTRACT_ME(PsrLinkLinkProviderInterface, getLinksByRel) | |
78 | PHP_FE_END | |
79 | }; | |
80 | ||
81 | static zend_always_inline void php_psr_register_PsrLinkLinkProviderInterface(INIT_FUNC_ARGS) | |
82 | { | |
83 | zend_class_entry ce; | |
84 | INIT_CLASS_ENTRY(ce, "Psr\\Link\\LinkProviderInterface", PsrLinkLinkProviderInterface_methods); | |
85 | PsrLinkLinkProviderInterface_ce_ptr = zend_register_internal_interface(&ce); | |
86 | } | |
87 | ||
88 | /* }}} ---------------------------------------------------------------------- */ | |
89 | ||
90 | /* {{{ PHP_MINIT_FUNCTION */ | |
91 | PHP_MINIT_FUNCTION(psr_link) | |
92 | { | |
93 | php_psr_register_PsrLinkLinkInterface(INIT_FUNC_ARGS_PASSTHRU); | |
94 | php_psr_register_PsrLinkLinkProviderInterface(INIT_FUNC_ARGS_PASSTHRU); | |
95 | php_psr_register_PsrLinkEvolvableLinkInterface(INIT_FUNC_ARGS_PASSTHRU); | |
96 | php_psr_register_PsrLinkEvolvableLinkProviderInterface(INIT_FUNC_ARGS_PASSTHRU); | |
97 | ||
98 | return SUCCESS; | |
99 | } | |
100 | /* }}} */ | |
101 | ||
102 | /* | |
103 | * Local variables: | |
104 | * tab-width: 4 | |
105 | * c-basic-offset: 4 | |
106 | * End: | |
107 | * vim600: fdm=marker | |
108 | * vim: et sw=4 ts=4 | |
109 | */ |
0 | ||
1 | #ifndef PSR_LINK_H | |
2 | #define PSR_LINK_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_psr.h" | |
6 | ||
7 | #define PHP_PSR_LINK_VERSION "1.0.0" | |
8 | #define PHP_PSR_LINK_VERSION_ID 10000 | |
9 | ||
10 | extern PHP_PSR_API zend_class_entry * PsrLinkEvolvableLinkInterface_ce_ptr; | |
11 | extern PHP_PSR_API zend_class_entry * PsrLinkEvolvableLinkProviderInterface_ce_ptr; | |
12 | extern PHP_PSR_API zend_class_entry * PsrLinkLinkInterface_ce_ptr; | |
13 | extern PHP_PSR_API zend_class_entry * PsrLinkLinkProviderInterface_ce_ptr; | |
14 | ||
15 | extern PHP_MINIT_FUNCTION(psr_link); | |
16 | ||
17 | PHP_PSR_BEGIN_ARG_INFO(PsrLinkEvolvableLinkInterface, withHref, 1) | |
18 | ZEND_ARG_INFO(0, href) | |
19 | PHP_PSR_END_ARG_INFO() | |
20 | ||
21 | PHP_PSR_BEGIN_ARG_INFO(PsrLinkEvolvableLinkInterface, withRel, 1) | |
22 | ZEND_ARG_INFO(0, rel) | |
23 | PHP_PSR_END_ARG_INFO() | |
24 | ||
25 | PHP_PSR_BEGIN_ARG_INFO(PsrLinkEvolvableLinkInterface, withoutRel, 1) | |
26 | ZEND_ARG_INFO(0, rel) | |
27 | PHP_PSR_END_ARG_INFO() | |
28 | ||
29 | PHP_PSR_BEGIN_ARG_INFO(PsrLinkEvolvableLinkInterface, withAttribute, 2) | |
30 | ZEND_ARG_INFO(0, attribute) | |
31 | ZEND_ARG_INFO(0, value) | |
32 | PHP_PSR_END_ARG_INFO() | |
33 | ||
34 | PHP_PSR_BEGIN_ARG_INFO(PsrLinkEvolvableLinkInterface, withoutAttribute, 1) | |
35 | ZEND_ARG_INFO(0, attribute) | |
36 | PHP_PSR_END_ARG_INFO() | |
37 | ||
38 | PHP_PSR_BEGIN_ARG_INFO(PsrLinkEvolvableLinkProviderInterface, withLink, 1) | |
39 | ZEND_ARG_OBJ_INFO(0, link, Psr\\Link\\LinkInterface, 0) | |
40 | PHP_PSR_END_ARG_INFO() | |
41 | ||
42 | PHP_PSR_BEGIN_ARG_INFO(PsrLinkEvolvableLinkProviderInterface, withoutLink, 1) | |
43 | ZEND_ARG_OBJ_INFO(0, link, Psr\\Link\\LinkInterface, 0) | |
44 | PHP_PSR_END_ARG_INFO() | |
45 | ||
46 | PHP_PSR_BEGIN_ARG_INFO(PsrLinkLinkInterface, getHref, 0) | |
47 | PHP_PSR_END_ARG_INFO() | |
48 | ||
49 | PHP_PSR_BEGIN_ARG_INFO(PsrLinkLinkInterface, isTemplated, 0) | |
50 | PHP_PSR_END_ARG_INFO() | |
51 | ||
52 | PHP_PSR_BEGIN_ARG_INFO(PsrLinkLinkInterface, getRels, 0) | |
53 | PHP_PSR_END_ARG_INFO() | |
54 | ||
55 | PHP_PSR_BEGIN_ARG_INFO(PsrLinkLinkInterface, getAttributes, 0) | |
56 | PHP_PSR_END_ARG_INFO() | |
57 | ||
58 | PHP_PSR_BEGIN_ARG_INFO(PsrLinkLinkProviderInterface, getLinks, 0) | |
59 | PHP_PSR_END_ARG_INFO() | |
60 | ||
61 | PHP_PSR_BEGIN_ARG_INFO(PsrLinkLinkProviderInterface, getLinksByRel, 1) | |
62 | ZEND_ARG_INFO(0, rel) | |
63 | PHP_PSR_END_ARG_INFO() | |
64 | ||
65 | #endif /* PSR_LINK_H */ | |
66 | ||
67 | /* | |
68 | * Local variables: | |
69 | * tab-width: 4 | |
70 | * c-basic-offset: 4 | |
71 | * End: | |
72 | * vim600: fdm=marker | |
73 | * vim: et sw=4 ts=4 | |
74 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include "php_ini.h" | |
7 | #include "ext/standard/info.h" | |
8 | #include "ext/spl/spl_exceptions.h" | |
9 | #include "zend_API.h" | |
10 | #include "zend_interfaces.h" | |
11 | ||
12 | #include "php_psr.h" | |
13 | #include "psr_log.h" | |
14 | ||
15 | /* Needed to work around https://bugs.php.net/bug.php?id=69579 */ | |
16 | #define PHP_PSR_EXTRA_TRAIT_FLAGS ZEND_ACC_ARENA_ALLOCATED | |
17 | ||
18 | /* {{{ Psr\Log\InvalidArgumentException */ | |
19 | ||
20 | PHP_PSR_API zend_class_entry * PsrLogInvalidArgumentException_ce_ptr; | |
21 | ||
22 | static zend_always_inline void php_psr_register_InvalidArgumentException(INIT_FUNC_ARGS) | |
23 | { | |
24 | zend_class_entry ce; | |
25 | INIT_CLASS_ENTRY(ce, "Psr\\Log\\InvalidArgumentException", NULL); | |
26 | PsrLogInvalidArgumentException_ce_ptr = zend_register_internal_class_ex(&ce, spl_ce_InvalidArgumentException); | |
27 | } | |
28 | ||
29 | /* }}} Psr\Log\InvalidArgumentException */ | |
30 | /* {{{ Psr\Log\LogLevel */ | |
31 | ||
32 | PHP_PSR_API zend_class_entry * PsrLogLogLevel_ce_ptr; | |
33 | ||
34 | static zend_always_inline void php_psr_register_LogLevel(INIT_FUNC_ARGS) | |
35 | { | |
36 | zend_class_entry ce; | |
37 | ||
38 | INIT_CLASS_ENTRY(ce, "Psr\\Log\\LogLevel", NULL); | |
39 | PsrLogLogLevel_ce_ptr = zend_register_internal_class(&ce); | |
40 | ||
41 | REGISTER_PSR_CLASS_CONST_STRING(PsrLogLogLevel_ce_ptr, "EMERGENCY", "emergency"); | |
42 | REGISTER_PSR_CLASS_CONST_STRING(PsrLogLogLevel_ce_ptr, "ALERT", "alert"); | |
43 | REGISTER_PSR_CLASS_CONST_STRING(PsrLogLogLevel_ce_ptr, "CRITICAL", "critical"); | |
44 | REGISTER_PSR_CLASS_CONST_STRING(PsrLogLogLevel_ce_ptr, "ERROR", "error"); | |
45 | REGISTER_PSR_CLASS_CONST_STRING(PsrLogLogLevel_ce_ptr, "WARNING", "warning"); | |
46 | REGISTER_PSR_CLASS_CONST_STRING(PsrLogLogLevel_ce_ptr, "NOTICE", "notice"); | |
47 | REGISTER_PSR_CLASS_CONST_STRING(PsrLogLogLevel_ce_ptr, "INFO", "info"); | |
48 | REGISTER_PSR_CLASS_CONST_STRING(PsrLogLogLevel_ce_ptr, "DEBUG", "debug"); | |
49 | ||
50 | } | |
51 | ||
52 | /* }}} Psr\Log\LogLevel */ | |
53 | /* {{{ Psr\Log\LoggerInterface */ | |
54 | ||
55 | PHP_PSR_API zend_class_entry * PsrLogLoggerInterface_ce_ptr; | |
56 | ||
57 | static zend_function_entry PsrLogLoggerInterface_methods[] = { | |
58 | PHP_PSR_ABSTRACT_ME(PsrLogLoggerInterface, emergency) | |
59 | PHP_PSR_ABSTRACT_ME(PsrLogLoggerInterface, alert) | |
60 | PHP_PSR_ABSTRACT_ME(PsrLogLoggerInterface, critical) | |
61 | PHP_PSR_ABSTRACT_ME(PsrLogLoggerInterface, error) | |
62 | PHP_PSR_ABSTRACT_ME(PsrLogLoggerInterface, warning) | |
63 | PHP_PSR_ABSTRACT_ME(PsrLogLoggerInterface, notice) | |
64 | PHP_PSR_ABSTRACT_ME(PsrLogLoggerInterface, info) | |
65 | PHP_PSR_ABSTRACT_ME(PsrLogLoggerInterface, debug) | |
66 | PHP_PSR_ABSTRACT_ME(PsrLogLoggerInterface, log) | |
67 | PHP_FE_END | |
68 | }; | |
69 | ||
70 | static zend_always_inline void php_psr_register_LoggerInterface(INIT_FUNC_ARGS) { | |
71 | zend_class_entry ce; | |
72 | INIT_CLASS_ENTRY(ce, "Psr\\Log\\LoggerInterface", PsrLogLoggerInterface_methods); | |
73 | PsrLogLoggerInterface_ce_ptr = zend_register_internal_interface(&ce); | |
74 | } | |
75 | ||
76 | /* }}} Psr\Log\LoggerInterface */ | |
77 | /* {{{ Psr\Log\LoggerAwareInterface */ | |
78 | ||
79 | PHP_PSR_API zend_class_entry * PsrLogLoggerAwareInterface_ce_ptr; | |
80 | ||
81 | static zend_function_entry PsrLogLoggerAwareInterface_methods[] = { | |
82 | PHP_PSR_ABSTRACT_ME(PsrLogLoggerAwareInterface, setLogger) | |
83 | PHP_FE_END | |
84 | }; | |
85 | ||
86 | static zend_always_inline void php_psr_register_LoggerAwareInterface(INIT_FUNC_ARGS) | |
87 | { | |
88 | zend_class_entry ce; | |
89 | INIT_CLASS_ENTRY(ce, "Psr\\Log\\LoggerAwareInterface", PsrLogLoggerAwareInterface_methods); | |
90 | PsrLogLoggerAwareInterface_ce_ptr = zend_register_internal_interface(&ce); | |
91 | } | |
92 | ||
93 | /* }}} Psr\Log\LoggerAwareInterface */ | |
94 | /* {{{ Psr\Log\AbstractLogger */ | |
95 | ||
96 | PHP_PSR_API zend_class_entry * PsrLogAbstractLogger_ce_ptr; | |
97 | ||
98 | static void php_psr_PsrLogAbstractLogger_log(const char * level_str, size_t level_len, INTERNAL_FUNCTION_PARAMETERS) | |
99 | { | |
100 | zval * _this_zval = getThis(); | |
101 | zval * message; | |
102 | zval * context = NULL; | |
103 | zval fname = {0}; | |
104 | zval fparams[3]; | |
105 | ||
106 | ZEND_PARSE_PARAMETERS_START(1, 2) | |
107 | Z_PARAM_ZVAL(message) | |
108 | Z_PARAM_OPTIONAL | |
109 | Z_PARAM_ARRAY(context) | |
110 | ZEND_PARSE_PARAMETERS_END(); | |
111 | ||
112 | // Alloc function name to call | |
113 | ZVAL_STRINGL(&fname, "log", sizeof("log")-1); | |
114 | ||
115 | // Make function params | |
116 | ZVAL_STRINGL(&fparams[0], level_str, level_len); | |
117 | ZVAL_ZVAL(&fparams[1], message, 0, 0); | |
118 | if( context && Z_TYPE_P(context) == IS_ARRAY ) { | |
119 | ZVAL_ZVAL(&fparams[2], context, 1, 0); | |
120 | } else { | |
121 | array_init(&fparams[2]); | |
122 | } | |
123 | ||
124 | call_user_function(&Z_OBJCE_P(_this_zval)->function_table, _this_zval, &fname, return_value, 3, fparams); | |
125 | ||
126 | zval_ptr_dtor(&fparams[0]); | |
127 | zval_ptr_dtor(&fparams[2]); | |
128 | zval_ptr_dtor(&fname); | |
129 | } | |
130 | ||
131 | PHP_METHOD(PsrLogAbstractLogger, emergency) | |
132 | { | |
133 | php_psr_PsrLogAbstractLogger_log(ZEND_STRL("emergency"), INTERNAL_FUNCTION_PARAM_PASSTHRU); | |
134 | } | |
135 | ||
136 | PHP_METHOD(PsrLogAbstractLogger, alert) | |
137 | { | |
138 | php_psr_PsrLogAbstractLogger_log(ZEND_STRL("alert"), INTERNAL_FUNCTION_PARAM_PASSTHRU); | |
139 | } | |
140 | ||
141 | PHP_METHOD(PsrLogAbstractLogger, critical) | |
142 | { | |
143 | php_psr_PsrLogAbstractLogger_log(ZEND_STRL("critical"), INTERNAL_FUNCTION_PARAM_PASSTHRU); | |
144 | } | |
145 | ||
146 | PHP_METHOD(PsrLogAbstractLogger, error) | |
147 | { | |
148 | php_psr_PsrLogAbstractLogger_log(ZEND_STRL("error"), INTERNAL_FUNCTION_PARAM_PASSTHRU); | |
149 | } | |
150 | ||
151 | PHP_METHOD(PsrLogAbstractLogger, warning) | |
152 | { | |
153 | php_psr_PsrLogAbstractLogger_log(ZEND_STRL("warning"), INTERNAL_FUNCTION_PARAM_PASSTHRU); | |
154 | } | |
155 | ||
156 | PHP_METHOD(PsrLogAbstractLogger, notice) | |
157 | { | |
158 | php_psr_PsrLogAbstractLogger_log(ZEND_STRL("notice"), INTERNAL_FUNCTION_PARAM_PASSTHRU); | |
159 | } | |
160 | ||
161 | PHP_METHOD(PsrLogAbstractLogger, info) | |
162 | { | |
163 | php_psr_PsrLogAbstractLogger_log(ZEND_STRL("info"), INTERNAL_FUNCTION_PARAM_PASSTHRU); | |
164 | } | |
165 | ||
166 | PHP_METHOD(PsrLogAbstractLogger, debug) | |
167 | { | |
168 | php_psr_PsrLogAbstractLogger_log(ZEND_STRL("debug"), INTERNAL_FUNCTION_PARAM_PASSTHRU); | |
169 | } | |
170 | ||
171 | static zend_function_entry PsrLogAbstractLogger_methods[] = { | |
172 | PHP_ME(PsrLogAbstractLogger, emergency, arginfo_PsrLogLoggerInterface_emergency, ZEND_ACC_PUBLIC) | |
173 | PHP_ME(PsrLogAbstractLogger, alert, arginfo_PsrLogLoggerInterface_alert, ZEND_ACC_PUBLIC) | |
174 | PHP_ME(PsrLogAbstractLogger, critical, arginfo_PsrLogLoggerInterface_critical, ZEND_ACC_PUBLIC) | |
175 | PHP_ME(PsrLogAbstractLogger, error, arginfo_PsrLogLoggerInterface_error, ZEND_ACC_PUBLIC) | |
176 | PHP_ME(PsrLogAbstractLogger, warning, arginfo_PsrLogLoggerInterface_warning, ZEND_ACC_PUBLIC) | |
177 | PHP_ME(PsrLogAbstractLogger, notice, arginfo_PsrLogLoggerInterface_notice, ZEND_ACC_PUBLIC) | |
178 | PHP_ME(PsrLogAbstractLogger, info, arginfo_PsrLogLoggerInterface_info, ZEND_ACC_PUBLIC) | |
179 | PHP_ME(PsrLogAbstractLogger, debug, arginfo_PsrLogLoggerInterface_debug, ZEND_ACC_PUBLIC) | |
180 | PHP_FE_END | |
181 | }; | |
182 | ||
183 | static zend_always_inline void php_psr_register_AbstractLogger(INIT_FUNC_ARGS) | |
184 | { | |
185 | zend_class_entry ce; | |
186 | INIT_CLASS_ENTRY(ce, "Psr\\Log\\AbstractLogger", PsrLogAbstractLogger_methods); | |
187 | PsrLogAbstractLogger_ce_ptr = zend_register_internal_class(&ce); | |
188 | zend_class_implements(PsrLogAbstractLogger_ce_ptr, 1, PsrLogLoggerInterface_ce_ptr); | |
189 | } | |
190 | ||
191 | /* }}} Psr\Log\AbstractLogger */ | |
192 | /* {{{ Psr\Log\NullLogger */ | |
193 | ||
194 | PHP_PSR_API zend_class_entry * PsrLogNullLogger_ce_ptr; | |
195 | ||
196 | PHP_METHOD(PsrLogNullLogger, log) | |
197 | { | |
198 | // noop | |
199 | } | |
200 | ||
201 | static zend_function_entry PsrLogNullLogger_methods[] = { | |
202 | PHP_ME(PsrLogNullLogger, log, arginfo_PsrLogLoggerInterface_log, ZEND_ACC_PUBLIC) | |
203 | PHP_FE_END | |
204 | }; | |
205 | ||
206 | static zend_always_inline void php_psr_register_NullLogger(INIT_FUNC_ARGS) | |
207 | { | |
208 | zend_class_entry ce; | |
209 | INIT_CLASS_ENTRY(ce, "Psr\\Log\\NullLogger", PsrLogNullLogger_methods); | |
210 | PsrLogNullLogger_ce_ptr = zend_register_internal_class_ex(&ce, PsrLogAbstractLogger_ce_ptr); | |
211 | } | |
212 | ||
213 | /* }}} Psr\Log\NullLogger */ | |
214 | /* {{{ Psr\Log\LoggerTrait */ | |
215 | ||
216 | PHP_PSR_API zend_class_entry * PsrLogLoggerTrait_ce_ptr; | |
217 | ||
218 | static zend_function_entry PsrLogLoggerTrait_methods[] = { | |
219 | PHP_ME(PsrLogAbstractLogger, emergency, arginfo_PsrLogLoggerInterface_emergency, ZEND_ACC_PUBLIC | PHP_PSR_EXTRA_TRAIT_FLAGS) | |
220 | PHP_ME(PsrLogAbstractLogger, alert, arginfo_PsrLogLoggerInterface_alert, ZEND_ACC_PUBLIC | PHP_PSR_EXTRA_TRAIT_FLAGS) | |
221 | PHP_ME(PsrLogAbstractLogger, critical, arginfo_PsrLogLoggerInterface_critical, ZEND_ACC_PUBLIC | PHP_PSR_EXTRA_TRAIT_FLAGS) | |
222 | PHP_ME(PsrLogAbstractLogger, error, arginfo_PsrLogLoggerInterface_error, ZEND_ACC_PUBLIC | PHP_PSR_EXTRA_TRAIT_FLAGS) | |
223 | PHP_ME(PsrLogAbstractLogger, warning, arginfo_PsrLogLoggerInterface_warning, ZEND_ACC_PUBLIC | PHP_PSR_EXTRA_TRAIT_FLAGS) | |
224 | PHP_ME(PsrLogAbstractLogger, notice, arginfo_PsrLogLoggerInterface_notice, ZEND_ACC_PUBLIC | PHP_PSR_EXTRA_TRAIT_FLAGS) | |
225 | PHP_ME(PsrLogAbstractLogger, info, arginfo_PsrLogLoggerInterface_info, ZEND_ACC_PUBLIC | PHP_PSR_EXTRA_TRAIT_FLAGS) | |
226 | PHP_ME(PsrLogAbstractLogger, debug, arginfo_PsrLogLoggerInterface_debug, ZEND_ACC_PUBLIC | PHP_PSR_EXTRA_TRAIT_FLAGS) | |
227 | PHP_ABSTRACT_ME(PsrLogNullLogger, log, arginfo_PsrLogLoggerInterface_log) | |
228 | PHP_FE_END | |
229 | }; | |
230 | ||
231 | static zend_always_inline void php_psr_register_LoggerTrait(INIT_FUNC_ARGS) | |
232 | { | |
233 | zend_class_entry ce; | |
234 | INIT_CLASS_ENTRY(ce, "Psr\\Log\\LoggerTrait", PsrLogLoggerTrait_methods); | |
235 | PsrLogLoggerTrait_ce_ptr = zend_register_internal_class(&ce); | |
236 | PsrLogLoggerTrait_ce_ptr->ce_flags |= ZEND_ACC_TRAIT; | |
237 | } | |
238 | ||
239 | /* }}} Psr\Log\LoggerTrait */ | |
240 | /* {{{ Psr\Log\LoggerAwareTrait */ | |
241 | ||
242 | PHP_PSR_API zend_class_entry * PsrLogLoggerAwareTrait_ce_ptr; | |
243 | ||
244 | PHP_METHOD(PsrLogLoggerAwareTrait, setLogger) | |
245 | { | |
246 | zval * _this_zval = getThis(); | |
247 | zval * logger; | |
248 | ||
249 | ZEND_PARSE_PARAMETERS_START(1, 1) | |
250 | Z_PARAM_OBJECT_OF_CLASS(logger, PsrLogLoggerInterface_ce_ptr) | |
251 | ZEND_PARSE_PARAMETERS_END(); | |
252 | ||
253 | #if PHP_VERSION_ID < 80000 | |
254 | zend_update_property(Z_OBJCE_P(_this_zval), _this_zval, "logger", sizeof("logger")-1, logger); | |
255 | #else | |
256 | zend_update_property(Z_OBJCE_P(_this_zval), Z_OBJ_P(_this_zval), "logger", sizeof("logger")-1, logger); | |
257 | #endif | |
258 | } | |
259 | ||
260 | static zend_function_entry PsrLogLoggerAwareTrait_methods[] = { | |
261 | PHP_ME(PsrLogLoggerAwareTrait, setLogger, arginfo_PsrLogLoggerAwareInterface_setLogger, ZEND_ACC_PUBLIC | PHP_PSR_EXTRA_TRAIT_FLAGS) | |
262 | PHP_FE_END | |
263 | }; | |
264 | ||
265 | static zend_always_inline void php_psr_register_LoggerAwareTrait(INIT_FUNC_ARGS) | |
266 | { | |
267 | zend_class_entry ce; | |
268 | INIT_CLASS_ENTRY(ce, "Psr\\Log\\LoggerAwareTrait", PsrLogLoggerAwareTrait_methods); | |
269 | //ce.ce_flags |= ZEND_ACC_TRAIT; | |
270 | PsrLogLoggerAwareTrait_ce_ptr = zend_register_internal_class(&ce); | |
271 | PsrLogLoggerAwareTrait_ce_ptr->ce_flags |= ZEND_ACC_TRAIT; | |
272 | zend_declare_property_null(PsrLogLoggerAwareTrait_ce_ptr, "logger", sizeof("logger")-1, ZEND_ACC_PROTECTED); | |
273 | } | |
274 | ||
275 | /* }}} Psr\Log\LoggerAwareTrait */ | |
276 | ||
277 | /* {{{ PHP_MINIT_FUNCTION */ | |
278 | PHP_MINIT_FUNCTION(psr_log) | |
279 | { | |
280 | php_psr_register_InvalidArgumentException(INIT_FUNC_ARGS_PASSTHRU); | |
281 | php_psr_register_LogLevel(INIT_FUNC_ARGS_PASSTHRU); | |
282 | php_psr_register_LoggerInterface(INIT_FUNC_ARGS_PASSTHRU); | |
283 | php_psr_register_LoggerAwareInterface(INIT_FUNC_ARGS_PASSTHRU); | |
284 | php_psr_register_AbstractLogger(INIT_FUNC_ARGS_PASSTHRU); | |
285 | php_psr_register_NullLogger(INIT_FUNC_ARGS_PASSTHRU); | |
286 | php_psr_register_LoggerTrait(INIT_FUNC_ARGS_PASSTHRU); | |
287 | php_psr_register_LoggerAwareTrait(INIT_FUNC_ARGS_PASSTHRU); | |
288 | ||
289 | return SUCCESS; | |
290 | } | |
291 | /* }}} */ | |
292 | ||
293 | /* | |
294 | * Local variables: | |
295 | * tab-width: 4 | |
296 | * c-basic-offset: 4 | |
297 | * End: | |
298 | * vim600: fdm=marker | |
299 | * vim: et sw=4 ts=4 | |
300 | */ |
0 | ||
1 | #ifndef PSR_LOG_H | |
2 | #define PSR_LOG_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_psr.h" | |
6 | ||
7 | #define PHP_PSR_LOG_VERSION "1.0.0" | |
8 | #define PHP_PSR_LOG_VERSION_ID 10000 | |
9 | ||
10 | extern PHP_PSR_API zend_class_entry * PsrLogInvalidArgumentException_ce_ptr; | |
11 | extern PHP_PSR_API zend_class_entry * PsrLogLogLevel_ce_ptr; | |
12 | extern PHP_PSR_API zend_class_entry * PsrLogLoggerInterface_ce_ptr; | |
13 | extern PHP_PSR_API zend_class_entry * PsrLogLoggerAwareInterface_ce_ptr; | |
14 | extern PHP_PSR_API zend_class_entry * PsrLogAbstractLogger_ce_ptr; | |
15 | extern PHP_PSR_API zend_class_entry * PsrLogNullLogger_ce_ptr; | |
16 | extern PHP_PSR_API zend_class_entry * PsrLogLoggerTrait_ce_ptr; | |
17 | extern PHP_PSR_API zend_class_entry * PsrLogLoggerAwareTrait_ce_ptr; | |
18 | ||
19 | extern PHP_MINIT_FUNCTION(psr_log); | |
20 | ||
21 | #if PHP_VERSION_ID < 80000 | |
22 | #define PHP_PSR_CONTEXT_PARAM ZEND_ARG_ARRAY_INFO(0, context, 0) | |
23 | #else | |
24 | #define PHP_PSR_CONTEXT_PARAM ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, context, IS_ARRAY, 0, "[]") | |
25 | #endif | |
26 | ||
27 | PHP_PSR_BEGIN_ARG_INFO(PsrLogLoggerInterface, emergency, 1) | |
28 | ZEND_ARG_INFO(0, message) | |
29 | PHP_PSR_CONTEXT_PARAM | |
30 | PHP_PSR_END_ARG_INFO() | |
31 | ||
32 | PHP_PSR_BEGIN_ARG_INFO(PsrLogLoggerInterface, alert, 1) | |
33 | ZEND_ARG_INFO(0, message) | |
34 | PHP_PSR_CONTEXT_PARAM | |
35 | PHP_PSR_END_ARG_INFO() | |
36 | ||
37 | PHP_PSR_BEGIN_ARG_INFO(PsrLogLoggerInterface, critical, 1) | |
38 | ZEND_ARG_INFO(0, message) | |
39 | PHP_PSR_CONTEXT_PARAM | |
40 | PHP_PSR_END_ARG_INFO() | |
41 | ||
42 | PHP_PSR_BEGIN_ARG_INFO(PsrLogLoggerInterface, error, 1) | |
43 | ZEND_ARG_INFO(0, message) | |
44 | PHP_PSR_CONTEXT_PARAM | |
45 | PHP_PSR_END_ARG_INFO() | |
46 | ||
47 | PHP_PSR_BEGIN_ARG_INFO(PsrLogLoggerInterface, warning, 1) | |
48 | ZEND_ARG_INFO(0, message) | |
49 | PHP_PSR_CONTEXT_PARAM | |
50 | PHP_PSR_END_ARG_INFO() | |
51 | ||
52 | PHP_PSR_BEGIN_ARG_INFO(PsrLogLoggerInterface, notice, 1) | |
53 | ZEND_ARG_INFO(0, message) | |
54 | PHP_PSR_CONTEXT_PARAM | |
55 | PHP_PSR_END_ARG_INFO() | |
56 | ||
57 | PHP_PSR_BEGIN_ARG_INFO(PsrLogLoggerInterface, info, 1) | |
58 | ZEND_ARG_INFO(0, message) | |
59 | PHP_PSR_CONTEXT_PARAM | |
60 | PHP_PSR_END_ARG_INFO() | |
61 | ||
62 | PHP_PSR_BEGIN_ARG_INFO(PsrLogLoggerInterface, debug, 1) | |
63 | ZEND_ARG_INFO(0, message) | |
64 | PHP_PSR_CONTEXT_PARAM | |
65 | PHP_PSR_END_ARG_INFO() | |
66 | ||
67 | PHP_PSR_BEGIN_ARG_INFO(PsrLogLoggerInterface, log, 2) | |
68 | ZEND_ARG_INFO(0, level) | |
69 | ZEND_ARG_INFO(0, message) | |
70 | PHP_PSR_CONTEXT_PARAM | |
71 | PHP_PSR_END_ARG_INFO() | |
72 | ||
73 | PHP_PSR_BEGIN_ARG_INFO(PsrLogLoggerAwareInterface, setLogger, 1) | |
74 | ZEND_ARG_OBJ_INFO(0, logger, Psr\\Log\\LoggerInterface, 0) | |
75 | PHP_PSR_END_ARG_INFO(); | |
76 | ||
77 | #endif /* PSR_LOG_H */ | |
78 | ||
79 | /* | |
80 | * Local variables: | |
81 | * tab-width: 4 | |
82 | * c-basic-offset: 4 | |
83 | * End: | |
84 | * vim600: fdm=marker | |
85 | * vim: et sw=4 ts=4 | |
86 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include "php_ini.h" | |
7 | #include "ext/standard/info.h" | |
8 | #include "ext/spl/spl_exceptions.h" | |
9 | #include "zend_API.h" | |
10 | #include "zend_interfaces.h" | |
11 | ||
12 | #include "php_psr.h" | |
13 | #include "psr_simple_cache.h" | |
14 | ||
15 | /* {{{ CacheException ------------------------------------------------------- */ | |
16 | ||
17 | PHP_PSR_API zend_class_entry * PsrSimpleCacheCacheException_ce_ptr; | |
18 | ||
19 | static zend_always_inline void php_psr_register_PsrSimpleCacheCacheException(INIT_FUNC_ARGS) | |
20 | { | |
21 | zend_class_entry ce; | |
22 | INIT_CLASS_ENTRY(ce, "Psr\\SimpleCache\\CacheException", NULL); | |
23 | PsrSimpleCacheCacheException_ce_ptr = zend_register_internal_interface(&ce); | |
24 | } | |
25 | ||
26 | /* }}} ---------------------------------------------------------------------- */ | |
27 | /* {{{ CacheInterface ------------------------------------------------------- */ | |
28 | ||
29 | PHP_PSR_API zend_class_entry * PsrSimpleCacheCacheInterface_ce_ptr; | |
30 | ||
31 | static zend_function_entry PsrSimpleCacheCacheInterface_methods[] = { | |
32 | PHP_PSR_ABSTRACT_ME(PsrSimpleCacheCacheInterface, get) | |
33 | PHP_PSR_ABSTRACT_ME(PsrSimpleCacheCacheInterface, set) | |
34 | PHP_PSR_ABSTRACT_ME(PsrSimpleCacheCacheInterface, delete) | |
35 | PHP_PSR_ABSTRACT_ME(PsrSimpleCacheCacheInterface, clear) | |
36 | PHP_PSR_ABSTRACT_ME(PsrSimpleCacheCacheInterface, getMultiple) | |
37 | PHP_PSR_ABSTRACT_ME(PsrSimpleCacheCacheInterface, setMultiple) | |
38 | PHP_PSR_ABSTRACT_ME(PsrSimpleCacheCacheInterface, deleteMultiple) | |
39 | PHP_PSR_ABSTRACT_ME(PsrSimpleCacheCacheInterface, has) | |
40 | PHP_FE_END | |
41 | }; | |
42 | ||
43 | static zend_always_inline void php_psr_register_PsrSimpleCacheCacheInterface(INIT_FUNC_ARGS) | |
44 | { | |
45 | zend_class_entry ce; | |
46 | INIT_CLASS_ENTRY(ce, "Psr\\SimpleCache\\CacheInterface", PsrSimpleCacheCacheInterface_methods); | |
47 | PsrSimpleCacheCacheInterface_ce_ptr = zend_register_internal_interface(&ce); | |
48 | } | |
49 | ||
50 | /* }}} ---------------------------------------------------------------------- */ | |
51 | /* {{{ InvalidArgumentException --------------------------------------------- */ | |
52 | ||
53 | PHP_PSR_API zend_class_entry * PsrSimpleCacheInvalidArgumentException_ce_ptr; | |
54 | ||
55 | static zend_always_inline void php_psr_register_PsrSimpleCacheInvalidArgumentException(INIT_FUNC_ARGS) | |
56 | { | |
57 | zend_class_entry ce; | |
58 | INIT_CLASS_ENTRY(ce, "Psr\\SimpleCache\\InvalidArgumentException", NULL); | |
59 | PsrSimpleCacheInvalidArgumentException_ce_ptr = zend_register_internal_interface(&ce); | |
60 | zend_class_implements(PsrSimpleCacheInvalidArgumentException_ce_ptr, 1, PsrSimpleCacheCacheException_ce_ptr); | |
61 | } | |
62 | ||
63 | /* }}} ---------------------------------------------------------------------- */ | |
64 | ||
65 | /* {{{ PHP_MINIT_FUNCTION */ | |
66 | PHP_MINIT_FUNCTION(psr_simple_cache) | |
67 | { | |
68 | php_psr_register_PsrSimpleCacheCacheException(INIT_FUNC_ARGS_PASSTHRU); | |
69 | php_psr_register_PsrSimpleCacheCacheInterface(INIT_FUNC_ARGS_PASSTHRU); | |
70 | php_psr_register_PsrSimpleCacheInvalidArgumentException(INIT_FUNC_ARGS_PASSTHRU); | |
71 | ||
72 | return SUCCESS; | |
73 | } | |
74 | /* }}} */ | |
75 | ||
76 | /* | |
77 | * Local variables: | |
78 | * tab-width: 4 | |
79 | * c-basic-offset: 4 | |
80 | * End: | |
81 | * vim600: fdm=marker | |
82 | * vim: et sw=4 ts=4 | |
83 | */ |
0 | ||
1 | #ifndef PSR_SIMPLE_CACHE_H | |
2 | #define PSR_SIMPLE_CACHE_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_psr.h" | |
6 | ||
7 | #define PHP_PSR_SIMPLE_CACHE_VERSION "1.0.0" | |
8 | #define PHP_PSR_SIMPLE_CACHE_VERSION_ID 10000 | |
9 | ||
10 | extern PHP_PSR_API zend_class_entry * PsrSimpleCacheCacheException_ce_ptr; | |
11 | extern PHP_PSR_API zend_class_entry * PsrSimpleCacheCacheInterface_ce_ptr; | |
12 | extern PHP_PSR_API zend_class_entry * PsrSimpleCacheInvalidArgumentException_ce_ptr; | |
13 | ||
14 | extern PHP_MINIT_FUNCTION(psr_simple_cache); | |
15 | ||
16 | PHP_PSR_BEGIN_ARG_INFO(PsrSimpleCacheCacheInterface, get, 1) | |
17 | ZEND_ARG_INFO(0, key) | |
18 | ZEND_ARG_INFO(0, default) | |
19 | PHP_PSR_END_ARG_INFO() | |
20 | ||
21 | PHP_PSR_BEGIN_ARG_INFO(PsrSimpleCacheCacheInterface, set, 2) | |
22 | ZEND_ARG_INFO(0, key) | |
23 | ZEND_ARG_INFO(0, value) | |
24 | ZEND_ARG_INFO(0, ttl) | |
25 | PHP_PSR_END_ARG_INFO() | |
26 | ||
27 | PHP_PSR_BEGIN_ARG_INFO(PsrSimpleCacheCacheInterface, delete, 1) | |
28 | ZEND_ARG_INFO(0, key) | |
29 | PHP_PSR_END_ARG_INFO() | |
30 | ||
31 | PHP_PSR_BEGIN_ARG_INFO(PsrSimpleCacheCacheInterface, clear, 0) | |
32 | PHP_PSR_END_ARG_INFO() | |
33 | ||
34 | PHP_PSR_BEGIN_ARG_INFO(PsrSimpleCacheCacheInterface, getMultiple, 1) | |
35 | ZEND_ARG_INFO(0, keys) | |
36 | ZEND_ARG_INFO(0, default) | |
37 | PHP_PSR_END_ARG_INFO() | |
38 | ||
39 | PHP_PSR_BEGIN_ARG_INFO(PsrSimpleCacheCacheInterface, setMultiple, 1) | |
40 | ZEND_ARG_INFO(0, values) | |
41 | ZEND_ARG_INFO(0, ttl) | |
42 | PHP_PSR_END_ARG_INFO() | |
43 | ||
44 | PHP_PSR_BEGIN_ARG_INFO(PsrSimpleCacheCacheInterface, deleteMultiple, 1) | |
45 | ZEND_ARG_INFO(0, keys) | |
46 | PHP_PSR_END_ARG_INFO() | |
47 | ||
48 | PHP_PSR_BEGIN_ARG_INFO(PsrSimpleCacheCacheInterface, has, 1) | |
49 | ZEND_ARG_INFO(0, key) | |
50 | PHP_PSR_END_ARG_INFO() | |
51 | ||
52 | #endif /* PSR_CACHE_H */ | |
53 | ||
54 | /* | |
55 | * Local variables: | |
56 | * tab-width: 4 | |
57 | * c-basic-offset: 4 | |
58 | * End: | |
59 | * vim600: fdm=marker | |
60 | * vim: et sw=4 ts=4 | |
61 | */ |
0 | --TEST-- | |
1 | Psr\Cache\CacheException | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Cache\CacheException; | |
7 | class MyCacheException extends Exception implements CacheException {} | |
8 | $ex = new MyCacheException('test'); | |
9 | var_dump($ex instanceof CacheException); | |
10 | var_dump($ex instanceof Exception); | |
11 | try { | |
12 | throw $ex; | |
13 | } catch( CacheException $e ) { | |
14 | var_dump($e->getMessage()); | |
15 | } | |
16 | --EXPECT-- | |
17 | bool(true) | |
18 | bool(true) | |
19 | string(4) "test" |
0 | --TEST-- | |
1 | Psr\Cache\CacheItemInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleCacheItem.inc'; | |
7 | var_dump(interface_exists('\\Psr\\Cache\\CacheItemInterface', false)); | |
8 | var_dump(class_implements('SampleCacheItem', false)); | |
9 | $cacheItem = new SampleCacheItem(); | |
10 | $cacheItem->getKey(); | |
11 | $cacheItem->get(); | |
12 | $cacheItem->isHit(); | |
13 | $cacheItem->set('test set'); | |
14 | $cacheItem->expiresAt(1435364259); | |
15 | $cacheItem->expiresAfter(1435364259); | |
16 | --EXPECT-- | |
17 | bool(true) | |
18 | array(1) { | |
19 | ["Psr\Cache\CacheItemInterface"]=> | |
20 | string(28) "Psr\Cache\CacheItemInterface" | |
21 | } | |
22 | string(23) "SampleCacheItem::getKey" | |
23 | string(20) "SampleCacheItem::get" | |
24 | string(22) "SampleCacheItem::isHit" | |
25 | string(20) "SampleCacheItem::set" | |
26 | string(8) "test set" | |
27 | string(26) "SampleCacheItem::expiresAt" | |
28 | int(1435364259) | |
29 | string(29) "SampleCacheItem::expiresAfter" | |
30 | int(1435364259) | |
31 |
0 | --TEST-- | |
1 | Psr\Cache\CacheItemPoolInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleCacheItem.inc'; | |
7 | include __DIR__ . '/SampleCacheItemPool.inc'; | |
8 | var_dump(interface_exists('\\Psr\\Cache\\CacheItemPoolInterface', false)); | |
9 | var_dump(class_implements('SampleCacheItemPool', false)); | |
10 | $cacheItem = new SampleCacheItemPool(); | |
11 | $cacheItem->getItem('key'); | |
12 | $cacheItem->getItems(); | |
13 | $cacheItem->getItems(array('keyA', 'keyB')); | |
14 | $cacheItem->hasItem('key'); | |
15 | $cacheItem->clear(); | |
16 | $cacheItem->deleteItem('keyC'); | |
17 | $cacheItem->deleteItems(array('keyC')); | |
18 | $cacheItem->save(new SampleCacheItem()); | |
19 | $cacheItem->saveDeferred(new SampleCacheItem()); | |
20 | $cacheItem->commit(); | |
21 | --EXPECTF-- | |
22 | bool(true) | |
23 | array(1) { | |
24 | ["Psr\Cache\CacheItemPoolInterface"]=> | |
25 | string(32) "Psr\Cache\CacheItemPoolInterface" | |
26 | } | |
27 | string(28) "SampleCacheItemPool::getItem" | |
28 | string(3) "key" | |
29 | string(29) "SampleCacheItemPool::getItems" | |
30 | array(0) { | |
31 | } | |
32 | string(29) "SampleCacheItemPool::getItems" | |
33 | array(2) { | |
34 | [0]=> | |
35 | string(4) "keyA" | |
36 | [1]=> | |
37 | string(4) "keyB" | |
38 | } | |
39 | string(28) "SampleCacheItemPool::hasItem" | |
40 | string(3) "key" | |
41 | string(26) "SampleCacheItemPool::clear" | |
42 | string(31) "SampleCacheItemPool::deleteItem" | |
43 | string(4) "keyC" | |
44 | string(32) "SampleCacheItemPool::deleteItems" | |
45 | array(1) { | |
46 | [0]=> | |
47 | string(4) "keyC" | |
48 | } | |
49 | string(25) "SampleCacheItemPool::save" | |
50 | object(SampleCacheItem)#%d (0) { | |
51 | } | |
52 | string(33) "SampleCacheItemPool::saveDeferred" | |
53 | object(SampleCacheItem)#%d (0) { | |
54 | } | |
55 | string(27) "SampleCacheItemPool::commit" |
0 | --TEST-- | |
1 | Psr\Cache\InvalidArgumentException | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Cache\CacheException; | |
7 | use Psr\Cache\InvalidArgumentException; | |
8 | class MyInvalidArgumentException extends Exception implements InvalidArgumentException {} | |
9 | $ex = new MyInvalidArgumentException('test'); | |
10 | var_dump($ex instanceof InvalidArgumentException); | |
11 | var_dump($ex instanceof Exception); | |
12 | var_dump($ex instanceof CacheException); | |
13 | try { | |
14 | throw $ex; | |
15 | } catch( InvalidArgumentException $e ) { | |
16 | var_dump($e->getMessage()); | |
17 | } | |
18 | --EXPECT-- | |
19 | bool(true) | |
20 | bool(true) | |
21 | bool(true) | |
22 | string(4) "test" |
0 | --TEST-- | |
1 | Psr\Container\ContainerExceptionInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Container\ContainerExceptionInterface; | |
7 | class MyException extends Exception implements ContainerExceptionInterface {} | |
8 | $ex = new MyException('test'); | |
9 | var_dump($ex instanceof ContainerExceptionInterface); | |
10 | var_dump($ex instanceof Exception); | |
11 | try { | |
12 | throw $ex; | |
13 | } catch( ContainerExceptionInterface $e ) { | |
14 | var_dump($e->getMessage()); | |
15 | } | |
16 | --EXPECT-- | |
17 | bool(true) | |
18 | bool(true) | |
19 | string(4) "test" |
0 | --TEST-- | |
1 | Psr\Container\ContainerInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Container\ContainerInterface; | |
7 | class MyImpl implements ContainerInterface { | |
8 | public function get(string $id) {} | |
9 | public function has(string $id) {} | |
10 | } | |
11 | $ex = new MyImpl(); | |
12 | var_dump($ex instanceof ContainerInterface); | |
13 | --EXPECT-- | |
14 | bool(true) |
0 | --TEST-- | |
1 | Psr\Container\NotFoundExceptionInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Container\ContainerExceptionInterface; | |
7 | use Psr\Container\NotFoundExceptionInterface; | |
8 | class MyException extends Exception implements NotFoundExceptionInterface {} | |
9 | $ex = new MyException('test'); | |
10 | var_dump($ex instanceof ContainerExceptionInterface); | |
11 | var_dump($ex instanceof NotFoundExceptionInterface); | |
12 | var_dump($ex instanceof Exception); | |
13 | try { | |
14 | throw $ex; | |
15 | } catch( NotFoundExceptionInterface $e ) { | |
16 | var_dump($e->getMessage()); | |
17 | } | |
18 | --EXPECT-- | |
19 | bool(true) | |
20 | bool(true) | |
21 | bool(true) | |
22 | string(4) "test" |
0 | --TEST-- | |
1 | Psr\EventDispatcher\EventDispatcherInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip_lt_php72.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleEventDispatcher.inc'; | |
7 | var_dump(interface_exists('\\Psr\\EventDispatcher\\EventDispatcherInterface', false)); | |
8 | var_dump(class_implements('SampleEventDispatcher', false)); | |
9 | $dispatcher = new SampleEventDispatcher(); | |
10 | var_dump($dispatcher instanceof SampleEventDispatcher); | |
11 | $event = new stdClass(); | |
12 | $return = $dispatcher->dispatch($event); | |
13 | var_dump(is_object($return)); | |
14 | --EXPECT-- | |
15 | bool(true) | |
16 | array(1) { | |
17 | ["Psr\EventDispatcher\EventDispatcherInterface"]=> | |
18 | string(44) "Psr\EventDispatcher\EventDispatcherInterface" | |
19 | } | |
20 | bool(true) | |
21 | string(31) "SampleEventDispatcher::dispatch" | |
22 | bool(true) | |
23 | bool(true) |
0 | --TEST-- | |
1 | Psr\EventDispatcher\ListenerProviderInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip_lt_php72.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleListenerProvider.inc'; | |
7 | var_dump(interface_exists('\\Psr\\EventDispatcher\\ListenerProviderInterface', false)); | |
8 | var_dump(class_implements('SampleListenerProvider', false)); | |
9 | $provider = new SampleListenerProvider(); | |
10 | var_dump($provider instanceof SampleListenerProvider); | |
11 | $event = new stdClass(); | |
12 | $return = $provider->getListenersForEvent($event); | |
13 | var_dump(is_iterable($return)); | |
14 | --EXPECT-- | |
15 | bool(true) | |
16 | array(1) { | |
17 | ["Psr\EventDispatcher\ListenerProviderInterface"]=> | |
18 | string(45) "Psr\EventDispatcher\ListenerProviderInterface" | |
19 | } | |
20 | bool(true) | |
21 | string(44) "SampleListenerProvider::getListenersForEvent" | |
22 | bool(true) | |
23 | bool(true) |
0 | --TEST-- | |
1 | Psr\EventDispatcher\StoppableEventInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip_lt_php72.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleStoppableEvent.inc'; | |
7 | var_dump(interface_exists('\\Psr\\EventDispatcher\\StoppableEventInterface', false)); | |
8 | var_dump(class_implements('SampleStoppableEvent', false)); | |
9 | $event = new SampleStoppableEvent(); | |
10 | var_dump($event instanceof SampleStoppableEvent); | |
11 | $return = $event->isPropagationStopped(); | |
12 | var_dump(is_bool($return)); | |
13 | --EXPECT-- | |
14 | bool(true) | |
15 | array(1) { | |
16 | ["Psr\EventDispatcher\StoppableEventInterface"]=> | |
17 | string(43) "Psr\EventDispatcher\StoppableEventInterface" | |
18 | } | |
19 | bool(true) | |
20 | string(42) "SampleStoppableEvent::isPropagationStopped" | |
21 | bool(true) |
0 | --TEST-- | |
1 | Psr\Http\Client\ClientExceptionInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Http\Client\ClientExceptionInterface; | |
7 | var_dump(is_subclass_of(ClientExceptionInterface::class, Throwable::class)); | |
8 | class MyException extends Exception implements ClientExceptionInterface {} | |
9 | $ex = new MyException('test'); | |
10 | var_dump($ex instanceof ClientExceptionInterface); | |
11 | var_dump($ex instanceof Exception); | |
12 | var_dump($ex instanceof Throwable); | |
13 | try { | |
14 | throw $ex; | |
15 | } catch( ClientExceptionInterface $e ) { | |
16 | var_dump($e->getMessage()); | |
17 | } | |
18 | --EXPECT-- | |
19 | bool(true) | |
20 | bool(true) | |
21 | bool(true) | |
22 | bool(true) | |
23 | string(4) "test" |
0 | --TEST-- | |
1 | Psr\Http\Client\ClientInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleRequest.inc'; | |
8 | include __DIR__ . '/SampleResponse.inc'; | |
9 | include __DIR__ . '/SampleClient.inc'; | |
10 | var_dump(interface_exists('\\Psr\\Http\\Client\\ClientInterface', false)); | |
11 | var_dump(class_implements('SampleClient', false)); | |
12 | $client = new SampleClient(); | |
13 | $request = new SampleRequest(); | |
14 | $response = $client->sendRequest($request); | |
15 | var_dump($response instanceof \Psr\Http\Message\ResponseInterface); | |
16 | --EXPECTF-- | |
17 | bool(true) | |
18 | array(1) { | |
19 | ["Psr\Http\Client\ClientInterface"]=> | |
20 | string(31) "Psr\Http\Client\ClientInterface" | |
21 | } | |
22 | string(25) "SampleClient::sendRequest" | |
23 | object(SampleRequest)#%d (0) { | |
24 | } | |
25 | bool(true) |
0 | --TEST-- | |
1 | Psr\Http\Client\NetworkExceptionInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Http\Message\RequestInterface; | |
7 | use Psr\Http\Client\NetworkExceptionInterface; | |
8 | include __DIR__ . '/SampleMessage.inc'; | |
9 | include __DIR__ . '/SampleRequest.inc'; | |
10 | var_dump(is_subclass_of(NetworkExceptionInterface::class, Psr\Http\Client\ClientExceptionInterface::class)); | |
11 | var_dump(is_subclass_of(NetworkExceptionInterface::class, Throwable::class)); | |
12 | class MyException extends Exception implements NetworkExceptionInterface { | |
13 | public function getRequest(): RequestInterface { | |
14 | var_dump(__METHOD__); | |
15 | return new SampleRequest(); | |
16 | } | |
17 | } | |
18 | $ex = new MyException('test'); | |
19 | var_dump($ex instanceof NetworkExceptionInterface); | |
20 | var_dump($ex instanceof Psr\Http\Client\ClientExceptionInterface); | |
21 | var_dump($ex instanceof Exception); | |
22 | var_dump($ex instanceof Throwable); | |
23 | try { | |
24 | throw $ex; | |
25 | } catch( NetworkExceptionInterface $e ) { | |
26 | var_dump($e->getMessage()); | |
27 | var_dump($e->getRequest()); | |
28 | } | |
29 | --EXPECTF-- | |
30 | bool(true) | |
31 | bool(true) | |
32 | bool(true) | |
33 | bool(true) | |
34 | bool(true) | |
35 | bool(true) | |
36 | string(4) "test" | |
37 | string(23) "MyException::getRequest" | |
38 | object(SampleRequest)#%d (0) { | |
39 | } |
0 | --TEST-- | |
1 | Psr\Http\Client\RequestExceptionInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Http\Message\RequestInterface; | |
7 | use Psr\Http\Client\RequestExceptionInterface; | |
8 | include __DIR__ . '/SampleMessage.inc'; | |
9 | include __DIR__ . '/SampleRequest.inc'; | |
10 | var_dump(is_subclass_of(RequestExceptionInterface::class, Psr\Http\Client\ClientExceptionInterface::class)); | |
11 | var_dump(is_subclass_of(RequestExceptionInterface::class, Throwable::class)); | |
12 | class MyException extends Exception implements RequestExceptionInterface { | |
13 | public function getRequest(): RequestInterface { | |
14 | var_dump(__METHOD__); | |
15 | return new SampleRequest(); | |
16 | } | |
17 | } | |
18 | $ex = new MyException('test'); | |
19 | var_dump($ex instanceof RequestExceptionInterface); | |
20 | var_dump($ex instanceof Psr\Http\Client\ClientExceptionInterface); | |
21 | var_dump($ex instanceof Exception); | |
22 | var_dump($ex instanceof Throwable); | |
23 | try { | |
24 | throw $ex; | |
25 | } catch( RequestExceptionInterface $e ) { | |
26 | var_dump($e->getMessage()); | |
27 | var_dump($e->getRequest()); | |
28 | } | |
29 | --EXPECTF-- | |
30 | bool(true) | |
31 | bool(true) | |
32 | bool(true) | |
33 | bool(true) | |
34 | bool(true) | |
35 | bool(true) | |
36 | string(4) "test" | |
37 | string(23) "MyException::getRequest" | |
38 | object(SampleRequest)#%d (0) { | |
39 | } |
0 | --TEST-- | |
1 | Psr\Http\Message\MessageInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleStream.inc'; | |
8 | var_dump(interface_exists('\\Psr\\Http\\Message\\MessageInterface', false)); | |
9 | var_dump(class_implements('SampleMessage', false)); | |
10 | $message = new SampleMessage(); | |
11 | $message->getProtocolVersion(); | |
12 | $message->withProtocolVersion('1.0'); | |
13 | $message->getHeaders(); | |
14 | $message->hasHeader('content-type'); | |
15 | $message->getHeader('content-type'); | |
16 | $message->getHeaderLine('content-type'); | |
17 | $message->withHeader('content-type', 'text/plain'); | |
18 | $message->withAddedHeader('content-type', 'text/html'); | |
19 | $message->withoutHeader('content-type'); | |
20 | $message->getBody(); | |
21 | $message->withBody(new SampleStream()); | |
22 | --EXPECTF-- | |
23 | bool(true) | |
24 | array(1) { | |
25 | ["Psr\Http\Message\MessageInterface"]=> | |
26 | string(33) "Psr\Http\Message\MessageInterface" | |
27 | } | |
28 | string(33) "SampleMessage::getProtocolVersion" | |
29 | string(34) "SampleMessage::withProtocolVersion" | |
30 | string(3) "1.0" | |
31 | string(25) "SampleMessage::getHeaders" | |
32 | string(24) "SampleMessage::hasHeader" | |
33 | string(12) "content-type" | |
34 | string(24) "SampleMessage::getHeader" | |
35 | string(12) "content-type" | |
36 | string(28) "SampleMessage::getHeaderLine" | |
37 | string(12) "content-type" | |
38 | string(25) "SampleMessage::withHeader" | |
39 | string(12) "content-type" | |
40 | string(10) "text/plain" | |
41 | string(30) "SampleMessage::withAddedHeader" | |
42 | string(12) "content-type" | |
43 | string(9) "text/html" | |
44 | string(28) "SampleMessage::withoutHeader" | |
45 | string(12) "content-type" | |
46 | string(22) "SampleMessage::getBody" | |
47 | string(23) "SampleMessage::withBody" | |
48 | object(SampleStream)#%d (0) { | |
49 | } |
0 | --TEST-- | |
1 | Psr\Http\Message\RequestFactoryInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleRequest.inc'; | |
8 | include __DIR__ . '/SampleUri.inc'; | |
9 | include __DIR__ . '/SampleRequestFactory.inc'; | |
10 | var_dump(interface_exists('\\Psr\\Http\\Message\\RequestFactoryInterface', false)); | |
11 | var_dump(class_implements('SampleRequestFactory', false)); | |
12 | $factory = new SampleRequestFactory(); | |
13 | $request = $factory->createRequest('GET', 'http://domain.com'); | |
14 | var_dump($request instanceof \Psr\Http\Message\RequestInterface); | |
15 | $factory->createRequest('POST', new SampleUri()); | |
16 | --EXPECTF-- | |
17 | bool(true) | |
18 | array(1) { | |
19 | ["Psr\Http\Message\RequestFactoryInterface"]=> | |
20 | string(40) "Psr\Http\Message\RequestFactoryInterface" | |
21 | } | |
22 | string(35) "SampleRequestFactory::createRequest" | |
23 | string(3) "GET" | |
24 | string(17) "http://domain.com" | |
25 | bool(true) | |
26 | string(35) "SampleRequestFactory::createRequest" | |
27 | string(4) "POST" | |
28 | object(SampleUri)#%d (0) { | |
29 | } |
0 | --TEST-- | |
1 | Psr\Http\Message\RequestInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleRequest.inc'; | |
8 | include __DIR__ . '/SampleUri.inc'; | |
9 | var_dump(interface_exists('\\Psr\\Http\\Message\\RequestInterface', false)); | |
10 | var_dump(is_subclass_of('\\Psr\\Http\\Message\\RequestInterface', '\\Psr\\Http\\Message\\MessageInterface')); | |
11 | var_dump(class_implements('SampleRequest', false)); | |
12 | $request = new SampleRequest(); | |
13 | var_dump($request instanceof \Psr\Http\Message\MessageInterface); | |
14 | $request->getRequestTarget(); | |
15 | $request->withRequestTarget('test'); | |
16 | $request->getMethod(); | |
17 | $request->withMethod('PUT'); | |
18 | $request->getUri(); | |
19 | $request->withUri(new SampleUri()); | |
20 | $request->withUri(new SampleUri(), true); | |
21 | --EXPECTF-- | |
22 | bool(true) | |
23 | bool(true) | |
24 | array(2) { | |
25 | ["Psr\Http\Message\MessageInterface"]=> | |
26 | string(33) "Psr\Http\Message\MessageInterface" | |
27 | ["Psr\Http\Message\RequestInterface"]=> | |
28 | string(33) "Psr\Http\Message\RequestInterface" | |
29 | } | |
30 | bool(true) | |
31 | string(31) "SampleRequest::getRequestTarget" | |
32 | string(32) "SampleRequest::withRequestTarget" | |
33 | string(4) "test" | |
34 | string(24) "SampleRequest::getMethod" | |
35 | string(25) "SampleRequest::withMethod" | |
36 | string(3) "PUT" | |
37 | string(21) "SampleRequest::getUri" | |
38 | string(22) "SampleRequest::withUri" | |
39 | object(SampleUri)#%d (0) { | |
40 | } | |
41 | bool(false) | |
42 | string(22) "SampleRequest::withUri" | |
43 | object(SampleUri)#%d (0) { | |
44 | } | |
45 | bool(true) |
0 | --TEST-- | |
1 | Psr\Http\Message\ResponseFactoryInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleResponse.inc'; | |
8 | include __DIR__ . '/SampleResponseFactory.inc'; | |
9 | var_dump(interface_exists('\\Psr\\Http\\Message\\ResponseFactoryInterface', false)); | |
10 | var_dump(class_implements('SampleResponseFactory', false)); | |
11 | $factory = new SampleResponseFactory(); | |
12 | $response = $factory->createResponse(); | |
13 | var_dump($response instanceof \Psr\Http\Message\ResponseInterface); | |
14 | $factory->createResponse(400, 'BAD REQUEST'); | |
15 | --EXPECT-- | |
16 | bool(true) | |
17 | array(1) { | |
18 | ["Psr\Http\Message\ResponseFactoryInterface"]=> | |
19 | string(41) "Psr\Http\Message\ResponseFactoryInterface" | |
20 | } | |
21 | string(37) "SampleResponseFactory::createResponse" | |
22 | int(200) | |
23 | string(0) "" | |
24 | bool(true) | |
25 | string(37) "SampleResponseFactory::createResponse" | |
26 | int(400) | |
27 | string(11) "BAD REQUEST" |
0 | --TEST-- | |
1 | Psr\Http\Message\ResponseInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleResponse.inc'; | |
8 | var_dump(interface_exists('\\Psr\\Http\\Message\\ResponseInterface', false)); | |
9 | var_dump(is_subclass_of('\\Psr\\Http\\Message\\ResponseInterface', '\\Psr\\Http\\Message\\MessageInterface')); | |
10 | var_dump(class_implements('SampleResponse', false)); | |
11 | $request = new SampleResponse(); | |
12 | var_dump($request instanceof \Psr\Http\Message\MessageInterface); | |
13 | $request->getStatusCode(); | |
14 | $request->withStatus(400, 'BAD REQUEST'); | |
15 | $request->getReasonPhrase(); | |
16 | --EXPECT-- | |
17 | bool(true) | |
18 | bool(true) | |
19 | array(2) { | |
20 | ["Psr\Http\Message\MessageInterface"]=> | |
21 | string(33) "Psr\Http\Message\MessageInterface" | |
22 | ["Psr\Http\Message\ResponseInterface"]=> | |
23 | string(34) "Psr\Http\Message\ResponseInterface" | |
24 | } | |
25 | bool(true) | |
26 | string(29) "SampleResponse::getStatusCode" | |
27 | string(26) "SampleResponse::withStatus" | |
28 | int(400) | |
29 | string(11) "BAD REQUEST" | |
30 | string(31) "SampleResponse::getReasonPhrase" |
0 | --TEST-- | |
1 | Psr\Http\Message\ServerRequestFactoryInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleUri.inc'; | |
8 | include __DIR__ . '/SampleRequest.inc'; | |
9 | include __DIR__ . '/SampleServerRequest.inc'; | |
10 | include __DIR__ . '/SampleServerRequestFactory.inc'; | |
11 | var_dump(interface_exists('\\Psr\\Http\\Message\\ServerRequestFactoryInterface', false)); | |
12 | var_dump(class_implements('SampleServerRequestFactory', false)); | |
13 | $factory = new SampleServerRequestFactory(); | |
14 | $request = $factory->createServerRequest('GET', 'http://domain.com'); | |
15 | var_dump($request instanceof \Psr\Http\Message\ServerRequestInterface); | |
16 | $request = $factory->createServerRequest('POST', new SampleUri(), ['param' => 'value']); | |
17 | --EXPECTF-- | |
18 | bool(true) | |
19 | array(1) { | |
20 | ["Psr\Http\Message\ServerRequestFactoryInterface"]=> | |
21 | string(46) "Psr\Http\Message\ServerRequestFactoryInterface" | |
22 | } | |
23 | string(47) "SampleServerRequestFactory::createServerRequest" | |
24 | string(3) "GET" | |
25 | string(17) "http://domain.com" | |
26 | array(0) { | |
27 | } | |
28 | bool(true) | |
29 | string(47) "SampleServerRequestFactory::createServerRequest" | |
30 | string(4) "POST" | |
31 | object(SampleUri)#%d (0) { | |
32 | } | |
33 | array(1) { | |
34 | ["param"]=> | |
35 | string(5) "value" | |
36 | } |
0 | --TEST-- | |
1 | Psr\Http\Message\ServerRequestInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleRequest.inc'; | |
8 | include __DIR__ . '/SampleServerRequest.inc'; | |
9 | var_dump(interface_exists('\\Psr\\Http\\Message\\ServerRequestInterface', false)); | |
10 | var_dump(is_subclass_of('\\Psr\\Http\\Message\\ServerRequestInterface', '\\Psr\\Http\\Message\\MessageInterface')); | |
11 | var_dump(is_subclass_of('\\Psr\\Http\\Message\\ServerRequestInterface', '\\Psr\\Http\\Message\\RequestInterface')); | |
12 | $ifaces = class_implements('SampleServerRequest', false); | |
13 | ksort($ifaces); | |
14 | var_dump($ifaces); | |
15 | $request = new SampleServerRequest(); | |
16 | var_dump($request instanceof \Psr\Http\Message\MessageInterface); | |
17 | var_dump($request instanceof \Psr\Http\Message\RequestInterface); | |
18 | $request->getServerParams(); | |
19 | $request->getCookieParams(); | |
20 | $request->withCookieParams(array('a' => 'b')); | |
21 | $request->getQueryParams(); | |
22 | $request->withQueryParams(array('c' => 'd')); | |
23 | $request->getUploadedFiles(); | |
24 | $request->withUploadedFiles(array()); | |
25 | $request->getParsedBody(); | |
26 | $request->withParsedBody('body'); | |
27 | $request->getAttributes(); | |
28 | $request->getAttribute('attr'); | |
29 | $request->getAttribute('attr', 'bar'); | |
30 | $request->withAttribute('foo', 'baz'); | |
31 | $request->withoutAttribute('bar'); | |
32 | --EXPECT-- | |
33 | bool(true) | |
34 | bool(true) | |
35 | bool(true) | |
36 | array(3) { | |
37 | ["Psr\Http\Message\MessageInterface"]=> | |
38 | string(33) "Psr\Http\Message\MessageInterface" | |
39 | ["Psr\Http\Message\RequestInterface"]=> | |
40 | string(33) "Psr\Http\Message\RequestInterface" | |
41 | ["Psr\Http\Message\ServerRequestInterface"]=> | |
42 | string(39) "Psr\Http\Message\ServerRequestInterface" | |
43 | } | |
44 | bool(true) | |
45 | bool(true) | |
46 | string(36) "SampleServerRequest::getServerParams" | |
47 | string(36) "SampleServerRequest::getCookieParams" | |
48 | string(37) "SampleServerRequest::withCookieParams" | |
49 | array(1) { | |
50 | ["a"]=> | |
51 | string(1) "b" | |
52 | } | |
53 | string(35) "SampleServerRequest::getQueryParams" | |
54 | string(36) "SampleServerRequest::withQueryParams" | |
55 | array(1) { | |
56 | ["c"]=> | |
57 | string(1) "d" | |
58 | } | |
59 | string(37) "SampleServerRequest::getUploadedFiles" | |
60 | string(38) "SampleServerRequest::withUploadedFiles" | |
61 | array(0) { | |
62 | } | |
63 | string(34) "SampleServerRequest::getParsedBody" | |
64 | string(35) "SampleServerRequest::withParsedBody" | |
65 | string(4) "body" | |
66 | string(34) "SampleServerRequest::getAttributes" | |
67 | string(33) "SampleServerRequest::getAttribute" | |
68 | string(4) "attr" | |
69 | NULL | |
70 | string(33) "SampleServerRequest::getAttribute" | |
71 | string(4) "attr" | |
72 | string(3) "bar" | |
73 | string(34) "SampleServerRequest::withAttribute" | |
74 | string(3) "foo" | |
75 | string(3) "baz" | |
76 | string(37) "SampleServerRequest::withoutAttribute" | |
77 | string(3) "bar" |
0 | --TEST-- | |
1 | Psr\Http\Message\StreamFactoryInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleStream.inc'; | |
7 | include __DIR__ . '/SampleStreamFactory.inc'; | |
8 | var_dump(interface_exists('\\Psr\\Http\\Message\\StreamFactoryInterface', false)); | |
9 | var_dump(class_implements('SampleStreamFactory', false)); | |
10 | $factory = new SampleStreamFactory(); | |
11 | $stream = $factory->createStream(); | |
12 | var_dump($stream instanceof \Psr\Http\Message\StreamInterface); | |
13 | $factory->createStream('content'); | |
14 | $stream = $factory->createStreamFromFile('/tmp/file1'); | |
15 | var_dump($stream instanceof \Psr\Http\Message\StreamInterface); | |
16 | $factory->createStreamFromFile('/tmp/file2', 'wb'); | |
17 | $stream = $factory->createStreamFromResource(fopen('php://memory', 'r')); | |
18 | var_dump($stream instanceof \Psr\Http\Message\StreamInterface); | |
19 | --EXPECTF-- | |
20 | bool(true) | |
21 | array(1) { | |
22 | ["Psr\Http\Message\StreamFactoryInterface"]=> | |
23 | string(39) "Psr\Http\Message\StreamFactoryInterface" | |
24 | } | |
25 | string(33) "SampleStreamFactory::createStream" | |
26 | string(0) "" | |
27 | bool(true) | |
28 | string(33) "SampleStreamFactory::createStream" | |
29 | string(7) "content" | |
30 | string(41) "SampleStreamFactory::createStreamFromFile" | |
31 | string(10) "/tmp/file1" | |
32 | string(1) "r" | |
33 | bool(true) | |
34 | string(41) "SampleStreamFactory::createStreamFromFile" | |
35 | string(10) "/tmp/file2" | |
36 | string(2) "wb" | |
37 | string(45) "SampleStreamFactory::createStreamFromResource" | |
38 | resource(%d) of type (stream) | |
39 | bool(true) |
0 | --TEST-- | |
1 | Psr\Http\Message\StreamInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Http\Message\StreamInterface; | |
7 | include __DIR__ . '/SampleStream.inc'; | |
8 | var_dump(interface_exists(StreamInterface::class, false)); | |
9 | var_dump(is_subclass_of(SampleStream::class, StreamInterface::class)); | |
10 | $stream = new SampleStream(); | |
11 | $stream->__toString(); | |
12 | $stream->close(); | |
13 | $stream->detach(); | |
14 | $stream->getSize(); | |
15 | $stream->tell(); | |
16 | $stream->eof(); | |
17 | $stream->isSeekable(); | |
18 | $stream->seek(0); | |
19 | $stream->rewind(); | |
20 | $stream->isWritable(); | |
21 | $stream->write('foo'); | |
22 | $stream->isReadable(); | |
23 | $stream->read(123); | |
24 | $stream->getContents(); | |
25 | $stream->getMetadata(); | |
26 | --EXPECTF-- | |
27 | bool(true) | |
28 | bool(true) | |
29 | string(24) "SampleStream::__toString" | |
30 | string(19) "SampleStream::close" | |
31 | string(20) "SampleStream::detach" | |
32 | string(21) "SampleStream::getSize" | |
33 | string(18) "SampleStream::tell" | |
34 | string(17) "SampleStream::eof" | |
35 | string(24) "SampleStream::isSeekable" | |
36 | string(18) "SampleStream::seek" | |
37 | int(0) | |
38 | int(0) | |
39 | string(20) "SampleStream::rewind" | |
40 | string(24) "SampleStream::isWritable" | |
41 | string(19) "SampleStream::write" | |
42 | string(3) "foo" | |
43 | string(24) "SampleStream::isReadable" | |
44 | string(18) "SampleStream::read" | |
45 | int(123) | |
46 | string(25) "SampleStream::getContents" | |
47 | string(25) "SampleStream::getMetadata" | |
48 | NULL |
0 | --TEST-- | |
1 | Psr\Http\Message\UploadedFileFactoryInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleStream.inc'; | |
7 | include __DIR__ . '/SampleUploadedFile.inc'; | |
8 | include __DIR__ . '/SampleUploadedFileFactory.inc'; | |
9 | var_dump(interface_exists('\\Psr\\Http\\Message\\UploadedFileFactoryInterface', false)); | |
10 | var_dump(class_implements('SampleUploadedFileFactory', false)); | |
11 | $stream = new SampleStream(); | |
12 | $factory = new SampleUploadedFileFactory(); | |
13 | $uploadedFile = $factory->createUploadedFile($stream); | |
14 | var_dump($uploadedFile instanceof \Psr\Http\Message\UploadedFileInterface); | |
15 | $factory->createUploadedFile($stream, 100, UPLOAD_ERR_NO_FILE, 'image.png', 'image/png'); | |
16 | --EXPECTF-- | |
17 | bool(true) | |
18 | array(1) { | |
19 | ["Psr\Http\Message\UploadedFileFactoryInterface"]=> | |
20 | string(45) "Psr\Http\Message\UploadedFileFactoryInterface" | |
21 | } | |
22 | string(45) "SampleUploadedFileFactory::createUploadedFile" | |
23 | object(SampleStream)#%d (0) { | |
24 | } | |
25 | NULL | |
26 | int(0) | |
27 | NULL | |
28 | NULL | |
29 | bool(true) | |
30 | string(45) "SampleUploadedFileFactory::createUploadedFile" | |
31 | object(SampleStream)#%d (0) { | |
32 | } | |
33 | int(100) | |
34 | int(4) | |
35 | string(9) "image.png" | |
36 | string(9) "image/png" |
0 | --TEST-- | |
1 | Psr\Http\Message\UploadedFileInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleUploadedFile.inc'; | |
7 | var_dump(interface_exists('\\Psr\\Http\\Message\\UploadedFileInterface', false)); | |
8 | var_dump(class_implements('SampleUploadedFile', false)); | |
9 | $uploadedFile = new SampleUploadedFile(); | |
10 | $uploadedFile->getStream(); | |
11 | $uploadedFile->moveTo('/dev/null'); | |
12 | $uploadedFile->getSize(); | |
13 | $uploadedFile->getError(); | |
14 | $uploadedFile->getClientFilename(); | |
15 | $uploadedFile->getClientMediaType(); | |
16 | --EXPECT-- | |
17 | bool(true) | |
18 | array(1) { | |
19 | ["Psr\Http\Message\UploadedFileInterface"]=> | |
20 | string(38) "Psr\Http\Message\UploadedFileInterface" | |
21 | } | |
22 | string(29) "SampleUploadedFile::getStream" | |
23 | string(26) "SampleUploadedFile::moveTo" | |
24 | string(9) "/dev/null" | |
25 | string(27) "SampleUploadedFile::getSize" | |
26 | string(28) "SampleUploadedFile::getError" | |
27 | string(37) "SampleUploadedFile::getClientFilename" | |
28 | string(38) "SampleUploadedFile::getClientMediaType" | |
29 |
0 | --TEST-- | |
1 | Psr\Http\Message\UriFactoryInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleUri.inc'; | |
7 | include __DIR__ . '/SampleUriFactory.inc'; | |
8 | var_dump(interface_exists('\\Psr\\Http\\Message\\UriFactoryInterface', false)); | |
9 | var_dump(class_implements('SampleUriFactory', false)); | |
10 | $factory = new SampleUriFactory(); | |
11 | $uri = $factory->createUri(); | |
12 | var_dump($uri instanceof \Psr\Http\Message\UriInterface); | |
13 | $factory->createUri('http://domain.com'); | |
14 | --EXPECT-- | |
15 | bool(true) | |
16 | array(1) { | |
17 | ["Psr\Http\Message\UriFactoryInterface"]=> | |
18 | string(36) "Psr\Http\Message\UriFactoryInterface" | |
19 | } | |
20 | string(27) "SampleUriFactory::createUri" | |
21 | string(0) "" | |
22 | bool(true) | |
23 | string(27) "SampleUriFactory::createUri" | |
24 | string(17) "http://domain.com" |
0 | --TEST-- | |
1 | Psr\Http\Message\UriInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Http\Message\UriInterface; | |
7 | include __DIR__ . '/SampleUri.inc'; | |
8 | var_dump(interface_exists(UriInterface::class, false)); | |
9 | var_dump(is_subclass_of(SampleUri::class, UriInterface::class)); | |
10 | $uri = new SampleUri(); | |
11 | $uri->getScheme(); | |
12 | $uri->getAuthority(); | |
13 | $uri->getUserInfo(); | |
14 | $uri->getHost(); | |
15 | $uri->getPort(); | |
16 | $uri->getPath(); | |
17 | $uri->getQuery(); | |
18 | $uri->getFragment(); | |
19 | $uri->withScheme('http'); | |
20 | $uri->withUserInfo('foo', 'bar'); | |
21 | $uri->withHost('php.net'); | |
22 | $uri->withPort(8080); | |
23 | $uri->withPath('/'); | |
24 | $uri->withQuery(''); | |
25 | $uri->withFragment(''); | |
26 | $uri->__toString(); | |
27 | --EXPECT-- | |
28 | bool(true) | |
29 | bool(true) | |
30 | string(20) "SampleUri::getScheme" | |
31 | string(23) "SampleUri::getAuthority" | |
32 | string(22) "SampleUri::getUserInfo" | |
33 | string(18) "SampleUri::getHost" | |
34 | string(18) "SampleUri::getPort" | |
35 | string(18) "SampleUri::getPath" | |
36 | string(19) "SampleUri::getQuery" | |
37 | string(22) "SampleUri::getFragment" | |
38 | string(21) "SampleUri::withScheme" | |
39 | string(4) "http" | |
40 | string(23) "SampleUri::withUserInfo" | |
41 | string(3) "foo" | |
42 | string(3) "bar" | |
43 | string(19) "SampleUri::withHost" | |
44 | string(7) "php.net" | |
45 | string(19) "SampleUri::withPort" | |
46 | int(8080) | |
47 | string(19) "SampleUri::withPath" | |
48 | string(1) "/" | |
49 | string(20) "SampleUri::withQuery" | |
50 | string(0) "" | |
51 | string(23) "SampleUri::withFragment" | |
52 | string(0) "" | |
53 | string(21) "SampleUri::__toString" |
0 | --TEST-- | |
1 | Psr\Http\Server\MiddlewareInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleRequest.inc'; | |
8 | include __DIR__ . '/SampleServerRequest.inc'; | |
9 | include __DIR__ . '/SampleResponse.inc'; | |
10 | include __DIR__ . '/SampleRequestHandler.inc'; | |
11 | include __DIR__ . '/SampleMiddleware.inc'; | |
12 | var_dump(interface_exists('\\Psr\\Http\\Server\\MiddlewareInterface', false)); | |
13 | var_dump(class_implements('SampleMiddleware', false)); | |
14 | $request = new SampleServerRequest(); | |
15 | var_dump($request instanceof \Psr\Http\Message\ServerRequestInterface); | |
16 | $handler = new SampleRequestHandler(); | |
17 | var_dump($handler instanceof \Psr\Http\Server\RequestHandlerInterface); | |
18 | $middleware = new SampleMiddleware(); | |
19 | $response = $middleware->process($request, $handler); | |
20 | var_dump($response instanceof \Psr\Http\Message\ResponseInterface); | |
21 | --EXPECT-- | |
22 | bool(true) | |
23 | array(1) { | |
24 | ["Psr\Http\Server\MiddlewareInterface"]=> | |
25 | string(35) "Psr\Http\Server\MiddlewareInterface" | |
26 | } | |
27 | bool(true) | |
28 | bool(true) | |
29 | string(25) "SampleMiddleware::process" | |
30 | bool(true) |
0 | --TEST-- | |
1 | Psr\Http\Server\RequestHandlerInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleRequest.inc'; | |
8 | include __DIR__ . '/SampleServerRequest.inc'; | |
9 | include __DIR__ . '/SampleResponse.inc'; | |
10 | include __DIR__ . '/SampleRequestHandler.inc'; | |
11 | var_dump(interface_exists('\\Psr\\Http\\Server\\RequestHandlerInterface', false)); | |
12 | var_dump(class_implements('SampleRequestHandler', false)); | |
13 | $request = new SampleServerRequest(); | |
14 | var_dump($request instanceof \Psr\Http\Message\ServerRequestInterface); | |
15 | $handler = new SampleRequestHandler(); | |
16 | $response = $handler->handle($request); | |
17 | var_dump($response instanceof \Psr\Http\Message\ResponseInterface); | |
18 | --EXPECT-- | |
19 | bool(true) | |
20 | array(1) { | |
21 | ["Psr\Http\Server\RequestHandlerInterface"]=> | |
22 | string(39) "Psr\Http\Server\RequestHandlerInterface" | |
23 | } | |
24 | bool(true) | |
25 | string(28) "SampleRequestHandler::handle" | |
26 | bool(true) |
0 | --TEST-- | |
1 | Psr\Link\EvolvableLinkInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Link\LinkInterface; | |
7 | use Psr\Link\EvolvableLinkInterface; | |
8 | class MyImpl implements EvolvableLinkInterface { | |
9 | public function getHref() {} | |
10 | public function isTemplated() {} | |
11 | public function getRels() {} | |
12 | public function getAttributes() {} | |
13 | public function withHref($href) {} | |
14 | public function withRel($rel) {} | |
15 | public function withoutRel($rel) {} | |
16 | public function withAttribute($attribute, $value) {} | |
17 | public function withoutAttribute($attribute) {} | |
18 | } | |
19 | $ex = new MyImpl(); | |
20 | var_dump($ex instanceof LinkInterface); | |
21 | var_dump($ex instanceof EvolvableLinkInterface); | |
22 | --EXPECT-- | |
23 | bool(true) | |
24 | bool(true) |
0 | --TEST-- | |
1 | Psr\Link\EvolvableLinkProviderInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Link\LinkInterface; | |
7 | use Psr\Link\LinkProviderInterface; | |
8 | use Psr\Link\EvolvableLinkProviderInterface; | |
9 | class MyImpl implements EvolvableLinkProviderInterface { | |
10 | public function getLinks() {} | |
11 | public function getLinksByRel($rel) {} | |
12 | public function withLink(LinkInterface $link) {} | |
13 | public function withoutLink(LinkInterface $link) {} | |
14 | } | |
15 | $ex = new MyImpl(); | |
16 | var_dump($ex instanceof LinkProviderInterface); | |
17 | var_dump($ex instanceof EvolvableLinkProviderInterface); | |
18 | --EXPECT-- | |
19 | bool(true) | |
20 | bool(true) |
0 | --TEST-- | |
1 | Psr\Link\LinkInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Link\LinkInterface; | |
7 | class MyImpl implements LinkInterface { | |
8 | public function getHref() {} | |
9 | public function isTemplated() {} | |
10 | public function getRels() {} | |
11 | public function getAttributes() {} | |
12 | } | |
13 | $ex = new MyImpl(); | |
14 | var_dump($ex instanceof LinkInterface); | |
15 | --EXPECT-- | |
16 | bool(true) |
0 | --TEST-- | |
1 | Psr\Link\LinkProviderInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Link\LinkProviderInterface; | |
7 | class MyImpl implements LinkProviderInterface { | |
8 | public function getLinks() {} | |
9 | public function getLinksByRel($rel) {} | |
10 | } | |
11 | $ex = new MyImpl(); | |
12 | var_dump($ex instanceof LinkProviderInterface); | |
13 | --EXPECT-- | |
14 | bool(true) |
0 | --TEST-- | |
1 | Psr\Log\AbstractLogger | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleLogger2.inc'; | |
7 | $logger = new SampleLogger2; | |
8 | $logger->emergency('msg emergency', array(1)); | |
9 | $logger->alert('msg alert', array(2)); | |
10 | $logger->critical('msg critical', array(3)); | |
11 | $logger->error('msg error', array(4)); | |
12 | $logger->warning('msg warning', array(5)); | |
13 | $logger->notice('msg notice', array(6)); | |
14 | $logger->info('msg info', array(7)); | |
15 | $logger->debug('msg debug', array(8)); | |
16 | $logger->log('level', 'msg', array(9)); | |
17 | $logger->log('level', 'no context'); | |
18 | --EXPECT-- | |
19 | string(9) "emergency" | |
20 | string(13) "msg emergency" | |
21 | array(1) { | |
22 | [0]=> | |
23 | int(1) | |
24 | } | |
25 | string(5) "alert" | |
26 | string(9) "msg alert" | |
27 | array(1) { | |
28 | [0]=> | |
29 | int(2) | |
30 | } | |
31 | string(8) "critical" | |
32 | string(12) "msg critical" | |
33 | array(1) { | |
34 | [0]=> | |
35 | int(3) | |
36 | } | |
37 | string(5) "error" | |
38 | string(9) "msg error" | |
39 | array(1) { | |
40 | [0]=> | |
41 | int(4) | |
42 | } | |
43 | string(7) "warning" | |
44 | string(11) "msg warning" | |
45 | array(1) { | |
46 | [0]=> | |
47 | int(5) | |
48 | } | |
49 | string(6) "notice" | |
50 | string(10) "msg notice" | |
51 | array(1) { | |
52 | [0]=> | |
53 | int(6) | |
54 | } | |
55 | string(4) "info" | |
56 | string(8) "msg info" | |
57 | array(1) { | |
58 | [0]=> | |
59 | int(7) | |
60 | } | |
61 | string(5) "debug" | |
62 | string(9) "msg debug" | |
63 | array(1) { | |
64 | [0]=> | |
65 | int(8) | |
66 | } | |
67 | string(5) "level" | |
68 | string(3) "msg" | |
69 | array(1) { | |
70 | [0]=> | |
71 | int(9) | |
72 | } | |
73 | string(5) "level" | |
74 | string(10) "no context" | |
75 | array(0) { | |
76 | } |
0 | --TEST-- | |
1 | Psr\Log\AbstractLogger | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Log\AbstractLogger; | |
7 | try { | |
8 | new AbstractLogger(); | |
9 | } catch( \EngineException $e ) { | |
10 | echo $e->getMessage(); | |
11 | } catch( \Throwable $e ) { | |
12 | echo $e->getMessage(); | |
13 | } | |
14 | --EXPECTF-- | |
15 | %SCannot instantiate abstract class Psr\Log\AbstractLogger%S |
0 | --TEST-- | |
1 | Psr\Log\InvalidArgumentException | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Log\InvalidArgumentException; | |
7 | $ex = new InvalidArgumentException('test'); | |
8 | var_dump($ex instanceof \InvalidArgumentException); | |
9 | var_dump($ex instanceof \Exception); | |
10 | try { | |
11 | throw $ex; | |
12 | } catch( InvalidArgumentException $e ) { | |
13 | var_dump($e->getMessage()); | |
14 | } | |
15 | --EXPECT-- | |
16 | bool(true) | |
17 | bool(true) | |
18 | string(4) "test" |
0 | --TEST-- | |
1 | Psr\Log\LogLevel | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Log\LogLevel; | |
7 | var_dump(LogLevel::EMERGENCY); | |
8 | var_dump(LogLevel::ALERT); | |
9 | var_dump(LogLevel::CRITICAL); | |
10 | var_dump(LogLevel::ERROR); | |
11 | var_dump(LogLevel::WARNING); | |
12 | var_dump(LogLevel::NOTICE); | |
13 | var_dump(LogLevel::INFO); | |
14 | var_dump(LogLevel::DEBUG); | |
15 | --EXPECT-- | |
16 | string(9) "emergency" | |
17 | string(5) "alert" | |
18 | string(8) "critical" | |
19 | string(5) "error" | |
20 | string(7) "warning" | |
21 | string(6) "notice" | |
22 | string(4) "info" | |
23 | string(5) "debug" |
0 | --TEST-- | |
1 | Psr\Log\LoggerAwareInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleLogger.inc'; | |
7 | include __DIR__ . '/SampleLoggerAware.inc'; | |
8 | var_dump(interface_exists('\\Psr\\Log\\LoggerAwareInterface', false)); | |
9 | var_dump(class_implements('SampleLoggerAware', false)); | |
10 | $aware = new SampleLoggerAware(); | |
11 | $logger = new SampleLogger(); | |
12 | $aware->setLogger($logger); | |
13 | $aware->doSomethingThatLogs(); | |
14 | --EXPECT-- | |
15 | bool(true) | |
16 | array(1) { | |
17 | ["Psr\Log\LoggerAwareInterface"]=> | |
18 | string(28) "Psr\Log\LoggerAwareInterface" | |
19 | } | |
20 | string(10) "got logger" | |
21 | string(9) "emergency" | |
22 | string(8) "test log" | |
23 | array(0) { | |
24 | } |
0 | --TEST-- | |
1 | Psr\Log\LoggerAwareTrait | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Log\LoggerAwareTrait; | |
7 | include __DIR__ . '/SampleLogger.inc'; | |
8 | class SampleLoggerAwareTraitUser { | |
9 | use LoggerAwareTrait; | |
10 | public function getLogger() { | |
11 | return $this->logger; | |
12 | } | |
13 | } | |
14 | ||
15 | $aware = new SampleLoggerAwareTraitUser(); | |
16 | $logger = new SampleLogger(); | |
17 | $aware->setLogger($logger); | |
18 | var_dump($logger === $aware->getLogger()); | |
19 | var_dump(class_uses($aware, false)); | |
20 | --EXPECT-- | |
21 | bool(true) | |
22 | array(1) { | |
23 | ["Psr\Log\LoggerAwareTrait"]=> | |
24 | string(24) "Psr\Log\LoggerAwareTrait" | |
25 | } |
0 | --TEST-- | |
1 | Psr\Log\LoggerInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleLogger.inc'; | |
7 | var_dump(interface_exists('\\Psr\\Log\\LoggerInterface', false)); | |
8 | var_dump(class_implements('SampleLogger', false)); | |
9 | $logger = new SampleLogger(); | |
10 | $logger->emergency('msg emergency', array(1)); | |
11 | $logger->alert('msg alert', array(2)); | |
12 | $logger->critical('msg critical', array(3)); | |
13 | $logger->error('msg error', array(4)); | |
14 | $logger->warning('msg warning', array(5)); | |
15 | $logger->notice('msg notice', array(6)); | |
16 | $logger->info('msg info', array(7)); | |
17 | $logger->debug('msg debug', array(8)); | |
18 | $logger->log('level', 'msg', array(9)); | |
19 | $logger->log('level', 'no context'); | |
20 | --EXPECT-- | |
21 | bool(true) | |
22 | array(1) { | |
23 | ["Psr\Log\LoggerInterface"]=> | |
24 | string(23) "Psr\Log\LoggerInterface" | |
25 | } | |
26 | string(9) "emergency" | |
27 | string(13) "msg emergency" | |
28 | array(1) { | |
29 | [0]=> | |
30 | int(1) | |
31 | } | |
32 | string(5) "alert" | |
33 | string(9) "msg alert" | |
34 | array(1) { | |
35 | [0]=> | |
36 | int(2) | |
37 | } | |
38 | string(8) "critical" | |
39 | string(12) "msg critical" | |
40 | array(1) { | |
41 | [0]=> | |
42 | int(3) | |
43 | } | |
44 | string(5) "error" | |
45 | string(9) "msg error" | |
46 | array(1) { | |
47 | [0]=> | |
48 | int(4) | |
49 | } | |
50 | string(7) "warning" | |
51 | string(11) "msg warning" | |
52 | array(1) { | |
53 | [0]=> | |
54 | int(5) | |
55 | } | |
56 | string(6) "notice" | |
57 | string(10) "msg notice" | |
58 | array(1) { | |
59 | [0]=> | |
60 | int(6) | |
61 | } | |
62 | string(4) "info" | |
63 | string(8) "msg info" | |
64 | array(1) { | |
65 | [0]=> | |
66 | int(7) | |
67 | } | |
68 | string(5) "debug" | |
69 | string(9) "msg debug" | |
70 | array(1) { | |
71 | [0]=> | |
72 | int(8) | |
73 | } | |
74 | string(5) "level" | |
75 | string(3) "msg" | |
76 | array(1) { | |
77 | [0]=> | |
78 | int(9) | |
79 | } | |
80 | string(5) "level" | |
81 | string(10) "no context" | |
82 | array(0) { | |
83 | } | |
84 |
0 | --TEST-- | |
1 | Psr\Log\LoggerTrait | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Log\LoggerTrait; | |
7 | include __DIR__ . '/SampleLogger.inc'; | |
8 | class SampleLoggerTraitUser { | |
9 | use LoggerTrait; | |
10 | public function log($level, $message, array $context = array()) { | |
11 | var_dump($level, $message, $context); | |
12 | } | |
13 | } | |
14 | $logger = new SampleLoggerTraitUser(); | |
15 | $logger->emergency('msg emergency', array(1)); | |
16 | $logger->alert('msg alert', array(2)); | |
17 | $logger->critical('msg critical', array(3)); | |
18 | $logger->error('msg error', array(4)); | |
19 | $logger->warning('msg warning', array(5)); | |
20 | $logger->notice('msg notice', array(6)); | |
21 | $logger->info('msg info', array(7)); | |
22 | $logger->debug('msg debug', array(8)); | |
23 | $logger->log('level', 'msg', array(9)); | |
24 | $logger->log('level', 'no context'); | |
25 | var_dump(class_uses($logger, false)); | |
26 | --EXPECT-- | |
27 | string(9) "emergency" | |
28 | string(13) "msg emergency" | |
29 | array(1) { | |
30 | [0]=> | |
31 | int(1) | |
32 | } | |
33 | string(5) "alert" | |
34 | string(9) "msg alert" | |
35 | array(1) { | |
36 | [0]=> | |
37 | int(2) | |
38 | } | |
39 | string(8) "critical" | |
40 | string(12) "msg critical" | |
41 | array(1) { | |
42 | [0]=> | |
43 | int(3) | |
44 | } | |
45 | string(5) "error" | |
46 | string(9) "msg error" | |
47 | array(1) { | |
48 | [0]=> | |
49 | int(4) | |
50 | } | |
51 | string(7) "warning" | |
52 | string(11) "msg warning" | |
53 | array(1) { | |
54 | [0]=> | |
55 | int(5) | |
56 | } | |
57 | string(6) "notice" | |
58 | string(10) "msg notice" | |
59 | array(1) { | |
60 | [0]=> | |
61 | int(6) | |
62 | } | |
63 | string(4) "info" | |
64 | string(8) "msg info" | |
65 | array(1) { | |
66 | [0]=> | |
67 | int(7) | |
68 | } | |
69 | string(5) "debug" | |
70 | string(9) "msg debug" | |
71 | array(1) { | |
72 | [0]=> | |
73 | int(8) | |
74 | } | |
75 | string(5) "level" | |
76 | string(3) "msg" | |
77 | array(1) { | |
78 | [0]=> | |
79 | int(9) | |
80 | } | |
81 | string(5) "level" | |
82 | string(10) "no context" | |
83 | array(0) { | |
84 | } | |
85 | array(1) { | |
86 | ["Psr\Log\LoggerTrait"]=> | |
87 | string(19) "Psr\Log\LoggerTrait" | |
88 | } |
0 | --TEST-- | |
1 | Psr\Log\NullLogger | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Log\NullLogger; | |
7 | $logger = new NullLogger; | |
8 | $logger->emergency('msg emergency', array(1)); | |
9 | $logger->alert('msg alert', array(2)); | |
10 | $logger->critical('msg critical', array(3)); | |
11 | $logger->error('msg error', array(4)); | |
12 | $logger->warning('msg warning', array(5)); | |
13 | $logger->notice('msg notice', array(6)); | |
14 | $logger->info('msg info', array(7)); | |
15 | $logger->debug('msg debug', array(8)); | |
16 | $logger->log('level', 'msg', array(9)); | |
17 | $logger->log('level', 'no context'); | |
18 | var_dump($logger instanceof \Psr\Log\LoggerInterface); | |
19 | var_dump($logger instanceof \Psr\Log\AbstractLogger); | |
20 | --EXPECT-- | |
21 | bool(true) | |
22 | bool(true) |
0 | --TEST-- | |
1 | Psr\SimpleCache\CacheException | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\SimpleCache\CacheException; | |
7 | class MyException extends Exception implements CacheException {} | |
8 | $ex = new MyException('test'); | |
9 | var_dump($ex instanceof CacheException); | |
10 | var_dump($ex instanceof Exception); | |
11 | try { | |
12 | throw $ex; | |
13 | } catch( CacheException $e ) { | |
14 | var_dump($e->getMessage()); | |
15 | } | |
16 | --EXPECT-- | |
17 | bool(true) | |
18 | bool(true) | |
19 | string(4) "test" |
0 | --TEST-- | |
1 | Psr\SimpleCache\CacheInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\SimpleCache\CacheInterface; | |
7 | class MyImpl implements CacheInterface { | |
8 | public function get($key, $default = null) {} | |
9 | public function set($key, $value, $ttl = null) {} | |
10 | public function delete($key) {} | |
11 | public function clear() {} | |
12 | public function getMultiple($keys, $default = null) {} | |
13 | public function setMultiple($values, $ttl = null) {} | |
14 | public function deleteMultiple($keys) {} | |
15 | public function has($key) {} | |
16 | } | |
17 | $ex = new MyImpl(); | |
18 | var_dump($ex instanceof CacheInterface); | |
19 | --EXPECT-- | |
20 | bool(true) |
0 | --TEST-- | |
1 | Psr\SimpleCache\InvalidArgumentException | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\SimpleCache\InvalidArgumentException; | |
7 | class MyException extends Exception implements InvalidArgumentException {} | |
8 | $ex = new MyException('test'); | |
9 | var_dump($ex instanceof InvalidArgumentException); | |
10 | var_dump($ex instanceof Exception); | |
11 | try { | |
12 | throw $ex; | |
13 | } catch( InvalidArgumentException $e ) { | |
14 | var_dump($e->getMessage()); | |
15 | } | |
16 | --EXPECT-- | |
17 | bool(true) | |
18 | bool(true) | |
19 | string(4) "test" |
0 | <?php | |
1 | ||
2 | use Psr\Cache\CacheItemInterface; | |
3 | ||
4 | class SampleCacheItem implements CacheItemInterface | |
5 | { | |
6 | public function getKey() | |
7 | { | |
8 | var_dump(__METHOD__); | |
9 | } | |
10 | ||
11 | public function get() | |
12 | { | |
13 | var_dump(__METHOD__); | |
14 | } | |
15 | ||
16 | public function isHit() | |
17 | { | |
18 | var_dump(__METHOD__); | |
19 | } | |
20 | ||
21 | public function set($value) | |
22 | { | |
23 | var_dump(__METHOD__, $value); | |
24 | } | |
25 | ||
26 | public function expiresAt($expiration) | |
27 | { | |
28 | var_dump(__METHOD__, $expiration); | |
29 | } | |
30 | ||
31 | public function expiresAfter($time) | |
32 | { | |
33 | var_dump(__METHOD__, $time); | |
34 | } | |
35 | } |
0 | <?php | |
1 | ||
2 | use Psr\Cache\CacheItemInterface; | |
3 | use Psr\Cache\CacheItemPoolInterface; | |
4 | ||
5 | class SampleCacheItemPool implements CacheItemPoolInterface | |
6 | { | |
7 | public function getItem($key) | |
8 | { | |
9 | var_dump(__METHOD__, $key); | |
10 | } | |
11 | ||
12 | public function getItems(array $keys = array()) | |
13 | { | |
14 | var_dump(__METHOD__, $keys); | |
15 | } | |
16 | ||
17 | public function hasItem($key) | |
18 | { | |
19 | var_dump(__METHOD__, $key); | |
20 | } | |
21 | ||
22 | public function clear() | |
23 | { | |
24 | var_dump(__METHOD__); | |
25 | } | |
26 | ||
27 | public function deleteItem($key) | |
28 | { | |
29 | var_dump(__METHOD__, $key); | |
30 | } | |
31 | ||
32 | public function deleteItems(array $keys) | |
33 | { | |
34 | var_dump(__METHOD__, $keys); | |
35 | } | |
36 | ||
37 | public function save(CacheItemInterface $item) | |
38 | { | |
39 | var_dump(__METHOD__, $item); | |
40 | } | |
41 | ||
42 | public function saveDeferred(CacheItemInterface $item) | |
43 | { | |
44 | var_dump(__METHOD__, $item); | |
45 | } | |
46 | ||
47 | public function commit() | |
48 | { | |
49 | var_dump(__METHOD__); | |
50 | } | |
51 | } | |
52 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Client\ClientInterface; | |
3 | use Psr\Http\Message\RequestInterface; | |
4 | use Psr\Http\Message\ResponseInterface; | |
5 | ||
6 | class SampleClient implements ClientInterface | |
7 | { | |
8 | public function sendRequest(RequestInterface $request): ResponseInterface | |
9 | { | |
10 | var_dump(__METHOD__, $request); | |
11 | return new SampleResponse(); | |
12 | } | |
13 | } | |
14 |
0 | <?php | |
1 | ||
2 | use Psr\EventDispatcher\EventDispatcherInterface; | |
3 | ||
4 | class SampleEventDispatcher implements EventDispatcherInterface | |
5 | { | |
6 | public function dispatch(object $event) | |
7 | { | |
8 | var_dump(__METHOD__, is_object($event)); | |
9 | ||
10 | return $event; | |
11 | } | |
12 | } |
0 | <?php | |
1 | ||
2 | use Psr\EventDispatcher\ListenerProviderInterface; | |
3 | ||
4 | class SampleListenerProvider implements ListenerProviderInterface | |
5 | { | |
6 | public function getListenersForEvent(object $event): iterable | |
7 | { | |
8 | var_dump(__METHOD__, is_object($event)); | |
9 | ||
10 | return new ArrayIterator([]); | |
11 | } | |
12 | } |
0 | <?php | |
1 | ||
2 | use Psr\Log\LogLevel; | |
3 | use Psr\Log\LoggerInterface; | |
4 | ||
5 | class SampleLogger implements LoggerInterface { | |
6 | public function emergency($message, array $context = array()) { | |
7 | return $this->log(LogLevel::EMERGENCY, $message, $context); | |
8 | } | |
9 | public function alert($message, array $context = array()) { | |
10 | return $this->log(LogLevel::ALERT, $message, $context); | |
11 | } | |
12 | public function critical($message, array $context = array()) { | |
13 | return $this->log(LogLevel::CRITICAL, $message, $context); | |
14 | } | |
15 | public function error($message, array $context = array()) { | |
16 | return $this->log(LogLevel::ERROR, $message, $context); | |
17 | } | |
18 | public function warning($message, array $context = array()) { | |
19 | return $this->log(LogLevel::WARNING, $message, $context); | |
20 | } | |
21 | public function notice($message, array $context = array()) { | |
22 | return $this->log(LogLevel::NOTICE, $message, $context); | |
23 | } | |
24 | public function info($message, array $context = array()) { | |
25 | return $this->log(LogLevel::INFO, $message, $context); | |
26 | } | |
27 | public function debug($message, array $context = array()) { | |
28 | return $this->log(LogLevel::DEBUG, $message, $context); | |
29 | } | |
30 | public function log($level, $message, array $context = array()) { | |
31 | var_dump($level, $message, $context); | |
32 | } | |
33 | } | |
34 |
0 | <?php | |
1 | ||
2 | use Psr\Log\LogLevel; | |
3 | use Psr\Log\AbstractLogger; | |
4 | ||
5 | class SampleLogger2 extends AbstractLogger { | |
6 | public function log($level, $message, array $context = array()) { | |
7 | var_dump($level, $message, $context); | |
8 | } | |
9 | } | |
10 |
0 | <?php | |
1 | ||
2 | use Psr\Log\LoggerInterface; | |
3 | use Psr\Log\LoggerAwareInterface; | |
4 | ||
5 | class SampleLoggerAware implements LoggerAwareInterface { | |
6 | private $logger; | |
7 | public function setLogger(LoggerInterface $logger) { | |
8 | $this->logger = $logger; | |
9 | var_dump('got logger'); | |
10 | } | |
11 | public function doSomethingThatLogs() { | |
12 | $this->logger->emergency('test log'); | |
13 | } | |
14 | } | |
15 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\MessageInterface; | |
3 | use Psr\Http\Message\StreamInterface; | |
4 | ||
5 | class SampleMessage implements MessageInterface | |
6 | { | |
7 | public function getProtocolVersion() | |
8 | { | |
9 | var_dump(__METHOD__); | |
10 | } | |
11 | ||
12 | public function withProtocolVersion($version) | |
13 | { | |
14 | var_dump(__METHOD__, $version); | |
15 | } | |
16 | ||
17 | public function getHeaders() | |
18 | { | |
19 | var_dump(__METHOD__); | |
20 | } | |
21 | ||
22 | public function hasHeader($name) | |
23 | { | |
24 | var_dump(__METHOD__, $name); | |
25 | } | |
26 | ||
27 | public function getHeader($name) | |
28 | { | |
29 | var_dump(__METHOD__, $name); | |
30 | } | |
31 | ||
32 | public function getHeaderLine($name) | |
33 | { | |
34 | var_dump(__METHOD__, $name); | |
35 | } | |
36 | ||
37 | public function withHeader($name, $value) | |
38 | { | |
39 | var_dump(__METHOD__, $name, $value); | |
40 | } | |
41 | ||
42 | public function withAddedHeader($name, $value) | |
43 | { | |
44 | var_dump(__METHOD__, $name, $value); | |
45 | } | |
46 | ||
47 | public function withoutHeader($name) | |
48 | { | |
49 | var_dump(__METHOD__, $name); | |
50 | } | |
51 | ||
52 | public function getBody() | |
53 | { | |
54 | var_dump(__METHOD__); | |
55 | } | |
56 | ||
57 | public function withBody(StreamInterface $body) | |
58 | { | |
59 | var_dump(__METHOD__, $body); | |
60 | } | |
61 | } | |
62 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Server\MiddlewareInterface; | |
3 | use Psr\Http\Server\RequestHandlerInterface; | |
4 | use Psr\Http\Message\ServerRequestInterface; | |
5 | use Psr\Http\Message\ResponseInterface; | |
6 | ||
7 | class SampleMiddleware implements MiddlewareInterface { | |
8 | public function process(ServerRequestInterface $reqeust, RequestHandlerInterface $handler): ResponseInterface | |
9 | { | |
10 | var_dump(__METHOD__); | |
11 | ||
12 | return new SampleResponse(); | |
13 | } | |
14 | } | |
15 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\RequestInterface; | |
3 | use Psr\Http\Message\UriInterface; | |
4 | ||
5 | class SampleRequest extends SampleMessage implements RequestInterface | |
6 | { | |
7 | public function getRequestTarget() | |
8 | { | |
9 | var_dump(__METHOD__); | |
10 | } | |
11 | ||
12 | public function withRequestTarget($requestTarget) | |
13 | { | |
14 | var_dump(__METHOD__, $requestTarget); | |
15 | } | |
16 | ||
17 | public function getMethod() | |
18 | { | |
19 | var_dump(__METHOD__); | |
20 | } | |
21 | ||
22 | public function withMethod($method) | |
23 | { | |
24 | var_dump(__METHOD__, $method); | |
25 | } | |
26 | ||
27 | public function getUri() | |
28 | { | |
29 | var_dump(__METHOD__); | |
30 | } | |
31 | ||
32 | public function withUri(UriInterface $uri, $preserveHost = false) | |
33 | { | |
34 | var_dump(__METHOD__, $uri, $preserveHost); | |
35 | } | |
36 | } | |
37 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\RequestFactoryInterface; | |
3 | use Psr\Http\Message\RequestInterface; | |
4 | ||
5 | class SampleRequestFactory implements RequestFactoryInterface | |
6 | { | |
7 | public function createRequest(string $method, $uri): RequestInterface | |
8 | { | |
9 | var_dump(__METHOD__, $method, $uri); | |
10 | return new SampleRequest(); | |
11 | } | |
12 | } | |
13 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Server\RequestHandlerInterface; | |
3 | use Psr\Http\Message\ServerRequestInterface; | |
4 | use Psr\Http\Message\ResponseInterface; | |
5 | ||
6 | class SampleRequestHandler implements RequestHandlerInterface { | |
7 | public function handle(ServerRequestInterface $reqeust): ResponseInterface | |
8 | { | |
9 | var_dump(__METHOD__); | |
10 | ||
11 | return new SampleResponse(); | |
12 | } | |
13 | } | |
14 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\ResponseInterface; | |
3 | ||
4 | class SampleResponse extends SampleMessage implements ResponseInterface | |
5 | { | |
6 | public function getStatusCode() | |
7 | { | |
8 | var_dump(__METHOD__); | |
9 | } | |
10 | ||
11 | public function withStatus($code, $reasonPhrase = '') | |
12 | { | |
13 | var_dump(__METHOD__, $code, $reasonPhrase); | |
14 | } | |
15 | ||
16 | public function getReasonPhrase() | |
17 | { | |
18 | var_dump(__METHOD__); | |
19 | } | |
20 | ||
21 | } | |
22 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\ResponseFactoryInterface; | |
3 | use Psr\Http\Message\ResponseInterface; | |
4 | ||
5 | class SampleResponseFactory implements ResponseFactoryInterface | |
6 | { | |
7 | public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface | |
8 | { | |
9 | var_dump(__METHOD__, $code, $reasonPhrase); | |
10 | return new SampleResponse(); | |
11 | } | |
12 | } | |
13 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\ServerRequestInterface; | |
3 | ||
4 | class SampleServerRequest extends SampleRequest implements ServerRequestInterface | |
5 | { | |
6 | public function getServerParams() | |
7 | { | |
8 | var_dump(__METHOD__); | |
9 | } | |
10 | ||
11 | public function getCookieParams() | |
12 | { | |
13 | var_dump(__METHOD__); | |
14 | } | |
15 | ||
16 | public function withCookieParams(array $cookies) | |
17 | { | |
18 | var_dump(__METHOD__, $cookies); | |
19 | } | |
20 | ||
21 | public function getQueryParams() | |
22 | { | |
23 | var_dump(__METHOD__); | |
24 | } | |
25 | ||
26 | public function withQueryParams(array $query) | |
27 | { | |
28 | var_dump(__METHOD__, $query); | |
29 | } | |
30 | ||
31 | public function getUploadedFiles() | |
32 | { | |
33 | var_dump(__METHOD__); | |
34 | } | |
35 | ||
36 | public function withUploadedFiles(array $uploadedFiles) | |
37 | { | |
38 | var_dump(__METHOD__, $uploadedFiles); | |
39 | } | |
40 | ||
41 | public function getParsedBody() | |
42 | { | |
43 | var_dump(__METHOD__); | |
44 | } | |
45 | ||
46 | public function withParsedBody($data) | |
47 | { | |
48 | var_dump(__METHOD__, $data); | |
49 | } | |
50 | ||
51 | public function getAttributes() | |
52 | { | |
53 | var_dump(__METHOD__); | |
54 | } | |
55 | ||
56 | public function getAttribute($name, $default = null) | |
57 | { | |
58 | var_dump(__METHOD__, $name, $default); | |
59 | } | |
60 | ||
61 | public function withAttribute($name, $value) | |
62 | { | |
63 | var_dump(__METHOD__, $name, $value); | |
64 | } | |
65 | ||
66 | public function withoutAttribute($name) | |
67 | { | |
68 | var_dump(__METHOD__, $name); | |
69 | } | |
70 | } | |
71 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\ServerRequestFactoryInterface; | |
3 | use Psr\Http\Message\ServerRequestInterface; | |
4 | ||
5 | class SampleServerRequestFactory implements ServerRequestFactoryInterface | |
6 | { | |
7 | public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface | |
8 | { | |
9 | var_dump(__METHOD__, $method, $uri, $serverParams); | |
10 | return new SampleServerRequest(); | |
11 | } | |
12 | } | |
13 |
0 | <?php | |
1 | ||
2 | use Psr\EventDispatcher\StoppableEventInterface; | |
3 | ||
4 | class SampleStoppableEvent implements StoppableEventInterface | |
5 | { | |
6 | public function isPropagationStopped(): bool | |
7 | { | |
8 | var_dump(__METHOD__); | |
9 | ||
10 | return true; | |
11 | } | |
12 | } |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\StreamInterface; | |
3 | ||
4 | class SampleStream implements StreamInterface | |
5 | { | |
6 | public function __toString() | |
7 | { | |
8 | var_dump(__METHOD__); | |
9 | return __METHOD__; | |
10 | } | |
11 | ||
12 | public function close() | |
13 | { | |
14 | var_dump(__METHOD__); | |
15 | } | |
16 | ||
17 | public function detach() | |
18 | { | |
19 | var_dump(__METHOD__); | |
20 | } | |
21 | ||
22 | public function getSize() | |
23 | { | |
24 | var_dump(__METHOD__); | |
25 | } | |
26 | ||
27 | public function tell() | |
28 | { | |
29 | var_dump(__METHOD__); | |
30 | } | |
31 | ||
32 | public function eof() | |
33 | { | |
34 | var_dump(__METHOD__); | |
35 | } | |
36 | ||
37 | public function isSeekable() | |
38 | { | |
39 | var_dump(__METHOD__); | |
40 | } | |
41 | ||
42 | public function seek($offset, $whence = SEEK_SET) | |
43 | { | |
44 | var_dump(__METHOD__, $offset, $whence); | |
45 | } | |
46 | ||
47 | public function rewind() | |
48 | { | |
49 | var_dump(__METHOD__); | |
50 | } | |
51 | ||
52 | public function isWritable() | |
53 | { | |
54 | var_dump(__METHOD__); | |
55 | } | |
56 | ||
57 | public function write($string) | |
58 | { | |
59 | var_dump(__METHOD__, $string); | |
60 | } | |
61 | ||
62 | public function isReadable() | |
63 | { | |
64 | var_dump(__METHOD__); | |
65 | } | |
66 | ||
67 | public function read($length) | |
68 | { | |
69 | var_dump(__METHOD__, $length); | |
70 | } | |
71 | ||
72 | public function getContents() | |
73 | { | |
74 | var_dump(__METHOD__); | |
75 | } | |
76 | ||
77 | public function getMetadata($key = null) | |
78 | { | |
79 | var_dump(__METHOD__, $key); | |
80 | } | |
81 | } | |
82 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\StreamFactoryInterface; | |
3 | use Psr\Http\Message\StreamInterface; | |
4 | ||
5 | class SampleStreamFactory implements StreamFactoryInterface | |
6 | { | |
7 | public function createStream(string $content = ''): StreamInterface | |
8 | { | |
9 | var_dump(__METHOD__, $content); | |
10 | return new SampleStream(); | |
11 | } | |
12 | ||
13 | public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface | |
14 | { | |
15 | var_dump(__METHOD__, $filename, $mode); | |
16 | return new SampleStream(); | |
17 | } | |
18 | ||
19 | public function createStreamFromResource($resource): StreamInterface | |
20 | { | |
21 | var_dump(__METHOD__, $resource); | |
22 | return new SampleStream(); | |
23 | } | |
24 | } | |
25 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\UploadedFileInterface; | |
3 | ||
4 | class SampleUploadedFile implements UploadedFileInterface | |
5 | { | |
6 | public function getStream() | |
7 | { | |
8 | var_dump(__METHOD__); | |
9 | } | |
10 | ||
11 | public function moveTo($targetPath) | |
12 | { | |
13 | var_dump(__METHOD__, $targetPath); | |
14 | } | |
15 | ||
16 | public function getSize() | |
17 | { | |
18 | var_dump(__METHOD__); | |
19 | } | |
20 | ||
21 | public function getError() | |
22 | { | |
23 | var_dump(__METHOD__); | |
24 | } | |
25 | ||
26 | public function getClientFilename() | |
27 | { | |
28 | var_dump(__METHOD__); | |
29 | } | |
30 | ||
31 | public function getClientMediaType() | |
32 | { | |
33 | var_dump(__METHOD__); | |
34 | } | |
35 | } | |
36 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\UploadedFileFactoryInterface; | |
3 | use Psr\Http\Message\UploadedFileInterface; | |
4 | use Psr\Http\Message\StreamInterface; | |
5 | ||
6 | class SampleUploadedFileFactory implements UploadedFileFactoryInterface | |
7 | { | |
8 | public function createUploadedFile( | |
9 | StreamInterface $stream, | |
10 | int $size = null, | |
11 | int $error = \UPLOAD_ERR_OK, | |
12 | string $clientFilename = null, | |
13 | string $clientMediaType = null | |
14 | ): UploadedFileInterface | |
15 | { | |
16 | var_dump(__METHOD__, $stream, $size, $error, $clientFilename, $clientMediaType); | |
17 | return new SampleUploadedFile(); | |
18 | } | |
19 | } | |
20 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\UriInterface; | |
3 | ||
4 | class SampleUri implements UriInterface | |
5 | { | |
6 | public function getScheme() | |
7 | { | |
8 | var_dump(__METHOD__); | |
9 | } | |
10 | ||
11 | public function getAuthority() | |
12 | { | |
13 | var_dump(__METHOD__); | |
14 | } | |
15 | ||
16 | public function getUserInfo() | |
17 | { | |
18 | var_dump(__METHOD__); | |
19 | } | |
20 | ||
21 | public function getHost() | |
22 | { | |
23 | var_dump(__METHOD__); | |
24 | } | |
25 | ||
26 | public function getPort() | |
27 | { | |
28 | var_dump(__METHOD__); | |
29 | } | |
30 | ||
31 | public function getPath() | |
32 | { | |
33 | var_dump(__METHOD__); | |
34 | } | |
35 | ||
36 | public function getQuery() | |
37 | { | |
38 | var_dump(__METHOD__); | |
39 | } | |
40 | ||
41 | public function getFragment() | |
42 | { | |
43 | var_dump(__METHOD__); | |
44 | } | |
45 | ||
46 | public function withScheme($scheme) | |
47 | { | |
48 | var_dump(__METHOD__, $scheme); | |
49 | } | |
50 | ||
51 | public function withUserInfo($user, $password = null) | |
52 | { | |
53 | var_dump(__METHOD__, $user, $password); | |
54 | } | |
55 | ||
56 | public function withHost($host) | |
57 | { | |
58 | var_dump(__METHOD__, $host); | |
59 | } | |
60 | ||
61 | public function withPort($port) | |
62 | { | |
63 | var_dump(__METHOD__, $port); | |
64 | } | |
65 | ||
66 | public function withPath($path) | |
67 | { | |
68 | var_dump(__METHOD__, $path); | |
69 | } | |
70 | ||
71 | public function withQuery($query) | |
72 | { | |
73 | var_dump(__METHOD__, $query); | |
74 | } | |
75 | ||
76 | public function withFragment($fragment) | |
77 | { | |
78 | var_dump(__METHOD__, $fragment); | |
79 | } | |
80 | ||
81 | public function __toString() | |
82 | { | |
83 | var_dump(__METHOD__); | |
84 | return ''; | |
85 | } | |
86 | ||
87 | } | |
88 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\UriFactoryInterface; | |
3 | use Psr\Http\Message\UriInterface; | |
4 | ||
5 | class SampleUriFactory implements UriFactoryInterface | |
6 | { | |
7 | public function createUri(string $uri = ''): UriInterface | |
8 | { | |
9 | var_dump(__METHOD__, $uri); | |
10 | return new SampleUri(); | |
11 | } | |
12 | } | |
13 |
0 | --TEST-- | |
1 | Psr\Log\LoggerInterface - Invalid context default value (PHP 7) | |
2 | --SKIPIF-- | |
3 | <?php | |
4 | include 'skip.inc'; | |
5 | if (PHP_VERSION_ID >= 80000) { | |
6 | print "skip Due to version incompatibility"; | |
7 | } | |
8 | ?> | |
9 | --FILE-- | |
10 | <?php | |
11 | $reflectionMethod = new \ReflectionMethod(\Psr\Log\LoggerInterface::class, "emergency"); | |
12 | $reflectionParameter = $reflectionMethod->getParameters()[1]; | |
13 | var_dump($reflectionParameter->isOptional()); | |
14 | var_dump($reflectionParameter->isDefaultValueAvailable()); | |
15 | var_dump($reflectionParameter->getDefaultValue()); | |
16 | --EXPECT-- | |
17 | bool(true) | |
18 | bool(true) | |
19 | array(0) { | |
20 | } | |
21 | --XFAIL-- | |
22 | PHP 7 internal functions cannot have default values reported via reflection |
0 | --TEST-- | |
1 | Psr\Log\LoggerInterface - Invalid context default value (PHP 8) | |
2 | --SKIPIF-- | |
3 | <?php | |
4 | include 'skip.inc'; | |
5 | if (PHP_VERSION_ID < 80000) { | |
6 | print "skip Due to version incompatibility"; | |
7 | } | |
8 | ?> | |
9 | --FILE-- | |
10 | <?php | |
11 | $reflectionMethod = new \ReflectionMethod(\Psr\Log\LoggerInterface::class, "emergency"); | |
12 | $reflectionParameter = $reflectionMethod->getParameters()[1]; | |
13 | var_dump($reflectionParameter->isOptional()); | |
14 | var_dump($reflectionParameter->isDefaultValueAvailable()); | |
15 | var_dump($reflectionParameter->getDefaultValue()); | |
16 | --EXPECT-- | |
17 | bool(true) | |
18 | bool(true) | |
19 | array(0) { | |
20 | } |
0 | --TEST-- | |
1 | psr phpinfo | |
2 | --SKIPIF-- | |
3 | <?php include('skip_lt_php72.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | phpinfo(INFO_MODULES); | |
7 | --EXPECTF-- | |
8 | %A | |
9 | psr | |
10 | %A | |
11 | Version => %s | |
12 | Released => %s | |
13 | Authors => %s | |
14 | PSR-3 Log Version => %d.%d.%d | |
15 | PSR-6 Cache Version => %d.%d.%d | |
16 | PSR-7 Http Message Version => %d.%d.%d | |
17 | PSR-11 Container Version => %d.%d.%d | |
18 | PSR-13 Link Version => %d.%d.%d | |
19 | PSR-14 Event Dispatcher => %d.%d.%d | |
20 | PSR-15 HTTP Handlers (Server Handler) => %d.%d.%d | |
21 | PSR-15 HTTP Handlers (Middleware) => %d.%d.%d | |
22 | PSR-16 Simple Cache Version => %d.%d.%d | |
23 | PSR-17 HTTP Factories => %d.%d.%d | |
24 | PSR-18 HTTP Client => %d.%d.%d | |
25 | %A |
0 | --TEST-- | |
1 | psr phpinfo | |
2 | --SKIPIF-- | |
3 | <?php | |
4 | include('skip.inc'); | |
5 | if (PHP_VERSION_ID >= 70200) { | |
6 | print "skip Due to version incompatibility"; | |
7 | } | |
8 | ?> | |
9 | --FILE-- | |
10 | <?php | |
11 | phpinfo(INFO_MODULES); | |
12 | --EXPECTF-- | |
13 | %A | |
14 | psr | |
15 | %A | |
16 | Version => %s | |
17 | Released => %s | |
18 | Authors => %s | |
19 | PSR-3 Log Version => %d.%d.%d | |
20 | PSR-6 Cache Version => %d.%d.%d | |
21 | PSR-7 Http Message Version => %d.%d.%d | |
22 | PSR-11 Container Version => %d.%d.%d | |
23 | PSR-13 Link Version => %d.%d.%d | |
24 | PSR-15 HTTP Handlers (Server Handler) => %d.%d.%d | |
25 | PSR-15 HTTP Handlers (Middleware) => %d.%d.%d | |
26 | PSR-16 Simple Cache Version => %d.%d.%d | |
27 | PSR-17 HTTP Factories => %d.%d.%d | |
28 | PSR-18 HTTP Client => %d.%d.%d | |
29 | %A |
0 | <?php | |
1 | include 'skip.inc'; | |
2 | if (PHP_VERSION_ID < 70200) { | |
3 | print "skip Due to version incompatibility"; | |
4 | } |
0 | # Changelog | |
1 | ||
2 | All Notable changes to `php-psr` will be documented in this file. | |
3 | ||
4 | Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles. | |
5 | ||
6 | ## [1.2.0] - 2021-12-11 | |
7 | ||
8 | ### Added | |
9 | - PHP 8.1 support (@Jeckerson) | |
10 | ||
11 | ### Changed | |
12 | - All classes are now defined in a separate namespace `PsrExt` and aliased into the `Psr` | |
13 | namespace to aid in debuggging compatibility issues for framework maintainers. ([GH-88](https://github.com/jbboehr/php-psr/issues/88)) | |
14 | ||
15 | ## [1.1.0] - 2021-04-10 | |
16 | ||
17 | ### Changed | |
18 | - Update psr/container to 1.1.1 | |
19 | ||
20 | ### Added | |
21 | - Version ID constants to each header | |
22 | ||
23 | ### Fixed | |
24 | - Use __dllspec(dllimport) where appropriate in php_psr.h on windows | |
25 | ||
26 | ## [1.0.1] - 2020-11-12 | |
27 | ||
28 | ### Fixed | |
29 | - Test failures on PHP 8 in psr-http-client and psr-http-message due to changes in inheritance | |
30 | - Compile failures with clang | |
31 | - Compatibility with API changes to PHP 8 in psr-log (@remicollet) | |
32 | - Report proper default value in reflection for LoggerInterface - PHP 8 only ([GH-78](https://github.com/jbboehr/php-psr/issues/78)) | |
33 | ||
34 | ## [1.0.0] - 2020-02-18 | |
35 | ||
36 | ### Changed | |
37 | - Drop max PHP version constraint in package.xml | |
38 | ||
39 | ## [0.7.0] - 2019-08-12 | |
40 | ||
41 | ### Added | |
42 | - Preliminary PHP 7.4 and 8.0 (master) support | |
43 | - PSR-14 Event Dispatcher support | |
44 | ||
45 | ### Removed | |
46 | - PHP 5 support | |
47 | ||
48 | ## [0.6.1] - 2018-11-13 | |
49 | ||
50 | ### Fixed | |
51 | - Test failures on PHP 5.6 | |
52 | ||
53 | ## [0.6.0] - 2018-11-11 | |
54 | ||
55 | ### Added | |
56 | - PSR-18 HTTP Client support | |
57 | ||
58 | ## [0.5.1] - 2018-10-29 | |
59 | ||
60 | ### Fixed | |
61 | - `Psr\Http\Message\ServerRequestInterface` did not actually extend `Psr\Http\Message\RequestInterface` | |
62 | ||
63 | ## [0.5.0] - 2018-09-10 | |
64 | ||
65 | ### Added | |
66 | - PSR-17 HTTP Factories support | |
67 | - Whitelist PHP 7.3 | |
68 | ||
69 | ## [0.4.0] - 2018-03-05 | |
70 | ||
71 | ### Added | |
72 | - PSR-15 HTTP Handlers support | |
73 | ||
74 | ## [0.3.0] - 2018-02-08 | |
75 | ||
76 | ### Added | |
77 | - PSR-11 Container support | |
78 | - PSR-13 Link support | |
79 | - PSR-16 Simple Cache support | |
80 | - Windows support | |
81 | ||
82 | ### Removed | |
83 | - No longer run CI against PHP 5 due to lack of support in libraries | |
84 | ||
85 | ### Fixed | |
86 | - TypeError when no argument is passed to methods in AbstractLogger | |
87 | ||
88 | ## [0.2.3] - 2016-05-05 | |
89 | ||
90 | ### Changed | |
91 | - Changed the license from `LGPLv3` to `Simplified BSD License` | |
92 | - Move PHP5/7 compatibility macros into separate header | |
93 | ||
94 | ## [0.2.2] - 2016-03-16 | |
95 | ||
96 | ### Added | |
97 | - arginfo for interfaces in headers | |
98 | ||
99 | ### Fixed | |
100 | - Memory leak in Psr\Log\AbstractLogger::log() | |
101 | ||
102 | ## [0.2.1] - 2015-12-15 | |
103 | ||
104 | ### Changed | |
105 | - PSR-6 [psr/cache](https://github.com/php-fig/cache) v1.0.0 is released without changes to interfaces since commit [4908941](https://github.com/php-fig/cache/commit/4908941) | |
106 | - Test PSR-6 interfaces against Stash v1.0.0-dev branch | |
107 | ||
108 | ### Fixed | |
109 | - Memory leak in Psr\Log\AbstractLogger::log() with PHP7 | |
110 | ||
111 | ## [0.2.0] - 2015-12-09 | |
112 | ||
113 | ### Changed | |
114 | - Update PSR-6 interfaces for commits up to [4908941](https://github.com/php-fig/cache/commit/4908941) | |
115 | ||
116 | ### Fixed | |
117 | - Invalid read in Psr\Log\AbstractLogger::log() | |
118 | ||
119 | ## 0.1.0 - 2015-08-07 | |
120 | ||
121 | ### Added | |
122 | - PSR-3 [psr/log](https://github.com/php-fig/log) v1.0.0 interfaces and classes | |
123 | - PSR-6 [commit 2b812a4](https://github.com/php-fig/fig-standards/commit/2b812a4) interfaces | |
124 | - PSR-7 [psr/http-message](https://github.com/php-fig/http-message) v1.0.0 interfaces | |
125 | ||
126 | ||
127 | [Unreleased]: https://github.com/jbboehr/php-psr/compare/v1.2.0...HEAD | |
128 | [1.2.0]: https://github.com/jbboehr/php-psr/compare/v1.1.0...v1.2.0 | |
129 | [1.1.0]: https://github.com/jbboehr/php-psr/compare/v1.0.1...v1.1.0 | |
130 | [1.0.1]: https://github.com/jbboehr/php-psr/compare/v1.0.0...v1.0.1 | |
131 | [1.0.0]: https://github.com/jbboehr/php-psr/compare/v0.7.0...v1.0.0 | |
132 | [0.7.0]: https://github.com/jbboehr/php-psr/compare/v0.6.1...v0.7.0 | |
133 | [0.6.1]: https://github.com/jbboehr/php-psr/compare/v0.6.0...v0.6.1 | |
134 | [0.6.0]: https://github.com/jbboehr/php-psr/compare/v0.5.1...v0.6.0 | |
135 | [0.5.1]: https://github.com/jbboehr/php-psr/compare/v0.5.0...v0.5.1 | |
136 | [0.5.0]: https://github.com/jbboehr/php-psr/compare/v0.4.0...v0.5.0 | |
137 | [0.4.0]: https://github.com/jbboehr/php-psr/compare/v0.3.0...v0.4.0 | |
138 | [0.3.0]: https://github.com/jbboehr/php-psr/compare/v0.2.3...v0.3.0 | |
139 | [0.2.3]: https://github.com/jbboehr/php-psr/compare/v0.2.2...v0.2.3 | |
140 | [0.2.2]: https://github.com/jbboehr/php-psr/compare/v0.2.1...v0.2.2 | |
141 | [0.2.1]: https://github.com/jbboehr/php-psr/compare/v0.2.0...v0.2.1 | |
142 | [0.2.0]: https://github.com/jbboehr/php-psr/compare/v0.1.0...v0.2.0 |
0 | Simplified BSD License | |
1 | ====================== | |
2 | ||
3 | _Copyright © 2016-2018 John Boehr_ | |
4 | _All rights reserved._ | |
5 | ||
6 | Redistribution and use in source and binary forms, with or without | |
7 | modification, are permitted provided that the following conditions are met: | |
8 | ||
9 | 1. Redistributions of source code must retain the above copyright notice, this | |
10 | list of conditions and the following disclaimer. | |
11 | 2. Redistributions in binary form must reproduce the above copyright notice, | |
12 | this list of conditions and the following disclaimer in the documentation | |
13 | and/or other materials provided with the distribution. | |
14 | ||
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND | |
16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
18 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | |
19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
25 | ||
26 | The views and conclusions contained in the software and documentation are those | |
27 | of the authors and should not be interpreted as representing official policies, | |
28 | either expressed or implied, of the FreeBSD Project. |
0 | ||
1 | # php-psr | |
2 | ||
3 | [![GitHub Linux Build Status](https://github.com/jbboehr/php-psr/workflows/linux/badge.svg)](https://github.com/jbboehr/php-psr/actions?query=workflow%3Alinux) | |
4 | [![GitHub OSX Build Status](https://github.com/jbboehr/php-psr/workflows/osx/badge.svg)](https://github.com/jbboehr/php-psr/actions?query=workflow%3Aosx) | |
5 | [![GitHub Windows Build Status](https://github.com/jbboehr/php-psr/workflows/windows/badge.svg)](https://github.com/jbboehr/php-psr/actions?query=workflow%3Awindows) | |
6 | [![GitHub Docker Build Status](https://github.com/jbboehr/php-psr/workflows/docker/badge.svg)](https://github.com/jbboehr/php-psr/actions?query=workflow%3Adocker) | |
7 | [![Appveyor Build Status][:badge-appveyor:]][:build-appveyor:] | |
8 | [![Coverage Status][:badge-coveralls:]][:build-coveralls:] | |
9 | [![License][:badge-license:]][:ext-license:] | |
10 | ||
11 | This PHP extension provides the interfaces from the [PSR][:psr-fig:] standards as established by the [PHP-FIG][:php-fig:] group. | |
12 | You can use interfaces provided by this extension in another extension easily - see this [example][:example:]. | |
13 | ||
14 | As of v1.2 of the extension, classes are defined in the `PsrExt` namespace and aliased into the `Psr` namespace. | |
15 | ||
16 | ## Interfaces | |
17 | ||
18 | | PSR | Reference | Tested against | | |
19 | | --- | --- | --- | | |
20 | | [PSR-3] | [psr/log] [*](#psrlogunimpl) | [monolog/monolog] | | |
21 | | [PSR-6] | [psr/cache] | [psx/cache], [php-fig/cache-util] | | |
22 | | [PSR-7] | [psr/http-message] | [laminas/laminas-diactoros] | | |
23 | | [PSR-11] | [psr/container] | [psx/dependency] | | |
24 | | [PSR-13] | [psr/link] | [php-fig/link-util] | | |
25 | | [PSR-14] | [psr/event-dispatcher] | [crell/tukio], [php-fig/event-dispatcher-util] | | |
26 | | [PSR-15] | [psr/http-server-handler] | [equip/dispatch] | | |
27 | | [PSR-15] | [psr/http-server-middleware] | [middlewares/request-handler] | | |
28 | | [PSR-16] | [psr/simple-cache] | [psx/cache] | | |
29 | | [PSR-17] | [psr/http-factory] | [http-interop/http-factory-guzzle] | | |
30 | | [PSR-18] | [psr/http-client] | [ricardofiorani/guzzle-psr18-adapter] | | |
31 | ||
32 | ## Installation | |
33 | ||
34 | ### Linux / macOS | |
35 | ||
36 | Prerequisite packages are: | |
37 | ||
38 | - PHP development headers and tools, `php` >= 7.3 | |
39 | - `gcc` >= 4.4 | `clang` >= 3.x | `vc` >= 11 | |
40 | - GNU `make` >= 3.81 | |
41 | - `automake` | |
42 | - `autoconf` | |
43 | ||
44 | You will need the PHP development headers. If PHP was manually installed, these should be available by default. Otherwise, you will need to fetch them from a repository. | |
45 | ||
46 | ```bash | |
47 | git clone https://github.com/jbboehr/php-psr.git | |
48 | cd php-psr | |
49 | phpize | |
50 | ./configure | |
51 | make | |
52 | make test | |
53 | sudo make install | |
54 | ``` | |
55 | ||
56 | If you have specific PHP versions running: | |
57 | ||
58 | ```bash | |
59 | git clone https://github.com/jbboehr/php-psr.git | |
60 | cd php-psr | |
61 | /usr/local/bin/phpize | |
62 | ./configure --with-php-config=/usr/local/bin/php-config | |
63 | make | |
64 | make test | |
65 | sudo make install | |
66 | ``` | |
67 | ||
68 | Add the extension to your *php.ini*: | |
69 | ||
70 | ```ini | |
71 | echo extension=psr.so | tee -a /path/to/your/php.ini | |
72 | ``` | |
73 | ||
74 | Finally, _restart the web server_. | |
75 | ||
76 | ### PECL / Windows | |
77 | ||
78 | You may also be able to install this extension via [PECL][:pecl-psr:]: | |
79 | ||
80 | ```bash | |
81 | pecl install psr | |
82 | ``` | |
83 | ||
84 | or by downloading a DLL from [PECL][:pecl-psr:] or [windows.php.net][:windows-psr:] and placing it in the appropriate directory. | |
85 | ||
86 | ### Nix / NixOS | |
87 | ||
88 | ```bash | |
89 | nix-env -i -f https://github.com/jbboehr/php-psr/archive/master.tar.gz | |
90 | ``` | |
91 | ||
92 | with a custom version of PHP: | |
93 | ||
94 | ```bash | |
95 | nix-env -i -f https://github.com/jbboehr/php-psr/archive/master.tar.gz --arg php '(import <nixpkgs> {}).php71' | |
96 | ``` | |
97 | ||
98 | or, in a `.nix` file: | |
99 | ||
100 | ```nix | |
101 | (import <nixpkgs> {}).callPackage (import (fetchTarball { | |
102 | url = https://github.com/jbboehr/php-psr/archive/v1.0.0.tar.gz; | |
103 | sha256 = "12237b392rz224r4d8p6pwnldpl2bfrvpcim5947avjd49sn8ss4"; | |
104 | })) {} | |
105 | ``` | |
106 | ||
107 | ### Using with composer | |
108 | ||
109 | In your project, you can prevent the installation of the unnecessary composer packages provided by this extension by adding the following to your `composer.json`. You will need to make sure the extension is installed and enabled in your PHP configuration. You may also want to consider leaving them installed to provide stubs to your IDE. This configuration is not suitable for a library published to packagist. | |
110 | ||
111 | <a name="psrlogunimpl">Note:</a> `LoggerInterfaceTest` and `TestLogger` from `psr/log` are not implemented. If you use these classes, you should keep `psr/log` installed ([discussion](https://github.com/jbboehr/php-psr/issues/57)). | |
112 | ||
113 | ```json | |
114 | { | |
115 | "name": "sample/app", | |
116 | "require": { | |
117 | "ext-psr": "*" | |
118 | }, | |
119 | "provide": { | |
120 | "psr/log": "1.0.0", | |
121 | "psr/cache": "1.0.0", | |
122 | "psr/http-message": "1.0.0", | |
123 | "psr/container": "1.1.1", | |
124 | "psr/link": "1.0.0", | |
125 | "psr/event-dispatcher": "1.0.0", | |
126 | "psr/http-server-handler": "1.0.0", | |
127 | "psr/http-server-middleware": "1.0.0", | |
128 | "psr/simple-cache": "1.0.0", | |
129 | "psr/http-factory": "1.0.0", | |
130 | "psr/http-client": "1.0.0" | |
131 | }, | |
132 | } | |
133 | ``` | |
134 | ||
135 | This will use this PHP extension instead of downloading from packagist. | |
136 | ||
137 | ## Credits | |
138 | ||
139 | * [@sergeyklay][:github-sergeyklay:] - Appveyor and documentation improvements | |
140 | * [@flyinghail][:github-flyinghail:] - PSR-14, PSR-15, PSR-17, and PSR-18 support | |
141 | * [@Jan-E][:github-jan-e:] - Original appveyor template | |
142 | * [All Contributors](https://github.com/jbboehr/php-psr/graphs/contributors) | |
143 | ||
144 | ## License | |
145 | ||
146 | This project is open source software licensed under the Simplified BSD License. | |
147 | See the [LICENSE.md][:ext-license:] file for more information. | |
148 | ||
149 | PSR Interfaces: Copyright (c) 2012-present [PHP Framework Interoperability Group][:php-fig:]. | |
150 | ||
151 | [:psr-fig:]: https://www.php-fig.org/psr | |
152 | [:php-fig:]: https://www.php-fig.org | |
153 | [:pecl-psr:]: https://pecl.php.net/package/psr | |
154 | [:badge-appveyor:]: https://ci.appveyor.com/api/projects/status/x1ymkqggy1mkl0ux/branch/master?svg=true | |
155 | [:badge-coveralls:]: https://coveralls.io/repos/jbboehr/php-psr/badge.svg?branch=master&service=github | |
156 | [:badge-license:]: https://img.shields.io/badge/license-BSD-brightgreen.svg | |
157 | [:build-appveyor:]: https://ci.appveyor.com/project/jbboehr/php-psr/branch/master | |
158 | [:build-coveralls:]: https://coveralls.io/github/jbboehr/php-psr?branch=master | |
159 | [:ext-license:]: https://github.com/jbboehr/php-psr/blob/master/LICENSE.md | |
160 | [:example:]: https://github.com/jbboehr/php-handlebars/blob/v0.7.1/impl.c#L213-L215 | |
161 | [:windows-psr:]: http://windows.php.net/downloads/pecl/releases/psr/ | |
162 | ||
163 | [PSR-3]: http://www.php-fig.org/psr/psr-3 | |
164 | [PSR-6]: https://www.php-fig.org/psr/psr-6 | |
165 | [PSR-7]: https://www.php-fig.org/psr/psr-7 | |
166 | [PSR-11]: https://www.php-fig.org/psr/psr-11 | |
167 | [PSR-13]: https://www.php-fig.org/psr/psr-13 | |
168 | [PSR-14]: http://www.php-fig.org/psr/psr-14 | |
169 | [PSR-15]: http://www.php-fig.org/psr/psr-15 | |
170 | [PSR-16]: https://www.php-fig.org/psr/psr-16 | |
171 | [PSR-17]: https://www.php-fig.org/psr/psr-17 | |
172 | [PSR-18]: https://www.php-fig.org/psr/psr-18 | |
173 | ||
174 | [psr/log]: https://github.com/php-fig/log | |
175 | [psr/cache]: https://github.com/php-fig/cache | |
176 | [psr/http-message]: https://github.com/php-fig/http-message | |
177 | [psr/container]: https://github.com/php-fig/container | |
178 | [psr/link]: https://github.com/php-fig/link | |
179 | [psr/simple-cache]: https://github.com/php-fig/simple-cache | |
180 | [psr/http-server-handler]: https://github.com/php-fig/http-server-handler | |
181 | [psr/http-server-middleware]: https://github.com/php-fig/http-server-middleware | |
182 | [psr/http-factory]: https://github.com/php-fig/http-factory | |
183 | [psr/http-client]: https://github.com/php-fig/http-client | |
184 | [psr/event-dispatcher]: https://github.com/php-fig/event-dispatcher | |
185 | ||
186 | [equip/dispatch]: https://github.com/equip/dispatch | |
187 | [middlewares/request-handler]: https://github.com/middlewares/request-handler | |
188 | [http-interop/http-factory-guzzle]: https://github.com/http-interop/http-factory-guzzle | |
189 | [ricardofiorani/guzzle-psr18-adapter]: https://github.com/ricardofiorani/guzzle-psr18-adapter | |
190 | [monolog/monolog]: https://github.com/Seldaek/monolog | |
191 | [psx/cache]: https://github.com/apioo/psx-cache | |
192 | [psx/dependency]: https://github.com/apioo/psx-dependency | |
193 | [php-fig/link-util]: https://github.com/php-fig/link-util | |
194 | [crell/tukio]: https://github.com/Crell/Tukio.git | |
195 | [php-fig/event-dispatcher-util]: https://github.com/php-fig/event-dispatcher-util | |
196 | [php-fig/cache-util]: https://github.com/php-fig/cache-util | |
197 | [laminas/laminas-diactoros]: https://github.com/laminas/laminas-diactoros | |
198 | [php-fig/event-dispatcher-util]: https://github.com/php-fig/event-dispatcher-util | |
199 | ||
200 | [:github-sergeyklay:]: https://github.com/sergeyklay | |
201 | [:github-jan-e:]: https://github.com/Jan-E | |
202 | [:github-flyinghail:]: https://github.com/flyinghail |
0 | dnl vim: tabstop=4:softtabstop=4:shiftwidth=4:expandtab | |
1 | ||
2 | dnl PSR -------------------------------------------------------------------------- | |
3 | PHP_ARG_ENABLE(psr, whether to enable psr support, | |
4 | [ --enable-psr Enable PSR support]) | |
5 | ||
6 | dnl MAIN ------------------------------------------------------------------------- | |
7 | if test "$PHP_PSR" != "no"; then | |
8 | AH_BOTTOM([ | |
9 | #ifdef __clang__ | |
10 | #include "main/php_config.h" | |
11 | #/**/undef/**/ HAVE_ASM_GOTO | |
12 | #endif | |
13 | ]) | |
14 | AC_DEFINE(HAVE_PSR, 1, [Whether you have PSR]) | |
15 | PHP_NEW_EXTENSION(psr, php_psr.c psr_cache.c psr_container.c psr_http_message.c psr_link.c psr_log.c psr_simple_cache.c psr_http_server_handler.c psr_http_server_middleware.c psr_http_factory.c psr_http_client.c psr_event_dispatcher.c, $ext_shared) | |
16 | PHP_INSTALL_HEADERS([ext/psr], [php_psr.h psr_cache.h psr_container.h psr_http_message.h psr_link.h psr_log.h psr_simple_cache.h psr_http_server_handler.h psr_http_server_middleware.h psr_http_factory.h psr_http_client.h psr_event_dispatcher.h]) | |
17 | fi |
0 | // vim:ft=javascript | |
1 | ||
2 | ARG_ENABLE("psr", "Enable psr support", "no"); | |
3 | ||
4 | if (PHP_PSR != "no") { | |
5 | AC_DEFINE("HAVE_PSR", 1, "Have PSR Support"); | |
6 | EXTENSION("psr", "php_psr.c psr_cache.c psr_container.c psr_http_message.c psr_link.c psr_log.c psr_simple_cache.c psr_http_server_handler.c psr_http_server_middleware.c psr_http_factory.c psr_http_client.c psr_event_dispatcher.c"); | |
7 | ADD_FLAG("CFLAGS_PSR", "/D PHP_PSR_EXPORTS=1"); | |
8 | PHP_INSTALL_HEADERS("ext\\psr", "php_psr.h psr_cache.h psr_container.h psr_http_message.h psr_link.h psr_log.h psr_simple_cache.h psr_http_server_handler.h psr_http_server_middleware.h psr_http_factory.h psr_http_client.h psr_event_dispatcher.h") | |
9 | } |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include "php_ini.h" | |
7 | #include "ext/standard/info.h" | |
8 | #include "ext/spl/spl_exceptions.h" | |
9 | #include "zend_API.h" | |
10 | #include "zend_interfaces.h" | |
11 | ||
12 | #include "php_psr.h" | |
13 | #include "psr_cache.h" | |
14 | #include "psr_container.h" | |
15 | #include "psr_http_message.h" | |
16 | #include "psr_link.h" | |
17 | #include "psr_log.h" | |
18 | #include "psr_simple_cache.h" | |
19 | #include "psr_http_server_handler.h" | |
20 | #include "psr_http_server_middleware.h" | |
21 | #include "psr_http_factory.h" | |
22 | #include "psr_http_client.h" | |
23 | #include "psr_event_dispatcher.h" | |
24 | ||
25 | static PHP_MINIT_FUNCTION(psr) | |
26 | { | |
27 | PHP_MINIT(psr_cache)(INIT_FUNC_ARGS_PASSTHRU); | |
28 | PHP_MINIT(psr_container)(INIT_FUNC_ARGS_PASSTHRU); | |
29 | PHP_MINIT(psr_http_message)(INIT_FUNC_ARGS_PASSTHRU); | |
30 | PHP_MINIT(psr_link)(INIT_FUNC_ARGS_PASSTHRU); | |
31 | PHP_MINIT(psr_log)(INIT_FUNC_ARGS_PASSTHRU); | |
32 | PHP_MINIT(psr_simple_cache)(INIT_FUNC_ARGS_PASSTHRU); | |
33 | PHP_MINIT(psr_http_server_handler)(INIT_FUNC_ARGS_PASSTHRU); | |
34 | PHP_MINIT(psr_http_server_middleware)(INIT_FUNC_ARGS_PASSTHRU); | |
35 | PHP_MINIT(psr_http_factory)(INIT_FUNC_ARGS_PASSTHRU); | |
36 | PHP_MINIT(psr_http_client)(INIT_FUNC_ARGS_PASSTHRU); | |
37 | #if PHP_VERSION_ID >= 70200 | |
38 | PHP_MINIT(psr_event_dispatcher)(INIT_FUNC_ARGS_PASSTHRU); | |
39 | #endif | |
40 | return SUCCESS; | |
41 | } | |
42 | ||
43 | static PHP_MINFO_FUNCTION(psr) | |
44 | { | |
45 | php_info_print_table_start(); | |
46 | php_info_print_table_row(2, "Version", PHP_PSR_VERSION); | |
47 | php_info_print_table_row(2, "Released", PHP_PSR_RELEASE); | |
48 | php_info_print_table_row(2, "Authors", PHP_PSR_AUTHORS); | |
49 | php_info_print_table_row(2, "PSR-3 Log Version", PHP_PSR_LOG_VERSION); | |
50 | php_info_print_table_row(2, "PSR-6 Cache Version", PHP_PSR_CACHE_VERSION); | |
51 | php_info_print_table_row(2, "PSR-7 Http Message Version", PHP_PSR_HTTP_MESSAGE_VERSION); | |
52 | php_info_print_table_row(2, "PSR-11 Container Version", PHP_PSR_CONTAINER_VERSION); | |
53 | php_info_print_table_row(2, "PSR-13 Link Version", PHP_PSR_LOG_VERSION); | |
54 | #if PHP_VERSION_ID >= 70200 | |
55 | php_info_print_table_row(2, "PSR-14 Event Dispatcher", PHP_PSR_EVENT_DISPATCHER_VERSION); | |
56 | #endif | |
57 | php_info_print_table_row(2, "PSR-15 HTTP Handlers (Server Handler)", PHP_PSR_HTTP_SERVER_HANDLER_VERSION); | |
58 | php_info_print_table_row(2, "PSR-15 HTTP Handlers (Middleware)", PHP_PSR_HTTP_SERVER_MIDDLEWARE_VERSION); | |
59 | php_info_print_table_row(2, "PSR-16 Simple Cache Version", PHP_PSR_SIMPLE_CACHE_VERSION); | |
60 | php_info_print_table_row(2, "PSR-17 HTTP Factories", PHP_PSR_HTTP_FACTORY_VERSION); | |
61 | php_info_print_table_row(2, "PSR-18 HTTP Client", PHP_PSR_HTTP_CLIENT_VERSION); | |
62 | php_info_print_table_end(); | |
63 | } | |
64 | ||
65 | static const zend_module_dep psr_deps[] = { | |
66 | ZEND_MOD_REQUIRED("spl") | |
67 | ZEND_MOD_END | |
68 | }; | |
69 | ||
70 | zend_module_entry psr_module_entry = { | |
71 | STANDARD_MODULE_HEADER_EX, | |
72 | NULL, | |
73 | psr_deps, | |
74 | PHP_PSR_NAME, /* Name */ | |
75 | NULL, /* Functions */ | |
76 | PHP_MINIT(psr), /* MINIT */ | |
77 | NULL, /* MSHUTDOWN */ | |
78 | NULL, /* RINIT */ | |
79 | NULL, /* RSHUTDOWN */ | |
80 | PHP_MINFO(psr), /* MINFO */ | |
81 | PHP_PSR_VERSION, /* Version */ | |
82 | STANDARD_MODULE_PROPERTIES | |
83 | }; | |
84 | ||
85 | #ifdef COMPILE_DL_PSR | |
86 | ZEND_GET_MODULE(psr) // Common for all PHP extensions which are build as shared modules | |
87 | #endif | |
88 | ||
89 | /* | |
90 | * Local variables: | |
91 | * tab-width: 4 | |
92 | * c-basic-offset: 4 | |
93 | * End: | |
94 | * vim600: fdm=marker | |
95 | * vim: et sw=4 ts=4 | |
96 | */ |
0 | ||
1 | #ifndef PHP_PSR_H | |
2 | #define PHP_PSR_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_ini.h" | |
6 | #include "ext/standard/info.h" | |
7 | ||
8 | #ifdef ZTS | |
9 | #include "TSRM.h" | |
10 | #endif | |
11 | ||
12 | #ifdef PHP_WIN32 | |
13 | # ifdef PHP_PSR_EXPORTS | |
14 | # define PHP_PSR_API __declspec(dllexport) | |
15 | # else | |
16 | # define PHP_PSR_API __declspec(dllimport) | |
17 | # endif | |
18 | #elif defined(__GNUC__) && __GNUC__ >= 4 | |
19 | # define PHP_PSR_API __attribute__ ((visibility("default"))) | |
20 | #else | |
21 | # define PHP_PSR_API | |
22 | #endif | |
23 | ||
24 | #define PHP_PSR_NAME "psr" | |
25 | #define PHP_PSR_VERSION "1.2.0" | |
26 | #define PHP_PSR_VERSION_ID 10200 | |
27 | #define PHP_PSR_RELEASE "2021-12-11" | |
28 | #define PHP_PSR_AUTHORS "John Boehr <jbboehr@gmail.com> (lead)" | |
29 | ||
30 | #define PHP_PSR_ARGINFO(p, c, f) (arginfo_Psr ## p ## c ## _ ## f) | |
31 | #define PHP_PSR_BEGIN_ARG_INFO(p, c, f, n) ZEND_BEGIN_ARG_INFO_EX(PHP_PSR_ARGINFO(p, c, f), ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, n) | |
32 | #define PHP_PSR_END_ARG_INFO ZEND_END_ARG_INFO | |
33 | #define REGISTER_PSR_CLASS_CONST_STRING(ce, const_name, value) \ | |
34 | zend_declare_class_constant_stringl(ce, const_name, sizeof(const_name)-1, value, sizeof(value)-1); | |
35 | ||
36 | #define PHP_PSR_CLASS_NAMESPACE "PsrExt" | |
37 | #define PHP_PSR_ALIAS_NAMESPACE "Psr" | |
38 | ||
39 | #ifdef ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX | |
40 | #define PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(p, c, f, n, cn, an) ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(PHP_PSR_ARGINFO(p, c, f), ZEND_RETURN_VALUE, n, cn, an) | |
41 | #define PHP_PSR_BEGIN_ARG_WITH_RETURN_TYPE_INFO(p, c, f, n, t, an) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(PHP_PSR_ARGINFO(p, c, f), ZEND_RETURN_VALUE, n, t, an) | |
42 | #else | |
43 | #define PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(p, c, f, n, cn, an) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(PHP_PSR_ARGINFO(p, c, f), ZEND_RETURN_VALUE, n, IS_OBJECT, #cn, an) | |
44 | #define PHP_PSR_BEGIN_ARG_WITH_RETURN_TYPE_INFO(p, c, f, n, t, an) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(PHP_PSR_ARGINFO(p, c, f), ZEND_RETURN_VALUE, n, t, NULL, an) | |
45 | #endif | |
46 | ||
47 | extern zend_module_entry psr_module_entry; | |
48 | #define phpext_psr_ptr &psr_module_entry | |
49 | ||
50 | #endif /* PHP_PSR_H */ | |
51 | ||
52 | /* | |
53 | * Local variables: | |
54 | * tab-width: 4 | |
55 | * c-basic-offset: 4 | |
56 | * End: | |
57 | * vim600: fdm=marker | |
58 | * vim: et sw=4 ts=4 | |
59 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include "php_ini.h" | |
7 | #include "ext/standard/info.h" | |
8 | #include "ext/spl/spl_exceptions.h" | |
9 | #include "zend_API.h" | |
10 | #include "zend_interfaces.h" | |
11 | ||
12 | #include "php_psr.h" | |
13 | #include "psr_cache.h" | |
14 | #include "psr_private.h" | |
15 | ||
16 | /* {{{ CacheException ------------------------------------------------------- */ | |
17 | ||
18 | PHP_PSR_API zend_class_entry * PsrCacheCacheException_ce_ptr; | |
19 | #define PsrCacheCacheException_methods NULL | |
20 | ||
21 | static zend_always_inline void php_psr_register_CacheException(INIT_FUNC_ARGS) | |
22 | { | |
23 | PHP_PSR_REGISTER_INTERFACE(Cache, CacheException); | |
24 | } | |
25 | ||
26 | /* }}} ---------------------------------------------------------------------- */ | |
27 | /* {{{ CacheItemInterface --------------------------------------------------- */ | |
28 | ||
29 | PHP_PSR_API zend_class_entry * PsrCacheCacheItemInterface_ce_ptr; | |
30 | ||
31 | static zend_function_entry PsrCacheCacheItemInterface_methods[] = { | |
32 | PHP_PSR_ABSTRACT_ME(Cache, CacheItemInterface, getKey) | |
33 | PHP_PSR_ABSTRACT_ME(Cache, CacheItemInterface, get) | |
34 | PHP_PSR_ABSTRACT_ME(Cache, CacheItemInterface, isHit) | |
35 | PHP_PSR_ABSTRACT_ME(Cache, CacheItemInterface, set) | |
36 | PHP_PSR_ABSTRACT_ME(Cache, CacheItemInterface, expiresAt) | |
37 | PHP_PSR_ABSTRACT_ME(Cache, CacheItemInterface, expiresAfter) | |
38 | PHP_FE_END | |
39 | }; | |
40 | ||
41 | static zend_always_inline void php_psr_register_CacheItemInterface(INIT_FUNC_ARGS) | |
42 | { | |
43 | PHP_PSR_REGISTER_INTERFACE(Cache, CacheItemInterface); | |
44 | } | |
45 | ||
46 | /* }}} ---------------------------------------------------------------------- */ | |
47 | /* {{{ CacheItemPoolInterface ----------------------------------------------- */ | |
48 | ||
49 | PHP_PSR_API zend_class_entry * PsrCacheCacheItemPoolInterface_ce_ptr; | |
50 | ||
51 | static zend_function_entry PsrCacheCacheItemPoolInterface_methods[] = { | |
52 | PHP_PSR_ABSTRACT_ME(Cache, CacheItemPoolInterface, getItem) | |
53 | PHP_PSR_ABSTRACT_ME(Cache, CacheItemPoolInterface, getItems) | |
54 | PHP_PSR_ABSTRACT_ME(Cache, CacheItemPoolInterface, hasItem) | |
55 | PHP_PSR_ABSTRACT_ME(Cache, CacheItemPoolInterface, clear) | |
56 | PHP_PSR_ABSTRACT_ME(Cache, CacheItemPoolInterface, deleteItem) | |
57 | PHP_PSR_ABSTRACT_ME(Cache, CacheItemPoolInterface, deleteItems) | |
58 | PHP_PSR_ABSTRACT_ME(Cache, CacheItemPoolInterface, save) | |
59 | PHP_PSR_ABSTRACT_ME(Cache, CacheItemPoolInterface, saveDeferred) | |
60 | PHP_PSR_ABSTRACT_ME(Cache, CacheItemPoolInterface, commit) | |
61 | PHP_FE_END | |
62 | }; | |
63 | ||
64 | static zend_always_inline void php_psr_register_CacheItemPoolInterface(INIT_FUNC_ARGS) | |
65 | { | |
66 | PHP_PSR_REGISTER_INTERFACE(Cache, CacheItemPoolInterface); | |
67 | } | |
68 | ||
69 | /* }}} ---------------------------------------------------------------------- */ | |
70 | /* {{{ InvalidArgumentException --------------------------------------------- */ | |
71 | ||
72 | PHP_PSR_API zend_class_entry * PsrCacheInvalidArgumentException_ce_ptr; | |
73 | #define PsrCacheInvalidArgumentException_methods NULL | |
74 | ||
75 | static zend_always_inline void php_psr_register_InvalidArgumentException(INIT_FUNC_ARGS) | |
76 | { | |
77 | PHP_PSR_REGISTER_INTERFACE(Cache, InvalidArgumentException); | |
78 | zend_class_implements(PsrCacheInvalidArgumentException_ce_ptr, 1, PsrCacheCacheException_ce_ptr); | |
79 | } | |
80 | ||
81 | /* }}} ---------------------------------------------------------------------- */ | |
82 | ||
83 | /* {{{ PHP_MINIT_FUNCTION */ | |
84 | PHP_MINIT_FUNCTION(psr_cache) | |
85 | { | |
86 | php_psr_register_CacheException(INIT_FUNC_ARGS_PASSTHRU); | |
87 | php_psr_register_CacheItemInterface(INIT_FUNC_ARGS_PASSTHRU); | |
88 | php_psr_register_CacheItemPoolInterface(INIT_FUNC_ARGS_PASSTHRU); | |
89 | php_psr_register_InvalidArgumentException(INIT_FUNC_ARGS_PASSTHRU); | |
90 | ||
91 | return SUCCESS; | |
92 | } | |
93 | /* }}} */ | |
94 | ||
95 | /* | |
96 | * Local variables: | |
97 | * tab-width: 4 | |
98 | * c-basic-offset: 4 | |
99 | * End: | |
100 | * vim600: fdm=marker | |
101 | * vim: et sw=4 ts=4 | |
102 | */ |
0 | ||
1 | #ifndef PSR_CACHE_H | |
2 | #define PSR_CACHE_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_psr.h" | |
6 | ||
7 | #define PHP_PSR_CACHE_VERSION "1.0.0" | |
8 | #define PHP_PSR_CACHE_VERSION_ID 10000 | |
9 | ||
10 | extern PHP_PSR_API zend_class_entry * PsrCacheCacheItemInterface_ce_ptr; | |
11 | extern PHP_PSR_API zend_class_entry * PsrCacheCacheItemPoolInterface_ce_ptr; | |
12 | extern PHP_PSR_API zend_class_entry * PsrCacheInvalidArgumentException_ce_ptr; | |
13 | extern PHP_PSR_API zend_class_entry * PsrCacheCacheException_ce_ptr; | |
14 | ||
15 | extern PHP_MINIT_FUNCTION(psr_cache); | |
16 | ||
17 | PHP_PSR_BEGIN_ARG_INFO(Cache, CacheItemInterface, getKey, 0) | |
18 | PHP_PSR_END_ARG_INFO() | |
19 | ||
20 | PHP_PSR_BEGIN_ARG_INFO(Cache, CacheItemInterface, get, 0) | |
21 | PHP_PSR_END_ARG_INFO() | |
22 | ||
23 | PHP_PSR_BEGIN_ARG_INFO(Cache, CacheItemInterface, isHit, 0) | |
24 | PHP_PSR_END_ARG_INFO() | |
25 | ||
26 | PHP_PSR_BEGIN_ARG_INFO(Cache, CacheItemInterface, set, 1) | |
27 | ZEND_ARG_INFO(0, value) | |
28 | PHP_PSR_END_ARG_INFO() | |
29 | ||
30 | PHP_PSR_BEGIN_ARG_INFO(Cache, CacheItemInterface, expiresAt, 1) | |
31 | ZEND_ARG_INFO(0, expiration) | |
32 | PHP_PSR_END_ARG_INFO() | |
33 | ||
34 | PHP_PSR_BEGIN_ARG_INFO(Cache, CacheItemInterface, expiresAfter, 1) | |
35 | ZEND_ARG_INFO(0, time) | |
36 | PHP_PSR_END_ARG_INFO() | |
37 | ||
38 | PHP_PSR_BEGIN_ARG_INFO(Cache, CacheItemPoolInterface, getItem, 1) | |
39 | ZEND_ARG_INFO(0, key) | |
40 | PHP_PSR_END_ARG_INFO() | |
41 | ||
42 | PHP_PSR_BEGIN_ARG_INFO(Cache, CacheItemPoolInterface, getItems, 0) | |
43 | ZEND_ARG_ARRAY_INFO(0, keys, 0) | |
44 | PHP_PSR_END_ARG_INFO() | |
45 | ||
46 | PHP_PSR_BEGIN_ARG_INFO(Cache, CacheItemPoolInterface, hasItem, 1) | |
47 | ZEND_ARG_INFO(0, key) | |
48 | PHP_PSR_END_ARG_INFO() | |
49 | ||
50 | PHP_PSR_BEGIN_ARG_INFO(Cache, CacheItemPoolInterface, clear, 0) | |
51 | PHP_PSR_END_ARG_INFO() | |
52 | ||
53 | PHP_PSR_BEGIN_ARG_INFO(Cache, CacheItemPoolInterface, deleteItem, 1) | |
54 | ZEND_ARG_INFO(0, key) | |
55 | PHP_PSR_END_ARG_INFO() | |
56 | ||
57 | PHP_PSR_BEGIN_ARG_INFO(Cache, CacheItemPoolInterface, deleteItems, 1) | |
58 | ZEND_ARG_ARRAY_INFO(0, keys, 0) | |
59 | PHP_PSR_END_ARG_INFO() | |
60 | ||
61 | PHP_PSR_BEGIN_ARG_INFO(Cache, CacheItemPoolInterface, save, 1) | |
62 | ZEND_ARG_OBJ_INFO(0, logger, Psr\\Cache\\CacheItemInterface, 0) | |
63 | PHP_PSR_END_ARG_INFO() | |
64 | ||
65 | PHP_PSR_BEGIN_ARG_INFO(Cache, CacheItemPoolInterface, saveDeferred, 1) | |
66 | ZEND_ARG_OBJ_INFO(0, logger, Psr\\Cache\\CacheItemInterface, 0) | |
67 | PHP_PSR_END_ARG_INFO() | |
68 | ||
69 | PHP_PSR_BEGIN_ARG_INFO(Cache, CacheItemPoolInterface, commit, 0) | |
70 | PHP_PSR_END_ARG_INFO() | |
71 | ||
72 | #endif /* PSR_CACHE_H */ | |
73 | ||
74 | /* | |
75 | * Local variables: | |
76 | * tab-width: 4 | |
77 | * c-basic-offset: 4 | |
78 | * End: | |
79 | * vim600: fdm=marker | |
80 | * vim: et sw=4 ts=4 | |
81 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include <Zend/zend_exceptions.h> | |
7 | #include "php_psr.h" | |
8 | #include "psr_container.h" | |
9 | #include "psr_private.h" | |
10 | ||
11 | /* {{{ ContainerExceptionInterface ------------------------------------------ */ | |
12 | ||
13 | PHP_PSR_API zend_class_entry * PsrContainerContainerExceptionInterface_ce_ptr; | |
14 | #define PsrContainerContainerExceptionInterface_methods NULL | |
15 | ||
16 | static zend_always_inline void php_psr_register_PsrContainerContainerExceptionInterface(INIT_FUNC_ARGS) | |
17 | { | |
18 | PHP_PSR_REGISTER_INTERFACE(Container, ContainerExceptionInterface); | |
19 | } | |
20 | ||
21 | /* }}} ---------------------------------------------------------------------- */ | |
22 | /* {{{ ContainerInterface --------------------------------------------------- */ | |
23 | ||
24 | PHP_PSR_API zend_class_entry * PsrContainerContainerInterface_ce_ptr; | |
25 | ||
26 | static zend_function_entry PsrContainerContainerInterface_methods[] = { | |
27 | PHP_PSR_ABSTRACT_ME_WITH_FLAGS(Container, ContainerInterface, get, ZEND_ACC_PUBLIC | ZEND_ACC_ABSTRACT | ZEND_ACC_STRICT_TYPES) | |
28 | PHP_PSR_ABSTRACT_ME_WITH_FLAGS(Container, ContainerInterface, has, ZEND_ACC_PUBLIC | ZEND_ACC_ABSTRACT | ZEND_ACC_STRICT_TYPES) | |
29 | PHP_FE_END | |
30 | }; | |
31 | ||
32 | static zend_always_inline void php_psr_register_PsrContainerContainerInterface(INIT_FUNC_ARGS) | |
33 | { | |
34 | PHP_PSR_REGISTER_INTERFACE(Container, ContainerInterface); | |
35 | } | |
36 | ||
37 | /* }}} ---------------------------------------------------------------------- */ | |
38 | /* {{{ NotFoundException ---------------------------------------------------- */ | |
39 | ||
40 | PHP_PSR_API zend_class_entry * PsrContainerNotFoundExceptionInterface_ce_ptr; | |
41 | #define PsrContainerNotFoundExceptionInterface_methods NULL | |
42 | ||
43 | static zend_always_inline void php_psr_register_PsrContainerNotFoundExceptionInterface(INIT_FUNC_ARGS) | |
44 | { | |
45 | PHP_PSR_REGISTER_INTERFACE(Container, NotFoundExceptionInterface); | |
46 | zend_class_implements(PsrContainerNotFoundExceptionInterface_ce_ptr, 1, PsrContainerContainerExceptionInterface_ce_ptr); | |
47 | } | |
48 | ||
49 | /* }}} ---------------------------------------------------------------------- */ | |
50 | ||
51 | /* {{{ PHP_MINIT_FUNCTION */ | |
52 | PHP_MINIT_FUNCTION(psr_container) | |
53 | { | |
54 | php_psr_register_PsrContainerContainerExceptionInterface(INIT_FUNC_ARGS_PASSTHRU); | |
55 | php_psr_register_PsrContainerContainerInterface(INIT_FUNC_ARGS_PASSTHRU); | |
56 | php_psr_register_PsrContainerNotFoundExceptionInterface(INIT_FUNC_ARGS_PASSTHRU); | |
57 | ||
58 | return SUCCESS; | |
59 | } | |
60 | /* }}} */ | |
61 | ||
62 | /* | |
63 | * Local variables: | |
64 | * tab-width: 4 | |
65 | * c-basic-offset: 4 | |
66 | * End: | |
67 | * vim600: fdm=marker | |
68 | * vim: et sw=4 ts=4 | |
69 | */ |
0 | ||
1 | #ifndef PSR_CONTAINER_H | |
2 | #define PSR_CONTAINER_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_psr.h" | |
6 | ||
7 | #define PHP_PSR_CONTAINER_VERSION "1.1.1" | |
8 | #define PHP_PSR_CONTAINER_VERSION_ID 10101 | |
9 | ||
10 | extern PHP_PSR_API zend_class_entry * PsrContainerContainerExceptionInterface_ce_ptr; | |
11 | extern PHP_PSR_API zend_class_entry * PsrContainerContainerInterface_ce_ptr; | |
12 | extern PHP_PSR_API zend_class_entry * PsrContainerNotFoundExceptionInterface_ce_ptr; | |
13 | ||
14 | extern PHP_MINIT_FUNCTION(psr_container); | |
15 | ||
16 | PHP_PSR_BEGIN_ARG_INFO(Container, ContainerInterface, get, 1) | |
17 | ZEND_ARG_TYPE_INFO(0, id, IS_STRING, 0) | |
18 | PHP_PSR_END_ARG_INFO() | |
19 | ||
20 | PHP_PSR_BEGIN_ARG_INFO(Container, ContainerInterface, has, 1) | |
21 | ZEND_ARG_TYPE_INFO(0, id, IS_STRING, 0) | |
22 | PHP_PSR_END_ARG_INFO() | |
23 | ||
24 | #endif /* PSR_CONTAINER_H */ | |
25 | ||
26 | /* | |
27 | * Local variables: | |
28 | * tab-width: 4 | |
29 | * c-basic-offset: 4 | |
30 | * End: | |
31 | * vim600: fdm=marker | |
32 | * vim: et sw=4 ts=4 | |
33 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include "php_psr.h" | |
7 | #include "psr_event_dispatcher.h" | |
8 | #include "psr_private.h" | |
9 | ||
10 | #if PHP_VERSION_ID >= 70200 | |
11 | /* {{{ Psr\EventDispatcher\EventDispatcherInterface */ | |
12 | ||
13 | PHP_PSR_API zend_class_entry * PsrEventDispatcherEventDispatcherInterface_ce_ptr; | |
14 | ||
15 | static zend_function_entry PsrEventDispatcherEventDispatcherInterface_methods[] = { | |
16 | PHP_PSR_ABSTRACT_ME(EventDispatcher, EventDispatcherInterface, dispatch) | |
17 | PHP_FE_END | |
18 | }; | |
19 | ||
20 | static zend_always_inline void php_psr_register_PsrEventDispatcherEventDispatcherInterface(INIT_FUNC_ARGS) | |
21 | { | |
22 | PHP_PSR_REGISTER_INTERFACE(EventDispatcher, EventDispatcherInterface); | |
23 | } | |
24 | ||
25 | /* }}} Psr\EventDispatcher\EventDispatcherInterface */ | |
26 | /* {{{ Psr\EventDispatcher\ListenerProviderInterface */ | |
27 | ||
28 | PHP_PSR_API zend_class_entry * PsrEventDispatcherListenerProviderInterface_ce_ptr; | |
29 | ||
30 | static zend_function_entry PsrEventDispatcherListenerProviderInterface_methods[] = { | |
31 | PHP_PSR_ABSTRACT_ME(EventDispatcher, ListenerProviderInterface, getListenersForEvent) | |
32 | PHP_FE_END | |
33 | }; | |
34 | ||
35 | static zend_always_inline void php_psr_register_PsrEventDispatcherListenerProviderInterface(INIT_FUNC_ARGS) | |
36 | { | |
37 | PHP_PSR_REGISTER_INTERFACE(EventDispatcher, ListenerProviderInterface); | |
38 | } | |
39 | ||
40 | /* }}} Psr\EventDispatcher\ListenerProviderInterface */ | |
41 | /* {{{ Psr\EventDispatcher\StoppableEventInterface */ | |
42 | ||
43 | PHP_PSR_API zend_class_entry * PsrEventDispatcherStoppableEventInterface_ce_ptr; | |
44 | ||
45 | static zend_function_entry PsrEventDispatcherStoppableEventInterface_methods[] = { | |
46 | PHP_PSR_ABSTRACT_ME(EventDispatcher, StoppableEventInterface, isPropagationStopped) | |
47 | PHP_FE_END | |
48 | }; | |
49 | ||
50 | static zend_always_inline void php_psr_register_PsrEventDispatcherStoppableEventInterface(INIT_FUNC_ARGS) | |
51 | { | |
52 | PHP_PSR_REGISTER_INTERFACE(EventDispatcher, StoppableEventInterface); | |
53 | } | |
54 | ||
55 | /* }}} Psr\EventDispatcher\StoppableEventInterface */ | |
56 | #endif | |
57 | ||
58 | /* {{{ PHP_MINIT_FUNCTION */ | |
59 | PHP_MINIT_FUNCTION(psr_event_dispatcher) | |
60 | { | |
61 | #if PHP_VERSION_ID >= 70200 | |
62 | php_psr_register_PsrEventDispatcherEventDispatcherInterface(INIT_FUNC_ARGS_PASSTHRU); | |
63 | php_psr_register_PsrEventDispatcherListenerProviderInterface(INIT_FUNC_ARGS_PASSTHRU); | |
64 | php_psr_register_PsrEventDispatcherStoppableEventInterface(INIT_FUNC_ARGS_PASSTHRU); | |
65 | #endif | |
66 | ||
67 | return SUCCESS; | |
68 | } | |
69 | /* }}} */ | |
70 | ||
71 | /* | |
72 | * Local variables: | |
73 | * tab-width: 4 | |
74 | * c-basic-offset: 4 | |
75 | * End: | |
76 | * vim600: fdm=marker | |
77 | * vim: et sw=4 ts=4 | |
78 | */ |
0 | ||
1 | #ifndef PSR_EVENT_DISPATCHER_H | |
2 | #define PSR_EVENT_DISPATCHER_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_psr.h" | |
6 | ||
7 | #if PHP_VERSION_ID >= 70200 | |
8 | #define PHP_PSR_EVENT_DISPATCHER_VERSION "1.0.0" | |
9 | #define PHP_PSR_EVENT_DISPATCHER_VERSION_ID 10000 | |
10 | ||
11 | extern PHP_PSR_API zend_class_entry * PsrEventDispatcherEventDispatcherInterface_ce_ptr; | |
12 | extern PHP_PSR_API zend_class_entry * PsrEventDispatcherListenerProviderInterface_ce_ptr; | |
13 | extern PHP_PSR_API zend_class_entry * PsrEventDispatcherStoppableEventInterface_ce_ptr; | |
14 | ||
15 | extern PHP_MINIT_FUNCTION(psr_event_dispatcher); | |
16 | ||
17 | PHP_PSR_BEGIN_ARG_INFO(EventDispatcher, EventDispatcherInterface, dispatch, 1) | |
18 | ZEND_ARG_TYPE_INFO(0, event, IS_OBJECT, 0) | |
19 | PHP_PSR_END_ARG_INFO() | |
20 | ||
21 | PHP_PSR_BEGIN_ARG_WITH_RETURN_TYPE_INFO(EventDispatcher, ListenerProviderInterface, getListenersForEvent, 1, IS_ITERABLE, 0) | |
22 | ZEND_ARG_TYPE_INFO(0, event, IS_OBJECT, 0) | |
23 | PHP_PSR_END_ARG_INFO() | |
24 | ||
25 | PHP_PSR_BEGIN_ARG_WITH_RETURN_TYPE_INFO(EventDispatcher, StoppableEventInterface, isPropagationStopped, 0, _IS_BOOL, 0) | |
26 | PHP_PSR_END_ARG_INFO() | |
27 | #endif | |
28 | ||
29 | #endif /* PSR_EVENT_DISPATCHER_H */ | |
30 | ||
31 | /* | |
32 | * Local variables: | |
33 | * tab-width: 4 | |
34 | * c-basic-offset: 4 | |
35 | * End: | |
36 | * vim600: fdm=marker | |
37 | * vim: et sw=4 ts=4 | |
38 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include <Zend/zend_exceptions.h> | |
7 | #include "php_psr.h" | |
8 | #include "psr_http_client.h" | |
9 | #include "psr_private.h" | |
10 | ||
11 | /* {{{ Psr\Http\Client\ClientInterface */ | |
12 | ||
13 | PHP_PSR_API zend_class_entry * PsrHttpClientClientInterface_ce_ptr; | |
14 | ||
15 | static zend_function_entry PsrHttpClientClientInterface_methods[] = { | |
16 | PHP_PSR_ABSTRACT_ME(HttpClient, ClientInterface, sendRequest) | |
17 | PHP_FE_END | |
18 | }; | |
19 | ||
20 | static zend_always_inline void php_psr_register_PsrHttpClientClientInterface(INIT_FUNC_ARGS) | |
21 | { | |
22 | PHP_PSR_REGISTER_INTERFACE2(Http, Client, ClientInterface); | |
23 | } | |
24 | ||
25 | /* }}} Psr\Http\Client\ClientInterface */ | |
26 | /* {{{ Psr\Http\Client\ClientExceptionInterface */ | |
27 | ||
28 | PHP_PSR_API zend_class_entry * PsrHttpClientClientExceptionInterface_ce_ptr; | |
29 | #define PsrHttpClientClientExceptionInterface_methods NULL | |
30 | ||
31 | static zend_always_inline void php_psr_register_PsrHttpClientClientExceptionInterface(INIT_FUNC_ARGS) | |
32 | { | |
33 | PHP_PSR_REGISTER_INTERFACE2(Http, Client, ClientExceptionInterface); | |
34 | zend_class_implements(PsrHttpClientClientExceptionInterface_ce_ptr, 1, zend_ce_throwable); | |
35 | } | |
36 | ||
37 | /* }}} Psr\Http\Client\ClientExceptionInterface */ | |
38 | /* {{{ Psr\Http\Client\NetworkExceptionInterface */ | |
39 | ||
40 | PHP_PSR_API zend_class_entry * PsrHttpClientNetworkExceptionInterface_ce_ptr; | |
41 | ||
42 | static zend_function_entry PsrHttpClientNetworkExceptionInterface_methods[] = { | |
43 | PHP_PSR_ABSTRACT_ME(HttpClient, NetworkExceptionInterface, getRequest) | |
44 | PHP_FE_END | |
45 | }; | |
46 | ||
47 | static zend_always_inline void php_psr_register_PsrHttpClientNetworkExceptionInterface(INIT_FUNC_ARGS) | |
48 | { | |
49 | PHP_PSR_REGISTER_INTERFACE2(Http, Client, NetworkExceptionInterface); | |
50 | zend_class_implements(PsrHttpClientNetworkExceptionInterface_ce_ptr, 1, PsrHttpClientClientExceptionInterface_ce_ptr); | |
51 | } | |
52 | ||
53 | /* }}} Psr\Http\Client\NetworkExceptionInterface */ | |
54 | /* {{{ Psr\Http\Client\RequestExceptionInterface */ | |
55 | ||
56 | PHP_PSR_API zend_class_entry * PsrHttpClientRequestExceptionInterface_ce_ptr; | |
57 | ||
58 | static zend_function_entry PsrHttpClientRequestExceptionInterface_methods[] = { | |
59 | PHP_PSR_ABSTRACT_ME(HttpClient, RequestExceptionInterface, getRequest) | |
60 | PHP_FE_END | |
61 | }; | |
62 | ||
63 | static zend_always_inline void php_psr_register_PsrHttpClientRequestExceptionInterface(INIT_FUNC_ARGS) | |
64 | { | |
65 | PHP_PSR_REGISTER_INTERFACE2(Http, Client, RequestExceptionInterface); | |
66 | zend_class_implements(PsrHttpClientRequestExceptionInterface_ce_ptr, 1, PsrHttpClientClientExceptionInterface_ce_ptr); | |
67 | } | |
68 | ||
69 | /* }}} Psr\Http\Client\RequestExceptionInterface */ | |
70 | ||
71 | /* {{{ PHP_MINIT_FUNCTION */ | |
72 | PHP_MINIT_FUNCTION(psr_http_client) | |
73 | { | |
74 | php_psr_register_PsrHttpClientClientInterface(INIT_FUNC_ARGS_PASSTHRU); | |
75 | php_psr_register_PsrHttpClientClientExceptionInterface(INIT_FUNC_ARGS_PASSTHRU); | |
76 | php_psr_register_PsrHttpClientNetworkExceptionInterface(INIT_FUNC_ARGS_PASSTHRU); | |
77 | php_psr_register_PsrHttpClientRequestExceptionInterface(INIT_FUNC_ARGS_PASSTHRU); | |
78 | ||
79 | return SUCCESS; | |
80 | } | |
81 | /* }}} */ | |
82 | ||
83 | /* | |
84 | * Local variables: | |
85 | * tab-width: 4 | |
86 | * c-basic-offset: 4 | |
87 | * End: | |
88 | * vim600: fdm=marker | |
89 | * vim: et sw=4 ts=4 | |
90 | */ |
0 | ||
1 | #ifndef PSR_HTTP_CLIENT_H | |
2 | #define PSR_HTTP_CLIENT_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_psr.h" | |
6 | ||
7 | #define PHP_PSR_HTTP_CLIENT_VERSION "1.0.0" | |
8 | #define PHP_PSR_HTTP_CLIENT_VERSION_ID 10000 | |
9 | ||
10 | extern PHP_PSR_API zend_class_entry * PsrHttpClientClientInterface_ce_ptr; | |
11 | extern PHP_PSR_API zend_class_entry * PsrHttpClientClientExceptionInterface_ce_ptr; | |
12 | extern PHP_PSR_API zend_class_entry * PsrHttpClientNetworkExceptionInterface_ce_ptr; | |
13 | extern PHP_PSR_API zend_class_entry * PsrHttpClientRequestExceptionInterface_ce_ptr; | |
14 | ||
15 | extern PHP_MINIT_FUNCTION(psr_http_client); | |
16 | ||
17 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(HttpClient, ClientInterface, sendRequest, 1, Psr\\Http\\Message\\ResponseInterface, 0) | |
18 | ZEND_ARG_OBJ_INFO(0, request, Psr\\Http\\Message\\RequestInterface, 0) | |
19 | PHP_PSR_END_ARG_INFO() | |
20 | ||
21 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(HttpClient, NetworkExceptionInterface, getRequest, 0, Psr\\Http\\Message\\RequestInterface, 0) | |
22 | PHP_PSR_END_ARG_INFO() | |
23 | ||
24 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(HttpClient, RequestExceptionInterface, getRequest, 0, Psr\\Http\\Message\\RequestInterface, 0) | |
25 | PHP_PSR_END_ARG_INFO() | |
26 | ||
27 | #endif /* PSR_HTTP_CLIENT_H */ | |
28 | ||
29 | /* | |
30 | * Local variables: | |
31 | * tab-width: 4 | |
32 | * c-basic-offset: 4 | |
33 | * End: | |
34 | * vim600: fdm=marker | |
35 | * vim: et sw=4 ts=4 | |
36 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include "php_psr.h" | |
7 | #include "psr_http_factory.h" | |
8 | #include "psr_private.h" | |
9 | ||
10 | /* {{{ Psr\Http\Message\RequestFactoryInterface */ | |
11 | ||
12 | PHP_PSR_API zend_class_entry * PsrHttpMessageRequestFactoryInterface_ce_ptr; | |
13 | ||
14 | static zend_function_entry PsrHttpMessageRequestFactoryInterface_methods[] = { | |
15 | PHP_PSR_ABSTRACT_ME(HttpMessage, RequestFactoryInterface, createRequest) | |
16 | PHP_FE_END | |
17 | }; | |
18 | ||
19 | static zend_always_inline void php_psr_register_PsrHttpMessageRequestFactoryInterface(INIT_FUNC_ARGS) | |
20 | { | |
21 | PHP_PSR_REGISTER_INTERFACE2(Http, Message, RequestFactoryInterface); | |
22 | } | |
23 | ||
24 | /* }}} Psr\Http\Message\RequestFactoryInterface */ | |
25 | /* {{{ Psr\Http\Message\ResponseFactoryInterface */ | |
26 | ||
27 | PHP_PSR_API zend_class_entry * PsrHttpMessageResponseFactoryInterface_ce_ptr; | |
28 | ||
29 | static zend_function_entry PsrHttpMessageResponseFactoryInterface_methods[] = { | |
30 | PHP_PSR_ABSTRACT_ME(HttpMessage, ResponseFactoryInterface, createResponse) | |
31 | PHP_FE_END | |
32 | }; | |
33 | ||
34 | static zend_always_inline void php_psr_register_PsrHttpMessageResponseFactoryInterface(INIT_FUNC_ARGS) | |
35 | { | |
36 | PHP_PSR_REGISTER_INTERFACE2(Http, Message, ResponseFactoryInterface); | |
37 | } | |
38 | ||
39 | /* }}} Psr\Http\Message\ResponseFactoryInterface */ | |
40 | /* {{{ Psr\Http\Message\ServerRequestFactoryInterface */ | |
41 | ||
42 | PHP_PSR_API zend_class_entry * PsrHttpMessageServerRequestFactoryInterface_ce_ptr; | |
43 | ||
44 | static zend_function_entry PsrHttpMessageServerRequestFactoryInterface_methods[] = { | |
45 | PHP_PSR_ABSTRACT_ME(HttpMessage, ServerRequestFactoryInterface, createServerRequest) | |
46 | PHP_FE_END | |
47 | }; | |
48 | ||
49 | static zend_always_inline void php_psr_register_PsrHttpMessageServerRequestFactoryInterface(INIT_FUNC_ARGS) | |
50 | { | |
51 | PHP_PSR_REGISTER_INTERFACE2(Http, Message, ServerRequestFactoryInterface); | |
52 | } | |
53 | ||
54 | /* }}} Psr\Http\Message\ServerRequestFactoryInterface */ | |
55 | /* {{{ Psr\Http\Message\StreamFactoryInterface */ | |
56 | ||
57 | PHP_PSR_API zend_class_entry * PsrHttpMessageStreamFactoryInterface_ce_ptr; | |
58 | ||
59 | static zend_function_entry PsrHttpMessageStreamFactoryInterface_methods[] = { | |
60 | PHP_PSR_ABSTRACT_ME(HttpMessage, StreamFactoryInterface, createStream) | |
61 | PHP_PSR_ABSTRACT_ME(HttpMessage, StreamFactoryInterface, createStreamFromFile) | |
62 | PHP_PSR_ABSTRACT_ME(HttpMessage, StreamFactoryInterface, createStreamFromResource) | |
63 | PHP_FE_END | |
64 | }; | |
65 | ||
66 | static zend_always_inline void php_psr_register_PsrHttpMessageStreamFactoryInterface(INIT_FUNC_ARGS) | |
67 | { | |
68 | PHP_PSR_REGISTER_INTERFACE2(Http, Message, StreamFactoryInterface); | |
69 | } | |
70 | ||
71 | /* }}} Psr\Http\Message\StreamFactoryInterface */ | |
72 | /* {{{ Psr\Http\Message\UploadedFileFactoryInterface */ | |
73 | ||
74 | PHP_PSR_API zend_class_entry * PsrHttpMessageUploadedFileFactoryInterface_ce_ptr; | |
75 | ||
76 | static zend_function_entry PsrHttpMessageUploadedFileFactoryInterface_methods[] = { | |
77 | PHP_PSR_ABSTRACT_ME(HttpMessage, UploadedFileFactoryInterface, createUploadedFile) | |
78 | PHP_FE_END | |
79 | }; | |
80 | ||
81 | static zend_always_inline void php_psr_register_PsrHttpMessageUploadedFileFactoryInterface(INIT_FUNC_ARGS) | |
82 | { | |
83 | PHP_PSR_REGISTER_INTERFACE2(Http, Message, UploadedFileFactoryInterface); | |
84 | } | |
85 | ||
86 | /* }}} Psr\Http\Message\UploadedFileFactoryInterface */ | |
87 | /* {{{ Psr\Http\Message\UriFactoryInterface */ | |
88 | ||
89 | PHP_PSR_API zend_class_entry * PsrHttpMessageUriFactoryInterface_ce_ptr; | |
90 | ||
91 | static zend_function_entry PsrHttpMessageUriFactoryInterface_methods[] = { | |
92 | PHP_PSR_ABSTRACT_ME(HttpMessage, UriFactoryInterface, createUri) | |
93 | PHP_FE_END | |
94 | }; | |
95 | ||
96 | static zend_always_inline void php_psr_register_PsrHttpMessageUriFactoryInterface(INIT_FUNC_ARGS) | |
97 | { | |
98 | PHP_PSR_REGISTER_INTERFACE2(Http, Message, UriFactoryInterface); | |
99 | } | |
100 | ||
101 | /* }}} Psr\Http\Message\UriFactoryInterface */ | |
102 | ||
103 | /* {{{ PHP_MINIT_FUNCTION */ | |
104 | PHP_MINIT_FUNCTION(psr_http_factory) | |
105 | { | |
106 | php_psr_register_PsrHttpMessageRequestFactoryInterface(INIT_FUNC_ARGS_PASSTHRU); | |
107 | php_psr_register_PsrHttpMessageResponseFactoryInterface(INIT_FUNC_ARGS_PASSTHRU); | |
108 | php_psr_register_PsrHttpMessageServerRequestFactoryInterface(INIT_FUNC_ARGS_PASSTHRU); | |
109 | php_psr_register_PsrHttpMessageStreamFactoryInterface(INIT_FUNC_ARGS_PASSTHRU); | |
110 | php_psr_register_PsrHttpMessageUploadedFileFactoryInterface(INIT_FUNC_ARGS_PASSTHRU); | |
111 | php_psr_register_PsrHttpMessageUriFactoryInterface(INIT_FUNC_ARGS_PASSTHRU); | |
112 | ||
113 | return SUCCESS; | |
114 | } | |
115 | /* }}} */ | |
116 | ||
117 | /* | |
118 | * Local variables: | |
119 | * tab-width: 4 | |
120 | * c-basic-offset: 4 | |
121 | * End: | |
122 | * vim600: fdm=marker | |
123 | * vim: et sw=4 ts=4 | |
124 | */ |
0 | ||
1 | #ifndef PSR_HTTP_FACTORY_H | |
2 | #define PSR_HTTP_FACTORY_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_psr.h" | |
6 | ||
7 | #define PHP_PSR_HTTP_FACTORY_VERSION "1.0.0" | |
8 | #define PHP_PSR_HTTP_FACTORY_VERSION_ID 10000 | |
9 | ||
10 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageRequestFactoryInterface_ce_ptr; | |
11 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageResponseFactoryInterface_ce_ptr; | |
12 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageServerRequestFactoryInterface_ce_ptr; | |
13 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageStreamFactoryInterface_ce_ptr; | |
14 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageUploadedFileFactoryInterface_ce_ptr; | |
15 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageUriFactoryInterface_ce_ptr; | |
16 | ||
17 | extern PHP_MINIT_FUNCTION(psr_http_factory); | |
18 | ||
19 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(HttpMessage, RequestFactoryInterface, createRequest, 2, Psr\\Http\\Message\\RequestInterface, 0) | |
20 | ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0) | |
21 | ZEND_ARG_INFO(0, uri) | |
22 | PHP_PSR_END_ARG_INFO() | |
23 | ||
24 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(HttpMessage, ResponseFactoryInterface, createResponse, 0, Psr\\Http\\Message\\ResponseInterface, 0) | |
25 | ZEND_ARG_TYPE_INFO(0, code, IS_LONG, 0) | |
26 | ZEND_ARG_TYPE_INFO(0, reasonPhrase, IS_STRING, 0) | |
27 | PHP_PSR_END_ARG_INFO() | |
28 | ||
29 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(HttpMessage, ServerRequestFactoryInterface, createServerRequest, 2, Psr\\Http\\Message\\ServerRequestInterface, 0) | |
30 | ZEND_ARG_TYPE_INFO(0, method, IS_STRING, 0) | |
31 | ZEND_ARG_INFO(0, uri) | |
32 | ZEND_ARG_ARRAY_INFO(0, serverParams, 0) | |
33 | PHP_PSR_END_ARG_INFO() | |
34 | ||
35 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(HttpMessage, StreamFactoryInterface, createStream, 0, Psr\\Http\\Message\\StreamInterface, 0) | |
36 | ZEND_ARG_TYPE_INFO(0, content, IS_STRING, 0) | |
37 | PHP_PSR_END_ARG_INFO() | |
38 | ||
39 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(HttpMessage, StreamFactoryInterface, createStreamFromFile, 1, Psr\\Http\\Message\\StreamInterface, 0) | |
40 | ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) | |
41 | ZEND_ARG_TYPE_INFO(0, mode, IS_STRING, 0) | |
42 | PHP_PSR_END_ARG_INFO() | |
43 | ||
44 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(HttpMessage, StreamFactoryInterface, createStreamFromResource, 1, Psr\\Http\\Message\\StreamInterface, 0) | |
45 | ZEND_ARG_INFO(0, resouce) | |
46 | PHP_PSR_END_ARG_INFO() | |
47 | ||
48 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(HttpMessage, UploadedFileFactoryInterface, createUploadedFile, 1, Psr\\Http\\Message\\UploadedFileInterface, 0) | |
49 | ZEND_ARG_OBJ_INFO(0, stream, Psr\\Http\\Message\\StreamInterface, 0) | |
50 | ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 1) | |
51 | ZEND_ARG_TYPE_INFO(0, error, IS_LONG, 0) | |
52 | ZEND_ARG_TYPE_INFO(0, clientFilename, IS_STRING, 1) | |
53 | ZEND_ARG_TYPE_INFO(0, clientMediaType, IS_STRING, 1) | |
54 | PHP_PSR_END_ARG_INFO() | |
55 | ||
56 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(HttpMessage, UriFactoryInterface, createUri, 0, Psr\\Http\\Message\\UriInterface, 0) | |
57 | ZEND_ARG_TYPE_INFO(0, uri, IS_STRING, 0) | |
58 | PHP_PSR_END_ARG_INFO() | |
59 | ||
60 | #endif /* PSR_HTTP_FACTORY_H */ | |
61 | ||
62 | /* | |
63 | * Local variables: | |
64 | * tab-width: 4 | |
65 | * c-basic-offset: 4 | |
66 | * End: | |
67 | * vim600: fdm=marker | |
68 | * vim: et sw=4 ts=4 | |
69 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include "php_ini.h" | |
7 | #include "ext/standard/info.h" | |
8 | #include "ext/spl/spl_exceptions.h" | |
9 | #include "zend_API.h" | |
10 | #include "zend_interfaces.h" | |
11 | ||
12 | #include "php_psr.h" | |
13 | #include "psr_http_message.h" | |
14 | #include "psr_private.h" | |
15 | ||
16 | /* {{{ Psr\Http\Message\MessageInterface */ | |
17 | ||
18 | PHP_PSR_API zend_class_entry * PsrHttpMessageMessageInterface_ce_ptr; | |
19 | ||
20 | static zend_function_entry PsrHttpMessageMessageInterface_methods[] = { | |
21 | PHP_PSR_ABSTRACT_ME(HttpMessage, MessageInterface, getProtocolVersion) | |
22 | PHP_PSR_ABSTRACT_ME(HttpMessage, MessageInterface, withProtocolVersion) | |
23 | PHP_PSR_ABSTRACT_ME(HttpMessage, MessageInterface, getHeaders) | |
24 | PHP_PSR_ABSTRACT_ME(HttpMessage, MessageInterface, hasHeader) | |
25 | PHP_PSR_ABSTRACT_ME(HttpMessage, MessageInterface, getHeader) | |
26 | PHP_PSR_ABSTRACT_ME(HttpMessage, MessageInterface, getHeaderLine) | |
27 | PHP_PSR_ABSTRACT_ME(HttpMessage, MessageInterface, withHeader) | |
28 | PHP_PSR_ABSTRACT_ME(HttpMessage, MessageInterface, withAddedHeader) | |
29 | PHP_PSR_ABSTRACT_ME(HttpMessage, MessageInterface, withoutHeader) | |
30 | PHP_PSR_ABSTRACT_ME(HttpMessage, MessageInterface, getBody) | |
31 | PHP_PSR_ABSTRACT_ME(HttpMessage, MessageInterface, withBody) | |
32 | PHP_FE_END | |
33 | }; | |
34 | ||
35 | static zend_always_inline void php_register_PsrHttpMessageMessageInterface(INIT_FUNC_ARGS) | |
36 | { | |
37 | PHP_PSR_REGISTER_INTERFACE2(Http, Message, MessageInterface); | |
38 | } | |
39 | ||
40 | /* }}} Psr\Http\Message\MessageInterface */ | |
41 | /* {{{ Psr\Http\Message\RequestInterface */ | |
42 | ||
43 | PHP_PSR_API zend_class_entry * PsrHttpMessageRequestInterface_ce_ptr; | |
44 | ||
45 | static zend_function_entry PsrHttpMessageRequestInterface_methods[] = { | |
46 | PHP_PSR_ABSTRACT_ME(HttpMessage, RequestInterface, getRequestTarget) | |
47 | PHP_PSR_ABSTRACT_ME(HttpMessage, RequestInterface, withRequestTarget) | |
48 | PHP_PSR_ABSTRACT_ME(HttpMessage, RequestInterface, getMethod) | |
49 | PHP_PSR_ABSTRACT_ME(HttpMessage, RequestInterface, withMethod) | |
50 | PHP_PSR_ABSTRACT_ME(HttpMessage, RequestInterface, getUri) | |
51 | PHP_PSR_ABSTRACT_ME(HttpMessage, RequestInterface, withUri) | |
52 | PHP_FE_END | |
53 | }; | |
54 | ||
55 | static zend_always_inline void php_register_PsrHttpMessageRequestInterface(INIT_FUNC_ARGS) | |
56 | { | |
57 | PHP_PSR_REGISTER_INTERFACE2(Http, Message, RequestInterface); | |
58 | // @todo make sure this is right | |
59 | zend_class_implements(PsrHttpMessageRequestInterface_ce_ptr, 1, PsrHttpMessageMessageInterface_ce_ptr); | |
60 | } | |
61 | ||
62 | /* }}} Psr\Http\Message\RequestInterface */ | |
63 | /* {{{ Psr\Http\Message\ResponseInterface */ | |
64 | ||
65 | PHP_PSR_API zend_class_entry * PsrHttpMessageResponseInterface_ce_ptr; | |
66 | ||
67 | static zend_function_entry PsrHttpMessageResponseInterface_methods[] = { | |
68 | PHP_PSR_ABSTRACT_ME(HttpMessage, ResponseInterface, getStatusCode) | |
69 | PHP_PSR_ABSTRACT_ME(HttpMessage, ResponseInterface, withStatus) | |
70 | PHP_PSR_ABSTRACT_ME(HttpMessage, ResponseInterface, getReasonPhrase) | |
71 | PHP_FE_END | |
72 | }; | |
73 | ||
74 | static zend_always_inline void php_register_PsrHttpMessageResponseInterface(INIT_FUNC_ARGS) | |
75 | { | |
76 | PHP_PSR_REGISTER_INTERFACE2(Http, Message, ResponseInterface); | |
77 | zend_class_implements(PsrHttpMessageResponseInterface_ce_ptr, 1, PsrHttpMessageMessageInterface_ce_ptr); | |
78 | } | |
79 | ||
80 | /* }}} Psr\Http\Message\ResponseInterface */ | |
81 | /* {{{ Psr\Http\Message\ServerRequestInterface */ | |
82 | ||
83 | PHP_PSR_API zend_class_entry * PsrHttpMessageServerRequestInterface_ce_ptr; | |
84 | ||
85 | static zend_function_entry PsrHttpMessageServerRequestInterface_methods[] = { | |
86 | PHP_PSR_ABSTRACT_ME(HttpMessage, ServerRequestInterface, getServerParams) | |
87 | PHP_PSR_ABSTRACT_ME(HttpMessage, ServerRequestInterface, getCookieParams) | |
88 | PHP_PSR_ABSTRACT_ME(HttpMessage, ServerRequestInterface, withCookieParams) | |
89 | PHP_PSR_ABSTRACT_ME(HttpMessage, ServerRequestInterface, getQueryParams) | |
90 | PHP_PSR_ABSTRACT_ME(HttpMessage, ServerRequestInterface, withQueryParams) | |
91 | PHP_PSR_ABSTRACT_ME(HttpMessage, ServerRequestInterface, getUploadedFiles) | |
92 | PHP_PSR_ABSTRACT_ME(HttpMessage, ServerRequestInterface, withUploadedFiles) | |
93 | PHP_PSR_ABSTRACT_ME(HttpMessage, ServerRequestInterface, getParsedBody) | |
94 | PHP_PSR_ABSTRACT_ME(HttpMessage, ServerRequestInterface, withParsedBody) | |
95 | PHP_PSR_ABSTRACT_ME(HttpMessage, ServerRequestInterface, getAttributes) | |
96 | PHP_PSR_ABSTRACT_ME(HttpMessage, ServerRequestInterface, getAttribute) | |
97 | PHP_PSR_ABSTRACT_ME(HttpMessage, ServerRequestInterface, withAttribute) | |
98 | PHP_PSR_ABSTRACT_ME(HttpMessage, ServerRequestInterface, withoutAttribute) | |
99 | PHP_FE_END | |
100 | }; | |
101 | ||
102 | static zend_always_inline void php_register_PsrHttpMessageServerRequestInterface(INIT_FUNC_ARGS) | |
103 | { | |
104 | PHP_PSR_REGISTER_INTERFACE2(Http, Message, ServerRequestInterface); | |
105 | zend_class_implements(PsrHttpMessageServerRequestInterface_ce_ptr, 1, PsrHttpMessageRequestInterface_ce_ptr); | |
106 | } | |
107 | ||
108 | /* }}} Psr\Http\Message\ServerRequestInterface */ | |
109 | /* {{{ Psr\Http\Message\StreamInterface */ | |
110 | ||
111 | PHP_PSR_API zend_class_entry * PsrHttpMessageStreamInterface_ce_ptr; | |
112 | ||
113 | static zend_function_entry PsrHttpMessageStreamInterface_methods[] = { | |
114 | PHP_PSR_ABSTRACT_ME(HttpMessage, StreamInterface, __toString) | |
115 | PHP_PSR_ABSTRACT_ME(HttpMessage, StreamInterface, close) | |
116 | PHP_PSR_ABSTRACT_ME(HttpMessage, StreamInterface, detach) | |
117 | PHP_PSR_ABSTRACT_ME(HttpMessage, StreamInterface, getSize) | |
118 | PHP_PSR_ABSTRACT_ME(HttpMessage, StreamInterface, tell) | |
119 | PHP_PSR_ABSTRACT_ME(HttpMessage, StreamInterface, eof) | |
120 | PHP_PSR_ABSTRACT_ME(HttpMessage, StreamInterface, isSeekable) | |
121 | PHP_PSR_ABSTRACT_ME(HttpMessage, StreamInterface, seek) | |
122 | PHP_PSR_ABSTRACT_ME(HttpMessage, StreamInterface, rewind) | |
123 | PHP_PSR_ABSTRACT_ME(HttpMessage, StreamInterface, isWritable) | |
124 | PHP_PSR_ABSTRACT_ME(HttpMessage, StreamInterface, write) | |
125 | PHP_PSR_ABSTRACT_ME(HttpMessage, StreamInterface, isReadable) | |
126 | PHP_PSR_ABSTRACT_ME(HttpMessage, StreamInterface, read) | |
127 | PHP_PSR_ABSTRACT_ME(HttpMessage, StreamInterface, getContents) | |
128 | PHP_PSR_ABSTRACT_ME(HttpMessage, StreamInterface, getMetadata) | |
129 | PHP_FE_END | |
130 | }; | |
131 | ||
132 | static zend_always_inline void php_register_PsrHttpMessageStreamInterface(INIT_FUNC_ARGS) | |
133 | { | |
134 | PHP_PSR_REGISTER_INTERFACE2(Http, Message, StreamInterface); | |
135 | } | |
136 | ||
137 | /* }}} Psr\Http\Message\StreamInterface */ | |
138 | /* {{{ Psr\Http\Message\UploadedFileInterface */ | |
139 | ||
140 | PHP_PSR_API zend_class_entry * PsrHttpMessageUploadedFileInterface_ce_ptr; | |
141 | ||
142 | static zend_function_entry PsrHttpMessageUploadedFileInterface_methods[] = { | |
143 | PHP_PSR_ABSTRACT_ME(HttpMessage, UploadedFileInterface, getStream) | |
144 | PHP_PSR_ABSTRACT_ME(HttpMessage, UploadedFileInterface, moveTo) | |
145 | PHP_PSR_ABSTRACT_ME(HttpMessage, UploadedFileInterface, getSize) | |
146 | PHP_PSR_ABSTRACT_ME(HttpMessage, UploadedFileInterface, getError) | |
147 | PHP_PSR_ABSTRACT_ME(HttpMessage, UploadedFileInterface, getClientFilename) | |
148 | PHP_PSR_ABSTRACT_ME(HttpMessage, UploadedFileInterface, getClientMediaType) | |
149 | PHP_FE_END | |
150 | }; | |
151 | ||
152 | static zend_always_inline void php_register_PsrHttpMessageUploadedFileInterface(INIT_FUNC_ARGS) | |
153 | { | |
154 | PHP_PSR_REGISTER_INTERFACE2(Http, Message, UploadedFileInterface); | |
155 | } | |
156 | ||
157 | /* }}} Psr\Http\Message\UploadedFileInterface */ | |
158 | /* {{{ Psr\Http\Message\UriInterface */ | |
159 | ||
160 | PHP_PSR_API zend_class_entry * PsrHttpMessageUriInterface_ce_ptr; | |
161 | ||
162 | static zend_function_entry PsrHttpMessageUriInterface_methods[] = { | |
163 | PHP_PSR_ABSTRACT_ME(HttpMessage, UriInterface, getScheme) | |
164 | PHP_PSR_ABSTRACT_ME(HttpMessage, UriInterface, getAuthority) | |
165 | PHP_PSR_ABSTRACT_ME(HttpMessage, UriInterface, getUserInfo) | |
166 | PHP_PSR_ABSTRACT_ME(HttpMessage, UriInterface, getHost) | |
167 | PHP_PSR_ABSTRACT_ME(HttpMessage, UriInterface, getPort) | |
168 | PHP_PSR_ABSTRACT_ME(HttpMessage, UriInterface, getPath) | |
169 | PHP_PSR_ABSTRACT_ME(HttpMessage, UriInterface, getQuery) | |
170 | PHP_PSR_ABSTRACT_ME(HttpMessage, UriInterface, getFragment) | |
171 | PHP_PSR_ABSTRACT_ME(HttpMessage, UriInterface, withScheme) | |
172 | PHP_PSR_ABSTRACT_ME(HttpMessage, UriInterface, withUserInfo) | |
173 | PHP_PSR_ABSTRACT_ME(HttpMessage, UriInterface, withHost) | |
174 | PHP_PSR_ABSTRACT_ME(HttpMessage, UriInterface, withPort) | |
175 | PHP_PSR_ABSTRACT_ME(HttpMessage, UriInterface, withPath) | |
176 | PHP_PSR_ABSTRACT_ME(HttpMessage, UriInterface, withQuery) | |
177 | PHP_PSR_ABSTRACT_ME(HttpMessage, UriInterface, withFragment) | |
178 | PHP_PSR_ABSTRACT_ME(HttpMessage, UriInterface, __toString) | |
179 | PHP_FE_END | |
180 | }; | |
181 | ||
182 | static zend_always_inline void php_register_PsrHttpMessageUriInterface(INIT_FUNC_ARGS) | |
183 | { | |
184 | PHP_PSR_REGISTER_INTERFACE2(Http, Message, UriInterface); | |
185 | } | |
186 | ||
187 | /* }}} Psr\Http\Message\UriInterface */ | |
188 | ||
189 | /* {{{ PHP_MINIT_FUNCTION */ | |
190 | PHP_MINIT_FUNCTION(psr_http_message) | |
191 | { | |
192 | php_register_PsrHttpMessageMessageInterface(INIT_FUNC_ARGS_PASSTHRU); | |
193 | php_register_PsrHttpMessageRequestInterface(INIT_FUNC_ARGS_PASSTHRU); | |
194 | php_register_PsrHttpMessageResponseInterface(INIT_FUNC_ARGS_PASSTHRU); | |
195 | php_register_PsrHttpMessageServerRequestInterface(INIT_FUNC_ARGS_PASSTHRU); | |
196 | php_register_PsrHttpMessageStreamInterface(INIT_FUNC_ARGS_PASSTHRU); | |
197 | php_register_PsrHttpMessageUploadedFileInterface(INIT_FUNC_ARGS_PASSTHRU); | |
198 | php_register_PsrHttpMessageUriInterface(INIT_FUNC_ARGS_PASSTHRU); | |
199 | return SUCCESS; | |
200 | } | |
201 | /* }}} */ | |
202 | ||
203 | /* | |
204 | * Local variables: | |
205 | * tab-width: 4 | |
206 | * c-basic-offset: 4 | |
207 | * End: | |
208 | * vim600: fdm=marker | |
209 | * vim: et sw=4 ts=4 | |
210 | */ |
0 | ||
1 | #ifndef PSR_HTTP_MESSAGE_H | |
2 | #define PSR_HTTP_MESSAGE_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_psr.h" | |
6 | ||
7 | #define PHP_PSR_HTTP_MESSAGE_VERSION "1.0.0" | |
8 | #define PHP_PSR_HTTP_MESSAGE_VERSION_ID 10000 | |
9 | ||
10 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageMessageInterface_ce_ptr; | |
11 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageRequestInterface_ce_ptr; | |
12 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageResponseInterface_ce_ptr; | |
13 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageServerRequestInterface_ce_ptr; | |
14 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageStreamInterface_ce_ptr; | |
15 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageUploadedFileInterface_ce_ptr; | |
16 | extern PHP_PSR_API zend_class_entry * PsrHttpMessageUriInterface_ce_ptr; | |
17 | ||
18 | extern PHP_MINIT_FUNCTION(psr_http_message); | |
19 | ||
20 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, MessageInterface, getProtocolVersion, 0) | |
21 | PHP_PSR_END_ARG_INFO() | |
22 | ||
23 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, MessageInterface, withProtocolVersion, 1) | |
24 | ZEND_ARG_INFO(0, version) | |
25 | PHP_PSR_END_ARG_INFO() | |
26 | ||
27 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, MessageInterface, getHeaders, 0) | |
28 | PHP_PSR_END_ARG_INFO() | |
29 | ||
30 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, MessageInterface, hasHeader, 1) | |
31 | ZEND_ARG_INFO(0, name) | |
32 | PHP_PSR_END_ARG_INFO() | |
33 | ||
34 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, MessageInterface, getHeader, 1) | |
35 | ZEND_ARG_INFO(0, name) | |
36 | PHP_PSR_END_ARG_INFO() | |
37 | ||
38 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, MessageInterface, getHeaderLine, 1) | |
39 | ZEND_ARG_INFO(0, name) | |
40 | PHP_PSR_END_ARG_INFO() | |
41 | ||
42 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, MessageInterface, withHeader, 2) | |
43 | ZEND_ARG_INFO(0, name) | |
44 | ZEND_ARG_INFO(0, value) | |
45 | PHP_PSR_END_ARG_INFO() | |
46 | ||
47 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, MessageInterface, withAddedHeader, 2) | |
48 | ZEND_ARG_INFO(0, name) | |
49 | ZEND_ARG_INFO(0, value) | |
50 | PHP_PSR_END_ARG_INFO() | |
51 | ||
52 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, MessageInterface, withoutHeader, 1) | |
53 | ZEND_ARG_INFO(0, name) | |
54 | PHP_PSR_END_ARG_INFO() | |
55 | ||
56 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, MessageInterface, getBody, 0) | |
57 | PHP_PSR_END_ARG_INFO() | |
58 | ||
59 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, MessageInterface, withBody, 1) | |
60 | ZEND_ARG_OBJ_INFO(0, body, Psr\\Http\\Message\\StreamInterface, 0) | |
61 | PHP_PSR_END_ARG_INFO() | |
62 | ||
63 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, RequestInterface, getRequestTarget, 0) | |
64 | PHP_PSR_END_ARG_INFO() | |
65 | ||
66 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, RequestInterface, withRequestTarget, 1) | |
67 | ZEND_ARG_INFO(0, requestTarget) | |
68 | PHP_PSR_END_ARG_INFO() | |
69 | ||
70 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, RequestInterface, getMethod, 0) | |
71 | PHP_PSR_END_ARG_INFO() | |
72 | ||
73 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, RequestInterface, withMethod, 1) | |
74 | ZEND_ARG_INFO(0, method) | |
75 | PHP_PSR_END_ARG_INFO() | |
76 | ||
77 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, RequestInterface, getUri, 0) | |
78 | PHP_PSR_END_ARG_INFO() | |
79 | ||
80 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, RequestInterface, withUri, 1) | |
81 | ZEND_ARG_OBJ_INFO(0, uri, Psr\\Http\\Message\\UriInterface, 0) | |
82 | ZEND_ARG_INFO(0, preserveHost) | |
83 | PHP_PSR_END_ARG_INFO() | |
84 | ||
85 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, ResponseInterface, getStatusCode, 0) | |
86 | PHP_PSR_END_ARG_INFO() | |
87 | ||
88 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, ResponseInterface, withStatus, 1) | |
89 | ZEND_ARG_INFO(0, code) | |
90 | ZEND_ARG_INFO(0, reasonPhrase) | |
91 | PHP_PSR_END_ARG_INFO() | |
92 | ||
93 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, ResponseInterface, getReasonPhrase, 0) | |
94 | PHP_PSR_END_ARG_INFO() | |
95 | ||
96 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, ServerRequestInterface, getServerParams, 0) | |
97 | PHP_PSR_END_ARG_INFO() | |
98 | ||
99 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, ServerRequestInterface, getCookieParams, 0) | |
100 | PHP_PSR_END_ARG_INFO() | |
101 | ||
102 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, ServerRequestInterface, withCookieParams, 1) | |
103 | ZEND_ARG_ARRAY_INFO(0, cookies, 0) | |
104 | PHP_PSR_END_ARG_INFO() | |
105 | ||
106 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, ServerRequestInterface, getQueryParams, 0) | |
107 | PHP_PSR_END_ARG_INFO() | |
108 | ||
109 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, ServerRequestInterface, withQueryParams, 1) | |
110 | ZEND_ARG_ARRAY_INFO(0, query, 0) | |
111 | PHP_PSR_END_ARG_INFO() | |
112 | ||
113 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, ServerRequestInterface, getUploadedFiles, 0) | |
114 | PHP_PSR_END_ARG_INFO() | |
115 | ||
116 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, ServerRequestInterface, withUploadedFiles, 1) | |
117 | ZEND_ARG_ARRAY_INFO(0, uploadedFiles, 0) | |
118 | PHP_PSR_END_ARG_INFO() | |
119 | ||
120 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, ServerRequestInterface, getParsedBody, 0) | |
121 | PHP_PSR_END_ARG_INFO() | |
122 | ||
123 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, ServerRequestInterface, withParsedBody, 1) | |
124 | ZEND_ARG_INFO(0, parsedBody) | |
125 | PHP_PSR_END_ARG_INFO() | |
126 | ||
127 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, ServerRequestInterface, getAttributes, 0) | |
128 | PHP_PSR_END_ARG_INFO() | |
129 | ||
130 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, ServerRequestInterface, getAttribute, 1) | |
131 | ZEND_ARG_INFO(0, name) | |
132 | ZEND_ARG_INFO(0, default) | |
133 | PHP_PSR_END_ARG_INFO() | |
134 | ||
135 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, ServerRequestInterface, withAttribute, 2) | |
136 | ZEND_ARG_INFO(0, name) | |
137 | ZEND_ARG_INFO(0, value) | |
138 | PHP_PSR_END_ARG_INFO() | |
139 | ||
140 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, ServerRequestInterface, withoutAttribute, 1) | |
141 | ZEND_ARG_INFO(0, name) | |
142 | PHP_PSR_END_ARG_INFO() | |
143 | ||
144 | #if PHP_VERSION_ID >= 80000 | |
145 | PHP_PSR_BEGIN_ARG_WITH_RETURN_TYPE_INFO(HttpMessage, StreamInterface, __toString, 0, IS_STRING, 0) | |
146 | #else | |
147 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, StreamInterface, __toString, 0) | |
148 | #endif | |
149 | PHP_PSR_END_ARG_INFO() | |
150 | ||
151 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, StreamInterface, close, 0) | |
152 | PHP_PSR_END_ARG_INFO() | |
153 | ||
154 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, StreamInterface, detach, 0) | |
155 | PHP_PSR_END_ARG_INFO() | |
156 | ||
157 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, StreamInterface, getSize, 0) | |
158 | PHP_PSR_END_ARG_INFO() | |
159 | ||
160 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, StreamInterface, tell, 0) | |
161 | PHP_PSR_END_ARG_INFO() | |
162 | ||
163 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, StreamInterface, eof, 0) | |
164 | PHP_PSR_END_ARG_INFO() | |
165 | ||
166 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, StreamInterface, isSeekable, 0) | |
167 | PHP_PSR_END_ARG_INFO() | |
168 | ||
169 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, StreamInterface, seek, 1) | |
170 | ZEND_ARG_INFO(0, offset) | |
171 | ZEND_ARG_INFO(0, whence) | |
172 | PHP_PSR_END_ARG_INFO() | |
173 | ||
174 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, StreamInterface, rewind, 0) | |
175 | PHP_PSR_END_ARG_INFO() | |
176 | ||
177 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, StreamInterface, isWritable, 0) | |
178 | PHP_PSR_END_ARG_INFO() | |
179 | ||
180 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, StreamInterface, write, 1) | |
181 | ZEND_ARG_INFO(0, string) | |
182 | PHP_PSR_END_ARG_INFO() | |
183 | ||
184 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, StreamInterface, isReadable, 0) | |
185 | PHP_PSR_END_ARG_INFO() | |
186 | ||
187 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, StreamInterface, read, 1) | |
188 | ZEND_ARG_INFO(0, length) | |
189 | PHP_PSR_END_ARG_INFO() | |
190 | ||
191 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, StreamInterface, getContents, 0) | |
192 | PHP_PSR_END_ARG_INFO() | |
193 | ||
194 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, StreamInterface, getMetadata, 0) | |
195 | ZEND_ARG_INFO(0, key) | |
196 | PHP_PSR_END_ARG_INFO() | |
197 | ||
198 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UploadedFileInterface, getStream, 0) | |
199 | PHP_PSR_END_ARG_INFO() | |
200 | ||
201 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UploadedFileInterface, moveTo, 1) | |
202 | ZEND_ARG_INFO(0, targetPath) | |
203 | PHP_PSR_END_ARG_INFO() | |
204 | ||
205 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UploadedFileInterface, getSize, 0) | |
206 | PHP_PSR_END_ARG_INFO() | |
207 | ||
208 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UploadedFileInterface, getError, 0) | |
209 | PHP_PSR_END_ARG_INFO() | |
210 | ||
211 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UploadedFileInterface, getClientFilename, 0) | |
212 | PHP_PSR_END_ARG_INFO() | |
213 | ||
214 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UploadedFileInterface, getClientMediaType, 0) | |
215 | PHP_PSR_END_ARG_INFO() | |
216 | ||
217 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UriInterface, getScheme, 0) | |
218 | PHP_PSR_END_ARG_INFO() | |
219 | ||
220 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UriInterface, getAuthority, 0) | |
221 | PHP_PSR_END_ARG_INFO() | |
222 | ||
223 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UriInterface, getUserInfo, 0) | |
224 | PHP_PSR_END_ARG_INFO() | |
225 | ||
226 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UriInterface, getHost, 0) | |
227 | PHP_PSR_END_ARG_INFO() | |
228 | ||
229 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UriInterface, getPort, 0) | |
230 | PHP_PSR_END_ARG_INFO() | |
231 | ||
232 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UriInterface, getPath, 0) | |
233 | PHP_PSR_END_ARG_INFO() | |
234 | ||
235 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UriInterface, getQuery, 0) | |
236 | PHP_PSR_END_ARG_INFO() | |
237 | ||
238 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UriInterface, getFragment, 0) | |
239 | PHP_PSR_END_ARG_INFO() | |
240 | ||
241 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UriInterface, withScheme, 1) | |
242 | ZEND_ARG_INFO(0, scheme) | |
243 | PHP_PSR_END_ARG_INFO() | |
244 | ||
245 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UriInterface, withUserInfo, 1) | |
246 | ZEND_ARG_INFO(0, user) | |
247 | ZEND_ARG_INFO(0, password) | |
248 | PHP_PSR_END_ARG_INFO() | |
249 | ||
250 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UriInterface, withHost, 1) | |
251 | ZEND_ARG_INFO(0, host) | |
252 | PHP_PSR_END_ARG_INFO() | |
253 | ||
254 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UriInterface, withPort, 1) | |
255 | ZEND_ARG_INFO(0, port) | |
256 | PHP_PSR_END_ARG_INFO() | |
257 | ||
258 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UriInterface, withPath, 1) | |
259 | ZEND_ARG_INFO(0, path) | |
260 | PHP_PSR_END_ARG_INFO() | |
261 | ||
262 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UriInterface, withQuery, 1) | |
263 | ZEND_ARG_INFO(0, query) | |
264 | PHP_PSR_END_ARG_INFO() | |
265 | ||
266 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UriInterface, withFragment, 1) | |
267 | ZEND_ARG_INFO(0, fragment) | |
268 | PHP_PSR_END_ARG_INFO() | |
269 | ||
270 | #if PHP_VERSION_ID >= 80000 | |
271 | PHP_PSR_BEGIN_ARG_WITH_RETURN_TYPE_INFO(HttpMessage, UriInterface, __toString, 0, IS_STRING, 0) | |
272 | #else | |
273 | PHP_PSR_BEGIN_ARG_INFO(HttpMessage, UriInterface, __toString, 0) | |
274 | #endif | |
275 | PHP_PSR_END_ARG_INFO() | |
276 | ||
277 | #endif /* PSR_HTTP_MESSAGE_H */ | |
278 | ||
279 | /* | |
280 | * Local variables: | |
281 | * tab-width: 4 | |
282 | * c-basic-offset: 4 | |
283 | * End: | |
284 | * vim600: fdm=marker | |
285 | * vim: et sw=4 ts=4 | |
286 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include "php_psr.h" | |
7 | #include "psr_http_server_handler.h" | |
8 | #include "psr_private.h" | |
9 | ||
10 | /* {{{ RequestHandlerInterface ---------------------------------------------- */ | |
11 | ||
12 | PHP_PSR_API zend_class_entry * PsrHttpServerRequestHandlerInterface_ce_ptr; | |
13 | ||
14 | static zend_function_entry PsrHttpServerRequestHandlerInterface_methods[] = { | |
15 | PHP_PSR_ABSTRACT_ME(HttpServer, RequestHandlerInterface, handle) | |
16 | PHP_FE_END | |
17 | }; | |
18 | ||
19 | static zend_always_inline void php_psr_register_PsrHttpServerRequestHandlerInterface(INIT_FUNC_ARGS) | |
20 | { | |
21 | PHP_PSR_REGISTER_INTERFACE2(Http, Server, RequestHandlerInterface); | |
22 | } | |
23 | ||
24 | /* }}} ---------------------------------------------------------------------- */ | |
25 | ||
26 | /* {{{ PHP_MINIT_FUNCTION */ | |
27 | PHP_MINIT_FUNCTION(psr_http_server_handler) | |
28 | { | |
29 | php_psr_register_PsrHttpServerRequestHandlerInterface(INIT_FUNC_ARGS_PASSTHRU); | |
30 | ||
31 | return SUCCESS; | |
32 | } | |
33 | /* }}} */ | |
34 | ||
35 | /* | |
36 | * Local variables: | |
37 | * tab-width: 4 | |
38 | * c-basic-offset: 4 | |
39 | * End: | |
40 | * vim600: fdm=marker | |
41 | * vim: et sw=4 ts=4 | |
42 | */ |
0 | #ifndef PSR_HTTP_SERVER_HANDLER_H | |
1 | #define PSR_HTTP_SERVER_HANDLER_H | |
2 | ||
3 | #include "php.h" | |
4 | #include "php_psr.h" | |
5 | ||
6 | #define PHP_PSR_HTTP_SERVER_HANDLER_VERSION "1.0.0" | |
7 | #define PHP_PSR_HTTP_SERVER_HANDLER_VERSION_ID 10000 | |
8 | ||
9 | extern PHP_MINIT_FUNCTION(psr_http_server_handler); | |
10 | ||
11 | extern PHP_PSR_API zend_class_entry * PsrHttpServerRequestHandlerInterface_ce_ptr; | |
12 | ||
13 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(HttpServer, RequestHandlerInterface, handle, 1, Psr\\Http\\Message\\ResponseInterface, 0) | |
14 | ZEND_ARG_OBJ_INFO(0, request, Psr\\Http\\Message\\ServerRequestInterface, 0) | |
15 | PHP_PSR_END_ARG_INFO() | |
16 | ||
17 | #endif /* PSR_HTTP_SERVER_HANDLER_H */ | |
18 | ||
19 | /* | |
20 | * Local variables: | |
21 | * tab-width: 4 | |
22 | * c-basic-offset: 4 | |
23 | * End: | |
24 | * vim600: fdm=marker | |
25 | * vim: et sw=4 ts=4 | |
26 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include "php_psr.h" | |
7 | #include "psr_http_server_middleware.h" | |
8 | #include "psr_private.h" | |
9 | ||
10 | /* {{{ MiddlewareInterface -------------------------------------------------- */ | |
11 | ||
12 | PHP_PSR_API zend_class_entry * PsrHttpServerMiddlewareInterface_ce_ptr; | |
13 | ||
14 | static zend_function_entry PsrHttpServerMiddlewareInterface_methods[] = { | |
15 | PHP_PSR_ABSTRACT_ME(HttpServer, MiddlewareInterface, process) | |
16 | PHP_FE_END | |
17 | }; | |
18 | ||
19 | static zend_always_inline void php_psr_register_PsrHttpServerMiddlewareInterface(INIT_FUNC_ARGS) | |
20 | { | |
21 | PHP_PSR_REGISTER_INTERFACE2(Http, Server, MiddlewareInterface); | |
22 | } | |
23 | ||
24 | /* }}} ---------------------------------------------------------------------- */ | |
25 | ||
26 | /* {{{ PHP_MINIT_FUNCTION */ | |
27 | PHP_MINIT_FUNCTION(psr_http_server_middleware) | |
28 | { | |
29 | php_psr_register_PsrHttpServerMiddlewareInterface(INIT_FUNC_ARGS_PASSTHRU); | |
30 | ||
31 | return SUCCESS; | |
32 | } | |
33 | /* }}} */ | |
34 | ||
35 | /* | |
36 | * Local variables: | |
37 | * tab-width: 4 | |
38 | * c-basic-offset: 4 | |
39 | * End: | |
40 | * vim600: fdm=marker | |
41 | * vim: et sw=4 ts=4 | |
42 | */ |
0 | #ifndef PSR_HTTP_SERVER_MIDDLEWARE_H | |
1 | #define PSR_HTTP_SERVER_MIDDLEWARE_H | |
2 | ||
3 | #include "php.h" | |
4 | #include "php_psr.h" | |
5 | ||
6 | #define PHP_PSR_HTTP_SERVER_MIDDLEWARE_VERSION "1.0.0" | |
7 | #define PHP_PSR_HTTP_SERVER_MIDDLEWARE_VERSION_ID 10000 | |
8 | ||
9 | extern PHP_MINIT_FUNCTION(psr_http_server_middleware); | |
10 | ||
11 | extern PHP_PSR_API zend_class_entry * PsrHttpServerMiddlewareInterface_ce_ptr; | |
12 | ||
13 | PHP_PSR_BEGIN_ARG_WITH_RETURN_OBJ_INFO(HttpServer, MiddlewareInterface, process, 2, Psr\\Http\\Message\\ResponseInterface, 0) | |
14 | ZEND_ARG_OBJ_INFO(0, request, Psr\\Http\\Message\\ServerRequestInterface, 0) | |
15 | ZEND_ARG_OBJ_INFO(0, handler, Psr\\Http\\Server\\RequestHandlerInterface, 0) | |
16 | PHP_PSR_END_ARG_INFO() | |
17 | ||
18 | #endif /* PSR_HTTP_SERVER_MIDDLEWARE_H */ | |
19 | ||
20 | /* | |
21 | * Local variables: | |
22 | * tab-width: 4 | |
23 | * c-basic-offset: 4 | |
24 | * End: | |
25 | * vim600: fdm=marker | |
26 | * vim: et sw=4 ts=4 | |
27 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | ||
7 | #include "php_psr.h" | |
8 | #include "psr_link.h" | |
9 | #include "psr_private.h" | |
10 | ||
11 | /* {{{ EvolvableLinkInterface ----------------------------------------------- */ | |
12 | ||
13 | PHP_PSR_API zend_class_entry * PsrLinkEvolvableLinkInterface_ce_ptr; | |
14 | ||
15 | static zend_function_entry PsrLinkEvolvableLinkInterface_methods[] = { | |
16 | PHP_PSR_ABSTRACT_ME(Link, EvolvableLinkInterface, withHref) | |
17 | PHP_PSR_ABSTRACT_ME(Link, EvolvableLinkInterface, withRel) | |
18 | PHP_PSR_ABSTRACT_ME(Link, EvolvableLinkInterface, withoutRel) | |
19 | PHP_PSR_ABSTRACT_ME(Link, EvolvableLinkInterface, withAttribute) | |
20 | PHP_PSR_ABSTRACT_ME(Link, EvolvableLinkInterface, withoutAttribute) | |
21 | PHP_FE_END | |
22 | }; | |
23 | ||
24 | static zend_always_inline void php_psr_register_PsrLinkEvolvableLinkInterface(INIT_FUNC_ARGS) | |
25 | { | |
26 | PHP_PSR_REGISTER_INTERFACE(Link, EvolvableLinkInterface); | |
27 | zend_class_implements(PsrLinkEvolvableLinkInterface_ce_ptr, 1, PsrLinkLinkInterface_ce_ptr); | |
28 | } | |
29 | ||
30 | /* }}} ---------------------------------------------------------------------- */ | |
31 | /* {{{ PsrLinkEvolvableLinkProviderInterface -------------------------------- */ | |
32 | ||
33 | PHP_PSR_API zend_class_entry * PsrLinkEvolvableLinkProviderInterface_ce_ptr; | |
34 | ||
35 | static zend_function_entry PsrLinkEvolvableLinkProviderInterface_methods[] = { | |
36 | PHP_PSR_ABSTRACT_ME(Link, EvolvableLinkProviderInterface, withLink) | |
37 | PHP_PSR_ABSTRACT_ME(Link, EvolvableLinkProviderInterface, withoutLink) | |
38 | PHP_FE_END | |
39 | }; | |
40 | ||
41 | static zend_always_inline void php_psr_register_PsrLinkEvolvableLinkProviderInterface(INIT_FUNC_ARGS) | |
42 | { | |
43 | PHP_PSR_REGISTER_INTERFACE(Link, EvolvableLinkProviderInterface); | |
44 | zend_class_implements(PsrLinkEvolvableLinkProviderInterface_ce_ptr, 1, PsrLinkLinkProviderInterface_ce_ptr); | |
45 | } | |
46 | ||
47 | /* }}} ---------------------------------------------------------------------- */ | |
48 | /* {{{ PsrLinkLinkInterface -------------------------------- */ | |
49 | ||
50 | PHP_PSR_API zend_class_entry * PsrLinkLinkInterface_ce_ptr; | |
51 | ||
52 | static zend_function_entry PsrLinkLinkInterface_methods[] = { | |
53 | PHP_PSR_ABSTRACT_ME(Link, LinkInterface, getHref) | |
54 | PHP_PSR_ABSTRACT_ME(Link, LinkInterface, isTemplated) | |
55 | PHP_PSR_ABSTRACT_ME(Link, LinkInterface, getRels) | |
56 | PHP_PSR_ABSTRACT_ME(Link, LinkInterface, getAttributes) | |
57 | PHP_FE_END | |
58 | }; | |
59 | ||
60 | static zend_always_inline void php_psr_register_PsrLinkLinkInterface(INIT_FUNC_ARGS) | |
61 | { | |
62 | PHP_PSR_REGISTER_INTERFACE(Link, LinkInterface); | |
63 | } | |
64 | ||
65 | /* }}} ---------------------------------------------------------------------- */ | |
66 | /* {{{ LinkProviderInterface ------------------------------------------------ */ | |
67 | ||
68 | PHP_PSR_API zend_class_entry * PsrLinkLinkProviderInterface_ce_ptr; | |
69 | ||
70 | static zend_function_entry PsrLinkLinkProviderInterface_methods[] = { | |
71 | PHP_PSR_ABSTRACT_ME(Link, LinkProviderInterface, getLinks) | |
72 | PHP_PSR_ABSTRACT_ME(Link, LinkProviderInterface, getLinksByRel) | |
73 | PHP_FE_END | |
74 | }; | |
75 | ||
76 | static zend_always_inline void php_psr_register_PsrLinkLinkProviderInterface(INIT_FUNC_ARGS) | |
77 | { | |
78 | PHP_PSR_REGISTER_INTERFACE(Link, LinkProviderInterface); | |
79 | } | |
80 | ||
81 | /* }}} ---------------------------------------------------------------------- */ | |
82 | ||
83 | /* {{{ PHP_MINIT_FUNCTION */ | |
84 | PHP_MINIT_FUNCTION(psr_link) | |
85 | { | |
86 | php_psr_register_PsrLinkLinkInterface(INIT_FUNC_ARGS_PASSTHRU); | |
87 | php_psr_register_PsrLinkLinkProviderInterface(INIT_FUNC_ARGS_PASSTHRU); | |
88 | php_psr_register_PsrLinkEvolvableLinkInterface(INIT_FUNC_ARGS_PASSTHRU); | |
89 | php_psr_register_PsrLinkEvolvableLinkProviderInterface(INIT_FUNC_ARGS_PASSTHRU); | |
90 | ||
91 | return SUCCESS; | |
92 | } | |
93 | /* }}} */ | |
94 | ||
95 | /* | |
96 | * Local variables: | |
97 | * tab-width: 4 | |
98 | * c-basic-offset: 4 | |
99 | * End: | |
100 | * vim600: fdm=marker | |
101 | * vim: et sw=4 ts=4 | |
102 | */ |
0 | ||
1 | #ifndef PSR_LINK_H | |
2 | #define PSR_LINK_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_psr.h" | |
6 | ||
7 | #define PHP_PSR_LINK_VERSION "1.0.0" | |
8 | #define PHP_PSR_LINK_VERSION_ID 10000 | |
9 | ||
10 | extern PHP_PSR_API zend_class_entry * PsrLinkEvolvableLinkInterface_ce_ptr; | |
11 | extern PHP_PSR_API zend_class_entry * PsrLinkEvolvableLinkProviderInterface_ce_ptr; | |
12 | extern PHP_PSR_API zend_class_entry * PsrLinkLinkInterface_ce_ptr; | |
13 | extern PHP_PSR_API zend_class_entry * PsrLinkLinkProviderInterface_ce_ptr; | |
14 | ||
15 | extern PHP_MINIT_FUNCTION(psr_link); | |
16 | ||
17 | PHP_PSR_BEGIN_ARG_INFO(Link, EvolvableLinkInterface, withHref, 1) | |
18 | ZEND_ARG_INFO(0, href) | |
19 | PHP_PSR_END_ARG_INFO() | |
20 | ||
21 | PHP_PSR_BEGIN_ARG_INFO(Link, EvolvableLinkInterface, withRel, 1) | |
22 | ZEND_ARG_INFO(0, rel) | |
23 | PHP_PSR_END_ARG_INFO() | |
24 | ||
25 | PHP_PSR_BEGIN_ARG_INFO(Link, EvolvableLinkInterface, withoutRel, 1) | |
26 | ZEND_ARG_INFO(0, rel) | |
27 | PHP_PSR_END_ARG_INFO() | |
28 | ||
29 | PHP_PSR_BEGIN_ARG_INFO(Link, EvolvableLinkInterface, withAttribute, 2) | |
30 | ZEND_ARG_INFO(0, attribute) | |
31 | ZEND_ARG_INFO(0, value) | |
32 | PHP_PSR_END_ARG_INFO() | |
33 | ||
34 | PHP_PSR_BEGIN_ARG_INFO(Link, EvolvableLinkInterface, withoutAttribute, 1) | |
35 | ZEND_ARG_INFO(0, attribute) | |
36 | PHP_PSR_END_ARG_INFO() | |
37 | ||
38 | PHP_PSR_BEGIN_ARG_INFO(Link, EvolvableLinkProviderInterface, withLink, 1) | |
39 | ZEND_ARG_OBJ_INFO(0, link, Psr\\Link\\LinkInterface, 0) | |
40 | PHP_PSR_END_ARG_INFO() | |
41 | ||
42 | PHP_PSR_BEGIN_ARG_INFO(Link, EvolvableLinkProviderInterface, withoutLink, 1) | |
43 | ZEND_ARG_OBJ_INFO(0, link, Psr\\Link\\LinkInterface, 0) | |
44 | PHP_PSR_END_ARG_INFO() | |
45 | ||
46 | PHP_PSR_BEGIN_ARG_INFO(Link, LinkInterface, getHref, 0) | |
47 | PHP_PSR_END_ARG_INFO() | |
48 | ||
49 | PHP_PSR_BEGIN_ARG_INFO(Link, LinkInterface, isTemplated, 0) | |
50 | PHP_PSR_END_ARG_INFO() | |
51 | ||
52 | PHP_PSR_BEGIN_ARG_INFO(Link, LinkInterface, getRels, 0) | |
53 | PHP_PSR_END_ARG_INFO() | |
54 | ||
55 | PHP_PSR_BEGIN_ARG_INFO(Link, LinkInterface, getAttributes, 0) | |
56 | PHP_PSR_END_ARG_INFO() | |
57 | ||
58 | PHP_PSR_BEGIN_ARG_INFO(Link, LinkProviderInterface, getLinks, 0) | |
59 | PHP_PSR_END_ARG_INFO() | |
60 | ||
61 | PHP_PSR_BEGIN_ARG_INFO(Link, LinkProviderInterface, getLinksByRel, 1) | |
62 | ZEND_ARG_INFO(0, rel) | |
63 | PHP_PSR_END_ARG_INFO() | |
64 | ||
65 | #endif /* PSR_LINK_H */ | |
66 | ||
67 | /* | |
68 | * Local variables: | |
69 | * tab-width: 4 | |
70 | * c-basic-offset: 4 | |
71 | * End: | |
72 | * vim600: fdm=marker | |
73 | * vim: et sw=4 ts=4 | |
74 | */ |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include "php_ini.h" | |
7 | #include "ext/standard/info.h" | |
8 | #include "ext/spl/spl_exceptions.h" | |
9 | #include "zend_API.h" | |
10 | #include "zend_interfaces.h" | |
11 | ||
12 | #include "php_psr.h" | |
13 | #include "psr_log.h" | |
14 | #include "psr_private.h" | |
15 | ||
16 | /* Needed to work around https://bugs.php.net/bug.php?id=69579 */ | |
17 | #define PHP_PSR_EXTRA_TRAIT_FLAGS ZEND_ACC_ARENA_ALLOCATED | |
18 | ||
19 | /* {{{ Psr\Log\InvalidArgumentException */ | |
20 | ||
21 | PHP_PSR_API zend_class_entry * PsrLogInvalidArgumentException_ce_ptr; | |
22 | #define PsrLogInvalidArgumentException_methods NULL | |
23 | ||
24 | static zend_always_inline void php_psr_register_InvalidArgumentException(INIT_FUNC_ARGS) | |
25 | { | |
26 | PHP_PSR_REGISTER_CLASS(Log, InvalidArgumentException, spl_ce_InvalidArgumentException); | |
27 | } | |
28 | ||
29 | /* }}} Psr\Log\InvalidArgumentException */ | |
30 | /* {{{ Psr\Log\LogLevel */ | |
31 | ||
32 | PHP_PSR_API zend_class_entry * PsrLogLogLevel_ce_ptr; | |
33 | #define PsrLogLogLevel_methods NULL | |
34 | ||
35 | static zend_always_inline void php_psr_register_LogLevel(INIT_FUNC_ARGS) | |
36 | { | |
37 | PHP_PSR_REGISTER_CLASS(Log, LogLevel, NULL); | |
38 | ||
39 | REGISTER_PSR_CLASS_CONST_STRING(PsrLogLogLevel_ce_ptr, "EMERGENCY", "emergency"); | |
40 | REGISTER_PSR_CLASS_CONST_STRING(PsrLogLogLevel_ce_ptr, "ALERT", "alert"); | |
41 | REGISTER_PSR_CLASS_CONST_STRING(PsrLogLogLevel_ce_ptr, "CRITICAL", "critical"); | |
42 | REGISTER_PSR_CLASS_CONST_STRING(PsrLogLogLevel_ce_ptr, "ERROR", "error"); | |
43 | REGISTER_PSR_CLASS_CONST_STRING(PsrLogLogLevel_ce_ptr, "WARNING", "warning"); | |
44 | REGISTER_PSR_CLASS_CONST_STRING(PsrLogLogLevel_ce_ptr, "NOTICE", "notice"); | |
45 | REGISTER_PSR_CLASS_CONST_STRING(PsrLogLogLevel_ce_ptr, "INFO", "info"); | |
46 | REGISTER_PSR_CLASS_CONST_STRING(PsrLogLogLevel_ce_ptr, "DEBUG", "debug"); | |
47 | ||
48 | } | |
49 | ||
50 | /* }}} Psr\Log\LogLevel */ | |
51 | /* {{{ Psr\Log\LoggerInterface */ | |
52 | ||
53 | PHP_PSR_API zend_class_entry * PsrLogLoggerInterface_ce_ptr; | |
54 | ||
55 | static zend_function_entry PsrLogLoggerInterface_methods[] = { | |
56 | PHP_PSR_ABSTRACT_ME(Log, LoggerInterface, emergency) | |
57 | PHP_PSR_ABSTRACT_ME(Log, LoggerInterface, alert) | |
58 | PHP_PSR_ABSTRACT_ME(Log, LoggerInterface, critical) | |
59 | PHP_PSR_ABSTRACT_ME(Log, LoggerInterface, error) | |
60 | PHP_PSR_ABSTRACT_ME(Log, LoggerInterface, warning) | |
61 | PHP_PSR_ABSTRACT_ME(Log, LoggerInterface, notice) | |
62 | PHP_PSR_ABSTRACT_ME(Log, LoggerInterface, info) | |
63 | PHP_PSR_ABSTRACT_ME(Log, LoggerInterface, debug) | |
64 | PHP_PSR_ABSTRACT_ME(Log, LoggerInterface, log) | |
65 | PHP_FE_END | |
66 | }; | |
67 | ||
68 | static zend_always_inline void php_psr_register_LoggerInterface(INIT_FUNC_ARGS) | |
69 | { | |
70 | PHP_PSR_REGISTER_INTERFACE(Log, LoggerInterface); | |
71 | } | |
72 | ||
73 | /* }}} Psr\Log\LoggerInterface */ | |
74 | /* {{{ Psr\Log\LoggerAwareInterface */ | |
75 | ||
76 | PHP_PSR_API zend_class_entry * PsrLogLoggerAwareInterface_ce_ptr; | |
77 | ||
78 | static zend_function_entry PsrLogLoggerAwareInterface_methods[] = { | |
79 | PHP_PSR_ABSTRACT_ME(Log, LoggerAwareInterface, setLogger) | |
80 | PHP_FE_END | |
81 | }; | |
82 | ||
83 | static zend_always_inline void php_psr_register_LoggerAwareInterface(INIT_FUNC_ARGS) | |
84 | { | |
85 | PHP_PSR_REGISTER_INTERFACE(Log, LoggerAwareInterface); | |
86 | } | |
87 | ||
88 | /* }}} Psr\Log\LoggerAwareInterface */ | |
89 | /* {{{ Psr\Log\AbstractLogger */ | |
90 | ||
91 | PHP_PSR_API zend_class_entry * PsrLogAbstractLogger_ce_ptr; | |
92 | ||
93 | static void php_psr_PsrLogAbstractLogger_log(const char * level_str, size_t level_len, INTERNAL_FUNCTION_PARAMETERS) | |
94 | { | |
95 | zval * _this_zval = getThis(); | |
96 | zval * message; | |
97 | zval * context = NULL; | |
98 | zval fname = {0}; | |
99 | zval fparams[3]; | |
100 | ||
101 | ZEND_PARSE_PARAMETERS_START(1, 2) | |
102 | Z_PARAM_ZVAL(message) | |
103 | Z_PARAM_OPTIONAL | |
104 | Z_PARAM_ARRAY(context) | |
105 | ZEND_PARSE_PARAMETERS_END(); | |
106 | ||
107 | // Alloc function name to call | |
108 | ZVAL_STRINGL(&fname, "log", sizeof("log")-1); | |
109 | ||
110 | // Make function params | |
111 | ZVAL_STRINGL(&fparams[0], level_str, level_len); | |
112 | ZVAL_ZVAL(&fparams[1], message, 0, 0); | |
113 | if( context && Z_TYPE_P(context) == IS_ARRAY ) { | |
114 | ZVAL_ZVAL(&fparams[2], context, 1, 0); | |
115 | } else { | |
116 | array_init(&fparams[2]); | |
117 | } | |
118 | ||
119 | call_user_function(&Z_OBJCE_P(_this_zval)->function_table, _this_zval, &fname, return_value, 3, fparams); | |
120 | ||
121 | zval_ptr_dtor(&fparams[0]); | |
122 | zval_ptr_dtor(&fparams[2]); | |
123 | zval_ptr_dtor(&fname); | |
124 | } | |
125 | ||
126 | PHP_METHOD(PsrLogAbstractLogger, emergency) | |
127 | { | |
128 | php_psr_PsrLogAbstractLogger_log(ZEND_STRL("emergency"), INTERNAL_FUNCTION_PARAM_PASSTHRU); | |
129 | } | |
130 | ||
131 | PHP_METHOD(PsrLogAbstractLogger, alert) | |
132 | { | |
133 | php_psr_PsrLogAbstractLogger_log(ZEND_STRL("alert"), INTERNAL_FUNCTION_PARAM_PASSTHRU); | |
134 | } | |
135 | ||
136 | PHP_METHOD(PsrLogAbstractLogger, critical) | |
137 | { | |
138 | php_psr_PsrLogAbstractLogger_log(ZEND_STRL("critical"), INTERNAL_FUNCTION_PARAM_PASSTHRU); | |
139 | } | |
140 | ||
141 | PHP_METHOD(PsrLogAbstractLogger, error) | |
142 | { | |
143 | php_psr_PsrLogAbstractLogger_log(ZEND_STRL("error"), INTERNAL_FUNCTION_PARAM_PASSTHRU); | |
144 | } | |
145 | ||
146 | PHP_METHOD(PsrLogAbstractLogger, warning) | |
147 | { | |
148 | php_psr_PsrLogAbstractLogger_log(ZEND_STRL("warning"), INTERNAL_FUNCTION_PARAM_PASSTHRU); | |
149 | } | |
150 | ||
151 | PHP_METHOD(PsrLogAbstractLogger, notice) | |
152 | { | |
153 | php_psr_PsrLogAbstractLogger_log(ZEND_STRL("notice"), INTERNAL_FUNCTION_PARAM_PASSTHRU); | |
154 | } | |
155 | ||
156 | PHP_METHOD(PsrLogAbstractLogger, info) | |
157 | { | |
158 | php_psr_PsrLogAbstractLogger_log(ZEND_STRL("info"), INTERNAL_FUNCTION_PARAM_PASSTHRU); | |
159 | } | |
160 | ||
161 | PHP_METHOD(PsrLogAbstractLogger, debug) | |
162 | { | |
163 | php_psr_PsrLogAbstractLogger_log(ZEND_STRL("debug"), INTERNAL_FUNCTION_PARAM_PASSTHRU); | |
164 | } | |
165 | ||
166 | static zend_function_entry PsrLogAbstractLogger_methods[] = { | |
167 | PHP_ME(PsrLogAbstractLogger, emergency, arginfo_PsrLogLoggerInterface_emergency, ZEND_ACC_PUBLIC) | |
168 | PHP_ME(PsrLogAbstractLogger, alert, arginfo_PsrLogLoggerInterface_alert, ZEND_ACC_PUBLIC) | |
169 | PHP_ME(PsrLogAbstractLogger, critical, arginfo_PsrLogLoggerInterface_critical, ZEND_ACC_PUBLIC) | |
170 | PHP_ME(PsrLogAbstractLogger, error, arginfo_PsrLogLoggerInterface_error, ZEND_ACC_PUBLIC) | |
171 | PHP_ME(PsrLogAbstractLogger, warning, arginfo_PsrLogLoggerInterface_warning, ZEND_ACC_PUBLIC) | |
172 | PHP_ME(PsrLogAbstractLogger, notice, arginfo_PsrLogLoggerInterface_notice, ZEND_ACC_PUBLIC) | |
173 | PHP_ME(PsrLogAbstractLogger, info, arginfo_PsrLogLoggerInterface_info, ZEND_ACC_PUBLIC) | |
174 | PHP_ME(PsrLogAbstractLogger, debug, arginfo_PsrLogLoggerInterface_debug, ZEND_ACC_PUBLIC) | |
175 | PHP_FE_END | |
176 | }; | |
177 | ||
178 | static zend_always_inline void php_psr_register_AbstractLogger(INIT_FUNC_ARGS) | |
179 | { | |
180 | PHP_PSR_REGISTER_CLASS(Log, AbstractLogger, NULL); | |
181 | zend_class_implements(PsrLogAbstractLogger_ce_ptr, 1, PsrLogLoggerInterface_ce_ptr); | |
182 | } | |
183 | ||
184 | /* }}} Psr\Log\AbstractLogger */ | |
185 | /* {{{ Psr\Log\NullLogger */ | |
186 | ||
187 | PHP_PSR_API zend_class_entry * PsrLogNullLogger_ce_ptr; | |
188 | ||
189 | PHP_METHOD(PsrLogNullLogger, log) | |
190 | { | |
191 | // noop | |
192 | } | |
193 | ||
194 | static zend_function_entry PsrLogNullLogger_methods[] = { | |
195 | PHP_ME(PsrLogNullLogger, log, arginfo_PsrLogLoggerInterface_log, ZEND_ACC_PUBLIC) | |
196 | PHP_FE_END | |
197 | }; | |
198 | ||
199 | static zend_always_inline void php_psr_register_NullLogger(INIT_FUNC_ARGS) | |
200 | { | |
201 | PHP_PSR_REGISTER_CLASS(Log, NullLogger, PsrLogAbstractLogger_ce_ptr); | |
202 | } | |
203 | ||
204 | /* }}} Psr\Log\NullLogger */ | |
205 | /* {{{ Psr\Log\LoggerTrait */ | |
206 | ||
207 | PHP_PSR_API zend_class_entry * PsrLogLoggerTrait_ce_ptr; | |
208 | ||
209 | static zend_function_entry PsrLogLoggerTrait_methods[] = { | |
210 | PHP_ME(PsrLogAbstractLogger, emergency, arginfo_PsrLogLoggerInterface_emergency, ZEND_ACC_PUBLIC | PHP_PSR_EXTRA_TRAIT_FLAGS) | |
211 | PHP_ME(PsrLogAbstractLogger, alert, arginfo_PsrLogLoggerInterface_alert, ZEND_ACC_PUBLIC | PHP_PSR_EXTRA_TRAIT_FLAGS) | |
212 | PHP_ME(PsrLogAbstractLogger, critical, arginfo_PsrLogLoggerInterface_critical, ZEND_ACC_PUBLIC | PHP_PSR_EXTRA_TRAIT_FLAGS) | |
213 | PHP_ME(PsrLogAbstractLogger, error, arginfo_PsrLogLoggerInterface_error, ZEND_ACC_PUBLIC | PHP_PSR_EXTRA_TRAIT_FLAGS) | |
214 | PHP_ME(PsrLogAbstractLogger, warning, arginfo_PsrLogLoggerInterface_warning, ZEND_ACC_PUBLIC | PHP_PSR_EXTRA_TRAIT_FLAGS) | |
215 | PHP_ME(PsrLogAbstractLogger, notice, arginfo_PsrLogLoggerInterface_notice, ZEND_ACC_PUBLIC | PHP_PSR_EXTRA_TRAIT_FLAGS) | |
216 | PHP_ME(PsrLogAbstractLogger, info, arginfo_PsrLogLoggerInterface_info, ZEND_ACC_PUBLIC | PHP_PSR_EXTRA_TRAIT_FLAGS) | |
217 | PHP_ME(PsrLogAbstractLogger, debug, arginfo_PsrLogLoggerInterface_debug, ZEND_ACC_PUBLIC | PHP_PSR_EXTRA_TRAIT_FLAGS) | |
218 | PHP_ABSTRACT_ME(PsrLogNullLogger, log, arginfo_PsrLogLoggerInterface_log) | |
219 | PHP_FE_END | |
220 | }; | |
221 | ||
222 | static zend_always_inline void php_psr_register_LoggerTrait(INIT_FUNC_ARGS) | |
223 | { | |
224 | PHP_PSR_REGISTER_CLASS(Log, LoggerTrait, NULL); | |
225 | PsrLogLoggerTrait_ce_ptr->ce_flags |= ZEND_ACC_TRAIT; | |
226 | } | |
227 | ||
228 | /* }}} Psr\Log\LoggerTrait */ | |
229 | /* {{{ Psr\Log\LoggerAwareTrait */ | |
230 | ||
231 | PHP_PSR_API zend_class_entry * PsrLogLoggerAwareTrait_ce_ptr; | |
232 | ||
233 | PHP_METHOD(PsrLogLoggerAwareTrait, setLogger) | |
234 | { | |
235 | zval * _this_zval = getThis(); | |
236 | zval * logger; | |
237 | ||
238 | ZEND_PARSE_PARAMETERS_START(1, 1) | |
239 | Z_PARAM_OBJECT_OF_CLASS(logger, PsrLogLoggerInterface_ce_ptr) | |
240 | ZEND_PARSE_PARAMETERS_END(); | |
241 | ||
242 | #if PHP_VERSION_ID < 80000 | |
243 | zend_update_property(Z_OBJCE_P(_this_zval), _this_zval, "logger", sizeof("logger")-1, logger); | |
244 | #else | |
245 | zend_update_property(Z_OBJCE_P(_this_zval), Z_OBJ_P(_this_zval), "logger", sizeof("logger")-1, logger); | |
246 | #endif | |
247 | } | |
248 | ||
249 | static zend_function_entry PsrLogLoggerAwareTrait_methods[] = { | |
250 | PHP_ME(PsrLogLoggerAwareTrait, setLogger, arginfo_PsrLogLoggerAwareInterface_setLogger, ZEND_ACC_PUBLIC | PHP_PSR_EXTRA_TRAIT_FLAGS) | |
251 | PHP_FE_END | |
252 | }; | |
253 | ||
254 | static zend_always_inline void php_psr_register_LoggerAwareTrait(INIT_FUNC_ARGS) | |
255 | { | |
256 | PHP_PSR_REGISTER_CLASS(Log, LoggerAwareTrait, NULL); | |
257 | PsrLogLoggerAwareTrait_ce_ptr->ce_flags |= ZEND_ACC_TRAIT; | |
258 | zend_declare_property_null(PsrLogLoggerAwareTrait_ce_ptr, "logger", sizeof("logger")-1, ZEND_ACC_PROTECTED); | |
259 | } | |
260 | ||
261 | /* }}} Psr\Log\LoggerAwareTrait */ | |
262 | ||
263 | /* {{{ PHP_MINIT_FUNCTION */ | |
264 | PHP_MINIT_FUNCTION(psr_log) | |
265 | { | |
266 | php_psr_register_InvalidArgumentException(INIT_FUNC_ARGS_PASSTHRU); | |
267 | php_psr_register_LogLevel(INIT_FUNC_ARGS_PASSTHRU); | |
268 | php_psr_register_LoggerInterface(INIT_FUNC_ARGS_PASSTHRU); | |
269 | php_psr_register_LoggerAwareInterface(INIT_FUNC_ARGS_PASSTHRU); | |
270 | php_psr_register_AbstractLogger(INIT_FUNC_ARGS_PASSTHRU); | |
271 | php_psr_register_NullLogger(INIT_FUNC_ARGS_PASSTHRU); | |
272 | php_psr_register_LoggerTrait(INIT_FUNC_ARGS_PASSTHRU); | |
273 | php_psr_register_LoggerAwareTrait(INIT_FUNC_ARGS_PASSTHRU); | |
274 | ||
275 | return SUCCESS; | |
276 | } | |
277 | /* }}} */ | |
278 | ||
279 | /* | |
280 | * Local variables: | |
281 | * tab-width: 4 | |
282 | * c-basic-offset: 4 | |
283 | * End: | |
284 | * vim600: fdm=marker | |
285 | * vim: et sw=4 ts=4 | |
286 | */ |
0 | ||
1 | #ifndef PSR_LOG_H | |
2 | #define PSR_LOG_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_psr.h" | |
6 | ||
7 | #define PHP_PSR_LOG_VERSION "1.0.0" | |
8 | #define PHP_PSR_LOG_VERSION_ID 10000 | |
9 | ||
10 | extern PHP_PSR_API zend_class_entry * PsrLogInvalidArgumentException_ce_ptr; | |
11 | extern PHP_PSR_API zend_class_entry * PsrLogLogLevel_ce_ptr; | |
12 | extern PHP_PSR_API zend_class_entry * PsrLogLoggerInterface_ce_ptr; | |
13 | extern PHP_PSR_API zend_class_entry * PsrLogLoggerAwareInterface_ce_ptr; | |
14 | extern PHP_PSR_API zend_class_entry * PsrLogAbstractLogger_ce_ptr; | |
15 | extern PHP_PSR_API zend_class_entry * PsrLogNullLogger_ce_ptr; | |
16 | extern PHP_PSR_API zend_class_entry * PsrLogLoggerTrait_ce_ptr; | |
17 | extern PHP_PSR_API zend_class_entry * PsrLogLoggerAwareTrait_ce_ptr; | |
18 | ||
19 | extern PHP_MINIT_FUNCTION(psr_log); | |
20 | ||
21 | #if PHP_VERSION_ID < 80000 | |
22 | #define PHP_PSR_CONTEXT_PARAM ZEND_ARG_ARRAY_INFO(0, context, 0) | |
23 | #else | |
24 | #define PHP_PSR_CONTEXT_PARAM ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, context, IS_ARRAY, 0, "[]") | |
25 | #endif | |
26 | ||
27 | PHP_PSR_BEGIN_ARG_INFO(Log, LoggerInterface, emergency, 1) | |
28 | ZEND_ARG_INFO(0, message) | |
29 | PHP_PSR_CONTEXT_PARAM | |
30 | PHP_PSR_END_ARG_INFO() | |
31 | ||
32 | PHP_PSR_BEGIN_ARG_INFO(Log, LoggerInterface, alert, 1) | |
33 | ZEND_ARG_INFO(0, message) | |
34 | PHP_PSR_CONTEXT_PARAM | |
35 | PHP_PSR_END_ARG_INFO() | |
36 | ||
37 | PHP_PSR_BEGIN_ARG_INFO(Log, LoggerInterface, critical, 1) | |
38 | ZEND_ARG_INFO(0, message) | |
39 | PHP_PSR_CONTEXT_PARAM | |
40 | PHP_PSR_END_ARG_INFO() | |
41 | ||
42 | PHP_PSR_BEGIN_ARG_INFO(Log, LoggerInterface, error, 1) | |
43 | ZEND_ARG_INFO(0, message) | |
44 | PHP_PSR_CONTEXT_PARAM | |
45 | PHP_PSR_END_ARG_INFO() | |
46 | ||
47 | PHP_PSR_BEGIN_ARG_INFO(Log, LoggerInterface, warning, 1) | |
48 | ZEND_ARG_INFO(0, message) | |
49 | PHP_PSR_CONTEXT_PARAM | |
50 | PHP_PSR_END_ARG_INFO() | |
51 | ||
52 | PHP_PSR_BEGIN_ARG_INFO(Log, LoggerInterface, notice, 1) | |
53 | ZEND_ARG_INFO(0, message) | |
54 | PHP_PSR_CONTEXT_PARAM | |
55 | PHP_PSR_END_ARG_INFO() | |
56 | ||
57 | PHP_PSR_BEGIN_ARG_INFO(Log, LoggerInterface, info, 1) | |
58 | ZEND_ARG_INFO(0, message) | |
59 | PHP_PSR_CONTEXT_PARAM | |
60 | PHP_PSR_END_ARG_INFO() | |
61 | ||
62 | PHP_PSR_BEGIN_ARG_INFO(Log, LoggerInterface, debug, 1) | |
63 | ZEND_ARG_INFO(0, message) | |
64 | PHP_PSR_CONTEXT_PARAM | |
65 | PHP_PSR_END_ARG_INFO() | |
66 | ||
67 | PHP_PSR_BEGIN_ARG_INFO(Log, LoggerInterface, log, 2) | |
68 | ZEND_ARG_INFO(0, level) | |
69 | ZEND_ARG_INFO(0, message) | |
70 | PHP_PSR_CONTEXT_PARAM | |
71 | PHP_PSR_END_ARG_INFO() | |
72 | ||
73 | PHP_PSR_BEGIN_ARG_INFO(Log, LoggerAwareInterface, setLogger, 1) | |
74 | ZEND_ARG_OBJ_INFO(0, logger, Psr\\Log\\LoggerInterface, 0) | |
75 | PHP_PSR_END_ARG_INFO(); | |
76 | ||
77 | #endif /* PSR_LOG_H */ | |
78 | ||
79 | /* | |
80 | * Local variables: | |
81 | * tab-width: 4 | |
82 | * c-basic-offset: 4 | |
83 | * End: | |
84 | * vim600: fdm=marker | |
85 | * vim: et sw=4 ts=4 | |
86 | */ |
0 | ||
1 | #define PHP_PSR_ABSTRACT_ME(p, c, f) PHP_ABSTRACT_ME(p ## c, f, PHP_PSR_ARGINFO(p, c, f)) | |
2 | #define PHP_PSR_ABSTRACT_ME_WITH_FLAGS(p, c, f, fl) ZEND_FENTRY(f, NULL, PHP_PSR_ARGINFO(p, c, f), fl) | |
3 | ||
4 | static zend_always_inline zend_class_entry* php_psr_register_interface( | |
5 | const char* class_name, | |
6 | size_t class_name_len, | |
7 | const char* class_alias, | |
8 | size_t class_alias_len, | |
9 | zend_function_entry* methods | |
10 | ||
11 | ) { | |
12 | zend_class_entry ce; | |
13 | zend_class_entry *class_entry; | |
14 | INIT_CLASS_ENTRY_EX(ce, class_name, class_name_len, methods); | |
15 | class_entry = zend_register_internal_interface(&ce); | |
16 | zend_register_class_alias_ex(class_alias, class_alias_len, class_entry, 1); | |
17 | return class_entry; | |
18 | } | |
19 | ||
20 | #define PHP_PSR_REGISTER_INTERFACE_EX(class_name, methods, ce) do { \ | |
21 | ce = php_psr_register_interface( \ | |
22 | PHP_PSR_CLASS_NAMESPACE "\\" class_name, \ | |
23 | sizeof(PHP_PSR_CLASS_NAMESPACE "\\" class_name)-1, \ | |
24 | PHP_PSR_ALIAS_NAMESPACE "\\" class_name, \ | |
25 | sizeof(PHP_PSR_ALIAS_NAMESPACE "\\" class_name)-1, \ | |
26 | methods \ | |
27 | ); \ | |
28 | } while (0) | |
29 | ||
30 | #define PHP_PSR_REGISTER_INTERFACE(psr_name, class_name) do { \ | |
31 | PHP_PSR_REGISTER_INTERFACE_EX(#psr_name "\\" #class_name, Psr ## psr_name ## class_name ## _methods , Psr ## psr_name ## class_name ## _ce_ptr); \ | |
32 | } while(0) | |
33 | ||
34 | #define PHP_PSR_REGISTER_INTERFACE2(psr_name, ns_name, class_name) do { \ | |
35 | PHP_PSR_REGISTER_INTERFACE_EX(#psr_name "\\" #ns_name "\\" #class_name, Psr ## psr_name ## ns_name ## class_name ## _methods , Psr ## psr_name ## ns_name ## class_name ## _ce_ptr); \ | |
36 | } while(0) | |
37 | ||
38 | ||
39 | ||
40 | static zend_always_inline zend_class_entry* php_psr_register_class( | |
41 | const char* class_name, | |
42 | size_t class_name_len, | |
43 | const char* class_alias, | |
44 | size_t class_alias_len, | |
45 | zend_function_entry* methods, | |
46 | zend_class_entry* parent_ce | |
47 | ) { | |
48 | zend_class_entry ce; | |
49 | zend_class_entry *class_entry; | |
50 | INIT_CLASS_ENTRY_EX(ce, class_name, class_name_len, methods); | |
51 | class_entry = zend_register_internal_class_ex(&ce, parent_ce); | |
52 | zend_register_class_alias_ex(class_alias, class_alias_len, class_entry, 1); | |
53 | return class_entry; | |
54 | } | |
55 | ||
56 | #define PHP_PSR_REGISTER_CLASS_EX(class_name, methods, ce, parent_ce) do { \ | |
57 | ce = php_psr_register_class( \ | |
58 | PHP_PSR_CLASS_NAMESPACE "\\" class_name, \ | |
59 | sizeof(PHP_PSR_CLASS_NAMESPACE "\\" class_name)-1, \ | |
60 | PHP_PSR_ALIAS_NAMESPACE "\\" class_name, \ | |
61 | sizeof(PHP_PSR_ALIAS_NAMESPACE "\\" class_name)-1, \ | |
62 | methods, \ | |
63 | parent_ce \ | |
64 | ); \ | |
65 | } while (0) | |
66 | ||
67 | #define PHP_PSR_REGISTER_CLASS(psr_name, class_name, parent_ce) do { \ | |
68 | PHP_PSR_REGISTER_CLASS_EX(#psr_name "\\" #class_name, Psr ## psr_name ## class_name ## _methods , Psr ## psr_name ## class_name ## _ce_ptr, parent_ce); \ | |
69 | } while(0) |
0 | ||
1 | #ifdef HAVE_CONFIG_H | |
2 | #include "config.h" | |
3 | #endif | |
4 | ||
5 | #include "php.h" | |
6 | #include "php_ini.h" | |
7 | #include "ext/standard/info.h" | |
8 | #include "ext/spl/spl_exceptions.h" | |
9 | #include "zend_API.h" | |
10 | #include "zend_interfaces.h" | |
11 | ||
12 | #include "php_psr.h" | |
13 | #include "psr_simple_cache.h" | |
14 | #include "psr_private.h" | |
15 | ||
16 | /* {{{ CacheException ------------------------------------------------------- */ | |
17 | ||
18 | PHP_PSR_API zend_class_entry * PsrSimpleCacheCacheException_ce_ptr; | |
19 | #define PsrSimpleCacheCacheException_methods NULL | |
20 | ||
21 | static zend_always_inline void php_psr_register_PsrSimpleCacheCacheException(INIT_FUNC_ARGS) | |
22 | { | |
23 | PHP_PSR_REGISTER_INTERFACE(SimpleCache, CacheException); | |
24 | } | |
25 | ||
26 | /* }}} ---------------------------------------------------------------------- */ | |
27 | /* {{{ CacheInterface ------------------------------------------------------- */ | |
28 | ||
29 | PHP_PSR_API zend_class_entry * PsrSimpleCacheCacheInterface_ce_ptr; | |
30 | ||
31 | static zend_function_entry PsrSimpleCacheCacheInterface_methods[] = { | |
32 | PHP_PSR_ABSTRACT_ME(SimpleCache, CacheInterface, get) | |
33 | PHP_PSR_ABSTRACT_ME(SimpleCache, CacheInterface, set) | |
34 | PHP_PSR_ABSTRACT_ME(SimpleCache, CacheInterface, delete) | |
35 | PHP_PSR_ABSTRACT_ME(SimpleCache, CacheInterface, clear) | |
36 | PHP_PSR_ABSTRACT_ME(SimpleCache, CacheInterface, getMultiple) | |
37 | PHP_PSR_ABSTRACT_ME(SimpleCache, CacheInterface, setMultiple) | |
38 | PHP_PSR_ABSTRACT_ME(SimpleCache, CacheInterface, deleteMultiple) | |
39 | PHP_PSR_ABSTRACT_ME(SimpleCache, CacheInterface, has) | |
40 | PHP_FE_END | |
41 | }; | |
42 | ||
43 | static zend_always_inline void php_psr_register_PsrSimpleCacheCacheInterface(INIT_FUNC_ARGS) | |
44 | { | |
45 | PHP_PSR_REGISTER_INTERFACE(SimpleCache, CacheInterface); | |
46 | } | |
47 | ||
48 | /* }}} ---------------------------------------------------------------------- */ | |
49 | /* {{{ InvalidArgumentException --------------------------------------------- */ | |
50 | ||
51 | PHP_PSR_API zend_class_entry * PsrSimpleCacheInvalidArgumentException_ce_ptr; | |
52 | #define PsrSimpleCacheInvalidArgumentException_methods NULL | |
53 | ||
54 | static zend_always_inline void php_psr_register_PsrSimpleCacheInvalidArgumentException(INIT_FUNC_ARGS) | |
55 | { | |
56 | PHP_PSR_REGISTER_INTERFACE(SimpleCache, InvalidArgumentException); | |
57 | zend_class_implements(PsrSimpleCacheInvalidArgumentException_ce_ptr, 1, PsrSimpleCacheCacheException_ce_ptr); | |
58 | } | |
59 | ||
60 | /* }}} ---------------------------------------------------------------------- */ | |
61 | ||
62 | /* {{{ PHP_MINIT_FUNCTION */ | |
63 | PHP_MINIT_FUNCTION(psr_simple_cache) | |
64 | { | |
65 | php_psr_register_PsrSimpleCacheCacheException(INIT_FUNC_ARGS_PASSTHRU); | |
66 | php_psr_register_PsrSimpleCacheCacheInterface(INIT_FUNC_ARGS_PASSTHRU); | |
67 | php_psr_register_PsrSimpleCacheInvalidArgumentException(INIT_FUNC_ARGS_PASSTHRU); | |
68 | ||
69 | return SUCCESS; | |
70 | } | |
71 | /* }}} */ | |
72 | ||
73 | /* | |
74 | * Local variables: | |
75 | * tab-width: 4 | |
76 | * c-basic-offset: 4 | |
77 | * End: | |
78 | * vim600: fdm=marker | |
79 | * vim: et sw=4 ts=4 | |
80 | */ |
0 | ||
1 | #ifndef PSR_SIMPLE_CACHE_H | |
2 | #define PSR_SIMPLE_CACHE_H | |
3 | ||
4 | #include "php.h" | |
5 | #include "php_psr.h" | |
6 | ||
7 | #define PHP_PSR_SIMPLE_CACHE_VERSION "1.0.0" | |
8 | #define PHP_PSR_SIMPLE_CACHE_VERSION_ID 10000 | |
9 | ||
10 | extern PHP_PSR_API zend_class_entry * PsrSimpleCacheCacheException_ce_ptr; | |
11 | extern PHP_PSR_API zend_class_entry * PsrSimpleCacheCacheInterface_ce_ptr; | |
12 | extern PHP_PSR_API zend_class_entry * PsrSimpleCacheInvalidArgumentException_ce_ptr; | |
13 | ||
14 | extern PHP_MINIT_FUNCTION(psr_simple_cache); | |
15 | ||
16 | PHP_PSR_BEGIN_ARG_INFO(SimpleCache, CacheInterface, get, 1) | |
17 | ZEND_ARG_INFO(0, key) | |
18 | ZEND_ARG_INFO(0, default) | |
19 | PHP_PSR_END_ARG_INFO() | |
20 | ||
21 | PHP_PSR_BEGIN_ARG_INFO(SimpleCache, CacheInterface, set, 2) | |
22 | ZEND_ARG_INFO(0, key) | |
23 | ZEND_ARG_INFO(0, value) | |
24 | ZEND_ARG_INFO(0, ttl) | |
25 | PHP_PSR_END_ARG_INFO() | |
26 | ||
27 | PHP_PSR_BEGIN_ARG_INFO(SimpleCache, CacheInterface, delete, 1) | |
28 | ZEND_ARG_INFO(0, key) | |
29 | PHP_PSR_END_ARG_INFO() | |
30 | ||
31 | PHP_PSR_BEGIN_ARG_INFO(SimpleCache, CacheInterface, clear, 0) | |
32 | PHP_PSR_END_ARG_INFO() | |
33 | ||
34 | PHP_PSR_BEGIN_ARG_INFO(SimpleCache, CacheInterface, getMultiple, 1) | |
35 | ZEND_ARG_INFO(0, keys) | |
36 | ZEND_ARG_INFO(0, default) | |
37 | PHP_PSR_END_ARG_INFO() | |
38 | ||
39 | PHP_PSR_BEGIN_ARG_INFO(SimpleCache, CacheInterface, setMultiple, 1) | |
40 | ZEND_ARG_INFO(0, values) | |
41 | ZEND_ARG_INFO(0, ttl) | |
42 | PHP_PSR_END_ARG_INFO() | |
43 | ||
44 | PHP_PSR_BEGIN_ARG_INFO(SimpleCache, CacheInterface, deleteMultiple, 1) | |
45 | ZEND_ARG_INFO(0, keys) | |
46 | PHP_PSR_END_ARG_INFO() | |
47 | ||
48 | PHP_PSR_BEGIN_ARG_INFO(SimpleCache, CacheInterface, has, 1) | |
49 | ZEND_ARG_INFO(0, key) | |
50 | PHP_PSR_END_ARG_INFO() | |
51 | ||
52 | #endif /* PSR_CACHE_H */ | |
53 | ||
54 | /* | |
55 | * Local variables: | |
56 | * tab-width: 4 | |
57 | * c-basic-offset: 4 | |
58 | * End: | |
59 | * vim600: fdm=marker | |
60 | * vim: et sw=4 ts=4 | |
61 | */ |
0 | --TEST-- | |
1 | Psr\Cache\CacheException | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Cache\CacheException; | |
7 | class MyCacheException extends Exception implements CacheException {} | |
8 | $ex = new MyCacheException('test'); | |
9 | var_dump($ex instanceof CacheException); | |
10 | var_dump($ex instanceof Exception); | |
11 | try { | |
12 | throw $ex; | |
13 | } catch( CacheException $e ) { | |
14 | var_dump($e->getMessage()); | |
15 | } | |
16 | --EXPECT-- | |
17 | bool(true) | |
18 | bool(true) | |
19 | string(4) "test" |
0 | --TEST-- | |
1 | Psr\Cache\CacheItemInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleCacheItem.inc'; | |
7 | var_dump(interface_exists('\\Psr\\Cache\\CacheItemInterface', false)); | |
8 | var_dump(class_implements('SampleCacheItem', false)); | |
9 | $cacheItem = new SampleCacheItem(); | |
10 | $cacheItem->getKey(); | |
11 | $cacheItem->get(); | |
12 | $cacheItem->isHit(); | |
13 | $cacheItem->set('test set'); | |
14 | $cacheItem->expiresAt(1435364259); | |
15 | $cacheItem->expiresAfter(1435364259); | |
16 | --EXPECT-- | |
17 | bool(true) | |
18 | array(1) { | |
19 | ["PsrExt\Cache\CacheItemInterface"]=> | |
20 | string(31) "PsrExt\Cache\CacheItemInterface" | |
21 | } | |
22 | string(23) "SampleCacheItem::getKey" | |
23 | string(20) "SampleCacheItem::get" | |
24 | string(22) "SampleCacheItem::isHit" | |
25 | string(20) "SampleCacheItem::set" | |
26 | string(8) "test set" | |
27 | string(26) "SampleCacheItem::expiresAt" | |
28 | int(1435364259) | |
29 | string(29) "SampleCacheItem::expiresAfter" | |
30 | int(1435364259) | |
31 |
0 | --TEST-- | |
1 | Psr\Cache\CacheItemPoolInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleCacheItem.inc'; | |
7 | include __DIR__ . '/SampleCacheItemPool.inc'; | |
8 | var_dump(interface_exists('\\Psr\\Cache\\CacheItemPoolInterface', false)); | |
9 | var_dump(class_implements('SampleCacheItemPool', false)); | |
10 | $cacheItem = new SampleCacheItemPool(); | |
11 | $cacheItem->getItem('key'); | |
12 | $cacheItem->getItems(); | |
13 | $cacheItem->getItems(array('keyA', 'keyB')); | |
14 | $cacheItem->hasItem('key'); | |
15 | $cacheItem->clear(); | |
16 | $cacheItem->deleteItem('keyC'); | |
17 | $cacheItem->deleteItems(array('keyC')); | |
18 | $cacheItem->save(new SampleCacheItem()); | |
19 | $cacheItem->saveDeferred(new SampleCacheItem()); | |
20 | $cacheItem->commit(); | |
21 | --EXPECTF-- | |
22 | bool(true) | |
23 | array(1) { | |
24 | ["PsrExt\Cache\CacheItemPoolInterface"]=> | |
25 | string(35) "PsrExt\Cache\CacheItemPoolInterface" | |
26 | } | |
27 | string(28) "SampleCacheItemPool::getItem" | |
28 | string(3) "key" | |
29 | string(29) "SampleCacheItemPool::getItems" | |
30 | array(0) { | |
31 | } | |
32 | string(29) "SampleCacheItemPool::getItems" | |
33 | array(2) { | |
34 | [0]=> | |
35 | string(4) "keyA" | |
36 | [1]=> | |
37 | string(4) "keyB" | |
38 | } | |
39 | string(28) "SampleCacheItemPool::hasItem" | |
40 | string(3) "key" | |
41 | string(26) "SampleCacheItemPool::clear" | |
42 | string(31) "SampleCacheItemPool::deleteItem" | |
43 | string(4) "keyC" | |
44 | string(32) "SampleCacheItemPool::deleteItems" | |
45 | array(1) { | |
46 | [0]=> | |
47 | string(4) "keyC" | |
48 | } | |
49 | string(25) "SampleCacheItemPool::save" | |
50 | object(SampleCacheItem)#%d (0) { | |
51 | } | |
52 | string(33) "SampleCacheItemPool::saveDeferred" | |
53 | object(SampleCacheItem)#%d (0) { | |
54 | } | |
55 | string(27) "SampleCacheItemPool::commit" |
0 | --TEST-- | |
1 | Psr\Cache\InvalidArgumentException | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Cache\CacheException; | |
7 | use Psr\Cache\InvalidArgumentException; | |
8 | class MyInvalidArgumentException extends Exception implements InvalidArgumentException {} | |
9 | $ex = new MyInvalidArgumentException('test'); | |
10 | var_dump($ex instanceof InvalidArgumentException); | |
11 | var_dump($ex instanceof Exception); | |
12 | var_dump($ex instanceof CacheException); | |
13 | try { | |
14 | throw $ex; | |
15 | } catch( InvalidArgumentException $e ) { | |
16 | var_dump($e->getMessage()); | |
17 | } | |
18 | --EXPECT-- | |
19 | bool(true) | |
20 | bool(true) | |
21 | bool(true) | |
22 | string(4) "test" |
0 | --TEST-- | |
1 | Psr\Container\ContainerExceptionInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Container\ContainerExceptionInterface; | |
7 | class MyException extends Exception implements ContainerExceptionInterface {} | |
8 | $ex = new MyException('test'); | |
9 | var_dump($ex instanceof ContainerExceptionInterface); | |
10 | var_dump($ex instanceof Exception); | |
11 | try { | |
12 | throw $ex; | |
13 | } catch( ContainerExceptionInterface $e ) { | |
14 | var_dump($e->getMessage()); | |
15 | } | |
16 | --EXPECT-- | |
17 | bool(true) | |
18 | bool(true) | |
19 | string(4) "test" |
0 | --TEST-- | |
1 | Psr\Container\ContainerInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Container\ContainerInterface; | |
7 | class MyImpl implements ContainerInterface { | |
8 | public function get(string $id) {} | |
9 | public function has(string $id) {} | |
10 | } | |
11 | $ex = new MyImpl(); | |
12 | var_dump($ex instanceof ContainerInterface); | |
13 | --EXPECT-- | |
14 | bool(true) |
0 | --TEST-- | |
1 | Psr\Container\NotFoundExceptionInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Container\ContainerExceptionInterface; | |
7 | use Psr\Container\NotFoundExceptionInterface; | |
8 | class MyException extends Exception implements NotFoundExceptionInterface {} | |
9 | $ex = new MyException('test'); | |
10 | var_dump($ex instanceof ContainerExceptionInterface); | |
11 | var_dump($ex instanceof NotFoundExceptionInterface); | |
12 | var_dump($ex instanceof Exception); | |
13 | try { | |
14 | throw $ex; | |
15 | } catch( NotFoundExceptionInterface $e ) { | |
16 | var_dump($e->getMessage()); | |
17 | } | |
18 | --EXPECT-- | |
19 | bool(true) | |
20 | bool(true) | |
21 | bool(true) | |
22 | string(4) "test" |
0 | --TEST-- | |
1 | Psr\EventDispatcher\EventDispatcherInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip_lt_php72.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleEventDispatcher.inc'; | |
7 | var_dump(interface_exists('\\Psr\\EventDispatcher\\EventDispatcherInterface', false)); | |
8 | var_dump(class_implements('SampleEventDispatcher', false)); | |
9 | $dispatcher = new SampleEventDispatcher(); | |
10 | var_dump($dispatcher instanceof SampleEventDispatcher); | |
11 | $event = new stdClass(); | |
12 | $return = $dispatcher->dispatch($event); | |
13 | var_dump(is_object($return)); | |
14 | --EXPECT-- | |
15 | bool(true) | |
16 | array(1) { | |
17 | ["PsrExt\EventDispatcher\EventDispatcherInterface"]=> | |
18 | string(47) "PsrExt\EventDispatcher\EventDispatcherInterface" | |
19 | } | |
20 | bool(true) | |
21 | string(31) "SampleEventDispatcher::dispatch" | |
22 | bool(true) | |
23 | bool(true) |
0 | --TEST-- | |
1 | Psr\EventDispatcher\ListenerProviderInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip_lt_php72.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleListenerProvider.inc'; | |
7 | var_dump(interface_exists('\\Psr\\EventDispatcher\\ListenerProviderInterface', false)); | |
8 | var_dump(class_implements('SampleListenerProvider', false)); | |
9 | $provider = new SampleListenerProvider(); | |
10 | var_dump($provider instanceof SampleListenerProvider); | |
11 | $event = new stdClass(); | |
12 | $return = $provider->getListenersForEvent($event); | |
13 | var_dump(is_iterable($return)); | |
14 | --EXPECT-- | |
15 | bool(true) | |
16 | array(1) { | |
17 | ["PsrExt\EventDispatcher\ListenerProviderInterface"]=> | |
18 | string(48) "PsrExt\EventDispatcher\ListenerProviderInterface" | |
19 | } | |
20 | bool(true) | |
21 | string(44) "SampleListenerProvider::getListenersForEvent" | |
22 | bool(true) | |
23 | bool(true) |
0 | --TEST-- | |
1 | Psr\EventDispatcher\StoppableEventInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip_lt_php72.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleStoppableEvent.inc'; | |
7 | var_dump(interface_exists('\\Psr\\EventDispatcher\\StoppableEventInterface', false)); | |
8 | var_dump(class_implements('SampleStoppableEvent', false)); | |
9 | $event = new SampleStoppableEvent(); | |
10 | var_dump($event instanceof SampleStoppableEvent); | |
11 | $return = $event->isPropagationStopped(); | |
12 | var_dump(is_bool($return)); | |
13 | --EXPECT-- | |
14 | bool(true) | |
15 | array(1) { | |
16 | ["PsrExt\EventDispatcher\StoppableEventInterface"]=> | |
17 | string(46) "PsrExt\EventDispatcher\StoppableEventInterface" | |
18 | } | |
19 | bool(true) | |
20 | string(42) "SampleStoppableEvent::isPropagationStopped" | |
21 | bool(true) |
0 | --TEST-- | |
1 | Psr\Http\Client\ClientExceptionInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Http\Client\ClientExceptionInterface; | |
7 | var_dump(is_subclass_of(ClientExceptionInterface::class, Throwable::class)); | |
8 | class MyException extends Exception implements ClientExceptionInterface {} | |
9 | $ex = new MyException('test'); | |
10 | var_dump($ex instanceof ClientExceptionInterface); | |
11 | var_dump($ex instanceof Exception); | |
12 | var_dump($ex instanceof Throwable); | |
13 | try { | |
14 | throw $ex; | |
15 | } catch( ClientExceptionInterface $e ) { | |
16 | var_dump($e->getMessage()); | |
17 | } | |
18 | --EXPECT-- | |
19 | bool(true) | |
20 | bool(true) | |
21 | bool(true) | |
22 | bool(true) | |
23 | string(4) "test" |
0 | --TEST-- | |
1 | Psr\Http\Client\ClientInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleRequest.inc'; | |
8 | include __DIR__ . '/SampleResponse.inc'; | |
9 | include __DIR__ . '/SampleClient.inc'; | |
10 | var_dump(interface_exists('\\Psr\\Http\\Client\\ClientInterface', false)); | |
11 | var_dump(class_implements('SampleClient', false)); | |
12 | $client = new SampleClient(); | |
13 | $request = new SampleRequest(); | |
14 | $response = $client->sendRequest($request); | |
15 | var_dump($response instanceof \Psr\Http\Message\ResponseInterface); | |
16 | --EXPECTF-- | |
17 | bool(true) | |
18 | array(1) { | |
19 | ["PsrExt\Http\Client\ClientInterface"]=> | |
20 | string(34) "PsrExt\Http\Client\ClientInterface" | |
21 | } | |
22 | string(25) "SampleClient::sendRequest" | |
23 | object(SampleRequest)#%d (0) { | |
24 | } | |
25 | bool(true) |
0 | --TEST-- | |
1 | Psr\Http\Client\NetworkExceptionInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Http\Message\RequestInterface; | |
7 | use Psr\Http\Client\NetworkExceptionInterface; | |
8 | include __DIR__ . '/SampleMessage.inc'; | |
9 | include __DIR__ . '/SampleRequest.inc'; | |
10 | var_dump(is_subclass_of(NetworkExceptionInterface::class, Psr\Http\Client\ClientExceptionInterface::class)); | |
11 | var_dump(is_subclass_of(NetworkExceptionInterface::class, Throwable::class)); | |
12 | class MyException extends Exception implements NetworkExceptionInterface { | |
13 | public function getRequest(): RequestInterface { | |
14 | var_dump(__METHOD__); | |
15 | return new SampleRequest(); | |
16 | } | |
17 | } | |
18 | $ex = new MyException('test'); | |
19 | var_dump($ex instanceof NetworkExceptionInterface); | |
20 | var_dump($ex instanceof Psr\Http\Client\ClientExceptionInterface); | |
21 | var_dump($ex instanceof Exception); | |
22 | var_dump($ex instanceof Throwable); | |
23 | try { | |
24 | throw $ex; | |
25 | } catch( NetworkExceptionInterface $e ) { | |
26 | var_dump($e->getMessage()); | |
27 | var_dump($e->getRequest()); | |
28 | } | |
29 | --EXPECTF-- | |
30 | bool(true) | |
31 | bool(true) | |
32 | bool(true) | |
33 | bool(true) | |
34 | bool(true) | |
35 | bool(true) | |
36 | string(4) "test" | |
37 | string(23) "MyException::getRequest" | |
38 | object(SampleRequest)#%d (0) { | |
39 | } |
0 | --TEST-- | |
1 | Psr\Http\Client\RequestExceptionInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Http\Message\RequestInterface; | |
7 | use Psr\Http\Client\RequestExceptionInterface; | |
8 | include __DIR__ . '/SampleMessage.inc'; | |
9 | include __DIR__ . '/SampleRequest.inc'; | |
10 | var_dump(is_subclass_of(RequestExceptionInterface::class, Psr\Http\Client\ClientExceptionInterface::class)); | |
11 | var_dump(is_subclass_of(RequestExceptionInterface::class, Throwable::class)); | |
12 | class MyException extends Exception implements RequestExceptionInterface { | |
13 | public function getRequest(): RequestInterface { | |
14 | var_dump(__METHOD__); | |
15 | return new SampleRequest(); | |
16 | } | |
17 | } | |
18 | $ex = new MyException('test'); | |
19 | var_dump($ex instanceof RequestExceptionInterface); | |
20 | var_dump($ex instanceof Psr\Http\Client\ClientExceptionInterface); | |
21 | var_dump($ex instanceof Exception); | |
22 | var_dump($ex instanceof Throwable); | |
23 | try { | |
24 | throw $ex; | |
25 | } catch( RequestExceptionInterface $e ) { | |
26 | var_dump($e->getMessage()); | |
27 | var_dump($e->getRequest()); | |
28 | } | |
29 | --EXPECTF-- | |
30 | bool(true) | |
31 | bool(true) | |
32 | bool(true) | |
33 | bool(true) | |
34 | bool(true) | |
35 | bool(true) | |
36 | string(4) "test" | |
37 | string(23) "MyException::getRequest" | |
38 | object(SampleRequest)#%d (0) { | |
39 | } |
0 | --TEST-- | |
1 | Psr\Http\Message\MessageInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleStream.inc'; | |
8 | var_dump(interface_exists('\\Psr\\Http\\Message\\MessageInterface', false)); | |
9 | var_dump(class_implements('SampleMessage', false)); | |
10 | $message = new SampleMessage(); | |
11 | $message->getProtocolVersion(); | |
12 | $message->withProtocolVersion('1.0'); | |
13 | $message->getHeaders(); | |
14 | $message->hasHeader('content-type'); | |
15 | $message->getHeader('content-type'); | |
16 | $message->getHeaderLine('content-type'); | |
17 | $message->withHeader('content-type', 'text/plain'); | |
18 | $message->withAddedHeader('content-type', 'text/html'); | |
19 | $message->withoutHeader('content-type'); | |
20 | $message->getBody(); | |
21 | $message->withBody(new SampleStream()); | |
22 | --EXPECTF-- | |
23 | bool(true) | |
24 | array(1) { | |
25 | ["PsrExt\Http\Message\MessageInterface"]=> | |
26 | string(36) "PsrExt\Http\Message\MessageInterface" | |
27 | } | |
28 | string(33) "SampleMessage::getProtocolVersion" | |
29 | string(34) "SampleMessage::withProtocolVersion" | |
30 | string(3) "1.0" | |
31 | string(25) "SampleMessage::getHeaders" | |
32 | string(24) "SampleMessage::hasHeader" | |
33 | string(12) "content-type" | |
34 | string(24) "SampleMessage::getHeader" | |
35 | string(12) "content-type" | |
36 | string(28) "SampleMessage::getHeaderLine" | |
37 | string(12) "content-type" | |
38 | string(25) "SampleMessage::withHeader" | |
39 | string(12) "content-type" | |
40 | string(10) "text/plain" | |
41 | string(30) "SampleMessage::withAddedHeader" | |
42 | string(12) "content-type" | |
43 | string(9) "text/html" | |
44 | string(28) "SampleMessage::withoutHeader" | |
45 | string(12) "content-type" | |
46 | string(22) "SampleMessage::getBody" | |
47 | string(23) "SampleMessage::withBody" | |
48 | object(SampleStream)#%d (0) { | |
49 | } |
0 | --TEST-- | |
1 | Psr\Http\Message\RequestFactoryInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleRequest.inc'; | |
8 | include __DIR__ . '/SampleUri.inc'; | |
9 | include __DIR__ . '/SampleRequestFactory.inc'; | |
10 | var_dump(interface_exists('\\Psr\\Http\\Message\\RequestFactoryInterface', false)); | |
11 | var_dump(class_implements('SampleRequestFactory', false)); | |
12 | $factory = new SampleRequestFactory(); | |
13 | $request = $factory->createRequest('GET', 'http://domain.com'); | |
14 | var_dump($request instanceof \Psr\Http\Message\RequestInterface); | |
15 | $factory->createRequest('POST', new SampleUri()); | |
16 | --EXPECTF-- | |
17 | bool(true) | |
18 | array(1) { | |
19 | ["PsrExt\Http\Message\RequestFactoryInterface"]=> | |
20 | string(43) "PsrExt\Http\Message\RequestFactoryInterface" | |
21 | } | |
22 | string(35) "SampleRequestFactory::createRequest" | |
23 | string(3) "GET" | |
24 | string(17) "http://domain.com" | |
25 | bool(true) | |
26 | string(35) "SampleRequestFactory::createRequest" | |
27 | string(4) "POST" | |
28 | object(SampleUri)#%d (0) { | |
29 | } |
0 | --TEST-- | |
1 | Psr\Http\Message\RequestInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleRequest.inc'; | |
8 | include __DIR__ . '/SampleUri.inc'; | |
9 | var_dump(interface_exists('\\Psr\\Http\\Message\\RequestInterface', false)); | |
10 | var_dump(is_subclass_of('\\Psr\\Http\\Message\\RequestInterface', '\\Psr\\Http\\Message\\MessageInterface')); | |
11 | var_dump(class_implements('SampleRequest', false)); | |
12 | $request = new SampleRequest(); | |
13 | var_dump($request instanceof \Psr\Http\Message\MessageInterface); | |
14 | $request->getRequestTarget(); | |
15 | $request->withRequestTarget('test'); | |
16 | $request->getMethod(); | |
17 | $request->withMethod('PUT'); | |
18 | $request->getUri(); | |
19 | $request->withUri(new SampleUri()); | |
20 | $request->withUri(new SampleUri(), true); | |
21 | --EXPECTF-- | |
22 | bool(true) | |
23 | bool(true) | |
24 | array(2) { | |
25 | ["PsrExt\Http\Message\MessageInterface"]=> | |
26 | string(36) "PsrExt\Http\Message\MessageInterface" | |
27 | ["PsrExt\Http\Message\RequestInterface"]=> | |
28 | string(36) "PsrExt\Http\Message\RequestInterface" | |
29 | } | |
30 | bool(true) | |
31 | string(31) "SampleRequest::getRequestTarget" | |
32 | string(32) "SampleRequest::withRequestTarget" | |
33 | string(4) "test" | |
34 | string(24) "SampleRequest::getMethod" | |
35 | string(25) "SampleRequest::withMethod" | |
36 | string(3) "PUT" | |
37 | string(21) "SampleRequest::getUri" | |
38 | string(22) "SampleRequest::withUri" | |
39 | object(SampleUri)#%d (0) { | |
40 | } | |
41 | bool(false) | |
42 | string(22) "SampleRequest::withUri" | |
43 | object(SampleUri)#%d (0) { | |
44 | } | |
45 | bool(true) |
0 | --TEST-- | |
1 | Psr\Http\Message\ResponseFactoryInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleResponse.inc'; | |
8 | include __DIR__ . '/SampleResponseFactory.inc'; | |
9 | var_dump(interface_exists('\\Psr\\Http\\Message\\ResponseFactoryInterface', false)); | |
10 | var_dump(class_implements('SampleResponseFactory', false)); | |
11 | $factory = new SampleResponseFactory(); | |
12 | $response = $factory->createResponse(); | |
13 | var_dump($response instanceof \Psr\Http\Message\ResponseInterface); | |
14 | $factory->createResponse(400, 'BAD REQUEST'); | |
15 | --EXPECT-- | |
16 | bool(true) | |
17 | array(1) { | |
18 | ["PsrExt\Http\Message\ResponseFactoryInterface"]=> | |
19 | string(44) "PsrExt\Http\Message\ResponseFactoryInterface" | |
20 | } | |
21 | string(37) "SampleResponseFactory::createResponse" | |
22 | int(200) | |
23 | string(0) "" | |
24 | bool(true) | |
25 | string(37) "SampleResponseFactory::createResponse" | |
26 | int(400) | |
27 | string(11) "BAD REQUEST" |
0 | --TEST-- | |
1 | Psr\Http\Message\ResponseInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleResponse.inc'; | |
8 | var_dump(interface_exists('\\Psr\\Http\\Message\\ResponseInterface', false)); | |
9 | var_dump(is_subclass_of('\\Psr\\Http\\Message\\ResponseInterface', '\\Psr\\Http\\Message\\MessageInterface')); | |
10 | var_dump(class_implements('SampleResponse', false)); | |
11 | $request = new SampleResponse(); | |
12 | var_dump($request instanceof \Psr\Http\Message\MessageInterface); | |
13 | $request->getStatusCode(); | |
14 | $request->withStatus(400, 'BAD REQUEST'); | |
15 | $request->getReasonPhrase(); | |
16 | --EXPECT-- | |
17 | bool(true) | |
18 | bool(true) | |
19 | array(2) { | |
20 | ["PsrExt\Http\Message\MessageInterface"]=> | |
21 | string(36) "PsrExt\Http\Message\MessageInterface" | |
22 | ["PsrExt\Http\Message\ResponseInterface"]=> | |
23 | string(37) "PsrExt\Http\Message\ResponseInterface" | |
24 | } | |
25 | bool(true) | |
26 | string(29) "SampleResponse::getStatusCode" | |
27 | string(26) "SampleResponse::withStatus" | |
28 | int(400) | |
29 | string(11) "BAD REQUEST" | |
30 | string(31) "SampleResponse::getReasonPhrase" |
0 | --TEST-- | |
1 | Psr\Http\Message\ServerRequestFactoryInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleUri.inc'; | |
8 | include __DIR__ . '/SampleRequest.inc'; | |
9 | include __DIR__ . '/SampleServerRequest.inc'; | |
10 | include __DIR__ . '/SampleServerRequestFactory.inc'; | |
11 | var_dump(interface_exists('\\Psr\\Http\\Message\\ServerRequestFactoryInterface', false)); | |
12 | var_dump(class_implements('SampleServerRequestFactory', false)); | |
13 | $factory = new SampleServerRequestFactory(); | |
14 | $request = $factory->createServerRequest('GET', 'http://domain.com'); | |
15 | var_dump($request instanceof \Psr\Http\Message\ServerRequestInterface); | |
16 | $request = $factory->createServerRequest('POST', new SampleUri(), ['param' => 'value']); | |
17 | --EXPECTF-- | |
18 | bool(true) | |
19 | array(1) { | |
20 | ["PsrExt\Http\Message\ServerRequestFactoryInterface"]=> | |
21 | string(49) "PsrExt\Http\Message\ServerRequestFactoryInterface" | |
22 | } | |
23 | string(47) "SampleServerRequestFactory::createServerRequest" | |
24 | string(3) "GET" | |
25 | string(17) "http://domain.com" | |
26 | array(0) { | |
27 | } | |
28 | bool(true) | |
29 | string(47) "SampleServerRequestFactory::createServerRequest" | |
30 | string(4) "POST" | |
31 | object(SampleUri)#%d (0) { | |
32 | } | |
33 | array(1) { | |
34 | ["param"]=> | |
35 | string(5) "value" | |
36 | } |
0 | --TEST-- | |
1 | Psr\Http\Message\ServerRequestInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleRequest.inc'; | |
8 | include __DIR__ . '/SampleServerRequest.inc'; | |
9 | var_dump(interface_exists('\\Psr\\Http\\Message\\ServerRequestInterface', false)); | |
10 | var_dump(is_subclass_of('\\Psr\\Http\\Message\\ServerRequestInterface', '\\Psr\\Http\\Message\\MessageInterface')); | |
11 | var_dump(is_subclass_of('\\Psr\\Http\\Message\\ServerRequestInterface', '\\Psr\\Http\\Message\\RequestInterface')); | |
12 | $ifaces = class_implements('SampleServerRequest', false); | |
13 | ksort($ifaces); | |
14 | var_dump($ifaces); | |
15 | $request = new SampleServerRequest(); | |
16 | var_dump($request instanceof \Psr\Http\Message\MessageInterface); | |
17 | var_dump($request instanceof \Psr\Http\Message\RequestInterface); | |
18 | $request->getServerParams(); | |
19 | $request->getCookieParams(); | |
20 | $request->withCookieParams(array('a' => 'b')); | |
21 | $request->getQueryParams(); | |
22 | $request->withQueryParams(array('c' => 'd')); | |
23 | $request->getUploadedFiles(); | |
24 | $request->withUploadedFiles(array()); | |
25 | $request->getParsedBody(); | |
26 | $request->withParsedBody('body'); | |
27 | $request->getAttributes(); | |
28 | $request->getAttribute('attr'); | |
29 | $request->getAttribute('attr', 'bar'); | |
30 | $request->withAttribute('foo', 'baz'); | |
31 | $request->withoutAttribute('bar'); | |
32 | --EXPECT-- | |
33 | bool(true) | |
34 | bool(true) | |
35 | bool(true) | |
36 | array(3) { | |
37 | ["PsrExt\Http\Message\MessageInterface"]=> | |
38 | string(36) "PsrExt\Http\Message\MessageInterface" | |
39 | ["PsrExt\Http\Message\RequestInterface"]=> | |
40 | string(36) "PsrExt\Http\Message\RequestInterface" | |
41 | ["PsrExt\Http\Message\ServerRequestInterface"]=> | |
42 | string(42) "PsrExt\Http\Message\ServerRequestInterface" | |
43 | } | |
44 | bool(true) | |
45 | bool(true) | |
46 | string(36) "SampleServerRequest::getServerParams" | |
47 | string(36) "SampleServerRequest::getCookieParams" | |
48 | string(37) "SampleServerRequest::withCookieParams" | |
49 | array(1) { | |
50 | ["a"]=> | |
51 | string(1) "b" | |
52 | } | |
53 | string(35) "SampleServerRequest::getQueryParams" | |
54 | string(36) "SampleServerRequest::withQueryParams" | |
55 | array(1) { | |
56 | ["c"]=> | |
57 | string(1) "d" | |
58 | } | |
59 | string(37) "SampleServerRequest::getUploadedFiles" | |
60 | string(38) "SampleServerRequest::withUploadedFiles" | |
61 | array(0) { | |
62 | } | |
63 | string(34) "SampleServerRequest::getParsedBody" | |
64 | string(35) "SampleServerRequest::withParsedBody" | |
65 | string(4) "body" | |
66 | string(34) "SampleServerRequest::getAttributes" | |
67 | string(33) "SampleServerRequest::getAttribute" | |
68 | string(4) "attr" | |
69 | NULL | |
70 | string(33) "SampleServerRequest::getAttribute" | |
71 | string(4) "attr" | |
72 | string(3) "bar" | |
73 | string(34) "SampleServerRequest::withAttribute" | |
74 | string(3) "foo" | |
75 | string(3) "baz" | |
76 | string(37) "SampleServerRequest::withoutAttribute" | |
77 | string(3) "bar" |
0 | --TEST-- | |
1 | Psr\Http\Message\StreamFactoryInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleStream.inc'; | |
7 | include __DIR__ . '/SampleStreamFactory.inc'; | |
8 | var_dump(interface_exists('\\Psr\\Http\\Message\\StreamFactoryInterface', false)); | |
9 | var_dump(class_implements('SampleStreamFactory', false)); | |
10 | $factory = new SampleStreamFactory(); | |
11 | $stream = $factory->createStream(); | |
12 | var_dump($stream instanceof \Psr\Http\Message\StreamInterface); | |
13 | $factory->createStream('content'); | |
14 | $stream = $factory->createStreamFromFile('/tmp/file1'); | |
15 | var_dump($stream instanceof \Psr\Http\Message\StreamInterface); | |
16 | $factory->createStreamFromFile('/tmp/file2', 'wb'); | |
17 | $stream = $factory->createStreamFromResource(fopen('php://memory', 'r')); | |
18 | var_dump($stream instanceof \Psr\Http\Message\StreamInterface); | |
19 | --EXPECTF-- | |
20 | bool(true) | |
21 | array(1) { | |
22 | ["PsrExt\Http\Message\StreamFactoryInterface"]=> | |
23 | string(42) "PsrExt\Http\Message\StreamFactoryInterface" | |
24 | } | |
25 | string(33) "SampleStreamFactory::createStream" | |
26 | string(0) "" | |
27 | bool(true) | |
28 | string(33) "SampleStreamFactory::createStream" | |
29 | string(7) "content" | |
30 | string(41) "SampleStreamFactory::createStreamFromFile" | |
31 | string(10) "/tmp/file1" | |
32 | string(1) "r" | |
33 | bool(true) | |
34 | string(41) "SampleStreamFactory::createStreamFromFile" | |
35 | string(10) "/tmp/file2" | |
36 | string(2) "wb" | |
37 | string(45) "SampleStreamFactory::createStreamFromResource" | |
38 | resource(%d) of type (stream) | |
39 | bool(true) |
0 | --TEST-- | |
1 | Psr\Http\Message\StreamInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Http\Message\StreamInterface; | |
7 | include __DIR__ . '/SampleStream.inc'; | |
8 | var_dump(interface_exists(StreamInterface::class, false)); | |
9 | var_dump(is_subclass_of(SampleStream::class, StreamInterface::class)); | |
10 | $stream = new SampleStream(); | |
11 | $stream->__toString(); | |
12 | $stream->close(); | |
13 | $stream->detach(); | |
14 | $stream->getSize(); | |
15 | $stream->tell(); | |
16 | $stream->eof(); | |
17 | $stream->isSeekable(); | |
18 | $stream->seek(0); | |
19 | $stream->rewind(); | |
20 | $stream->isWritable(); | |
21 | $stream->write('foo'); | |
22 | $stream->isReadable(); | |
23 | $stream->read(123); | |
24 | $stream->getContents(); | |
25 | $stream->getMetadata(); | |
26 | --EXPECTF-- | |
27 | bool(true) | |
28 | bool(true) | |
29 | string(24) "SampleStream::__toString" | |
30 | string(19) "SampleStream::close" | |
31 | string(20) "SampleStream::detach" | |
32 | string(21) "SampleStream::getSize" | |
33 | string(18) "SampleStream::tell" | |
34 | string(17) "SampleStream::eof" | |
35 | string(24) "SampleStream::isSeekable" | |
36 | string(18) "SampleStream::seek" | |
37 | int(0) | |
38 | int(0) | |
39 | string(20) "SampleStream::rewind" | |
40 | string(24) "SampleStream::isWritable" | |
41 | string(19) "SampleStream::write" | |
42 | string(3) "foo" | |
43 | string(24) "SampleStream::isReadable" | |
44 | string(18) "SampleStream::read" | |
45 | int(123) | |
46 | string(25) "SampleStream::getContents" | |
47 | string(25) "SampleStream::getMetadata" | |
48 | NULL |
0 | --TEST-- | |
1 | Psr\Http\Message\UploadedFileFactoryInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleStream.inc'; | |
7 | include __DIR__ . '/SampleUploadedFile.inc'; | |
8 | include __DIR__ . '/SampleUploadedFileFactory.inc'; | |
9 | var_dump(interface_exists('\\Psr\\Http\\Message\\UploadedFileFactoryInterface', false)); | |
10 | var_dump(class_implements('SampleUploadedFileFactory', false)); | |
11 | $stream = new SampleStream(); | |
12 | $factory = new SampleUploadedFileFactory(); | |
13 | $uploadedFile = $factory->createUploadedFile($stream); | |
14 | var_dump($uploadedFile instanceof \Psr\Http\Message\UploadedFileInterface); | |
15 | $factory->createUploadedFile($stream, 100, UPLOAD_ERR_NO_FILE, 'image.png', 'image/png'); | |
16 | --EXPECTF-- | |
17 | bool(true) | |
18 | array(1) { | |
19 | ["PsrExt\Http\Message\UploadedFileFactoryInterface"]=> | |
20 | string(48) "PsrExt\Http\Message\UploadedFileFactoryInterface" | |
21 | } | |
22 | string(45) "SampleUploadedFileFactory::createUploadedFile" | |
23 | object(SampleStream)#%d (0) { | |
24 | } | |
25 | NULL | |
26 | int(0) | |
27 | NULL | |
28 | NULL | |
29 | bool(true) | |
30 | string(45) "SampleUploadedFileFactory::createUploadedFile" | |
31 | object(SampleStream)#%d (0) { | |
32 | } | |
33 | int(100) | |
34 | int(4) | |
35 | string(9) "image.png" | |
36 | string(9) "image/png" |
0 | --TEST-- | |
1 | Psr\Http\Message\UploadedFileInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleUploadedFile.inc'; | |
7 | var_dump(interface_exists('\\Psr\\Http\\Message\\UploadedFileInterface', false)); | |
8 | var_dump(class_implements('SampleUploadedFile', false)); | |
9 | $uploadedFile = new SampleUploadedFile(); | |
10 | $uploadedFile->getStream(); | |
11 | $uploadedFile->moveTo('/dev/null'); | |
12 | $uploadedFile->getSize(); | |
13 | $uploadedFile->getError(); | |
14 | $uploadedFile->getClientFilename(); | |
15 | $uploadedFile->getClientMediaType(); | |
16 | --EXPECT-- | |
17 | bool(true) | |
18 | array(1) { | |
19 | ["PsrExt\Http\Message\UploadedFileInterface"]=> | |
20 | string(41) "PsrExt\Http\Message\UploadedFileInterface" | |
21 | } | |
22 | string(29) "SampleUploadedFile::getStream" | |
23 | string(26) "SampleUploadedFile::moveTo" | |
24 | string(9) "/dev/null" | |
25 | string(27) "SampleUploadedFile::getSize" | |
26 | string(28) "SampleUploadedFile::getError" | |
27 | string(37) "SampleUploadedFile::getClientFilename" | |
28 | string(38) "SampleUploadedFile::getClientMediaType" | |
29 |
0 | --TEST-- | |
1 | Psr\Http\Message\UriFactoryInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleUri.inc'; | |
7 | include __DIR__ . '/SampleUriFactory.inc'; | |
8 | var_dump(interface_exists('\\Psr\\Http\\Message\\UriFactoryInterface', false)); | |
9 | var_dump(class_implements('SampleUriFactory', false)); | |
10 | $factory = new SampleUriFactory(); | |
11 | $uri = $factory->createUri(); | |
12 | var_dump($uri instanceof \Psr\Http\Message\UriInterface); | |
13 | $factory->createUri('http://domain.com'); | |
14 | --EXPECT-- | |
15 | bool(true) | |
16 | array(1) { | |
17 | ["PsrExt\Http\Message\UriFactoryInterface"]=> | |
18 | string(39) "PsrExt\Http\Message\UriFactoryInterface" | |
19 | } | |
20 | string(27) "SampleUriFactory::createUri" | |
21 | string(0) "" | |
22 | bool(true) | |
23 | string(27) "SampleUriFactory::createUri" | |
24 | string(17) "http://domain.com" |
0 | --TEST-- | |
1 | Psr\Http\Message\UriInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Http\Message\UriInterface; | |
7 | include __DIR__ . '/SampleUri.inc'; | |
8 | var_dump(interface_exists(UriInterface::class, false)); | |
9 | var_dump(is_subclass_of(SampleUri::class, UriInterface::class)); | |
10 | $uri = new SampleUri(); | |
11 | $uri->getScheme(); | |
12 | $uri->getAuthority(); | |
13 | $uri->getUserInfo(); | |
14 | $uri->getHost(); | |
15 | $uri->getPort(); | |
16 | $uri->getPath(); | |
17 | $uri->getQuery(); | |
18 | $uri->getFragment(); | |
19 | $uri->withScheme('http'); | |
20 | $uri->withUserInfo('foo', 'bar'); | |
21 | $uri->withHost('php.net'); | |
22 | $uri->withPort(8080); | |
23 | $uri->withPath('/'); | |
24 | $uri->withQuery(''); | |
25 | $uri->withFragment(''); | |
26 | $uri->__toString(); | |
27 | --EXPECT-- | |
28 | bool(true) | |
29 | bool(true) | |
30 | string(20) "SampleUri::getScheme" | |
31 | string(23) "SampleUri::getAuthority" | |
32 | string(22) "SampleUri::getUserInfo" | |
33 | string(18) "SampleUri::getHost" | |
34 | string(18) "SampleUri::getPort" | |
35 | string(18) "SampleUri::getPath" | |
36 | string(19) "SampleUri::getQuery" | |
37 | string(22) "SampleUri::getFragment" | |
38 | string(21) "SampleUri::withScheme" | |
39 | string(4) "http" | |
40 | string(23) "SampleUri::withUserInfo" | |
41 | string(3) "foo" | |
42 | string(3) "bar" | |
43 | string(19) "SampleUri::withHost" | |
44 | string(7) "php.net" | |
45 | string(19) "SampleUri::withPort" | |
46 | int(8080) | |
47 | string(19) "SampleUri::withPath" | |
48 | string(1) "/" | |
49 | string(20) "SampleUri::withQuery" | |
50 | string(0) "" | |
51 | string(23) "SampleUri::withFragment" | |
52 | string(0) "" | |
53 | string(21) "SampleUri::__toString" |
0 | --TEST-- | |
1 | Psr\Http\Server\MiddlewareInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleRequest.inc'; | |
8 | include __DIR__ . '/SampleServerRequest.inc'; | |
9 | include __DIR__ . '/SampleResponse.inc'; | |
10 | include __DIR__ . '/SampleRequestHandler.inc'; | |
11 | include __DIR__ . '/SampleMiddleware.inc'; | |
12 | var_dump(interface_exists('\\Psr\\Http\\Server\\MiddlewareInterface', false)); | |
13 | var_dump(class_implements('SampleMiddleware', false)); | |
14 | $request = new SampleServerRequest(); | |
15 | var_dump($request instanceof \Psr\Http\Message\ServerRequestInterface); | |
16 | $handler = new SampleRequestHandler(); | |
17 | var_dump($handler instanceof \Psr\Http\Server\RequestHandlerInterface); | |
18 | $middleware = new SampleMiddleware(); | |
19 | $response = $middleware->process($request, $handler); | |
20 | var_dump($response instanceof \Psr\Http\Message\ResponseInterface); | |
21 | --EXPECT-- | |
22 | bool(true) | |
23 | array(1) { | |
24 | ["PsrExt\Http\Server\MiddlewareInterface"]=> | |
25 | string(38) "PsrExt\Http\Server\MiddlewareInterface" | |
26 | } | |
27 | bool(true) | |
28 | bool(true) | |
29 | string(25) "SampleMiddleware::process" | |
30 | bool(true) |
0 | --TEST-- | |
1 | Psr\Http\Server\RequestHandlerInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleMessage.inc'; | |
7 | include __DIR__ . '/SampleRequest.inc'; | |
8 | include __DIR__ . '/SampleServerRequest.inc'; | |
9 | include __DIR__ . '/SampleResponse.inc'; | |
10 | include __DIR__ . '/SampleRequestHandler.inc'; | |
11 | var_dump(interface_exists('\\Psr\\Http\\Server\\RequestHandlerInterface', false)); | |
12 | var_dump(class_implements('SampleRequestHandler', false)); | |
13 | $request = new SampleServerRequest(); | |
14 | var_dump($request instanceof \Psr\Http\Message\ServerRequestInterface); | |
15 | $handler = new SampleRequestHandler(); | |
16 | $response = $handler->handle($request); | |
17 | var_dump($response instanceof \Psr\Http\Message\ResponseInterface); | |
18 | --EXPECT-- | |
19 | bool(true) | |
20 | array(1) { | |
21 | ["PsrExt\Http\Server\RequestHandlerInterface"]=> | |
22 | string(42) "PsrExt\Http\Server\RequestHandlerInterface" | |
23 | } | |
24 | bool(true) | |
25 | string(28) "SampleRequestHandler::handle" | |
26 | bool(true) |
0 | --TEST-- | |
1 | Psr\Link\EvolvableLinkInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Link\LinkInterface; | |
7 | use Psr\Link\EvolvableLinkInterface; | |
8 | class MyImpl implements EvolvableLinkInterface { | |
9 | public function getHref() {} | |
10 | public function isTemplated() {} | |
11 | public function getRels() {} | |
12 | public function getAttributes() {} | |
13 | public function withHref($href) {} | |
14 | public function withRel($rel) {} | |
15 | public function withoutRel($rel) {} | |
16 | public function withAttribute($attribute, $value) {} | |
17 | public function withoutAttribute($attribute) {} | |
18 | } | |
19 | $ex = new MyImpl(); | |
20 | var_dump($ex instanceof LinkInterface); | |
21 | var_dump($ex instanceof EvolvableLinkInterface); | |
22 | --EXPECT-- | |
23 | bool(true) | |
24 | bool(true) |
0 | --TEST-- | |
1 | Psr\Link\EvolvableLinkProviderInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Link\LinkInterface; | |
7 | use Psr\Link\LinkProviderInterface; | |
8 | use Psr\Link\EvolvableLinkProviderInterface; | |
9 | class MyImpl implements EvolvableLinkProviderInterface { | |
10 | public function getLinks() {} | |
11 | public function getLinksByRel($rel) {} | |
12 | public function withLink(LinkInterface $link) {} | |
13 | public function withoutLink(LinkInterface $link) {} | |
14 | } | |
15 | $ex = new MyImpl(); | |
16 | var_dump($ex instanceof LinkProviderInterface); | |
17 | var_dump($ex instanceof EvolvableLinkProviderInterface); | |
18 | --EXPECT-- | |
19 | bool(true) | |
20 | bool(true) |
0 | --TEST-- | |
1 | Psr\Link\LinkInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Link\LinkInterface; | |
7 | class MyImpl implements LinkInterface { | |
8 | public function getHref() {} | |
9 | public function isTemplated() {} | |
10 | public function getRels() {} | |
11 | public function getAttributes() {} | |
12 | } | |
13 | $ex = new MyImpl(); | |
14 | var_dump($ex instanceof LinkInterface); | |
15 | --EXPECT-- | |
16 | bool(true) |
0 | --TEST-- | |
1 | Psr\Link\LinkProviderInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Link\LinkProviderInterface; | |
7 | class MyImpl implements LinkProviderInterface { | |
8 | public function getLinks() {} | |
9 | public function getLinksByRel($rel) {} | |
10 | } | |
11 | $ex = new MyImpl(); | |
12 | var_dump($ex instanceof LinkProviderInterface); | |
13 | --EXPECT-- | |
14 | bool(true) |
0 | --TEST-- | |
1 | Psr\Log\AbstractLogger | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleLogger2.inc'; | |
7 | $logger = new SampleLogger2; | |
8 | $logger->emergency('msg emergency', array(1)); | |
9 | $logger->alert('msg alert', array(2)); | |
10 | $logger->critical('msg critical', array(3)); | |
11 | $logger->error('msg error', array(4)); | |
12 | $logger->warning('msg warning', array(5)); | |
13 | $logger->notice('msg notice', array(6)); | |
14 | $logger->info('msg info', array(7)); | |
15 | $logger->debug('msg debug', array(8)); | |
16 | $logger->log('level', 'msg', array(9)); | |
17 | $logger->log('level', 'no context'); | |
18 | --EXPECT-- | |
19 | string(9) "emergency" | |
20 | string(13) "msg emergency" | |
21 | array(1) { | |
22 | [0]=> | |
23 | int(1) | |
24 | } | |
25 | string(5) "alert" | |
26 | string(9) "msg alert" | |
27 | array(1) { | |
28 | [0]=> | |
29 | int(2) | |
30 | } | |
31 | string(8) "critical" | |
32 | string(12) "msg critical" | |
33 | array(1) { | |
34 | [0]=> | |
35 | int(3) | |
36 | } | |
37 | string(5) "error" | |
38 | string(9) "msg error" | |
39 | array(1) { | |
40 | [0]=> | |
41 | int(4) | |
42 | } | |
43 | string(7) "warning" | |
44 | string(11) "msg warning" | |
45 | array(1) { | |
46 | [0]=> | |
47 | int(5) | |
48 | } | |
49 | string(6) "notice" | |
50 | string(10) "msg notice" | |
51 | array(1) { | |
52 | [0]=> | |
53 | int(6) | |
54 | } | |
55 | string(4) "info" | |
56 | string(8) "msg info" | |
57 | array(1) { | |
58 | [0]=> | |
59 | int(7) | |
60 | } | |
61 | string(5) "debug" | |
62 | string(9) "msg debug" | |
63 | array(1) { | |
64 | [0]=> | |
65 | int(8) | |
66 | } | |
67 | string(5) "level" | |
68 | string(3) "msg" | |
69 | array(1) { | |
70 | [0]=> | |
71 | int(9) | |
72 | } | |
73 | string(5) "level" | |
74 | string(10) "no context" | |
75 | array(0) { | |
76 | } |
0 | --TEST-- | |
1 | Psr\Log\AbstractLogger | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Log\AbstractLogger; | |
7 | try { | |
8 | new AbstractLogger(); | |
9 | } catch( \EngineException $e ) { | |
10 | echo $e->getMessage(); | |
11 | } catch( \Throwable $e ) { | |
12 | echo $e->getMessage(); | |
13 | } | |
14 | --EXPECTF-- | |
15 | %SCannot instantiate abstract class PsrExt\Log\AbstractLogger%S |
0 | --TEST-- | |
1 | Psr\Log\InvalidArgumentException | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Log\InvalidArgumentException; | |
7 | $ex = new InvalidArgumentException('test'); | |
8 | var_dump($ex instanceof \InvalidArgumentException); | |
9 | var_dump($ex instanceof \Exception); | |
10 | try { | |
11 | throw $ex; | |
12 | } catch( InvalidArgumentException $e ) { | |
13 | var_dump($e->getMessage()); | |
14 | } | |
15 | --EXPECT-- | |
16 | bool(true) | |
17 | bool(true) | |
18 | string(4) "test" |
0 | --TEST-- | |
1 | Psr\Log\LogLevel | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Log\LogLevel; | |
7 | var_dump(LogLevel::EMERGENCY); | |
8 | var_dump(LogLevel::ALERT); | |
9 | var_dump(LogLevel::CRITICAL); | |
10 | var_dump(LogLevel::ERROR); | |
11 | var_dump(LogLevel::WARNING); | |
12 | var_dump(LogLevel::NOTICE); | |
13 | var_dump(LogLevel::INFO); | |
14 | var_dump(LogLevel::DEBUG); | |
15 | --EXPECT-- | |
16 | string(9) "emergency" | |
17 | string(5) "alert" | |
18 | string(8) "critical" | |
19 | string(5) "error" | |
20 | string(7) "warning" | |
21 | string(6) "notice" | |
22 | string(4) "info" | |
23 | string(5) "debug" |
0 | --TEST-- | |
1 | Psr\Log\LoggerAwareInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleLogger.inc'; | |
7 | include __DIR__ . '/SampleLoggerAware.inc'; | |
8 | var_dump(interface_exists('\\Psr\\Log\\LoggerAwareInterface', false)); | |
9 | var_dump(class_implements('SampleLoggerAware', false)); | |
10 | $aware = new SampleLoggerAware(); | |
11 | $logger = new SampleLogger(); | |
12 | $aware->setLogger($logger); | |
13 | $aware->doSomethingThatLogs(); | |
14 | --EXPECT-- | |
15 | bool(true) | |
16 | array(1) { | |
17 | ["PsrExt\Log\LoggerAwareInterface"]=> | |
18 | string(31) "PsrExt\Log\LoggerAwareInterface" | |
19 | } | |
20 | string(10) "got logger" | |
21 | string(9) "emergency" | |
22 | string(8) "test log" | |
23 | array(0) { | |
24 | } |
0 | --TEST-- | |
1 | Psr\Log\LoggerAwareTrait | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Log\LoggerAwareTrait; | |
7 | include __DIR__ . '/SampleLogger.inc'; | |
8 | class SampleLoggerAwareTraitUser { | |
9 | use LoggerAwareTrait; | |
10 | public function getLogger() { | |
11 | return $this->logger; | |
12 | } | |
13 | } | |
14 | ||
15 | $aware = new SampleLoggerAwareTraitUser(); | |
16 | $logger = new SampleLogger(); | |
17 | $aware->setLogger($logger); | |
18 | var_dump($logger === $aware->getLogger()); | |
19 | var_dump(class_uses($aware, false)); | |
20 | --EXPECT-- | |
21 | bool(true) | |
22 | array(1) { | |
23 | ["PsrExt\Log\LoggerAwareTrait"]=> | |
24 | string(27) "PsrExt\Log\LoggerAwareTrait" | |
25 | } |
0 | --TEST-- | |
1 | Psr\Log\LoggerInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | include __DIR__ . '/SampleLogger.inc'; | |
7 | var_dump(interface_exists('\\Psr\\Log\\LoggerInterface', false)); | |
8 | var_dump(class_implements('SampleLogger', false)); | |
9 | $logger = new SampleLogger(); | |
10 | $logger->emergency('msg emergency', array(1)); | |
11 | $logger->alert('msg alert', array(2)); | |
12 | $logger->critical('msg critical', array(3)); | |
13 | $logger->error('msg error', array(4)); | |
14 | $logger->warning('msg warning', array(5)); | |
15 | $logger->notice('msg notice', array(6)); | |
16 | $logger->info('msg info', array(7)); | |
17 | $logger->debug('msg debug', array(8)); | |
18 | $logger->log('level', 'msg', array(9)); | |
19 | $logger->log('level', 'no context'); | |
20 | --EXPECT-- | |
21 | bool(true) | |
22 | array(1) { | |
23 | ["PsrExt\Log\LoggerInterface"]=> | |
24 | string(26) "PsrExt\Log\LoggerInterface" | |
25 | } | |
26 | string(9) "emergency" | |
27 | string(13) "msg emergency" | |
28 | array(1) { | |
29 | [0]=> | |
30 | int(1) | |
31 | } | |
32 | string(5) "alert" | |
33 | string(9) "msg alert" | |
34 | array(1) { | |
35 | [0]=> | |
36 | int(2) | |
37 | } | |
38 | string(8) "critical" | |
39 | string(12) "msg critical" | |
40 | array(1) { | |
41 | [0]=> | |
42 | int(3) | |
43 | } | |
44 | string(5) "error" | |
45 | string(9) "msg error" | |
46 | array(1) { | |
47 | [0]=> | |
48 | int(4) | |
49 | } | |
50 | string(7) "warning" | |
51 | string(11) "msg warning" | |
52 | array(1) { | |
53 | [0]=> | |
54 | int(5) | |
55 | } | |
56 | string(6) "notice" | |
57 | string(10) "msg notice" | |
58 | array(1) { | |
59 | [0]=> | |
60 | int(6) | |
61 | } | |
62 | string(4) "info" | |
63 | string(8) "msg info" | |
64 | array(1) { | |
65 | [0]=> | |
66 | int(7) | |
67 | } | |
68 | string(5) "debug" | |
69 | string(9) "msg debug" | |
70 | array(1) { | |
71 | [0]=> | |
72 | int(8) | |
73 | } | |
74 | string(5) "level" | |
75 | string(3) "msg" | |
76 | array(1) { | |
77 | [0]=> | |
78 | int(9) | |
79 | } | |
80 | string(5) "level" | |
81 | string(10) "no context" | |
82 | array(0) { | |
83 | } | |
84 |
0 | --TEST-- | |
1 | Psr\Log\LoggerTrait | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Log\LoggerTrait; | |
7 | include __DIR__ . '/SampleLogger.inc'; | |
8 | class SampleLoggerTraitUser { | |
9 | use LoggerTrait; | |
10 | public function log($level, $message, array $context = array()) { | |
11 | var_dump($level, $message, $context); | |
12 | } | |
13 | } | |
14 | $logger = new SampleLoggerTraitUser(); | |
15 | $logger->emergency('msg emergency', array(1)); | |
16 | $logger->alert('msg alert', array(2)); | |
17 | $logger->critical('msg critical', array(3)); | |
18 | $logger->error('msg error', array(4)); | |
19 | $logger->warning('msg warning', array(5)); | |
20 | $logger->notice('msg notice', array(6)); | |
21 | $logger->info('msg info', array(7)); | |
22 | $logger->debug('msg debug', array(8)); | |
23 | $logger->log('level', 'msg', array(9)); | |
24 | $logger->log('level', 'no context'); | |
25 | var_dump(class_uses($logger, false)); | |
26 | --EXPECT-- | |
27 | string(9) "emergency" | |
28 | string(13) "msg emergency" | |
29 | array(1) { | |
30 | [0]=> | |
31 | int(1) | |
32 | } | |
33 | string(5) "alert" | |
34 | string(9) "msg alert" | |
35 | array(1) { | |
36 | [0]=> | |
37 | int(2) | |
38 | } | |
39 | string(8) "critical" | |
40 | string(12) "msg critical" | |
41 | array(1) { | |
42 | [0]=> | |
43 | int(3) | |
44 | } | |
45 | string(5) "error" | |
46 | string(9) "msg error" | |
47 | array(1) { | |
48 | [0]=> | |
49 | int(4) | |
50 | } | |
51 | string(7) "warning" | |
52 | string(11) "msg warning" | |
53 | array(1) { | |
54 | [0]=> | |
55 | int(5) | |
56 | } | |
57 | string(6) "notice" | |
58 | string(10) "msg notice" | |
59 | array(1) { | |
60 | [0]=> | |
61 | int(6) | |
62 | } | |
63 | string(4) "info" | |
64 | string(8) "msg info" | |
65 | array(1) { | |
66 | [0]=> | |
67 | int(7) | |
68 | } | |
69 | string(5) "debug" | |
70 | string(9) "msg debug" | |
71 | array(1) { | |
72 | [0]=> | |
73 | int(8) | |
74 | } | |
75 | string(5) "level" | |
76 | string(3) "msg" | |
77 | array(1) { | |
78 | [0]=> | |
79 | int(9) | |
80 | } | |
81 | string(5) "level" | |
82 | string(10) "no context" | |
83 | array(0) { | |
84 | } | |
85 | array(1) { | |
86 | ["PsrExt\Log\LoggerTrait"]=> | |
87 | string(22) "PsrExt\Log\LoggerTrait" | |
88 | } |
0 | --TEST-- | |
1 | Psr\Log\NullLogger | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\Log\NullLogger; | |
7 | $logger = new NullLogger; | |
8 | $logger->emergency('msg emergency', array(1)); | |
9 | $logger->alert('msg alert', array(2)); | |
10 | $logger->critical('msg critical', array(3)); | |
11 | $logger->error('msg error', array(4)); | |
12 | $logger->warning('msg warning', array(5)); | |
13 | $logger->notice('msg notice', array(6)); | |
14 | $logger->info('msg info', array(7)); | |
15 | $logger->debug('msg debug', array(8)); | |
16 | $logger->log('level', 'msg', array(9)); | |
17 | $logger->log('level', 'no context'); | |
18 | var_dump($logger instanceof \Psr\Log\LoggerInterface); | |
19 | var_dump($logger instanceof \Psr\Log\AbstractLogger); | |
20 | --EXPECT-- | |
21 | bool(true) | |
22 | bool(true) |
0 | --TEST-- | |
1 | Psr\SimpleCache\CacheException | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\SimpleCache\CacheException; | |
7 | class MyException extends Exception implements CacheException {} | |
8 | $ex = new MyException('test'); | |
9 | var_dump($ex instanceof CacheException); | |
10 | var_dump($ex instanceof Exception); | |
11 | try { | |
12 | throw $ex; | |
13 | } catch( CacheException $e ) { | |
14 | var_dump($e->getMessage()); | |
15 | } | |
16 | --EXPECT-- | |
17 | bool(true) | |
18 | bool(true) | |
19 | string(4) "test" |
0 | --TEST-- | |
1 | Psr\SimpleCache\CacheInterface | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\SimpleCache\CacheInterface; | |
7 | class MyImpl implements CacheInterface { | |
8 | public function get($key, $default = null) {} | |
9 | public function set($key, $value, $ttl = null) {} | |
10 | public function delete($key) {} | |
11 | public function clear() {} | |
12 | public function getMultiple($keys, $default = null) {} | |
13 | public function setMultiple($values, $ttl = null) {} | |
14 | public function deleteMultiple($keys) {} | |
15 | public function has($key) {} | |
16 | } | |
17 | $ex = new MyImpl(); | |
18 | var_dump($ex instanceof CacheInterface); | |
19 | --EXPECT-- | |
20 | bool(true) |
0 | --TEST-- | |
1 | Psr\SimpleCache\InvalidArgumentException | |
2 | --SKIPIF-- | |
3 | <?php include('skip.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | use Psr\SimpleCache\InvalidArgumentException; | |
7 | class MyException extends Exception implements InvalidArgumentException {} | |
8 | $ex = new MyException('test'); | |
9 | var_dump($ex instanceof InvalidArgumentException); | |
10 | var_dump($ex instanceof Exception); | |
11 | try { | |
12 | throw $ex; | |
13 | } catch( InvalidArgumentException $e ) { | |
14 | var_dump($e->getMessage()); | |
15 | } | |
16 | --EXPECT-- | |
17 | bool(true) | |
18 | bool(true) | |
19 | string(4) "test" |
0 | <?php | |
1 | ||
2 | use Psr\Cache\CacheItemInterface; | |
3 | ||
4 | class SampleCacheItem implements CacheItemInterface | |
5 | { | |
6 | public function getKey() | |
7 | { | |
8 | var_dump(__METHOD__); | |
9 | } | |
10 | ||
11 | public function get() | |
12 | { | |
13 | var_dump(__METHOD__); | |
14 | } | |
15 | ||
16 | public function isHit() | |
17 | { | |
18 | var_dump(__METHOD__); | |
19 | } | |
20 | ||
21 | public function set($value) | |
22 | { | |
23 | var_dump(__METHOD__, $value); | |
24 | } | |
25 | ||
26 | public function expiresAt($expiration) | |
27 | { | |
28 | var_dump(__METHOD__, $expiration); | |
29 | } | |
30 | ||
31 | public function expiresAfter($time) | |
32 | { | |
33 | var_dump(__METHOD__, $time); | |
34 | } | |
35 | } |
0 | <?php | |
1 | ||
2 | use Psr\Cache\CacheItemInterface; | |
3 | use Psr\Cache\CacheItemPoolInterface; | |
4 | ||
5 | class SampleCacheItemPool implements CacheItemPoolInterface | |
6 | { | |
7 | public function getItem($key) | |
8 | { | |
9 | var_dump(__METHOD__, $key); | |
10 | } | |
11 | ||
12 | public function getItems(array $keys = array()) | |
13 | { | |
14 | var_dump(__METHOD__, $keys); | |
15 | } | |
16 | ||
17 | public function hasItem($key) | |
18 | { | |
19 | var_dump(__METHOD__, $key); | |
20 | } | |
21 | ||
22 | public function clear() | |
23 | { | |
24 | var_dump(__METHOD__); | |
25 | } | |
26 | ||
27 | public function deleteItem($key) | |
28 | { | |
29 | var_dump(__METHOD__, $key); | |
30 | } | |
31 | ||
32 | public function deleteItems(array $keys) | |
33 | { | |
34 | var_dump(__METHOD__, $keys); | |
35 | } | |
36 | ||
37 | public function save(CacheItemInterface $item) | |
38 | { | |
39 | var_dump(__METHOD__, $item); | |
40 | } | |
41 | ||
42 | public function saveDeferred(CacheItemInterface $item) | |
43 | { | |
44 | var_dump(__METHOD__, $item); | |
45 | } | |
46 | ||
47 | public function commit() | |
48 | { | |
49 | var_dump(__METHOD__); | |
50 | } | |
51 | } | |
52 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Client\ClientInterface; | |
3 | use Psr\Http\Message\RequestInterface; | |
4 | use Psr\Http\Message\ResponseInterface; | |
5 | ||
6 | class SampleClient implements ClientInterface | |
7 | { | |
8 | public function sendRequest(RequestInterface $request): ResponseInterface | |
9 | { | |
10 | var_dump(__METHOD__, $request); | |
11 | return new SampleResponse(); | |
12 | } | |
13 | } | |
14 |
0 | <?php | |
1 | ||
2 | use Psr\EventDispatcher\EventDispatcherInterface; | |
3 | ||
4 | class SampleEventDispatcher implements EventDispatcherInterface | |
5 | { | |
6 | public function dispatch(object $event) | |
7 | { | |
8 | var_dump(__METHOD__, is_object($event)); | |
9 | ||
10 | return $event; | |
11 | } | |
12 | } |
0 | <?php | |
1 | ||
2 | use Psr\EventDispatcher\ListenerProviderInterface; | |
3 | ||
4 | class SampleListenerProvider implements ListenerProviderInterface | |
5 | { | |
6 | public function getListenersForEvent(object $event): iterable | |
7 | { | |
8 | var_dump(__METHOD__, is_object($event)); | |
9 | ||
10 | return new ArrayIterator([]); | |
11 | } | |
12 | } |
0 | <?php | |
1 | ||
2 | use Psr\Log\LogLevel; | |
3 | use Psr\Log\LoggerInterface; | |
4 | ||
5 | class SampleLogger implements LoggerInterface { | |
6 | public function emergency($message, array $context = array()) { | |
7 | return $this->log(LogLevel::EMERGENCY, $message, $context); | |
8 | } | |
9 | public function alert($message, array $context = array()) { | |
10 | return $this->log(LogLevel::ALERT, $message, $context); | |
11 | } | |
12 | public function critical($message, array $context = array()) { | |
13 | return $this->log(LogLevel::CRITICAL, $message, $context); | |
14 | } | |
15 | public function error($message, array $context = array()) { | |
16 | return $this->log(LogLevel::ERROR, $message, $context); | |
17 | } | |
18 | public function warning($message, array $context = array()) { | |
19 | return $this->log(LogLevel::WARNING, $message, $context); | |
20 | } | |
21 | public function notice($message, array $context = array()) { | |
22 | return $this->log(LogLevel::NOTICE, $message, $context); | |
23 | } | |
24 | public function info($message, array $context = array()) { | |
25 | return $this->log(LogLevel::INFO, $message, $context); | |
26 | } | |
27 | public function debug($message, array $context = array()) { | |
28 | return $this->log(LogLevel::DEBUG, $message, $context); | |
29 | } | |
30 | public function log($level, $message, array $context = array()) { | |
31 | var_dump($level, $message, $context); | |
32 | } | |
33 | } | |
34 |
0 | <?php | |
1 | ||
2 | use Psr\Log\LogLevel; | |
3 | use Psr\Log\AbstractLogger; | |
4 | ||
5 | class SampleLogger2 extends AbstractLogger { | |
6 | public function log($level, $message, array $context = array()) { | |
7 | var_dump($level, $message, $context); | |
8 | } | |
9 | } | |
10 |
0 | <?php | |
1 | ||
2 | use Psr\Log\LoggerInterface; | |
3 | use Psr\Log\LoggerAwareInterface; | |
4 | ||
5 | class SampleLoggerAware implements LoggerAwareInterface { | |
6 | private $logger; | |
7 | public function setLogger(LoggerInterface $logger) { | |
8 | $this->logger = $logger; | |
9 | var_dump('got logger'); | |
10 | } | |
11 | public function doSomethingThatLogs() { | |
12 | $this->logger->emergency('test log'); | |
13 | } | |
14 | } | |
15 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\MessageInterface; | |
3 | use Psr\Http\Message\StreamInterface; | |
4 | ||
5 | class SampleMessage implements MessageInterface | |
6 | { | |
7 | public function getProtocolVersion() | |
8 | { | |
9 | var_dump(__METHOD__); | |
10 | } | |
11 | ||
12 | public function withProtocolVersion($version) | |
13 | { | |
14 | var_dump(__METHOD__, $version); | |
15 | } | |
16 | ||
17 | public function getHeaders() | |
18 | { | |
19 | var_dump(__METHOD__); | |
20 | } | |
21 | ||
22 | public function hasHeader($name) | |
23 | { | |
24 | var_dump(__METHOD__, $name); | |
25 | } | |
26 | ||
27 | public function getHeader($name) | |
28 | { | |
29 | var_dump(__METHOD__, $name); | |
30 | } | |
31 | ||
32 | public function getHeaderLine($name) | |
33 | { | |
34 | var_dump(__METHOD__, $name); | |
35 | } | |
36 | ||
37 | public function withHeader($name, $value) | |
38 | { | |
39 | var_dump(__METHOD__, $name, $value); | |
40 | } | |
41 | ||
42 | public function withAddedHeader($name, $value) | |
43 | { | |
44 | var_dump(__METHOD__, $name, $value); | |
45 | } | |
46 | ||
47 | public function withoutHeader($name) | |
48 | { | |
49 | var_dump(__METHOD__, $name); | |
50 | } | |
51 | ||
52 | public function getBody() | |
53 | { | |
54 | var_dump(__METHOD__); | |
55 | } | |
56 | ||
57 | public function withBody(StreamInterface $body) | |
58 | { | |
59 | var_dump(__METHOD__, $body); | |
60 | } | |
61 | } | |
62 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Server\MiddlewareInterface; | |
3 | use Psr\Http\Server\RequestHandlerInterface; | |
4 | use Psr\Http\Message\ServerRequestInterface; | |
5 | use Psr\Http\Message\ResponseInterface; | |
6 | ||
7 | class SampleMiddleware implements MiddlewareInterface { | |
8 | public function process(ServerRequestInterface $reqeust, RequestHandlerInterface $handler): ResponseInterface | |
9 | { | |
10 | var_dump(__METHOD__); | |
11 | ||
12 | return new SampleResponse(); | |
13 | } | |
14 | } | |
15 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\RequestInterface; | |
3 | use Psr\Http\Message\UriInterface; | |
4 | ||
5 | class SampleRequest extends SampleMessage implements RequestInterface | |
6 | { | |
7 | public function getRequestTarget() | |
8 | { | |
9 | var_dump(__METHOD__); | |
10 | } | |
11 | ||
12 | public function withRequestTarget($requestTarget) | |
13 | { | |
14 | var_dump(__METHOD__, $requestTarget); | |
15 | } | |
16 | ||
17 | public function getMethod() | |
18 | { | |
19 | var_dump(__METHOD__); | |
20 | } | |
21 | ||
22 | public function withMethod($method) | |
23 | { | |
24 | var_dump(__METHOD__, $method); | |
25 | } | |
26 | ||
27 | public function getUri() | |
28 | { | |
29 | var_dump(__METHOD__); | |
30 | } | |
31 | ||
32 | public function withUri(UriInterface $uri, $preserveHost = false) | |
33 | { | |
34 | var_dump(__METHOD__, $uri, $preserveHost); | |
35 | } | |
36 | } | |
37 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\RequestFactoryInterface; | |
3 | use Psr\Http\Message\RequestInterface; | |
4 | ||
5 | class SampleRequestFactory implements RequestFactoryInterface | |
6 | { | |
7 | public function createRequest(string $method, $uri): RequestInterface | |
8 | { | |
9 | var_dump(__METHOD__, $method, $uri); | |
10 | return new SampleRequest(); | |
11 | } | |
12 | } | |
13 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Server\RequestHandlerInterface; | |
3 | use Psr\Http\Message\ServerRequestInterface; | |
4 | use Psr\Http\Message\ResponseInterface; | |
5 | ||
6 | class SampleRequestHandler implements RequestHandlerInterface { | |
7 | public function handle(ServerRequestInterface $reqeust): ResponseInterface | |
8 | { | |
9 | var_dump(__METHOD__); | |
10 | ||
11 | return new SampleResponse(); | |
12 | } | |
13 | } | |
14 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\ResponseInterface; | |
3 | ||
4 | class SampleResponse extends SampleMessage implements ResponseInterface | |
5 | { | |
6 | public function getStatusCode() | |
7 | { | |
8 | var_dump(__METHOD__); | |
9 | } | |
10 | ||
11 | public function withStatus($code, $reasonPhrase = '') | |
12 | { | |
13 | var_dump(__METHOD__, $code, $reasonPhrase); | |
14 | } | |
15 | ||
16 | public function getReasonPhrase() | |
17 | { | |
18 | var_dump(__METHOD__); | |
19 | } | |
20 | ||
21 | } | |
22 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\ResponseFactoryInterface; | |
3 | use Psr\Http\Message\ResponseInterface; | |
4 | ||
5 | class SampleResponseFactory implements ResponseFactoryInterface | |
6 | { | |
7 | public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface | |
8 | { | |
9 | var_dump(__METHOD__, $code, $reasonPhrase); | |
10 | return new SampleResponse(); | |
11 | } | |
12 | } | |
13 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\ServerRequestInterface; | |
3 | ||
4 | class SampleServerRequest extends SampleRequest implements ServerRequestInterface | |
5 | { | |
6 | public function getServerParams() | |
7 | { | |
8 | var_dump(__METHOD__); | |
9 | } | |
10 | ||
11 | public function getCookieParams() | |
12 | { | |
13 | var_dump(__METHOD__); | |
14 | } | |
15 | ||
16 | public function withCookieParams(array $cookies) | |
17 | { | |
18 | var_dump(__METHOD__, $cookies); | |
19 | } | |
20 | ||
21 | public function getQueryParams() | |
22 | { | |
23 | var_dump(__METHOD__); | |
24 | } | |
25 | ||
26 | public function withQueryParams(array $query) | |
27 | { | |
28 | var_dump(__METHOD__, $query); | |
29 | } | |
30 | ||
31 | public function getUploadedFiles() | |
32 | { | |
33 | var_dump(__METHOD__); | |
34 | } | |
35 | ||
36 | public function withUploadedFiles(array $uploadedFiles) | |
37 | { | |
38 | var_dump(__METHOD__, $uploadedFiles); | |
39 | } | |
40 | ||
41 | public function getParsedBody() | |
42 | { | |
43 | var_dump(__METHOD__); | |
44 | } | |
45 | ||
46 | public function withParsedBody($data) | |
47 | { | |
48 | var_dump(__METHOD__, $data); | |
49 | } | |
50 | ||
51 | public function getAttributes() | |
52 | { | |
53 | var_dump(__METHOD__); | |
54 | } | |
55 | ||
56 | public function getAttribute($name, $default = null) | |
57 | { | |
58 | var_dump(__METHOD__, $name, $default); | |
59 | } | |
60 | ||
61 | public function withAttribute($name, $value) | |
62 | { | |
63 | var_dump(__METHOD__, $name, $value); | |
64 | } | |
65 | ||
66 | public function withoutAttribute($name) | |
67 | { | |
68 | var_dump(__METHOD__, $name); | |
69 | } | |
70 | } | |
71 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\ServerRequestFactoryInterface; | |
3 | use Psr\Http\Message\ServerRequestInterface; | |
4 | ||
5 | class SampleServerRequestFactory implements ServerRequestFactoryInterface | |
6 | { | |
7 | public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface | |
8 | { | |
9 | var_dump(__METHOD__, $method, $uri, $serverParams); | |
10 | return new SampleServerRequest(); | |
11 | } | |
12 | } | |
13 |
0 | <?php | |
1 | ||
2 | use Psr\EventDispatcher\StoppableEventInterface; | |
3 | ||
4 | class SampleStoppableEvent implements StoppableEventInterface | |
5 | { | |
6 | public function isPropagationStopped(): bool | |
7 | { | |
8 | var_dump(__METHOD__); | |
9 | ||
10 | return true; | |
11 | } | |
12 | } |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\StreamInterface; | |
3 | ||
4 | class SampleStream implements StreamInterface | |
5 | { | |
6 | public function __toString() | |
7 | { | |
8 | var_dump(__METHOD__); | |
9 | return __METHOD__; | |
10 | } | |
11 | ||
12 | public function close() | |
13 | { | |
14 | var_dump(__METHOD__); | |
15 | } | |
16 | ||
17 | public function detach() | |
18 | { | |
19 | var_dump(__METHOD__); | |
20 | } | |
21 | ||
22 | public function getSize() | |
23 | { | |
24 | var_dump(__METHOD__); | |
25 | } | |
26 | ||
27 | public function tell() | |
28 | { | |
29 | var_dump(__METHOD__); | |
30 | } | |
31 | ||
32 | public function eof() | |
33 | { | |
34 | var_dump(__METHOD__); | |
35 | } | |
36 | ||
37 | public function isSeekable() | |
38 | { | |
39 | var_dump(__METHOD__); | |
40 | } | |
41 | ||
42 | public function seek($offset, $whence = SEEK_SET) | |
43 | { | |
44 | var_dump(__METHOD__, $offset, $whence); | |
45 | } | |
46 | ||
47 | public function rewind() | |
48 | { | |
49 | var_dump(__METHOD__); | |
50 | } | |
51 | ||
52 | public function isWritable() | |
53 | { | |
54 | var_dump(__METHOD__); | |
55 | } | |
56 | ||
57 | public function write($string) | |
58 | { | |
59 | var_dump(__METHOD__, $string); | |
60 | } | |
61 | ||
62 | public function isReadable() | |
63 | { | |
64 | var_dump(__METHOD__); | |
65 | } | |
66 | ||
67 | public function read($length) | |
68 | { | |
69 | var_dump(__METHOD__, $length); | |
70 | } | |
71 | ||
72 | public function getContents() | |
73 | { | |
74 | var_dump(__METHOD__); | |
75 | } | |
76 | ||
77 | public function getMetadata($key = null) | |
78 | { | |
79 | var_dump(__METHOD__, $key); | |
80 | } | |
81 | } | |
82 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\StreamFactoryInterface; | |
3 | use Psr\Http\Message\StreamInterface; | |
4 | ||
5 | class SampleStreamFactory implements StreamFactoryInterface | |
6 | { | |
7 | public function createStream(string $content = ''): StreamInterface | |
8 | { | |
9 | var_dump(__METHOD__, $content); | |
10 | return new SampleStream(); | |
11 | } | |
12 | ||
13 | public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface | |
14 | { | |
15 | var_dump(__METHOD__, $filename, $mode); | |
16 | return new SampleStream(); | |
17 | } | |
18 | ||
19 | public function createStreamFromResource($resource): StreamInterface | |
20 | { | |
21 | var_dump(__METHOD__, $resource); | |
22 | return new SampleStream(); | |
23 | } | |
24 | } | |
25 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\UploadedFileInterface; | |
3 | ||
4 | class SampleUploadedFile implements UploadedFileInterface | |
5 | { | |
6 | public function getStream() | |
7 | { | |
8 | var_dump(__METHOD__); | |
9 | } | |
10 | ||
11 | public function moveTo($targetPath) | |
12 | { | |
13 | var_dump(__METHOD__, $targetPath); | |
14 | } | |
15 | ||
16 | public function getSize() | |
17 | { | |
18 | var_dump(__METHOD__); | |
19 | } | |
20 | ||
21 | public function getError() | |
22 | { | |
23 | var_dump(__METHOD__); | |
24 | } | |
25 | ||
26 | public function getClientFilename() | |
27 | { | |
28 | var_dump(__METHOD__); | |
29 | } | |
30 | ||
31 | public function getClientMediaType() | |
32 | { | |
33 | var_dump(__METHOD__); | |
34 | } | |
35 | } | |
36 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\UploadedFileFactoryInterface; | |
3 | use Psr\Http\Message\UploadedFileInterface; | |
4 | use Psr\Http\Message\StreamInterface; | |
5 | ||
6 | class SampleUploadedFileFactory implements UploadedFileFactoryInterface | |
7 | { | |
8 | public function createUploadedFile( | |
9 | StreamInterface $stream, | |
10 | int $size = null, | |
11 | int $error = \UPLOAD_ERR_OK, | |
12 | string $clientFilename = null, | |
13 | string $clientMediaType = null | |
14 | ): UploadedFileInterface | |
15 | { | |
16 | var_dump(__METHOD__, $stream, $size, $error, $clientFilename, $clientMediaType); | |
17 | return new SampleUploadedFile(); | |
18 | } | |
19 | } | |
20 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\UriInterface; | |
3 | ||
4 | class SampleUri implements UriInterface | |
5 | { | |
6 | public function getScheme() | |
7 | { | |
8 | var_dump(__METHOD__); | |
9 | } | |
10 | ||
11 | public function getAuthority() | |
12 | { | |
13 | var_dump(__METHOD__); | |
14 | } | |
15 | ||
16 | public function getUserInfo() | |
17 | { | |
18 | var_dump(__METHOD__); | |
19 | } | |
20 | ||
21 | public function getHost() | |
22 | { | |
23 | var_dump(__METHOD__); | |
24 | } | |
25 | ||
26 | public function getPort() | |
27 | { | |
28 | var_dump(__METHOD__); | |
29 | } | |
30 | ||
31 | public function getPath() | |
32 | { | |
33 | var_dump(__METHOD__); | |
34 | } | |
35 | ||
36 | public function getQuery() | |
37 | { | |
38 | var_dump(__METHOD__); | |
39 | } | |
40 | ||
41 | public function getFragment() | |
42 | { | |
43 | var_dump(__METHOD__); | |
44 | } | |
45 | ||
46 | public function withScheme($scheme) | |
47 | { | |
48 | var_dump(__METHOD__, $scheme); | |
49 | } | |
50 | ||
51 | public function withUserInfo($user, $password = null) | |
52 | { | |
53 | var_dump(__METHOD__, $user, $password); | |
54 | } | |
55 | ||
56 | public function withHost($host) | |
57 | { | |
58 | var_dump(__METHOD__, $host); | |
59 | } | |
60 | ||
61 | public function withPort($port) | |
62 | { | |
63 | var_dump(__METHOD__, $port); | |
64 | } | |
65 | ||
66 | public function withPath($path) | |
67 | { | |
68 | var_dump(__METHOD__, $path); | |
69 | } | |
70 | ||
71 | public function withQuery($query) | |
72 | { | |
73 | var_dump(__METHOD__, $query); | |
74 | } | |
75 | ||
76 | public function withFragment($fragment) | |
77 | { | |
78 | var_dump(__METHOD__, $fragment); | |
79 | } | |
80 | ||
81 | public function __toString() | |
82 | { | |
83 | var_dump(__METHOD__); | |
84 | return ''; | |
85 | } | |
86 | ||
87 | } | |
88 |
0 | <?php | |
1 | ||
2 | use Psr\Http\Message\UriFactoryInterface; | |
3 | use Psr\Http\Message\UriInterface; | |
4 | ||
5 | class SampleUriFactory implements UriFactoryInterface | |
6 | { | |
7 | public function createUri(string $uri = ''): UriInterface | |
8 | { | |
9 | var_dump(__METHOD__, $uri); | |
10 | return new SampleUri(); | |
11 | } | |
12 | } | |
13 |
0 | --TEST-- | |
1 | Psr\Log\LoggerInterface - Invalid context default value (PHP 7) | |
2 | --SKIPIF-- | |
3 | <?php | |
4 | include 'skip.inc'; | |
5 | if (PHP_VERSION_ID >= 80000) { | |
6 | print "skip Due to version incompatibility"; | |
7 | } | |
8 | ?> | |
9 | --FILE-- | |
10 | <?php | |
11 | $reflectionMethod = new \ReflectionMethod(\Psr\Log\LoggerInterface::class, "emergency"); | |
12 | $reflectionParameter = $reflectionMethod->getParameters()[1]; | |
13 | var_dump($reflectionParameter->isOptional()); | |
14 | var_dump($reflectionParameter->isDefaultValueAvailable()); | |
15 | var_dump($reflectionParameter->getDefaultValue()); | |
16 | --EXPECT-- | |
17 | bool(true) | |
18 | bool(true) | |
19 | array(0) { | |
20 | } | |
21 | --XFAIL-- | |
22 | PHP 7 internal functions cannot have default values reported via reflection |
0 | --TEST-- | |
1 | Psr\Log\LoggerInterface - Invalid context default value (PHP 8) | |
2 | --SKIPIF-- | |
3 | <?php | |
4 | include 'skip.inc'; | |
5 | if (PHP_VERSION_ID < 80000) { | |
6 | print "skip Due to version incompatibility"; | |
7 | } | |
8 | ?> | |
9 | --FILE-- | |
10 | <?php | |
11 | $reflectionMethod = new \ReflectionMethod(\Psr\Log\LoggerInterface::class, "emergency"); | |
12 | $reflectionParameter = $reflectionMethod->getParameters()[1]; | |
13 | var_dump($reflectionParameter->isOptional()); | |
14 | var_dump($reflectionParameter->isDefaultValueAvailable()); | |
15 | var_dump($reflectionParameter->getDefaultValue()); | |
16 | --EXPECT-- | |
17 | bool(true) | |
18 | bool(true) | |
19 | array(0) { | |
20 | } |
0 | --TEST-- | |
1 | psr phpinfo | |
2 | --SKIPIF-- | |
3 | <?php include('skip_lt_php72.inc'); ?> | |
4 | --FILE-- | |
5 | <?php | |
6 | phpinfo(INFO_MODULES); | |
7 | --EXPECTF-- | |
8 | %A | |
9 | psr | |
10 | %A | |
11 | Version => %s | |
12 | Released => %s | |
13 | Authors => %s | |
14 | PSR-3 Log Version => %d.%d.%d | |
15 | PSR-6 Cache Version => %d.%d.%d | |
16 | PSR-7 Http Message Version => %d.%d.%d | |
17 | PSR-11 Container Version => %d.%d.%d | |
18 | PSR-13 Link Version => %d.%d.%d | |
19 | PSR-14 Event Dispatcher => %d.%d.%d | |
20 | PSR-15 HTTP Handlers (Server Handler) => %d.%d.%d | |
21 | PSR-15 HTTP Handlers (Middleware) => %d.%d.%d | |
22 | PSR-16 Simple Cache Version => %d.%d.%d | |
23 | PSR-17 HTTP Factories => %d.%d.%d | |
24 | PSR-18 HTTP Client => %d.%d.%d | |
25 | %A |
0 | --TEST-- | |
1 | psr phpinfo | |
2 | --SKIPIF-- | |
3 | <?php | |
4 | include('skip.inc'); | |
5 | if (PHP_VERSION_ID >= 70200) { | |
6 | print "skip Due to version incompatibility"; | |
7 | } | |
8 | ?> | |
9 | --FILE-- | |
10 | <?php | |
11 | phpinfo(INFO_MODULES); | |
12 | --EXPECTF-- | |
13 | %A | |
14 | psr | |
15 | %A | |
16 | Version => %s | |
17 | Released => %s | |
18 | Authors => %s | |
19 | PSR-3 Log Version => %d.%d.%d | |
20 | PSR-6 Cache Version => %d.%d.%d | |
21 | PSR-7 Http Message Version => %d.%d.%d | |
22 | PSR-11 Container Version => %d.%d.%d | |
23 | PSR-13 Link Version => %d.%d.%d | |
24 | PSR-15 HTTP Handlers (Server Handler) => %d.%d.%d | |
25 | PSR-15 HTTP Handlers (Middleware) => %d.%d.%d | |
26 | PSR-16 Simple Cache Version => %d.%d.%d | |
27 | PSR-17 HTTP Factories => %d.%d.%d | |
28 | PSR-18 HTTP Client => %d.%d.%d | |
29 | %A |