Version Description
09-12-2019 =
Fix - Mollie crash when WooCommerce plugin is not active
Fix - Checkout form does not submit the order at first click on Place Order button when payment method is not one which support Mollie Components
Fix - Minor styles issues for Mollie Components
Download this release
Release Info
Developer | wido |
Plugin | Mollie Payments for WooCommerce |
Version | 5.4.2 |
Comparing to | |
See all releases |
Code changes from version 5.4.1 to 5.4.2
- assets/css/mollie-components.css +5 -0
- assets/js/mollie-components.min.js +1 -1
- inc/woocommerce.php +0 -8
- mollie-payments-for-woocommerce.php +8 -8
- readme.txt +7 -1
- src/Mollie/WC/Gateway/Abstract.php +1 -1
- src/Mollie/WC/Plugin.php +1 -1
- vendor/autoload.php +1 -1
- vendor/composer/autoload_real.php +7 -7
- vendor/composer/autoload_static.php +5 -5
- vendor/composer/ca-bundle/composer.json +54 -0
- vendor/composer/installed.json +5 -5
- vendor/guzzlehttp/guzzle/.php_cs +23 -0
- vendor/guzzlehttp/guzzle/Dockerfile +18 -0
- vendor/guzzlehttp/guzzle/build/Burgomaster.php +0 -385
- vendor/guzzlehttp/guzzle/build/packager.php +0 -27
- vendor/guzzlehttp/guzzle/composer.json +58 -0
- vendor/guzzlehttp/guzzle/phpstan-baseline.neon +230 -0
- vendor/guzzlehttp/guzzle/phpstan.neon.dist +7 -0
- vendor/guzzlehttp/promises/Makefile +13 -0
- vendor/guzzlehttp/promises/composer.json +39 -0
- vendor/guzzlehttp/psr7/composer.json +49 -0
- vendor/psr/http-message/composer.json +26 -0
- vendor/psr/http-message/docs/PSR7-Interfaces.md +130 -0
- vendor/psr/http-message/docs/PSR7-Usage.md +159 -0
assets/css/mollie-components.css
CHANGED
@@ -3,6 +3,10 @@
|
|
3 |
flex-wrap: wrap;
|
4 |
}
|
5 |
|
|
|
|
|
|
|
|
|
6 |
.mollie-components .mollie-component-label {
|
7 |
font-weight: 400;
|
8 |
}
|
@@ -22,6 +26,7 @@
|
|
22 |
|
23 |
.mollie-components .mollie-component iframe {
|
24 |
border-radius: 6px;
|
|
|
25 |
}
|
26 |
|
27 |
.mollie-components div {
|
3 |
flex-wrap: wrap;
|
4 |
}
|
5 |
|
6 |
+
.mollie-components-description svg {
|
7 |
+
display: inline !important;
|
8 |
+
}
|
9 |
+
|
10 |
.mollie-components .mollie-component-label {
|
11 |
font-weight: 400;
|
12 |
}
|
26 |
|
27 |
.mollie-components .mollie-component iframe {
|
28 |
border-radius: 6px;
|
29 |
+
margin: 0;
|
30 |
}
|
31 |
|
32 |
.mollie-components div {
|
assets/js/mollie-components.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=0)}([function(e,n){var t=".cardToken",r=".mollie-components",o="form",c=".wc_payment_methods",a="#mollie-notice";function u(){return!1}function i(e){return e?e.querySelector(c):null}function l(e,n){return n?n.querySelector(".payment_method_mollie_wc_gateway_".concat(e)):null}function s(e){return e?e.querySelector(a):null}function f(e){return e?e.querySelector(r):null}function m(e,n){var t,r,o,c=y(i(document)).parentNode||null,a=s(document),u=(r=(t=n).content,o=t.type,'\n <div id="mollie-notice" class="woocommerce-'.concat(o,'">\n ').concat(r,"\n </div>\n "));a&&a.remove(),c?(c.insertAdjacentHTML("beforebegin",u),function(e){var n=s(document);n||(n=i(document));e.scroll_to_notices(e(n))}(e)):alert(n.content)}function d(e){var n,r,o;return regeneratorRuntime.async((function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,regeneratorRuntime.awrap(e.createToken(t));case 2:if(n=c.sent,r=n.token,!(o=n.error)){c.next=7;break}throw new Error(o.message||"");case 7:return c.abrupt("return",r);case 8:case"end":return c.stop()}}))}function p(e,n){n&&(n.value=e,n.setAttribute("value",e))}function y(e){return e?e.closest(o):null}function b(e){e.off("checkout_place_order",u),e.off("submit",g)}function v(e){var n=l(e,document),t=n?n.querySelector("#payment_method_mollie_wc_gateway_".concat(e)):null;return t&&t.checked||!1}function g(e){var n,r,o,c,a,u,i,l,s,f,g,_,w;return regeneratorRuntime.async((function(h){for(;;)switch(h.prev=h.next){case 0:if(n="",r=e.data,o=r.jQuery,c=r.mollie,a=r.gateway,u=r.gatewayContainer,i=r.messages,l=y(u),s=o(l),f=o(document.body),v(a)){h.next=
|
1 |
+
!function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=0)}([function(e,n){var t=".cardToken",r=".mollie-components",o="form",c=".wc_payment_methods",a="#mollie-notice";function u(){return!1}function i(e){return e?e.querySelector(c):null}function l(e,n){return n?n.querySelector(".payment_method_mollie_wc_gateway_".concat(e)):null}function s(e){return e?e.querySelector(a):null}function f(e){return e?e.querySelector(r):null}function m(e,n){var t,r,o,c=y(i(document)).parentNode||null,a=s(document),u=(r=(t=n).content,o=t.type,'\n <div id="mollie-notice" class="woocommerce-'.concat(o,'">\n ').concat(r,"\n </div>\n "));a&&a.remove(),c?(c.insertAdjacentHTML("beforebegin",u),function(e){var n=s(document);n||(n=i(document));e.scroll_to_notices(e(n))}(e)):alert(n.content)}function d(e){var n,r,o;return regeneratorRuntime.async((function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,regeneratorRuntime.awrap(e.createToken(t));case 2:if(n=c.sent,r=n.token,!(o=n.error)){c.next=7;break}throw new Error(o.message||"");case 7:return c.abrupt("return",r);case 8:case"end":return c.stop()}}))}function p(e,n){n&&(n.value=e,n.setAttribute("value",e))}function y(e){return e?e.closest(o):null}function b(e){e.off("checkout_place_order",u),e.off("submit",g)}function v(e){var n=l(e,document),t=n?n.querySelector("#payment_method_mollie_wc_gateway_".concat(e)):null;return t&&t.checked||!1}function g(e){var n,r,o,c,a,u,i,l,s,f,g,_,w;return regeneratorRuntime.async((function(h){for(;;)switch(h.prev=h.next){case 0:if(n="",r=e.data,o=r.jQuery,c=r.mollie,a=r.gateway,u=r.gatewayContainer,i=r.messages,l=y(u),s=o(l),f=o(document.body),v(a)){h.next=9;break}return b(s),s.submit(),h.abrupt("return");case 9:return e.preventDefault(),e.stopImmediatePropagation(),h.prev=11,h.next=14,regeneratorRuntime.awrap(d(c));case 14:n=h.sent,h.next=24;break;case 17:return h.prev=17,h.t0=h.catch(11),g=h.t0,_=g.message,message=void 0===_?i.defaultErrorMessage:_,(w=g)&&m(o,{content:w,type:"error"}),s.removeClass("processing").unblock(),f.trigger("checkout_error"),h.abrupt("return");case 24:b(s),n&&p(n,u.querySelector(t)),s.submit();case 27:case"end":return h.stop()}}),null,null,[[11,17]])}function _(e,n,t,r,o){t.forEach((function(t){return function(e,n,t,r,o){var c=t.name,a=function(e,n,t,r){var o;return r.has(e)&&(o=r.get(e)),o||(o=n.createComponent(e,t)),o}(c,e,n,r);f(o).insertAdjacentHTML("beforeend",'<div id="'.concat(c,'"></div>')),a.mount("#".concat(c));var u,i,l=(u=c,(i=o)?i.querySelector(".mollie-component--".concat(u)):null);l?(!function(e,n){var t=n.label;e.insertAdjacentHTML("beforebegin",'<b class="mollie-component-label">'.concat(t,"</b>"))}(l,t),function(e,n){var t=n.name;e.insertAdjacentHTML("afterend",'<div role="alert" id="'.concat(t,'-errors"></div>'))}(l,t),!r.has(c)&&r.set(c,a)):console.warn("Component ".concat(c," not found in the DOM. Probably had problem during mount."))}(e,n,t,r,o)}))}!function(e){var n=e._,t=e.Mollie,r=e.mollieComponentsSettings,o=e.jQuery;if(!n.isEmpty(r)&&n.isFunction(t)){var c="updated_checkout",a=new Map,i=o(document),s=r.merchantProfileId,m=r.options,d=r.isCheckoutPayPage,p=new t(s,m);d&&(c="payment_method_selected"),i.on(c,(function(){return function(e,n,t,r){t.options,t.merchantProfileId;var o=t.componentsSettings,c=t.componentsAttributes,a=t.enabledGateways,i=t.messages;!function(e){e.forEach((function(e){return e.unmount()}))}(r),a.forEach((function(t){var a,s=l(t,document),m=f(s),d=y(s),p=e(d);s?d?(b(p),(a=m)&&(a.innerText=""),function(e){e.insertAdjacentHTML("beforeend",'<input type="hidden" name="cardToken" class="cardToken" value="" />')}(m),_(n,o[t],c,r,s),p.on("checkout_place_order",u),p.on("submit",null,{jQuery:e,mollie:n,gateway:t,gatewayContainer:s,messages:i},g)):console.warn("Cannot initialize Mollie Components, no form found."):console.warn("Cannot initialize Mollie Components for gateway ".concat(t,"."))}))}(o,p,r,a)}))}}(window)}]);
|
inc/woocommerce.php
CHANGED
@@ -16,14 +16,6 @@ if (!function_exists('is_order_received_page'))
|
|
16 |
}
|
17 |
}
|
18 |
|
19 |
-
if (!function_exists('wc_date_format'))
|
20 |
-
{
|
21 |
-
function wc_date_format ()
|
22 |
-
{
|
23 |
-
return apply_filters('woocommerce_date_format', get_option('date_format'));
|
24 |
-
}
|
25 |
-
}
|
26 |
-
|
27 |
if (!function_exists('untrailingslashit'))
|
28 |
{
|
29 |
/**
|
16 |
}
|
17 |
}
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
if (!function_exists('untrailingslashit'))
|
20 |
{
|
21 |
/**
|
mollie-payments-for-woocommerce.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Mollie Payments for WooCommerce
|
4 |
* Plugin URI: https://www.mollie.com
|
5 |
* Description: Accept payments in WooCommerce with the official Mollie plugin
|
6 |
-
* Version: 5.4.
|
7 |
* Author: Mollie
|
8 |
* Author URI: https://www.mollie.com
|
9 |
* Requires at least: 3.8
|
@@ -197,14 +197,14 @@ $bootstrap = Closure::bind(
|
|
197 |
add_action('admin_notices', 'mollie_wc_plugin_inactive');
|
198 |
return;
|
199 |
}
|
200 |
-
}
|
201 |
-
);
|
202 |
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
|
|
|
|
208 |
}
|
209 |
);
|
210 |
},
|
3 |
* Plugin Name: Mollie Payments for WooCommerce
|
4 |
* Plugin URI: https://www.mollie.com
|
5 |
* Description: Accept payments in WooCommerce with the official Mollie plugin
|
6 |
+
* Version: 5.4.2
|
7 |
* Author: Mollie
|
8 |
* Author URI: https://www.mollie.com
|
9 |
* Requires at least: 3.8
|
197 |
add_action('admin_notices', 'mollie_wc_plugin_inactive');
|
198 |
return;
|
199 |
}
|
|
|
|
|
200 |
|
201 |
+
add_action(
|
202 |
+
'init',
|
203 |
+
function () {
|
204 |
+
load_plugin_textdomain('mollie-payments-for-woocommerce');
|
205 |
+
Mollie_WC_Plugin::init();
|
206 |
+
}
|
207 |
+
);
|
208 |
}
|
209 |
);
|
210 |
},
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: daanvm, danielhuesken, davdebcom, dinamiko, inpsyde, l.vangunst, n
|
|
3 |
Tags: mollie, payments, payment gateway, woocommerce, credit card, ideal, bancontact, klarna, sofort, giropay, woocommerce subscriptions
|
4 |
Requires at least: 3.8
|
5 |
Tested up to: 5.3
|
6 |
-
Stable tag: 5.4.
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -181,6 +181,12 @@ Automatic updates should work like a charm; as always though, ensure you backup
|
|
181 |
|
182 |
== Changelog ==
|
183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
= 5.4.1 - 05-12-2019 =
|
185 |
|
186 |
* Fix - Mollie Components request multiple times the merchant profile ID via API
|
3 |
Tags: mollie, payments, payment gateway, woocommerce, credit card, ideal, bancontact, klarna, sofort, giropay, woocommerce subscriptions
|
4 |
Requires at least: 3.8
|
5 |
Tested up to: 5.3
|
6 |
+
Stable tag: 5.4.2
|
7 |
Requires PHP: 5.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
181 |
|
182 |
== Changelog ==
|
183 |
|
184 |
+
= 5.4.2 - 09-12-2019 =
|
185 |
+
|
186 |
+
* Fix - Mollie crash when WooCommerce plugin is not active
|
187 |
+
* Fix - Checkout form does not submit the order at first click on Place Order button when payment method is not one which support Mollie Components
|
188 |
+
* Fix - Minor styles issues for Mollie Components
|
189 |
+
|
190 |
= 5.4.1 - 05-12-2019 =
|
191 |
|
192 |
* Fix - Mollie Components request multiple times the merchant profile ID via API
|
src/Mollie/WC/Gateway/Abstract.php
CHANGED
@@ -2055,7 +2055,7 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
|
|
2055 |
|
2056 |
?>
|
2057 |
<div class="mollie-components"></div>
|
2058 |
-
<p>
|
2059 |
<?php
|
2060 |
echo $this->lockIcon();
|
2061 |
esc_html_e('Secure payments provided by ');
|
2055 |
|
2056 |
?>
|
2057 |
<div class="mollie-components"></div>
|
2058 |
+
<p class="mollie-components-description">
|
2059 |
<?php
|
2060 |
echo $this->lockIcon();
|
2061 |
esc_html_e('Secure payments provided by ');
|
src/Mollie/WC/Plugin.php
CHANGED
@@ -8,7 +8,7 @@ class Mollie_WC_Plugin
|
|
8 |
{
|
9 |
const PLUGIN_ID = 'mollie-payments-for-woocommerce';
|
10 |
const PLUGIN_TITLE = 'Mollie Payments for WooCommerce';
|
11 |
-
const PLUGIN_VERSION = '5.4.
|
12 |
|
13 |
const DB_VERSION = '1.0';
|
14 |
const DB_VERSION_PARAM_NAME = 'mollie-db-version';
|
8 |
{
|
9 |
const PLUGIN_ID = 'mollie-payments-for-woocommerce';
|
10 |
const PLUGIN_TITLE = 'Mollie Payments for WooCommerce';
|
11 |
+
const PLUGIN_VERSION = '5.4.2';
|
12 |
|
13 |
const DB_VERSION = '1.0';
|
14 |
const DB_VERSION_PARAM_NAME = 'mollie-db-version';
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit370efe70cdd87ac8963ae1cf674c7eb2::getLoader();
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit822e8679465379306e77c697814f1c55
|
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
-
spl_autoload_register(array('
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
-
spl_autoload_unregister(array('
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
-
call_user_func(\Composer\Autoload\
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
@@ -48,19 +48,19 @@ class ComposerAutoloaderInit822e8679465379306e77c697814f1c55
|
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
-
$includeFiles = Composer\Autoload\
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
-
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
-
function
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit370efe70cdd87ac8963ae1cf674c7eb2
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
19 |
return self::$loader;
|
20 |
}
|
21 |
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit370efe70cdd87ac8963ae1cf674c7eb2', 'loadClassLoader'), true, true);
|
23 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit370efe70cdd87ac8963ae1cf674c7eb2', 'loadClassLoader'));
|
25 |
|
26 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
27 |
if ($useStaticLoader) {
|
28 |
require_once __DIR__ . '/autoload_static.php';
|
29 |
|
30 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit370efe70cdd87ac8963ae1cf674c7eb2::getInitializer($loader));
|
31 |
} else {
|
32 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
33 |
foreach ($map as $namespace => $path) {
|
48 |
$loader->register(true);
|
49 |
|
50 |
if ($useStaticLoader) {
|
51 |
+
$includeFiles = Composer\Autoload\ComposerStaticInit370efe70cdd87ac8963ae1cf674c7eb2::$files;
|
52 |
} else {
|
53 |
$includeFiles = require __DIR__ . '/autoload_files.php';
|
54 |
}
|
55 |
foreach ($includeFiles as $fileIdentifier => $file) {
|
56 |
+
composerRequire370efe70cdd87ac8963ae1cf674c7eb2($fileIdentifier, $file);
|
57 |
}
|
58 |
|
59 |
return $loader;
|
60 |
}
|
61 |
}
|
62 |
|
63 |
+
function composerRequire370efe70cdd87ac8963ae1cf674c7eb2($fileIdentifier, $file)
|
64 |
{
|
65 |
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
66 |
require $file;
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
|
@@ -286,10 +286,10 @@ class ComposerStaticInit822e8679465379306e77c697814f1c55
|
|
286 |
public static function getInitializer(ClassLoader $loader)
|
287 |
{
|
288 |
return \Closure::bind(function () use ($loader) {
|
289 |
-
$loader->prefixLengthsPsr4 =
|
290 |
-
$loader->prefixDirsPsr4 =
|
291 |
-
$loader->prefixesPsr0 =
|
292 |
-
$loader->classMap =
|
293 |
|
294 |
}, null, ClassLoader::class);
|
295 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit370efe70cdd87ac8963ae1cf674c7eb2
|
8 |
{
|
9 |
public static $files = array (
|
10 |
'7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
|
286 |
public static function getInitializer(ClassLoader $loader)
|
287 |
{
|
288 |
return \Closure::bind(function () use ($loader) {
|
289 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit370efe70cdd87ac8963ae1cf674c7eb2::$prefixLengthsPsr4;
|
290 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit370efe70cdd87ac8963ae1cf674c7eb2::$prefixDirsPsr4;
|
291 |
+
$loader->prefixesPsr0 = ComposerStaticInit370efe70cdd87ac8963ae1cf674c7eb2::$prefixesPsr0;
|
292 |
+
$loader->classMap = ComposerStaticInit370efe70cdd87ac8963ae1cf674c7eb2::$classMap;
|
293 |
|
294 |
}, null, ClassLoader::class);
|
295 |
}
|
vendor/composer/ca-bundle/composer.json
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "composer/ca-bundle",
|
3 |
+
"description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.",
|
4 |
+
"type": "library",
|
5 |
+
"license": "MIT",
|
6 |
+
"keywords": [
|
7 |
+
"cabundle",
|
8 |
+
"cacert",
|
9 |
+
"certificate",
|
10 |
+
"ssl",
|
11 |
+
"tls"
|
12 |
+
],
|
13 |
+
"authors": [
|
14 |
+
{
|
15 |
+
"name": "Jordi Boggiano",
|
16 |
+
"email": "j.boggiano@seld.be",
|
17 |
+
"homepage": "http://seld.be"
|
18 |
+
}
|
19 |
+
],
|
20 |
+
"support": {
|
21 |
+
"irc": "irc://irc.freenode.org/composer",
|
22 |
+
"issues": "https://github.com/composer/ca-bundle/issues"
|
23 |
+
},
|
24 |
+
"require": {
|
25 |
+
"ext-openssl": "*",
|
26 |
+
"ext-pcre": "*",
|
27 |
+
"php": "^5.3.2 || ^7.0 || ^8.0"
|
28 |
+
},
|
29 |
+
"require-dev": {
|
30 |
+
"phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8",
|
31 |
+
"psr/log": "^1.0",
|
32 |
+
"symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0"
|
33 |
+
},
|
34 |
+
"autoload": {
|
35 |
+
"psr-4": {
|
36 |
+
"Composer\\CaBundle\\": "src"
|
37 |
+
}
|
38 |
+
},
|
39 |
+
"autoload-dev": {
|
40 |
+
"psr-4": {
|
41 |
+
"Composer\\CaBundle\\": "tests"
|
42 |
+
}
|
43 |
+
},
|
44 |
+
"extra": {
|
45 |
+
"branch-alias": {
|
46 |
+
"dev-master": "1.x-dev"
|
47 |
+
}
|
48 |
+
},
|
49 |
+
"config": {
|
50 |
+
"platform": {
|
51 |
+
"php": "5.3.9"
|
52 |
+
}
|
53 |
+
}
|
54 |
+
}
|
vendor/composer/installed.json
CHANGED
@@ -31,7 +31,7 @@
|
|
31 |
"dev-master": "1.x-dev"
|
32 |
}
|
33 |
},
|
34 |
-
"installation-source": "
|
35 |
"autoload": {
|
36 |
"psr-4": {
|
37 |
"Composer\\CaBundle\\": "src"
|
@@ -93,7 +93,7 @@
|
|
93 |
"dev-master": "6.5-dev"
|
94 |
}
|
95 |
},
|
96 |
-
"installation-source": "
|
97 |
"autoload": {
|
98 |
"psr-4": {
|
99 |
"GuzzleHttp\\": "src/"
|
@@ -153,7 +153,7 @@
|
|
153 |
"dev-master": "1.4-dev"
|
154 |
}
|
155 |
},
|
156 |
-
"installation-source": "
|
157 |
"autoload": {
|
158 |
"psr-4": {
|
159 |
"GuzzleHttp\\Promise\\": "src/"
|
@@ -215,7 +215,7 @@
|
|
215 |
"dev-master": "1.6-dev"
|
216 |
}
|
217 |
},
|
218 |
-
"installation-source": "
|
219 |
"autoload": {
|
220 |
"psr-4": {
|
221 |
"GuzzleHttp\\Psr7\\": "src/"
|
@@ -364,7 +364,7 @@
|
|
364 |
"dev-master": "1.0.x-dev"
|
365 |
}
|
366 |
},
|
367 |
-
"installation-source": "
|
368 |
"autoload": {
|
369 |
"psr-4": {
|
370 |
"Psr\\Http\\Message\\": "src/"
|
31 |
"dev-master": "1.x-dev"
|
32 |
}
|
33 |
},
|
34 |
+
"installation-source": "dist",
|
35 |
"autoload": {
|
36 |
"psr-4": {
|
37 |
"Composer\\CaBundle\\": "src"
|
93 |
"dev-master": "6.5-dev"
|
94 |
}
|
95 |
},
|
96 |
+
"installation-source": "dist",
|
97 |
"autoload": {
|
98 |
"psr-4": {
|
99 |
"GuzzleHttp\\": "src/"
|
153 |
"dev-master": "1.4-dev"
|
154 |
}
|
155 |
},
|
156 |
+
"installation-source": "dist",
|
157 |
"autoload": {
|
158 |
"psr-4": {
|
159 |
"GuzzleHttp\\Promise\\": "src/"
|
215 |
"dev-master": "1.6-dev"
|
216 |
}
|
217 |
},
|
218 |
+
"installation-source": "dist",
|
219 |
"autoload": {
|
220 |
"psr-4": {
|
221 |
"GuzzleHttp\\Psr7\\": "src/"
|
364 |
"dev-master": "1.0.x-dev"
|
365 |
}
|
366 |
},
|
367 |
+
"installation-source": "dist",
|
368 |
"autoload": {
|
369 |
"psr-4": {
|
370 |
"Psr\\Http\\Message\\": "src/"
|
vendor/guzzlehttp/guzzle/.php_cs
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$config = PhpCsFixer\Config::create()
|
4 |
+
->setRiskyAllowed(true)
|
5 |
+
->setRules([
|
6 |
+
'@PSR2' => true,
|
7 |
+
'array_syntax' => ['syntax' => 'short'],
|
8 |
+
'declare_strict_types' => false,
|
9 |
+
'concat_space' => ['spacing'=>'one'],
|
10 |
+
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
|
11 |
+
'ordered_imports' => true,
|
12 |
+
// 'phpdoc_align' => ['align'=>'vertical'],
|
13 |
+
// 'native_function_invocation' => true,
|
14 |
+
])
|
15 |
+
->setFinder(
|
16 |
+
PhpCsFixer\Finder::create()
|
17 |
+
->in(__DIR__.'/src')
|
18 |
+
->in(__DIR__.'/tests')
|
19 |
+
->name('*.php')
|
20 |
+
)
|
21 |
+
;
|
22 |
+
|
23 |
+
return $config;
|
vendor/guzzlehttp/guzzle/Dockerfile
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM composer:latest as setup
|
2 |
+
|
3 |
+
RUN mkdir /guzzle
|
4 |
+
|
5 |
+
WORKDIR /guzzle
|
6 |
+
|
7 |
+
RUN set -xe \
|
8 |
+
&& composer init --name=guzzlehttp/test --description="Simple project for testing Guzzle scripts" --author="Márk Sági-Kazár <mark.sagikazar@gmail.com>" --no-interaction \
|
9 |
+
&& composer require guzzlehttp/guzzle
|
10 |
+
|
11 |
+
|
12 |
+
FROM php:7.3
|
13 |
+
|
14 |
+
RUN mkdir /guzzle
|
15 |
+
|
16 |
+
WORKDIR /guzzle
|
17 |
+
|
18 |
+
COPY --from=setup /guzzle /guzzle
|
vendor/guzzlehttp/guzzle/build/Burgomaster.php
DELETED
@@ -1,385 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Packages the zip and phar file using a staging directory.
|
5 |
-
*
|
6 |
-
* @license MIT, Michael Dowling https://github.com/mtdowling
|
7 |
-
* @license https://github.com/mtdowling/Burgomaster/LICENSE
|
8 |
-
*/
|
9 |
-
class Burgomaster
|
10 |
-
{
|
11 |
-
/** @var string Base staging directory of the project */
|
12 |
-
public $stageDir;
|
13 |
-
|
14 |
-
/** @var string Root directory of the project */
|
15 |
-
public $projectRoot;
|
16 |
-
|
17 |
-
/** @var array stack of sections */
|
18 |
-
private $sections = array();
|
19 |
-
|
20 |
-
/**
|
21 |
-
* @param string $stageDir Staging base directory where your packaging
|
22 |
-
* takes place. This folder will be created for
|
23 |
-
* you if it does not exist. If it exists, it
|
24 |
-
* will be deleted and recreated to start fresh.
|
25 |
-
* @param string $projectRoot Root directory of the project.
|
26 |
-
*
|
27 |
-
* @throws \InvalidArgumentException
|
28 |
-
* @throws \RuntimeException
|
29 |
-
*/
|
30 |
-
public function __construct($stageDir, $projectRoot = null)
|
31 |
-
{
|
32 |
-
$this->startSection('setting_up');
|
33 |
-
$this->stageDir = $stageDir;
|
34 |
-
$this->projectRoot = $projectRoot;
|
35 |
-
|
36 |
-
if (!$this->stageDir || $this->stageDir == '/') {
|
37 |
-
throw new \InvalidArgumentException('Invalid base directory');
|
38 |
-
}
|
39 |
-
|
40 |
-
if (is_dir($this->stageDir)) {
|
41 |
-
$this->debug("Removing existing directory: $this->stageDir");
|
42 |
-
echo $this->exec("rm -rf $this->stageDir");
|
43 |
-
}
|
44 |
-
|
45 |
-
$this->debug("Creating staging directory: $this->stageDir");
|
46 |
-
|
47 |
-
if (!mkdir($this->stageDir, 0777, true)) {
|
48 |
-
throw new \RuntimeException("Could not create {$this->stageDir}");
|
49 |
-
}
|
50 |
-
|
51 |
-
$this->stageDir = realpath($this->stageDir);
|
52 |
-
$this->debug("Creating staging directory at: {$this->stageDir}");
|
53 |
-
|
54 |
-
if (!is_dir($this->projectRoot)) {
|
55 |
-
throw new \InvalidArgumentException(
|
56 |
-
"Project root not found: $this->projectRoot"
|
57 |
-
);
|
58 |
-
}
|
59 |
-
|
60 |
-
$this->endSection();
|
61 |
-
$this->startSection('staging');
|
62 |
-
|
63 |
-
chdir($this->projectRoot);
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Cleanup if the last section was not already closed.
|
68 |
-
*/
|
69 |
-
public function __destruct()
|
70 |
-
{
|
71 |
-
if ($this->sections) {
|
72 |
-
$this->endSection();
|
73 |
-
}
|
74 |
-
}
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Call this method when starting a specific section of the packager.
|
78 |
-
*
|
79 |
-
* This makes the debug messages used in your script more meaningful and
|
80 |
-
* adds context when things go wrong. Be sure to call endSection() when
|
81 |
-
* you have finished a section of your packaging script.
|
82 |
-
*
|
83 |
-
* @param string $section Part of the packager that is running
|
84 |
-
*/
|
85 |
-
public function startSection($section)
|
86 |
-
{
|
87 |
-
$this->sections[] = $section;
|
88 |
-
$this->debug('Starting');
|
89 |
-
}
|
90 |
-
|
91 |
-
/**
|
92 |
-
* Call this method when leaving the last pushed section of the packager.
|
93 |
-
*/
|
94 |
-
public function endSection()
|
95 |
-
{
|
96 |
-
if ($this->sections) {
|
97 |
-
$this->debug('Completed');
|
98 |
-
array_pop($this->sections);
|
99 |
-
}
|
100 |
-
}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Prints a debug message to STDERR bound to the current section.
|
104 |
-
*
|
105 |
-
* @param string $message Message to echo to STDERR
|
106 |
-
*/
|
107 |
-
public function debug($message)
|
108 |
-
{
|
109 |
-
$prefix = date('c') . ': ';
|
110 |
-
|
111 |
-
if ($this->sections) {
|
112 |
-
$prefix .= '[' . end($this->sections) . '] ';
|
113 |
-
}
|
114 |
-
|
115 |
-
fwrite(STDERR, $prefix . $message . "\n");
|
116 |
-
}
|
117 |
-
|
118 |
-
/**
|
119 |
-
* Copies a file and creates the destination directory if needed.
|
120 |
-
*
|
121 |
-
* @param string $from File to copy
|
122 |
-
* @param string $to Destination to copy the file to, relative to the
|
123 |
-
* base staging directory.
|
124 |
-
* @throws \InvalidArgumentException if the file cannot be found
|
125 |
-
* @throws \RuntimeException if the directory cannot be created.
|
126 |
-
* @throws \RuntimeException if the file cannot be copied.
|
127 |
-
*/
|
128 |
-
public function deepCopy($from, $to)
|
129 |
-
{
|
130 |
-
if (!is_file($from)) {
|
131 |
-
throw new \InvalidArgumentException("File not found: {$from}");
|
132 |
-
}
|
133 |
-
|
134 |
-
$to = str_replace('//', '/', $this->stageDir . '/' . $to);
|
135 |
-
$dir = dirname($to);
|
136 |
-
|
137 |
-
if (!is_dir($dir)) {
|
138 |
-
if (!mkdir($dir, 0777, true)) {
|
139 |
-
throw new \RuntimeException("Unable to create directory: $dir");
|
140 |
-
}
|
141 |
-
}
|
142 |
-
|
143 |
-
if (!copy($from, $to)) {
|
144 |
-
throw new \RuntimeException("Unable to copy $from to $to");
|
145 |
-
}
|
146 |
-
}
|
147 |
-
|
148 |
-
/**
|
149 |
-
* Recursively copy one folder to another.
|
150 |
-
*
|
151 |
-
* Any LICENSE file is automatically copied.
|
152 |
-
*
|
153 |
-
* @param string $sourceDir Source directory to copy from
|
154 |
-
* @param string $destDir Directory to copy the files to that is relative
|
155 |
-
* to the the stage base directory.
|
156 |
-
* @param array $extensions File extensions to copy from the $sourceDir.
|
157 |
-
* Defaults to "php" files only (e.g., ['php']).
|
158 |
-
* @throws \InvalidArgumentException if the source directory is invalid.
|
159 |
-
*/
|
160 |
-
public function recursiveCopy(
|
161 |
-
$sourceDir,
|
162 |
-
$destDir,
|
163 |
-
$extensions = array('php')
|
164 |
-
) {
|
165 |
-
if (!realpath($sourceDir)) {
|
166 |
-
throw new \InvalidArgumentException("$sourceDir not found");
|
167 |
-
}
|
168 |
-
|
169 |
-
if (!$extensions) {
|
170 |
-
throw new \InvalidArgumentException('$extensions is empty!');
|
171 |
-
}
|
172 |
-
|
173 |
-
$sourceDir = realpath($sourceDir);
|
174 |
-
$exts = array_fill_keys($extensions, true);
|
175 |
-
$iter = new \RecursiveDirectoryIterator($sourceDir);
|
176 |
-
$iter = new \RecursiveIteratorIterator($iter);
|
177 |
-
$total = 0;
|
178 |
-
|
179 |
-
$this->startSection('copy');
|
180 |
-
$this->debug("Starting to copy files from $sourceDir");
|
181 |
-
|
182 |
-
foreach ($iter as $file) {
|
183 |
-
if (isset($exts[$file->getExtension()])
|
184 |
-
|| $file->getBaseName() == 'LICENSE'
|
185 |
-
) {
|
186 |
-
// Remove the source directory from the destination path
|
187 |
-
$toPath = str_replace($sourceDir, '', (string) $file);
|
188 |
-
$toPath = $destDir . '/' . $toPath;
|
189 |
-
$toPath = str_replace('//', '/', $toPath);
|
190 |
-
$this->deepCopy((string) $file, $toPath);
|
191 |
-
$total++;
|
192 |
-
}
|
193 |
-
}
|
194 |
-
|
195 |
-
$this->debug("Copied $total files from $sourceDir");
|
196 |
-
$this->endSection();
|
197 |
-
}
|
198 |
-
|
199 |
-
/**
|
200 |
-
* Execute a command and throw an exception if the return code is not 0.
|
201 |
-
*
|
202 |
-
* @param string $command Command to execute
|
203 |
-
*
|
204 |
-
* @return string Returns the output of the command as a string
|
205 |
-
* @throws \RuntimeException on error.
|
206 |
-
*/
|
207 |
-
public function exec($command)
|
208 |
-
{
|
209 |
-
$this->debug("Executing: $command");
|
210 |
-
$output = $returnValue = null;
|
211 |
-
exec($command, $output, $returnValue);
|
212 |
-
|
213 |
-
if ($returnValue != 0) {
|
214 |
-
throw new \RuntimeException('Error executing command: '
|
215 |
-
. $command . ' : ' . implode("\n", $output));
|
216 |
-
}
|
217 |
-
|
218 |
-
return implode("\n", $output);
|
219 |
-
}
|
220 |
-
|
221 |
-
/**
|
222 |
-
* Creates a class-map autoloader to the staging directory in a file
|
223 |
-
* named autoloader.php
|
224 |
-
*
|
225 |
-
* @param array $files Files to explicitly require in the autoloader. This
|
226 |
-
* is similar to Composer's "files" "autoload" section.
|
227 |
-
* @param string $filename Name of the autoloader file.
|
228 |
-
* @throws \RuntimeException if the file cannot be written
|
229 |
-
*/
|
230 |
-
public function createAutoloader($files = array(), $filename = 'autoloader.php')
|
231 |
-
{
|
232 |
-
$sourceDir = realpath($this->stageDir);
|
233 |
-
$iter = new \RecursiveDirectoryIterator($sourceDir);
|
234 |
-
$iter = new \RecursiveIteratorIterator($iter);
|
235 |
-
|
236 |
-
$this->startSection('autoloader');
|
237 |
-
$this->debug('Creating classmap autoloader');
|
238 |
-
$this->debug("Collecting valid PHP files from {$this->stageDir}");
|
239 |
-
|
240 |
-
$classMap = array();
|
241 |
-
foreach ($iter as $file) {
|
242 |
-
if ($file->getExtension() == 'php') {
|
243 |
-
$location = str_replace($this->stageDir . '/', '', (string) $file);
|
244 |
-
$className = str_replace('/', '\\', $location);
|
245 |
-
$className = substr($className, 0, -4);
|
246 |
-
|
247 |
-
// Remove "src\" or "lib\"
|
248 |
-
if (strpos($className, 'src\\') === 0
|
249 |
-
|| strpos($className, 'lib\\') === 0
|
250 |
-
) {
|
251 |
-
$className = substr($className, 4);
|
252 |
-
}
|
253 |
-
|
254 |
-
$classMap[$className] = "__DIR__ . '/$location'";
|
255 |
-
$this->debug("Found $className");
|
256 |
-
}
|
257 |
-
}
|
258 |
-
|
259 |
-
$destFile = $this->stageDir . '/' . $filename;
|
260 |
-
$this->debug("Writing autoloader to {$destFile}");
|
261 |
-
|
262 |
-
if (!($h = fopen($destFile, 'w'))) {
|
263 |
-
throw new \RuntimeException('Unable to open file for writing');
|
264 |
-
}
|
265 |
-
|
266 |
-
$this->debug('Writing classmap files');
|
267 |
-
fwrite($h, "<?php\n\n");
|
268 |
-
fwrite($h, "\$mapping = array(\n");
|
269 |
-
foreach ($classMap as $c => $f) {
|
270 |
-
fwrite($h, " '$c' => $f,\n");
|
271 |
-
}
|
272 |
-
fwrite($h, ");\n\n");
|
273 |
-
fwrite($h, <<<EOT
|
274 |
-
spl_autoload_register(function (\$class) use (\$mapping) {
|
275 |
-
if (isset(\$mapping[\$class])) {
|
276 |
-
require \$mapping[\$class];
|
277 |
-
}
|
278 |
-
}, true);
|
279 |
-
|
280 |
-
EOT
|
281 |
-
);
|
282 |
-
|
283 |
-
fwrite($h, "\n");
|
284 |
-
|
285 |
-
$this->debug('Writing automatically included files');
|
286 |
-
foreach ($files as $file) {
|
287 |
-
fwrite($h, "require __DIR__ . '/$file';\n");
|
288 |
-
}
|
289 |
-
|
290 |
-
fclose($h);
|
291 |
-
|
292 |
-
$this->endSection();
|
293 |
-
}
|
294 |
-
|
295 |
-
/**
|
296 |
-
* Creates a default stub for the phar that includeds the generated
|
297 |
-
* autoloader.
|
298 |
-
*
|
299 |
-
* This phar also registers a constant that can be used to check if you
|
300 |
-
* are running the phar. The constant is the basename of the $dest variable
|
301 |
-
* without the extension, with "_PHAR" appended, then converted to all
|
302 |
-
* caps (e.g., "/foo/guzzle.phar" gets a contant defined as GUZZLE_PHAR.
|
303 |
-
*
|
304 |
-
* @param $dest
|
305 |
-
* @param string $autoloaderFilename Name of the autoloader file.
|
306 |
-
*
|
307 |
-
* @return string
|
308 |
-
*/
|
309 |
-
private function createStub($dest, $autoloaderFilename = 'autoloader.php')
|
310 |
-
{
|
311 |
-
$this->startSection('stub');
|
312 |
-
$this->debug("Creating phar stub at $dest");
|
313 |
-
|
314 |
-
$alias = basename($dest);
|
315 |
-
$constName = str_replace('.phar', '', strtoupper($alias)) . '_PHAR';
|
316 |
-
$stub = "<?php\n";
|
317 |
-
$stub .= "define('$constName', true);\n";
|
318 |
-
$stub .= "require 'phar://$alias/{$autoloaderFilename}';\n";
|
319 |
-
$stub .= "__HALT_COMPILER();\n";
|
320 |
-
$this->endSection();
|
321 |
-
|
322 |
-
return $stub;
|
323 |
-
}
|
324 |
-
|
325 |
-
/**
|
326 |
-
* Creates a phar that automatically registers an autoloader.
|
327 |
-
*
|
328 |
-
* Call this only after your staging directory is built.
|
329 |
-
*
|
330 |
-
* @param string $dest Where to save the file. The basename of the file
|
331 |
-
* is also used as the alias name in the phar
|
332 |
-
* (e.g., /path/to/guzzle.phar => guzzle.phar).
|
333 |
-
* @param string|bool|null $stub The path to the phar stub file. Pass or
|
334 |
-
* leave null to automatically have one created for you. Pass false
|
335 |
-
* to no use a stub in the generated phar.
|
336 |
-
* @param string $autoloaderFilename Name of the autolaoder filename.
|
337 |
-
*/
|
338 |
-
public function createPhar(
|
339 |
-
$dest,
|
340 |
-
$stub = null,
|
341 |
-
$autoloaderFilename = 'autoloader.php'
|
342 |
-
) {
|
343 |
-
$this->startSection('phar');
|
344 |
-
$this->debug("Creating phar file at $dest");
|
345 |
-
$this->createDirIfNeeded(dirname($dest));
|
346 |
-
$phar = new \Phar($dest, 0, basename($dest));
|
347 |
-
$phar->buildFromDirectory($this->stageDir);
|
348 |
-
|
349 |
-
if ($stub !== false) {
|
350 |
-
if (!$stub) {
|
351 |
-
$stub = $this->createStub($dest, $autoloaderFilename);
|
352 |
-
}
|
353 |
-
$phar->setStub($stub);
|
354 |
-
}
|
355 |
-
|
356 |
-
$this->debug("Created phar at $dest");
|
357 |
-
$this->endSection();
|
358 |
-
}
|
359 |
-
|
360 |
-
/**
|
361 |
-
* Creates a zip file containing the staged files of your project.
|
362 |
-
*
|
363 |
-
* Call this only after your staging directory is built.
|
364 |
-
*
|
365 |
-
* @param string $dest Where to save the zip file
|
366 |
-
*/
|
367 |
-
public function createZip($dest)
|
368 |
-
{
|
369 |
-
$this->startSection('zip');
|
370 |
-
$this->debug("Creating a zip file at $dest");
|
371 |
-
$this->createDirIfNeeded(dirname($dest));
|
372 |
-
chdir($this->stageDir);
|
373 |
-
$this->exec("zip -r $dest ./");
|
374 |
-
$this->debug(" > Created at $dest");
|
375 |
-
chdir(__DIR__);
|
376 |
-
$this->endSection();
|
377 |
-
}
|
378 |
-
|
379 |
-
private function createDirIfNeeded($dir)
|
380 |
-
{
|
381 |
-
if (!is_dir($dir) && !mkdir($dir, 0755, true)) {
|
382 |
-
throw new \RuntimeException("Could not create dir: $dir");
|
383 |
-
}
|
384 |
-
}
|
385 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/build/packager.php
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
require __DIR__ . '/Burgomaster.php';
|
3 |
-
|
4 |
-
$stageDirectory = __DIR__ . '/artifacts/staging';
|
5 |
-
$projectRoot = __DIR__ . '/../';
|
6 |
-
$packager = new \Burgomaster($stageDirectory, $projectRoot);
|
7 |
-
|
8 |
-
// Copy basic files to the stage directory. Note that we have chdir'd onto
|
9 |
-
// the $projectRoot directory, so use relative paths.
|
10 |
-
foreach (['README.md', 'LICENSE'] as $file) {
|
11 |
-
$packager->deepCopy($file, $file);
|
12 |
-
}
|
13 |
-
|
14 |
-
// Copy each dependency to the staging directory. Copy *.php and *.pem files.
|
15 |
-
$packager->recursiveCopy('src', 'GuzzleHttp', ['php']);
|
16 |
-
$packager->recursiveCopy('vendor/guzzlehttp/promises/src', 'GuzzleHttp/Promise');
|
17 |
-
$packager->recursiveCopy('vendor/guzzlehttp/psr7/src', 'GuzzleHttp/Psr7');
|
18 |
-
$packager->recursiveCopy('vendor/psr/http-message/src', 'Psr/Http/Message');
|
19 |
-
|
20 |
-
$packager->createAutoloader([
|
21 |
-
'GuzzleHttp/functions_include.php',
|
22 |
-
'GuzzleHttp/Psr7/functions_include.php',
|
23 |
-
'GuzzleHttp/Promise/functions_include.php',
|
24 |
-
]);
|
25 |
-
|
26 |
-
$packager->createPhar(__DIR__ . '/artifacts/guzzle.phar');
|
27 |
-
$packager->createZip(__DIR__ . '/artifacts/guzzle.zip');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vendor/guzzlehttp/guzzle/composer.json
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "guzzlehttp/guzzle",
|
3 |
+
"type": "library",
|
4 |
+
"description": "Guzzle is a PHP HTTP client library",
|
5 |
+
"keywords": [
|
6 |
+
"framework",
|
7 |
+
"http",
|
8 |
+
"rest",
|
9 |
+
"web service",
|
10 |
+
"curl",
|
11 |
+
"client",
|
12 |
+
"HTTP client"
|
13 |
+
],
|
14 |
+
"homepage": "http://guzzlephp.org/",
|
15 |
+
"license": "MIT",
|
16 |
+
"authors": [
|
17 |
+
{
|
18 |
+
"name": "Michael Dowling",
|
19 |
+
"email": "mtdowling@gmail.com",
|
20 |
+
"homepage": "https://github.com/mtdowling"
|
21 |
+
}
|
22 |
+
],
|
23 |
+
"require": {
|
24 |
+
"php": ">=5.5",
|
25 |
+
"ext-json": "*",
|
26 |
+
"guzzlehttp/promises": "^1.0",
|
27 |
+
"guzzlehttp/psr7": "^1.6.1"
|
28 |
+
},
|
29 |
+
"require-dev": {
|
30 |
+
"ext-curl": "*",
|
31 |
+
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
|
32 |
+
"psr/log": "^1.1"
|
33 |
+
},
|
34 |
+
"suggest": {
|
35 |
+
"psr/log": "Required for using the Log middleware"
|
36 |
+
},
|
37 |
+
"config": {
|
38 |
+
"sort-packages": true
|
39 |
+
},
|
40 |
+
"extra": {
|
41 |
+
"branch-alias": {
|
42 |
+
"dev-master": "6.5-dev"
|
43 |
+
}
|
44 |
+
},
|
45 |
+
"autoload": {
|
46 |
+
"psr-4": {
|
47 |
+
"GuzzleHttp\\": "src/"
|
48 |
+
},
|
49 |
+
"files": [
|
50 |
+
"src/functions_include.php"
|
51 |
+
]
|
52 |
+
},
|
53 |
+
"autoload-dev": {
|
54 |
+
"psr-4": {
|
55 |
+
"GuzzleHttp\\Tests\\": "tests/"
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
vendor/guzzlehttp/guzzle/phpstan-baseline.neon
ADDED
@@ -0,0 +1,230 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
parameters:
|
4 |
+
ignoreErrors:
|
5 |
+
-
|
6 |
+
message: "#^Method GuzzleHttp\\\\Client\\:\\:__call\\(\\) should return GuzzleHttp\\\\Promise\\\\PromiseInterface but returns GuzzleHttp\\\\PromiseInterface\\|Psr\\\\Http\\\\Message\\\\ResponseInterface\\.$#"
|
7 |
+
count: 1
|
8 |
+
path: src/Client.php
|
9 |
+
|
10 |
+
-
|
11 |
+
message: "#^Return typehint of method GuzzleHttp\\\\Client\\:\\:sendAsync\\(\\) has invalid type GuzzleHttp\\\\PromiseInterface\\.$#"
|
12 |
+
count: 1
|
13 |
+
path: src/Client.php
|
14 |
+
|
15 |
+
-
|
16 |
+
message: "#^Method GuzzleHttp\\\\Client\\:\\:sendAsync\\(\\) should return GuzzleHttp\\\\PromiseInterface but returns GuzzleHttp\\\\Promise\\\\PromiseInterface\\.$#"
|
17 |
+
count: 1
|
18 |
+
path: src/Client.php
|
19 |
+
|
20 |
+
-
|
21 |
+
message: "#^PHPDoc tag @throws with type GuzzleHttp\\\\GuzzleException is not subtype of Throwable$#"
|
22 |
+
count: 2
|
23 |
+
path: src/Client.php
|
24 |
+
|
25 |
+
-
|
26 |
+
message: "#^Call to method wait\\(\\) on an unknown class GuzzleHttp\\\\PromiseInterface\\.$#"
|
27 |
+
count: 2
|
28 |
+
path: src/Client.php
|
29 |
+
|
30 |
+
-
|
31 |
+
message: "#^Return typehint of method GuzzleHttp\\\\Client\\:\\:requestAsync\\(\\) has invalid type GuzzleHttp\\\\PromiseInterface\\.$#"
|
32 |
+
count: 1
|
33 |
+
path: src/Client.php
|
34 |
+
|
35 |
+
-
|
36 |
+
message: "#^Method GuzzleHttp\\\\Client\\:\\:requestAsync\\(\\) should return GuzzleHttp\\\\PromiseInterface but returns GuzzleHttp\\\\Promise\\\\PromiseInterface\\.$#"
|
37 |
+
count: 1
|
38 |
+
path: src/Client.php
|
39 |
+
|
40 |
+
-
|
41 |
+
message: "#^Parameter \\#1 \\$str of function strtolower expects string, int\\|string given\\.$#"
|
42 |
+
count: 1
|
43 |
+
path: src/Client.php
|
44 |
+
|
45 |
+
-
|
46 |
+
message: "#^Parameter \\#2 \\$prefix of function http_build_query expects string, null given\\.$#"
|
47 |
+
count: 1
|
48 |
+
path: src/Client.php
|
49 |
+
|
50 |
+
-
|
51 |
+
message: "#^PHPDoc tag @throws with type GuzzleHttp\\\\InvalidArgumentException is not subtype of Throwable$#"
|
52 |
+
count: 1
|
53 |
+
path: src/Client.php
|
54 |
+
|
55 |
+
-
|
56 |
+
message: "#^Result of \\|\\| is always false\\.$#"
|
57 |
+
count: 1
|
58 |
+
path: src/Cookie/CookieJar.php
|
59 |
+
|
60 |
+
-
|
61 |
+
message: "#^Strict comparison using \\=\\=\\= between string and null will always evaluate to false\\.$#"
|
62 |
+
count: 2
|
63 |
+
path: src/Cookie/CookieJar.php
|
64 |
+
|
65 |
+
-
|
66 |
+
message: "#^Method GuzzleHttp\\\\Cookie\\\\CookieJar\\:\\:clear\\(\\) should return GuzzleHttp\\\\Cookie\\\\CookieJarInterface but empty return statement found\\.$#"
|
67 |
+
count: 1
|
68 |
+
path: src/Cookie/CookieJar.php
|
69 |
+
|
70 |
+
-
|
71 |
+
message: "#^Parameter \\#3 \\$length of function substr expects int, int\\|false given\\.$#"
|
72 |
+
count: 1
|
73 |
+
path: src/Cookie/CookieJar.php
|
74 |
+
|
75 |
+
-
|
76 |
+
message: "#^Property GuzzleHttp\\\\Cookie\\\\SetCookie\\:\\:\\$data \\(array\\) does not accept array\\|null\\.$#"
|
77 |
+
count: 1
|
78 |
+
path: src/Cookie/SetCookie.php
|
79 |
+
|
80 |
+
-
|
81 |
+
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
|
82 |
+
count: 1
|
83 |
+
path: src/Cookie/SetCookie.php
|
84 |
+
|
85 |
+
-
|
86 |
+
message: "#^Parameter \\#1 \\$str of function ltrim expects string, string\\|null given\\.$#"
|
87 |
+
count: 1
|
88 |
+
path: src/Cookie/SetCookie.php
|
89 |
+
|
90 |
+
-
|
91 |
+
message: "#^Negated boolean expression is always false\\.$#"
|
92 |
+
count: 1
|
93 |
+
path: src/Handler/CurlFactory.php
|
94 |
+
|
95 |
+
-
|
96 |
+
message: "#^If condition is always true\\.$#"
|
97 |
+
count: 1
|
98 |
+
path: src/Handler/CurlFactory.php
|
99 |
+
|
100 |
+
-
|
101 |
+
message: "#^Parameter \\#1 \\$str1 of function strcasecmp expects string, int\\|string given\\.$#"
|
102 |
+
count: 1
|
103 |
+
path: src/Handler/CurlFactory.php
|
104 |
+
|
105 |
+
-
|
106 |
+
message: "#^Property GuzzleHttp\\\\Handler\\\\CurlMultiHandler\\:\\:\\$_mh \\(resource\\) does not accept resource\\|false\\.$#"
|
107 |
+
count: 1
|
108 |
+
path: src/Handler/CurlMultiHandler.php
|
109 |
+
|
110 |
+
-
|
111 |
+
message: "#^Parameter \\#1 \\$mh of function curl_multi_setopt expects resource, resource\\|false given\\.$#"
|
112 |
+
count: 1
|
113 |
+
path: src/Handler/CurlMultiHandler.php
|
114 |
+
|
115 |
+
-
|
116 |
+
message: "#^Parameter \\#1 \\$status of class GuzzleHttp\\\\Psr7\\\\Response constructor expects int, string given\\.$#"
|
117 |
+
count: 1
|
118 |
+
path: src/Handler/EasyHandle.php
|
119 |
+
|
120 |
+
-
|
121 |
+
message: "#^Parameter \\#2 \\$parameters of function call_user_func_array expects array\\<int, mixed\\>, array given\\.$#"
|
122 |
+
count: 1
|
123 |
+
path: src/Handler/MockHandler.php
|
124 |
+
|
125 |
+
-
|
126 |
+
message: "#^Binary operation \"\\*\" between float\\|int\\|string and 1000 results in an error\\.$#"
|
127 |
+
count: 1
|
128 |
+
path: src/Handler/MockHandler.php
|
129 |
+
|
130 |
+
-
|
131 |
+
message: "#^Parameter \\#1 \\$status of class GuzzleHttp\\\\Psr7\\\\Response constructor expects int, string given\\.$#"
|
132 |
+
count: 1
|
133 |
+
path: src/Handler/StreamHandler.php
|
134 |
+
|
135 |
+
-
|
136 |
+
message: "#^Argument of an invalid type array\\<int, array\\<string, int\\|string\\>\\>\\|null supplied for foreach, only iterables are supported\\.$#"
|
137 |
+
count: 1
|
138 |
+
path: src/Handler/StreamHandler.php
|
139 |
+
|
140 |
+
-
|
141 |
+
message: "#^Parameter \\#3 \\$use_include_path of function fopen expects bool, null given\\.$#"
|
142 |
+
count: 1
|
143 |
+
path: src/Handler/StreamHandler.php
|
144 |
+
|
145 |
+
-
|
146 |
+
message: "#^Parameter \\#1 \\$stream of function stream_set_timeout expects resource, resource\\|false given\\.$#"
|
147 |
+
count: 1
|
148 |
+
path: src/Handler/StreamHandler.php
|
149 |
+
|
150 |
+
-
|
151 |
+
message: "#^Parameter \\#3 \\$microseconds of function stream_set_timeout expects int, float\\|int given\\.$#"
|
152 |
+
count: 1
|
153 |
+
path: src/Handler/StreamHandler.php
|
154 |
+
|
155 |
+
-
|
156 |
+
message: "#^Parameter \\#1 \\$obj of function spl_object_hash expects object, callable given\\.$#"
|
157 |
+
count: 1
|
158 |
+
path: src/HandlerStack.php
|
159 |
+
|
160 |
+
-
|
161 |
+
message: "#^Method GuzzleHttp\\\\MessageFormatter\\:\\:format\\(\\) should return string but returns string\\|null\\.$#"
|
162 |
+
count: 1
|
163 |
+
path: src/MessageFormatter.php
|
164 |
+
|
165 |
+
-
|
166 |
+
message: "#^Result of && is always false\\.$#"
|
167 |
+
count: 1
|
168 |
+
path: src/Middleware.php
|
169 |
+
|
170 |
+
-
|
171 |
+
message: "#^Return typehint of method GuzzleHttp\\\\Pool\\:\\:promise\\(\\) has invalid type GuzzleHttp\\\\GuzzleHttp\\\\Promise\\\\Promise\\.$#"
|
172 |
+
count: 1
|
173 |
+
path: src/Pool.php
|
174 |
+
|
175 |
+
-
|
176 |
+
message: "#^Method GuzzleHttp\\\\Pool\\:\\:promise\\(\\) should return GuzzleHttp\\\\GuzzleHttp\\\\Promise\\\\Promise but returns GuzzleHttp\\\\Promise\\\\PromiseInterface\\.$#"
|
177 |
+
count: 1
|
178 |
+
path: src/Pool.php
|
179 |
+
|
180 |
+
-
|
181 |
+
message: "#^Call to method wait\\(\\) on an unknown class GuzzleHttp\\\\GuzzleHttp\\\\Promise\\\\Promise\\.$#"
|
182 |
+
count: 1
|
183 |
+
path: src/Pool.php
|
184 |
+
|
185 |
+
-
|
186 |
+
message: "#^Parameter \\#1 \\$str of function substr expects string, int given\\.$#"
|
187 |
+
count: 1
|
188 |
+
path: src/RedirectMiddleware.php
|
189 |
+
|
190 |
+
-
|
191 |
+
message: "#^Parameter \\#1 \\$promise of method GuzzleHttp\\\\RedirectMiddleware\\:\\:withTracking\\(\\) expects GuzzleHttp\\\\Promise\\\\PromiseInterface, GuzzleHttp\\\\Promise\\\\PromiseInterface\\|Psr\\\\Http\\\\Message\\\\ResponseInterface given\\.$#"
|
192 |
+
count: 1
|
193 |
+
path: src/RedirectMiddleware.php
|
194 |
+
|
195 |
+
-
|
196 |
+
message: "#^Parameter \\#2 \\$value of method Psr\\\\Http\\\\Message\\\\MessageInterface\\:\\:withHeader\\(\\) expects array\\<string\\>\\|string, array given\\.$#"
|
197 |
+
count: 2
|
198 |
+
path: src/RedirectMiddleware.php
|
199 |
+
|
200 |
+
-
|
201 |
+
message: "#^Method GuzzleHttp\\\\RetryMiddleware\\:\\:doRetry\\(\\) should return GuzzleHttp\\\\RetryMiddleware but returns GuzzleHttp\\\\Promise\\\\PromiseInterface\\.$#"
|
202 |
+
count: 1
|
203 |
+
path: src/RetryMiddleware.php
|
204 |
+
|
205 |
+
-
|
206 |
+
message: "#^Function uri_template not found\\.$#"
|
207 |
+
count: 1
|
208 |
+
path: src/functions.php
|
209 |
+
|
210 |
+
-
|
211 |
+
message: "#^Parameter \\#1 \\$str of function rtrim expects string, string\\|false given\\.$#"
|
212 |
+
count: 1
|
213 |
+
path: src/functions.php
|
214 |
+
|
215 |
+
-
|
216 |
+
message: "#^Function GuzzleHttp\\\\debug_resource\\(\\) should return resource but returns resource\\|false\\.$#"
|
217 |
+
count: 1
|
218 |
+
path: src/functions.php
|
219 |
+
|
220 |
+
-
|
221 |
+
message: "#^Parameter \\#1 \\$str of function substr expects string, string\\|null given\\.$#"
|
222 |
+
count: 1
|
223 |
+
path: src/functions.php
|
224 |
+
|
225 |
+
-
|
226 |
+
message: "#^Function GuzzleHttp\\\\json_encode\\(\\) should return string but returns string\\|false\\.$#"
|
227 |
+
count: 1
|
228 |
+
path: src/functions.php
|
229 |
+
|
230 |
+
|
vendor/guzzlehttp/guzzle/phpstan.neon.dist
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
includes:
|
2 |
+
- phpstan-baseline.neon
|
3 |
+
|
4 |
+
parameters:
|
5 |
+
level: max
|
6 |
+
paths:
|
7 |
+
- src
|
vendor/guzzlehttp/promises/Makefile
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
all: clean test
|
2 |
+
|
3 |
+
test:
|
4 |
+
vendor/bin/phpunit
|
5 |
+
|
6 |
+
coverage:
|
7 |
+
vendor/bin/phpunit --coverage-html=artifacts/coverage
|
8 |
+
|
9 |
+
view-coverage:
|
10 |
+
open artifacts/coverage/index.html
|
11 |
+
|
12 |
+
clean:
|
13 |
+
rm -rf artifacts/*
|
vendor/guzzlehttp/promises/composer.json
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "guzzlehttp/promises",
|
3 |
+
"description": "Guzzle promises library",
|
4 |
+
"keywords": ["promise"],
|
5 |
+
"license": "MIT",
|
6 |
+
"authors": [
|
7 |
+
{
|
8 |
+
"name": "Michael Dowling",
|
9 |
+
"email": "mtdowling@gmail.com",
|
10 |
+
"homepage": "https://github.com/mtdowling"
|
11 |
+
}
|
12 |
+
],
|
13 |
+
"require": {
|
14 |
+
"php": ">=5.6"
|
15 |
+
},
|
16 |
+
"require-dev": {
|
17 |
+
"phpunit/phpunit": "^5.7.27 || ^7.5"
|
18 |
+
},
|
19 |
+
"autoload": {
|
20 |
+
"psr-4": {
|
21 |
+
"GuzzleHttp\\Promise\\": "src/"
|
22 |
+
},
|
23 |
+
"files": ["src/functions_include.php"]
|
24 |
+
},
|
25 |
+
"autoload-dev": {
|
26 |
+
"psr-4": {
|
27 |
+
"GuzzleHttp\\Promise\\Tests\\": "tests/"
|
28 |
+
}
|
29 |
+
},
|
30 |
+
"scripts": {
|
31 |
+
"test": "vendor/bin/phpunit",
|
32 |
+
"test-ci": "vendor/bin/phpunit --coverage-text"
|
33 |
+
},
|
34 |
+
"extra": {
|
35 |
+
"branch-alias": {
|
36 |
+
"dev-master": "1.4-dev"
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
vendor/guzzlehttp/psr7/composer.json
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "guzzlehttp/psr7",
|
3 |
+
"type": "library",
|
4 |
+
"description": "PSR-7 message implementation that also provides common utility methods",
|
5 |
+
"keywords": ["request", "response", "message", "stream", "http", "uri", "url", "psr-7"],
|
6 |
+
"license": "MIT",
|
7 |
+
"authors": [
|
8 |
+
{
|
9 |
+
"name": "Michael Dowling",
|
10 |
+
"email": "mtdowling@gmail.com",
|
11 |
+
"homepage": "https://github.com/mtdowling"
|
12 |
+
},
|
13 |
+
{
|
14 |
+
"name": "Tobias Schultze",
|
15 |
+
"homepage": "https://github.com/Tobion"
|
16 |
+
}
|
17 |
+
],
|
18 |
+
"require": {
|
19 |
+
"php": ">=5.4.0",
|
20 |
+
"psr/http-message": "~1.0",
|
21 |
+
"ralouphie/getallheaders": "^2.0.5 || ^3.0.0"
|
22 |
+
},
|
23 |
+
"require-dev": {
|
24 |
+
"phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8",
|
25 |
+
"ext-zlib": "*"
|
26 |
+
},
|
27 |
+
"provide": {
|
28 |
+
"psr/http-message-implementation": "1.0"
|
29 |
+
},
|
30 |
+
"suggest": {
|
31 |
+
"zendframework/zend-httphandlerrunner": "Emit PSR-7 responses"
|
32 |
+
},
|
33 |
+
"autoload": {
|
34 |
+
"psr-4": {
|
35 |
+
"GuzzleHttp\\Psr7\\": "src/"
|
36 |
+
},
|
37 |
+
"files": ["src/functions_include.php"]
|
38 |
+
},
|
39 |
+
"autoload-dev": {
|
40 |
+
"psr-4": {
|
41 |
+
"GuzzleHttp\\Tests\\Psr7\\": "tests/"
|
42 |
+
}
|
43 |
+
},
|
44 |
+
"extra": {
|
45 |
+
"branch-alias": {
|
46 |
+
"dev-master": "1.6-dev"
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
vendor/psr/http-message/composer.json
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "psr/http-message",
|
3 |
+
"description": "Common interface for HTTP messages",
|
4 |
+
"keywords": ["psr", "psr-7", "http", "http-message", "request", "response"],
|
5 |
+
"homepage": "https://github.com/php-fig/http-message",
|
6 |
+
"license": "MIT",
|
7 |
+
"authors": [
|
8 |
+
{
|
9 |
+
"name": "PHP-FIG",
|
10 |
+
"homepage": "http://www.php-fig.org/"
|
11 |
+
}
|
12 |
+
],
|
13 |
+
"require": {
|
14 |
+
"php": ">=5.3.0"
|
15 |
+
},
|
16 |
+
"autoload": {
|
17 |
+
"psr-4": {
|
18 |
+
"Psr\\Http\\Message\\": "src/"
|
19 |
+
}
|
20 |
+
},
|
21 |
+
"extra": {
|
22 |
+
"branch-alias": {
|
23 |
+
"dev-master": "1.0.x-dev"
|
24 |
+
}
|
25 |
+
}
|
26 |
+
}
|
vendor/psr/http-message/docs/PSR7-Interfaces.md
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Interfaces
|
2 |
+
|
3 |
+
The purpose of this list is to help in finding the methods when working with PSR-7. This can be considered as a cheatsheet for PSR-7 interfaces.
|
4 |
+
|
5 |
+
The interfaces defined in PSR-7 are the following:
|
6 |
+
|
7 |
+
| Class Name | Description |
|
8 |
+
|---|---|
|
9 |
+
| [Psr\Http\Message\MessageInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessagemessageinterface) | Representation of a HTTP message |
|
10 |
+
| [Psr\Http\Message\RequestInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessagerequestinterface) | Representation of an outgoing, client-side request. |
|
11 |
+
| [Psr\Http\Message\ServerRequestInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessageserverrequestinterface) | Representation of an incoming, server-side HTTP request. |
|
12 |
+
| [Psr\Http\Message\ResponseInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessageresponseinterface) | Representation of an outgoing, server-side response. |
|
13 |
+
| [Psr\Http\Message\StreamInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessagestreaminterface) | Describes a data stream |
|
14 |
+
| [Psr\Http\Message\UriInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessageuriinterface) | Value object representing a URI. |
|
15 |
+
| [Psr\Http\Message\UploadedFileInterface](http://www.php-fig.org/psr/psr-7/#psrhttpmessageuploadedfileinterface) | Value object representing a file uploaded through an HTTP request. |
|
16 |
+
|
17 |
+
## `Psr\Http\Message\MessageInterface` Methods
|
18 |
+
|
19 |
+
| Method Name | Description | Notes |
|
20 |
+
|------------------------------------| ----------- | ----- |
|
21 |
+
| `getProtocolVersion()` | Retrieve HTTP protocol version | 1.0 or 1.1 |
|
22 |
+
| `withProtocolVersion($version)` | Returns new message instance with given HTTP protocol version | |
|
23 |
+
| `getHeaders()` | Retrieve all HTTP Headers | [Request Header List](https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Request_fields), [Response Header List](https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Response_fields) |
|
24 |
+
| `hasHeader($name)` | Checks if HTTP Header with given name exists | |
|
25 |
+
| `getHeader($name)` | Retrieves a array with the values for a single header | |
|
26 |
+
| `getHeaderLine($name)` | Retrieves a comma-separated string of the values for a single header | |
|
27 |
+
| `withHeader($name, $value)` | Returns new message instance with given HTTP Header | if the header existed in the original instance, replaces the header value from the original message with the value provided when creating the new instance. |
|
28 |
+
| `withAddedHeader($name, $value)` | Returns new message instance with appended value to given header | If header already exists value will be appended, if not a new header will be created |
|
29 |
+
| `withoutHeader($name)` | Removes HTTP Header with given name| |
|
30 |
+
| `getBody()` | Retrieves the HTTP Message Body | Returns object implementing `StreamInterface`|
|
31 |
+
| `withBody(StreamInterface $body)` | Returns new message instance with given HTTP Message Body | |
|
32 |
+
|
33 |
+
|
34 |
+
## `Psr\Http\Message\RequestInterface` Methods
|
35 |
+
|
36 |
+
Same methods as `Psr\Http\Message\MessageInterface` + the following methods:
|
37 |
+
|
38 |
+
| Method Name | Description | Notes |
|
39 |
+
|------------------------------------| ----------- | ----- |
|
40 |
+
| `getRequestTarget()` | Retrieves the message's request target | origin-form, absolute-form, authority-form, asterisk-form ([RFC7230](https://www.rfc-editor.org/rfc/rfc7230.txt)) |
|
41 |
+
| `withRequestTarget($requestTarget)` | Return a new message instance with the specific request-target | |
|
42 |
+
| `getMethod()` | Retrieves the HTTP method of the request. | GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS, TRACE (defined in [RFC7231](https://tools.ietf.org/html/rfc7231)), PATCH (defined in [RFC5789](https://tools.ietf.org/html/rfc5789)) |
|
43 |
+
| `withMethod($method)` | Returns a new message instance with the provided HTTP method | |
|
44 |
+
| `getUri()` | Retrieves the URI instance | |
|
45 |
+
| `withUri(UriInterface $uri, $preserveHost = false)` | Returns a new message instance with the provided URI | |
|
46 |
+
|
47 |
+
|
48 |
+
## `Psr\Http\Message\ServerRequestInterface` Methods
|
49 |
+
|
50 |
+
Same methods as `Psr\Http\Message\RequestInterface` + the following methods:
|
51 |
+
|
52 |
+
| Method Name | Description | Notes |
|
53 |
+
|------------------------------------| ----------- | ----- |
|
54 |
+
| `getServerParams() ` | Retrieve server parameters | Typically derived from `$_SERVER` |
|
55 |
+
| `getCookieParams()` | Retrieves cookies sent by the client to the server. | Typically derived from `$_COOKIES` |
|
56 |
+
| `withCookieParams(array $cookies)` | Returns a new request instance with the specified cookies | |
|
57 |
+
| `withQueryParams(array $query)` | Returns a new request instance with the specified query string arguments | |
|
58 |
+
| `getUploadedFiles()` | Retrieve normalized file upload data | |
|
59 |
+
| `withUploadedFiles(array $uploadedFiles)` | Returns a new request instance with the specified uploaded files | |
|
60 |
+
| `getParsedBody()` | Retrieve any parameters provided in the request body | |
|
61 |
+
| `withParsedBody($data)` | Returns a new request instance with the specified body parameters | |
|
62 |
+
| `getAttributes()` | Retrieve attributes derived from the request | |
|
63 |
+
| `getAttribute($name, $default = null)` | Retrieve a single derived request attribute | |
|
64 |
+
| `withAttribute($name, $value)` | Returns a new request instance with the specified derived request attribute | |
|
65 |
+
| `withoutAttribute($name)` | Returns a new request instance that without the specified derived request attribute | |
|
66 |
+
|
67 |
+
## `Psr\Http\Message\ResponseInterface` Methods:
|
68 |
+
|
69 |
+
Same methods as `Psr\Http\Message\MessageInterface` + the following methods:
|
70 |
+
|
71 |
+
| Method Name | Description | Notes |
|
72 |
+
|------------------------------------| ----------- | ----- |
|
73 |
+
| `getStatusCode()` | Gets the response status code. | |
|
74 |
+
| `withStatus($code, $reasonPhrase = '')` | Returns a new response instance with the specified status code and, optionally, reason phrase. | |
|
75 |
+
| `getReasonPhrase()` | Gets the response reason phrase associated with the status code. | |
|
76 |
+
|
77 |
+
## `Psr\Http\Message\StreamInterface` Methods
|
78 |
+
|
79 |
+
| Method Name | Description | Notes |
|
80 |
+
|------------------------------------| ----------- | ----- |
|
81 |
+
| `__toString()` | Reads all data from the stream into a string, from the beginning to end. | |
|
82 |
+
| `close()` | Closes the stream and any underlying resources. | |
|
83 |
+
| `detach()` | Separates any underlying resources from the stream. | |
|
84 |
+
| `getSize()` | Get the size of the stream if known. | |
|
85 |
+
| `eof()` | Returns true if the stream is at the end of the stream.| |
|
86 |
+
| `isSeekable()` | Returns whether or not the stream is seekable. | |
|
87 |
+
| `seek($offset, $whence = SEEK_SET)` | Seek to a position in the stream. | |
|
88 |
+
| `rewind()` | Seek to the beginning of the stream. | |
|
89 |
+
| `isWritable()` | Returns whether or not the stream is writable. | |
|
90 |
+
| `write($string)` | Write data to the stream. | |
|
91 |
+
| `isReadable()` | Returns whether or not the stream is readable. | |
|
92 |
+
| `read($length)` | Read data from the stream. | |
|
93 |
+
| `getContents()` | Returns the remaining contents in a string | |
|
94 |
+
| `getMetadata($key = null)()` | Get stream metadata as an associative array or retrieve a specific key. | |
|
95 |
+
|
96 |
+
## `Psr\Http\Message\UriInterface` Methods
|
97 |
+
|
98 |
+
| Method Name | Description | Notes |
|
99 |
+
|------------------------------------| ----------- | ----- |
|
100 |
+
| `getScheme()` | Retrieve the scheme component of the URI. | |
|
101 |
+
| `getAuthority()` | Retrieve the authority component of the URI. | |
|
102 |
+
| `getUserInfo()` | Retrieve the user information component of the URI. | |
|
103 |
+
| `getHost()` | Retrieve the host component of the URI. | |
|
104 |
+
| `getPort()` | Retrieve the port component of the URI. | |
|
105 |
+
| `getPath()` | Retrieve the path component of the URI. | |
|
106 |
+
| `getQuery()` | Retrieve the query string of the URI. | |
|
107 |
+
| `getFragment()` | Retrieve the fragment component of the URI. | |
|
108 |
+
| `withScheme($scheme)` | Return an instance with the specified scheme. | |
|
109 |
+
| `withUserInfo($user, $password = null)` | Return an instance with the specified user information. | |
|
110 |
+
| `withHost($host)` | Return an instance with the specified host. | |
|
111 |
+
| `withPort($port)` | Return an instance with the specified port. | |
|
112 |
+
| `withPath($path)` | Return an instance with the specified path. | |
|
113 |
+
| `withQuery($query)` | Return an instance with the specified query string. | |
|
114 |
+
| `withFragment($fragment)` | Return an instance with the specified URI fragment. | |
|
115 |
+
| `__toString()` | Return the string representation as a URI reference. | |
|
116 |
+
|
117 |
+
## `Psr\Http\Message\UploadedFileInterface` Methods
|
118 |
+
|
119 |
+
| Method Name | Description | Notes |
|
120 |
+
|------------------------------------| ----------- | ----- |
|
121 |
+
| `getStream()` | Retrieve a stream representing the uploaded file. | |
|
122 |
+
| `moveTo($targetPath)` | Move the uploaded file to a new location. | |
|
123 |
+
| `getSize()` | Retrieve the file size. | |
|
124 |
+
| `getError()` | Retrieve the error associated with the uploaded file. | |
|
125 |
+
| `getClientFilename()` | Retrieve the filename sent by the client. | |
|
126 |
+
| `getClientMediaType()` | Retrieve the media type sent by the client. | |
|
127 |
+
|
128 |
+
> `RequestInterface`, `ServerRequestInterface`, `ResponseInterface` extend `MessageInterface` because the `Request` and the `Response` are `HTTP Messages`.
|
129 |
+
> When using `ServerRequestInterface`, both `RequestInterface` and `Psr\Http\Message\MessageInterface` methods are considered.
|
130 |
+
|
vendor/psr/http-message/docs/PSR7-Usage.md
ADDED
@@ -0,0 +1,159 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
### PSR-7 Usage
|
2 |
+
|
3 |
+
All PSR-7 applications comply with these interfaces
|
4 |
+
They were created to establish a standard between middleware implementations.
|
5 |
+
|
6 |
+
> `RequestInterface`, `ServerRequestInterface`, `ResponseInterface` extend `MessageInterface` because the `Request` and the `Response` are `HTTP Messages`.
|
7 |
+
> When using `ServerRequestInterface`, both `RequestInterface` and `Psr\Http\Message\MessageInterface` methods are considered.
|
8 |
+
|
9 |
+
|
10 |
+
The following examples will illustrate how basic operations are done in PSR-7.
|
11 |
+
|
12 |
+
##### Examples
|
13 |
+
|
14 |
+
|
15 |
+
For this examples to work (at least) a PSR-7 implementation package is required. (eg: zendframework/zend-diactoros, guzzlehttp/psr7, slim/slim, etc)
|
16 |
+
All PSR-7 implementations should have the same behaviour.
|
17 |
+
|
18 |
+
The following will be assumed:
|
19 |
+
`$request` is an object of `Psr\Http\Message\RequestInterface` and
|
20 |
+
|
21 |
+
`$response` is an object implementing `Psr\Http\Message\RequestInterface`
|
22 |
+
|
23 |
+
|
24 |
+
### Working with HTTP Headers
|
25 |
+
|
26 |
+
#### Adding headers to response:
|
27 |
+
|
28 |
+
```php
|
29 |
+
$response->withHeader('My-Custom-Header', 'My Custom Message');
|
30 |
+
```
|
31 |
+
|
32 |
+
#### Appending values to headers
|
33 |
+
|
34 |
+
```php
|
35 |
+
$response->withAddedHeader('My-Custom-Header', 'The second message');
|
36 |
+
```
|
37 |
+
|
38 |
+
#### Checking if header exists:
|
39 |
+
|
40 |
+
```php
|
41 |
+
$request->hasHeader('My-Custom-Header'); // will return false
|
42 |
+
$response->hasHeader('My-Custom-Header'); // will return true
|
43 |
+
```
|
44 |
+
|
45 |
+
> Note: My-Custom-Header was only added in the Response
|
46 |
+
|
47 |
+
#### Getting comma-separated values from a header (also applies to request)
|
48 |
+
|
49 |
+
```php
|
50 |
+
// getting value from request headers
|
51 |
+
$request->getHeaderLine('Content-Type'); // will return: "text/html; charset=UTF-8"
|
52 |
+
// getting value from response headers
|
53 |
+
$response->getHeaderLine('My-Custom-Header'); // will return: "My Custom Message; The second message"
|
54 |
+
```
|
55 |
+
|
56 |
+
#### Getting array of value from a header (also applies to request)
|
57 |
+
```php
|
58 |
+
// getting value from request headers
|
59 |
+
$request->getHeader('Content-Type'); // will return: ["text/html", "charset=UTF-8"]
|
60 |
+
// getting value from response headers
|
61 |
+
$response->getHeader('My-Custom-Header'); // will return: ["My Custom Message", "The second message"]
|
62 |
+
```
|
63 |
+
|
64 |
+
#### Removing headers from HTTP Messages
|
65 |
+
```php
|
66 |
+
// removing a header from Request, removing deprecated "Content-MD5" header
|
67 |
+
$request->withoutHeader('Content-MD5');
|
68 |
+
|
69 |
+
// removing a header from Response
|
70 |
+
// effect: the browser won't know the size of the stream
|
71 |
+
// the browser will download the stream till it ends
|
72 |
+
$response->withoutHeader('Content-Length');
|
73 |
+
```
|
74 |
+
|
75 |
+
### Working with HTTP Message Body
|
76 |
+
|
77 |
+
When working with the PSR-7 there are two methods of implementation:
|
78 |
+
#### 1. Getting the body separately
|
79 |
+
|
80 |
+
> This method makes the body handling easier to understand and is useful when repeatedly calling body methods. (You only call `getBody()` once). Using this method mistakes like `$response->write()` are also prevented.
|
81 |
+
|
82 |
+
```php
|
83 |
+
$body = $response->getBody();
|
84 |
+
// operations on body, eg. read, write, seek
|
85 |
+
// ...
|
86 |
+
// replacing the old body
|
87 |
+
$response->withBody($body);
|
88 |
+
// this last statement is optional as we working with objects
|
89 |
+
// in this case the "new" body is same with the "old" one
|
90 |
+
// the $body variable has the same value as the one in $request, only the reference is passed
|
91 |
+
```
|
92 |
+
|
93 |
+
#### 2. Working directly on response
|
94 |
+
|
95 |
+
> This method is useful when only performing few operations as the `$request->getBody()` statement fragment is required
|
96 |
+
|
97 |
+
```php
|
98 |
+
$response->getBody()->write('hello');
|
99 |
+
```
|
100 |
+
|
101 |
+
### Getting the body contents
|
102 |
+
|
103 |
+
The following snippet gets the contents of a stream contents.
|
104 |
+
> Note: Streams must be rewinded, if content was written into streams, it will be ignored when calling `getContents()` because the stream pointer is set to the last character, which is `\0` - meaning end of stream.
|
105 |
+
```php
|
106 |
+
$body = $response->getBody();
|
107 |
+
$body->rewind(); // or $body->seek(0);
|
108 |
+
$bodyText = $body->getContents();
|
109 |
+
```
|
110 |
+
> Note: If `$body->seek(1)` is called before `$body->getContents()`, the first character will be ommited as the starting pointer is set to `1`, not `0`. This is why using `$body->rewind()` is recommended.
|
111 |
+
|
112 |
+
### Append to body
|
113 |
+
|
114 |
+
```php
|
115 |
+
$response->getBody()->write('Hello'); // writing directly
|
116 |
+
$body = $request->getBody(); // which is a `StreamInterface`
|
117 |
+
$body->write('xxxxx');
|
118 |
+
```
|
119 |
+
|
120 |
+
### Prepend to body
|
121 |
+
Prepending is different when it comes to streams. The content must be copied before writing the content to be prepended.
|
122 |
+
The following example will explain the behaviour of streams.
|
123 |
+
|
124 |
+
```php
|
125 |
+
// assuming our response is initially empty
|
126 |
+
$body = $repsonse->getBody();
|
127 |
+
// writing the string "abcd"
|
128 |
+
$body->write('abcd');
|
129 |
+
|
130 |
+
// seeking to start of stream
|
131 |
+
$body->seek(0);
|
132 |
+
// writing 'ef'
|
133 |
+
$body->write('ef'); // at this point the stream contains "efcd"
|
134 |
+
```
|
135 |
+
|
136 |
+
#### Prepending by rewriting separately
|
137 |
+
|
138 |
+
```php
|
139 |
+
// assuming our response body stream only contains: "abcd"
|
140 |
+
$body = $response->getBody();
|
141 |
+
$body->rewind();
|
142 |
+
$contents = $body->getContents(); // abcd
|
143 |
+
// seeking the stream to beginning
|
144 |
+
$body->rewind();
|
145 |
+
$body->write('ef'); // stream contains "efcd"
|
146 |
+
$body->write($contents); // stream contains "efabcd"
|
147 |
+
```
|
148 |
+
|
149 |
+
> Note: `getContents()` seeks the stream while reading it, therefore if the second `rewind()` method call was not present the stream would have resulted in `abcdefabcd` because the `write()` method appends to stream if not preceeded by `rewind()` or `seek(0)`.
|
150 |
+
|
151 |
+
#### Prepending by using contents as a string
|
152 |
+
```php
|
153 |
+
$body = $response->getBody();
|
154 |
+
$body->rewind();
|
155 |
+
$contents = $body->getContents(); // efabcd
|
156 |
+
$contents = 'ef'.$contents;
|
157 |
+
$body->rewind();
|
158 |
+
$body->write($contents);
|
159 |
+
```
|