diff --git a/.gitignore b/.gitignore index 69bd4889a..a26d5570d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,19 +4,12 @@ .vagrant* tmp src/.htaccess -.htaccess src/bb-config* -bb-config* !src/bb-config-sample.php -bb-config-sample.php src/bb-data/log/* -bb-data/log/* src/bb-data/cache/* -bb-data/cache/* src/bb-data/tmp.txt -bb-data/tmp.txt src/bb-test.php -bb-test.php build composer.phar public diff --git a/bb-config.php b/bb-config.php new file mode 100644 index 000000000..6995c74b8 --- /dev/null +++ b/bb-config.php @@ -0,0 +1,39 @@ + 'true', + 'license' => 'PRO-4W93-NZ9G-HGUP-3C7H-I6FM', + 'salt' => '258c25516c6525b3cf178d69899699e5', + 'url' => 'https://webbhostingservices.com/boxbilling/src/', + 'admin_area_prefix' => '/bb-admin', + 'sef_urls' => 'false', + 'timezone' => 'UTC', + 'locale' => 'en_US', + 'locale_date_format' => '%A, %d %B %G', + 'locale_time_format' => ' %T', + 'path_data' => '/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/src/bb-data/', + 'path_logs' => '/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/src/bb-data/log/application.log', + 'log_to_db' => 'true', + 'db' => + array ( + 'type' => 'mysql', + 'host' => 'localhost', + 'name' => 'boxbilling', + 'user' => 'boxbilling', + 'password' => 'Ai5*os5P7Gloofir', + ), + 'twig' => + array ( + 'debug' => true, + 'auto_reload' => true, + 'cache' => '/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/src/bb-data/cache/', + ), + 'api' => + array ( + 'require_referrer_header' => 'false', + 'allowed_ips' => + array ( + ), + 'rate_span' => 3600, + 'rate_limit' => 1000, + ), +); diff --git a/bb-data/.htaccess b/bb-data/.htaccess new file mode 100755 index 000000000..ff2beb844 --- /dev/null +++ b/bb-data/.htaccess @@ -0,0 +1,2 @@ +order deny,allow +deny from all diff --git a/bb-data/cache/00/009dd39f2f9b6e55a940f5e90444a96851bc7bce76d606b73b1d2985db757623.php b/bb-data/cache/00/009dd39f2f9b6e55a940f5e90444a96851bc7bce76d606b73b1d2985db757623.php new file mode 100644 index 000000000..e1656a6db --- /dev/null +++ b/bb-data/cache/00/009dd39f2f9b6e55a940f5e90444a96851bc7bce76d606b73b1d2985db757623.php @@ -0,0 +1,335 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'content' => [$this, 'block_content'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return $this->loadTemplate(((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "ajax", [], "any", false, false, false, 1)) ? ("layout_blank.phtml") : ("layout_default.phtml")), "mod_system_index.phtml", 1); + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 2 + $macros["mf"] = $this->macros["mf"] = $this->loadTemplate("macro_functions.phtml", "mod_system_index.phtml", 2)->unwrap(); + // line 4 + $context["active_menu"] = "system"; + // line 5 + $context["params"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "system_get_params", [], "any", false, false, false, 5); + // line 1 + $this->getParent($context)->display($context, array_merge($this->blocks, $blocks)); + } + + // line 3 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("Settings"); + } + + // line 6 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 7 + echo " +
+ + + +
+
+
+ "; + // line 18 + echo twig_call_macro($macros["mf"], "macro_table_search", [], 18, $context, $this->getSourceContext()); + echo " + + + "; + // line 21 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "extension_get_list", [0 => twig_array_merge(["active" => 1, "has_settings" => 1], ($context["request"] ?? null))], "method", false, false, false, 21)); + $context['loop'] = [ + 'parent' => $context['_parent'], + 'index0' => 0, + 'index' => 1, + 'first' => true, + ]; + if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof \Countable)) { + $length = count($context['_seq']); + $context['loop']['revindex0'] = $length - 1; + $context['loop']['revindex'] = $length; + $context['loop']['length'] = $length; + $context['loop']['last'] = 1 === $length; + } + foreach ($context['_seq'] as $context["_key"] => $context["ext"]) { + // line 22 + echo " env, $this->source, $context["loop"], "first", [], "any", false, false, false, 22)) ? ("style=\"border-top:0;\"") : ("")); + echo " class=\"hover-row\"> + + + + + "; + ++$context['loop']['index0']; + ++$context['loop']['index']; + $context['loop']['first'] = false; + if (isset($context['loop']['length'])) { + --$context['loop']['revindex0']; + --$context['loop']['revindex']; + $context['loop']['last'] = 0 === $context['loop']['revindex0']; + } + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['_key'], $context['ext'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 28 + echo " +
extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("extension/settings"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["ext"], "id", [], "any", false, false, false, 23), "html", null, true); + echo "\">env, twig_get_attribute($this->env, $this->source, $context["ext"], "icon_url", [], "any", false, false, false, 23), "html", null, true); + echo "\" alt=\""; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["ext"], "name", [], "any", false, false, false, 23), "html", null, true); + echo "\" style=\"width: 32px; height: 32px;\"/>extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("extension/settings"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["ext"], "id", [], "any", false, false, false, 24), "html", null, true); + echo "\">"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["ext"], "name", [], "any", false, false, false, 24), "html", null, true); + echo "extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("extension/settings"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["ext"], "id", [], "any", false, false, false, 25), "html", null, true); + echo "\">\"\"
+
+ +
+ +
+

"; + // line 35 + echo gettext("License"); + echo "

+

"; + // line 36 + echo gettext("After purchase you have received an e-mail with license key. Update license key to unlock all features of BoxBilling"); + echo "

+

"; + // line 37 + echo gettext("To change license key, change BB_LICENSE value in bb-config.php file"); + echo ".

+

extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("filemanager/ide", ["open" => "bb-config.php"]); + echo "\" target=\"_blank\" target=\"_blank\">"; + echo gettext("Edit bb-config.php file"); + echo " (File must be writable by web server)

+
+ + "; + // line 41 + $context["env"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "system_env", [], "any", false, false, false, 41); + // line 42 + echo " "; + $context["license"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "system_license_info", [], "any", false, false, false, 42); + // line 43 + echo " + + + + + + + + + + + "; + // line 54 + if (twig_get_attribute($this->env, $this->source, ($context["license"] ?? null), "expires_at", [], "any", false, false, false, 54)) { + // line 55 + echo " + + + + "; + } + // line 60 + echo " + + + + + +
"; + // line 46 + echo gettext("Licensed to"); + echo ""; + // line 47 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["license"] ?? null), "licensed_to", [], "any", false, false, false, 47), "html", null, true); + echo "
"; + // line 50 + echo gettext("Key"); + echo ""; + // line 51 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["license"] ?? null), "key", [], "any", false, false, false, 51), "html", null, true); + echo "
"; + // line 56 + echo gettext("Expires at"); + echo ""; + // line 57 + echo twig_escape_filter($this->env, twig_date_format_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["license"] ?? null), "expires_at", [], "any", false, false, false, 57), "Y-m-d"), "html", null, true); + echo "
"; + // line 62 + echo gettext("IP"); + echo ""; + // line 63 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["env"] ?? null), "ip", [], "any", false, false, false, 63), "html", null, true); + echo "
+
+ +
+ +
+"; + } + + public function getTemplateName() + { + return "mod_system_index.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 232 => 63, 228 => 62, 224 => 60, 218 => 57, 214 => 56, 211 => 55, 209 => 54, 203 => 51, 199 => 50, 193 => 47, 189 => 46, 184 => 43, 181 => 42, 179 => 41, 171 => 38, 167 => 37, 163 => 36, 159 => 35, 150 => 28, 129 => 25, 121 => 24, 111 => 23, 106 => 22, 89 => 21, 83 => 18, 74 => 12, 70 => 11, 64 => 7, 60 => 6, 53 => 3, 49 => 1, 47 => 5, 45 => 4, 43 => 2, 36 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends request.ajax ? \"layout_blank.phtml\" : \"layout_default.phtml\" %} +{% import \"macro_functions.phtml\" as mf %} +{% block meta_title %}{% trans 'Settings' %}{% endblock %} +{% set active_menu = 'system' %} +{% set params = admin.system_get_params %} +{% block content %} + +
+ + + +
+
+
+ {{ mf.table_search }} + + + {% for ext in admin.extension_get_list({\"active\":1, \"has_settings\":1}|merge(request)) %} + + + + + + {% endfor %} + +
\"{{ext.name}}\"{{ ext.name }}\"\"
+
+ +
+ +
+

{% trans 'License' %}

+

{% trans 'After purchase you have received an e-mail with license key. Update license key to unlock all features of BoxBilling' %}

+

{% trans 'To change license key, change BB_LICENSE value in bb-config.php file' %}.

+

{% trans 'Edit bb-config.php file' %} (File must be writable by web server)

+
+ + {% set env = admin.system_env %} + {% set license = admin.system_license_info %} + + + + + + + + + + + + {% if license.expires_at %} + + + + + {% endif %} + + + + + + +
{% trans 'Licensed to' %}{{ license.licensed_to }}
{% trans 'Key' %}{{ license.key }}
{% trans 'Expires at' %}{{ license.expires_at|date('Y-m-d') }}
{% trans 'IP' %}{{ env.ip }}
+
+ +
+ +
+{% endblock %}", "mod_system_index.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-themes/admin_default/html/mod_system_index.phtml"); + } +} diff --git a/bb-data/cache/01/01e1400d930d4623482eaa4db09c296ab3ea78af7afaf97b1cb610f586779205.php b/bb-data/cache/01/01e1400d930d4623482eaa4db09c296ab3ea78af7afaf97b1cb610f586779205.php new file mode 100644 index 000000000..ca54be8bb --- /dev/null +++ b/bb-data/cache/01/01e1400d930d4623482eaa4db09c296ab3ea78af7afaf97b1cb610f586779205.php @@ -0,0 +1,293 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'content' => [$this, 'block_content'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return $this->loadTemplate(((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "ajax", [], "any", false, false, false, 1)) ? ("layout_blank.phtml") : ("layout_default.phtml")), "mod_activity_index.phtml", 1); + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 2 + $macros["mf"] = $this->macros["mf"] = $this->loadTemplate("macro_functions.phtml", "mod_activity_index.phtml", 2)->unwrap(); + // line 4 + $context["active_menu"] = "activity"; + // line 1 + $this->getParent($context)->display($context, array_merge($this->blocks, $blocks)); + } + + // line 3 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo "System activity"; + } + + // line 6 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 7 + echo "
+
"; + // line 8 + echo gettext("System activity"); + echo "
+ +"; + // line 10 + echo twig_call_macro($macros["mf"], "macro_table_search", [], 10, $context, $this->getSourceContext()); + echo " + + + + + + + + + + + + + + "; + // line 24 + $context["events"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "activity_log_get_list", [0 => twig_array_merge(["per_page" => 30, "page" => twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "page", [], "any", false, false, false, 24)], ($context["request"] ?? null))], "method", false, false, false, 24); + // line 25 + echo " "; + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["events"] ?? null), "list", [], "any", false, false, false, 25)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["i"] => $context["event"]) { + // line 26 + echo " + + + + + + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 46 + echo " + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['i'], $context['event'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 52 + echo " +
"; + // line 15 + echo gettext("Message"); + echo ""; + // line 16 + echo gettext("Ip"); + echo ""; + // line 17 + echo gettext("Country"); + echo ""; + // line 18 + echo gettext("Date"); + echo " 
env, twig_get_attribute($this->env, $this->source, $context["event"], "id", [], "any", false, false, false, 27), "html", null, true); + echo "\"/> + "; + // line 29 + if (twig_get_attribute($this->env, $this->source, $context["event"], "client", [], "any", false, false, false, 29)) { + // line 30 + echo " extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("client/manage"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["event"], "client", [], "any", false, false, false, 30), "id", [], "any", false, false, false, 30), "html", null, true); + echo "\" title=\""; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["event"], "client", [], "any", false, false, false, 30), "name", [], "any", false, false, false, 30), "html", null, true); + echo "\">env, twig_gravatar_filter(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["event"], "client", [], "any", false, false, false, 30), "email", [], "any", false, false, false, 30)), "html", null, true); + echo "?size=20\" alt=\""; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["event"], "client", [], "any", false, false, false, 30), "name", [], "any", false, false, false, 30), "html", null, true); + echo "\" /> "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["event"], "client", [], "any", false, false, false, 30), "name", [], "any", false, false, false, 30), "html", null, true); + echo " + "; + } elseif (twig_get_attribute($this->env, $this->source, // line 31 +$context["event"], "staff", [], "any", false, false, false, 31)) { + // line 32 + echo " extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("staff/manage"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["event"], "staff", [], "any", false, false, false, 32), "id", [], "any", false, false, false, 32), "html", null, true); + echo "\" title=\""; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["event"], "staff", [], "any", false, false, false, 32), "name", [], "any", false, false, false, 32), "html", null, true); + echo "\">env, twig_gravatar_filter(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["event"], "staff", [], "any", false, false, false, 32), "email", [], "any", false, false, false, 32)), "html", null, true); + echo "?size=20\" alt=\""; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["event"], "staff", [], "any", false, false, false, 32), "name", [], "any", false, false, false, 32), "html", null, true); + echo "\" /> "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["event"], "staff", [], "any", false, false, false, 32), "name", [], "any", false, false, false, 32), "html", null, true); + echo " + "; + } else { + // line 34 + echo " Guest + "; + } + // line 36 + echo "
"; + // line 37 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["event"], "message", [], "any", false, false, false, 37), "html", null, true); + echo "
"; + // line 38 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["event"], "ip", [], "any", false, false, false, 38), "html", null, true); + echo ""; + // line 39 + echo twig_escape_filter($this->env, _twig_default_filter($this->extensions['Box_TwigExtensions']->twig_ipcountryname_filter(twig_get_attribute($this->env, $this->source, $context["event"], "ip", [], "any", false, false, false, 39)), "Unknown"), "html", null, true); + echo ""; + // line 40 + echo twig_escape_filter($this->env, twig_date_format_filter($this->env, twig_get_attribute($this->env, $this->source, $context["event"], "created_at", [], "any", false, false, false, 40), "Y-m-d H:i"), "html", null, true); + echo " + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("activity"); + echo "\" href=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/activity/log_delete", ["id" => twig_get_attribute($this->env, $this->source, $context["event"], "id", [], "any", false, false, false, 42)]); + echo "\">\"\" +
+ "; + // line 48 + echo gettext("The list is empty"); + // line 49 + echo "
+ +
+"; + // line 56 + $this->loadTemplate("partial_batch_delete.phtml", "mod_activity_index.phtml", 56)->display(twig_array_merge($context, ["action" => "admin/activity/batch_delete"])); + // line 57 + $this->loadTemplate("partial_pagination.phtml", "mod_activity_index.phtml", 57)->display(twig_array_merge($context, ["list" => ($context["events"] ?? null), "url" => "activity"])); + // line 58 + echo " +"; + } + + public function getTemplateName() + { + return "mod_activity_index.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 211 => 58, 209 => 57, 207 => 56, 201 => 52, 193 => 49, 191 => 48, 187 => 46, 174 => 42, 169 => 40, 165 => 39, 161 => 38, 157 => 37, 154 => 36, 150 => 34, 134 => 32, 132 => 31, 117 => 30, 115 => 29, 110 => 27, 107 => 26, 101 => 25, 99 => 24, 90 => 18, 86 => 17, 82 => 16, 78 => 15, 70 => 10, 65 => 8, 62 => 7, 58 => 6, 51 => 3, 47 => 1, 45 => 4, 43 => 2, 36 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends request.ajax ? \"layout_blank.phtml\" : \"layout_default.phtml\" %} +{% import \"macro_functions.phtml\" as mf %} +{% block meta_title %}System activity{% endblock %} +{% set active_menu = 'activity' %} + +{% block content %} +
+
{% trans 'System activity' %}
+ +{{ mf.table_search }} + + + + + + + + + + + + + + {% set events = admin.activity_log_get_list({\"per_page\":30, \"page\":request.page}|merge(request)) %} + {% for i, event in events.list %} + + + + + + + + + + {% else %} + + + + {% endfor %} + +
{% trans 'Message' %}{% trans 'Ip' %}{% trans 'Country' %}{% trans 'Date' %} 
+ {% if event.client %} + \"{{ {{ event.client.name }} + {% elseif event.staff %} + \"{{ {{ event.staff.name }} + {% else %} + Guest + {% endif %} +
{{ event.message }}
{{ event.ip }}{{ event.ip|ipcountryname|default('Unknown') }}{{ event.created_at|date('Y-m-d H:i') }} + \"\" +
+ {% trans 'The list is empty' %} +
+ +
+{% include \"partial_batch_delete.phtml\" with {'action' : 'admin/activity/batch_delete'} %} +{% include \"partial_pagination.phtml\" with {'list': events, 'url':'activity'} %} + +{% endblock %} +", "mod_activity_index.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-themes/admin_default/html/mod_activity_index.phtml"); + } +} diff --git a/bb-data/cache/01/01f99d41b5cba6bffcb4b94f09e30cf648d446675d1009d08934ca05620ae1ff.php b/bb-data/cache/01/01f99d41b5cba6bffcb4b94f09e30cf648d446675d1009d08934ca05620ae1ff.php new file mode 100644 index 000000000..d0e1d9fb9 --- /dev/null +++ b/bb-data/cache/01/01f99d41b5cba6bffcb4b94f09e30cf648d446675d1009d08934ca05620ae1ff.php @@ -0,0 +1,375 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'content' => [$this, 'block_content'], + 'head' => [$this, 'block_head'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return $this->loadTemplate(((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "ajax", [], "any", false, false, false, 1)) ? ("layout_blank.phtml") : ("layout_default.phtml")), "mod_news_index.phtml", 1); + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 2 + $macros["mf"] = $this->macros["mf"] = $this->loadTemplate("macro_functions.phtml", "mod_news_index.phtml", 2)->unwrap(); + // line 3 + $context["active_menu"] = "support"; + // line 1 + $this->getParent($context)->display($context, array_merge($this->blocks, $blocks)); + } + + // line 4 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("News"); + } + + // line 6 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 7 + echo "
+ + + +
+ +
+
+ + "; + // line 19 + echo twig_call_macro($macros["mf"], "macro_table_search", [], 19, $context, $this->getSourceContext()); + echo " + + + + + + + + + + + + + "; + // line 32 + $context["posts"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "news_get_list", [0 => twig_array_merge(["per_page" => 30, "page" => twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "page", [], "any", false, false, false, 32)], ($context["request"] ?? null))], "method", false, false, false, 32); + // line 33 + echo " "; + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["posts"] ?? null), "list", [], "any", false, false, false, 33)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["i"] => $context["post"]) { + // line 34 + echo " + + + + + + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 47 + echo " + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['i'], $context['post'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 53 + echo " +
"; + // line 24 + echo gettext("Title"); + echo ""; + // line 25 + echo gettext("Active"); + echo ""; + // line 26 + echo gettext("Date"); + echo " 
env, twig_get_attribute($this->env, $this->source, $context["post"], "id", [], "any", false, false, false, 35), "html", null, true); + echo "\"/>"; + // line 36 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["post"], "id", [], "any", false, false, false, 36), "html", null, true); + echo ""; + // line 37 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["post"], "title", [], "any", false, false, false, 37), "html", null, true); + echo ""; + // line 38 + echo twig_call_macro($macros["mf"], "macro_status_name", [twig_get_attribute($this->env, $this->source, $context["post"], "status", [], "any", false, false, false, 38)], 38, $context, $this->getSourceContext()); + echo ""; + // line 39 + echo twig_escape_filter($this->env, $this->extensions['Box_TwigExtensions']->twig_bb_datetime(twig_get_attribute($this->env, $this->source, $context["post"], "created_at", [], "any", false, false, false, 39)), "html", null, true); + echo " + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("/news/post"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["post"], "id", [], "any", false, false, false, 41), "html", null, true); + echo "\">\"\" + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/news/delete", ["id" => twig_get_attribute($this->env, $this->source, $context["post"], "id", [], "any", false, false, false, 42)]); + echo "\" data-api-redirect=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("news"); + echo "\">\"\" +
+ "; + // line 49 + echo gettext("The list is empty"); + // line 50 + echo "
+ "; + // line 55 + $this->loadTemplate("partial_pagination.phtml", "mod_news_index.phtml", 55)->display(twig_array_merge($context, ["list" => ($context["posts"] ?? null), "url" => "news/index"])); + // line 56 + echo " "; + $this->loadTemplate("partial_batch_delete.phtml", "mod_news_index.phtml", 56)->display(twig_array_merge($context, ["action" => "admin/news/batch_delete"])); + // line 57 + echo " +
+ +
+ +
extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/news/create"); + echo "\" class=\"mainForm api-form\" data-api-redirect=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("news"); + echo "\"> +
+
+ +
+ env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "title", [], "any", false, false, false, 67), "html", null, true); + echo "\" required=\"required\" placeholder=\"\"/> +
+
+
+
+ +
+ + +
+
+
+
+ +
+

If the text is very long you can use <!--more--> tag. Inserting this tag within the post will create and excerpt of text (before the tag) to be displayed in posts list. Users will be able to see whole content when they click on \"Read more\" button.

+
+ +
+
+
+ +
+
+
+ +
+
+ +"; + } + + // line 98 + public function block_head($context, array $blocks = []) + { + $macros = $this->macros; + echo twig_call_macro($macros["mf"], "macro_bb_editor", [".bb-textarea"], 98, $context, $this->getSourceContext()); + } + + public function getTemplateName() + { + return "mod_news_index.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 253 => 98, 240 => 88, 233 => 84, 226 => 80, 218 => 75, 214 => 74, 209 => 72, 201 => 67, 196 => 65, 188 => 62, 181 => 57, 178 => 56, 176 => 55, 172 => 53, 164 => 50, 162 => 49, 158 => 47, 146 => 42, 140 => 41, 135 => 39, 131 => 38, 127 => 37, 123 => 36, 119 => 35, 116 => 34, 110 => 33, 108 => 32, 99 => 26, 95 => 25, 91 => 24, 83 => 19, 72 => 11, 68 => 10, 63 => 7, 59 => 6, 52 => 4, 48 => 1, 46 => 3, 44 => 2, 37 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends request.ajax ? \"layout_blank.phtml\" : \"layout_default.phtml\" %} +{% import \"macro_functions.phtml\" as mf %} +{% set active_menu = 'support' %} +{% block meta_title %}{% trans 'News' %}{% endblock %} + +{% block content %} +
+ + + +
+ +
+
+ + {{ mf.table_search }} + + + + + + + + + + + + + {% set posts = admin.news_get_list({\"per_page\":30, \"page\":request.page}|merge(request)) %} + {% for i, post in posts.list %} + + + + + + + + + + {% else %} + + + + {% endfor %} + +
{% trans 'Title' %}{% trans 'Active' %}{% trans 'Date' %} 
{{ post.id }}{{ post.title }}{{ mf.status_name(post.status) }}{{ post.created_at|bb_datetime }} + \"\" + \"\" +
+ {% trans 'The list is empty' %} +
+ {% include \"partial_pagination.phtml\" with {'list': posts, 'url':'news/index'} %} + {% include \"partial_batch_delete.phtml\" with {'action' : 'admin/news/batch_delete'} %} + +
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ + +
+
+
+
+ +
+

If the text is very long you can use <!--more--> tag. Inserting this tag within the post will create and excerpt of text (before the tag) to be displayed in posts list. Users will be able to see whole content when they click on \"Read more\" button.

+
+ +
+
+
+ +
+
+
+ +
+
+ +{% endblock %} + +{% block head %}{{ mf.bb_editor('.bb-textarea') }}{% endblock %}", "mod_news_index.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-modules/News/html_admin/mod_news_index.phtml"); + } +} diff --git a/bb-data/cache/02/028f90f8bc0f495f8cc798ee2ed522accedae2311bc93e37f109e2e0e0417c4f.php b/bb-data/cache/02/028f90f8bc0f495f8cc798ee2ed522accedae2311bc93e37f109e2e0e0417c4f.php new file mode 100644 index 000000000..a95026ebc --- /dev/null +++ b/bb-data/cache/02/028f90f8bc0f495f8cc798ee2ed522accedae2311bc93e37f109e2e0e0417c4f.php @@ -0,0 +1,303 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'breadcrumb' => [$this, 'block_breadcrumb'], + 'content' => [$this, 'block_content'], + 'js' => [$this, 'block_js'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return $this->loadTemplate(((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "ajax", [], "any", false, false, false, 1)) ? ("layout_blank.phtml") : ("layout_default.phtml")), "mod_email_email.phtml", 1); + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + $this->getParent($context)->display($context, array_merge($this->blocks, $blocks)); + } + + // line 3 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("Email"); + } + + // line 4 + public function block_breadcrumb($context, array $blocks = []) + { + $macros = $this->macros; + // line 5 + echo "
  • extensions['Box_TwigExtensions']->twig_bb_client_link_filter("email"); + echo "\">"; + echo gettext("Emails"); + echo "/
  • +"; + // line 6 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["email"] ?? null), "subject", [], "any", false, false, false, 6), "html", null, true); + echo " +"; + } + + // line 8 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 9 + echo "
    +
    +
    +
    +

    "; + // line 13 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["email"] ?? null), "subject", [], "any", false, false, false, 13), "html", null, true); + echo "

    + +
    +
    + +
    env, $this->source, ($context["loop"] ?? null), "first", [], "any", false, false, false, 24)) { + echo "active"; + } + echo "\" id=\"tab"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["email"] ?? null), "id", [], "any", false, false, false, 24), "html", null, true); + echo "\" > +
    +

    "; + // line 26 + echo gettext("From:"); + echo " "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["email"] ?? null), "sender", [], "any", false, false, false, 26), "html", null, true); + echo "

    +

    "; + // line 27 + echo gettext("To:"); + echo " "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["email"] ?? null), "recipients", [], "any", false, false, false, 27), "html", null, true); + echo "

    +

    "; + // line 28 + echo gettext("Created at:"); + echo " "; + echo twig_escape_filter($this->env, $this->extensions['Box_TwigExtensions']->twig_bb_date(twig_get_attribute($this->env, $this->source, ($context["email"] ?? null), "created_at", [], "any", false, false, false, 28)), "html", null, true); + echo "

    +
    +
    +

    "; + // line 31 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["email"] ?? null), "subject", [], "any", false, false, false, 31), "html", null, true); + echo "

    +

    "; + // line 32 + echo twig_get_attribute($this->env, $this->source, ($context["email"] ?? null), "content_html", [], "any", false, false, false, 32); + echo "

    +
    + env, twig_get_attribute($this->env, $this->source, ($context["email"] ?? null), "id", [], "any", false, false, false, 34), "html", null, true); + echo "\">"; + echo gettext("Resend"); + echo " + env, twig_get_attribute($this->env, $this->source, ($context["email"] ?? null), "id", [], "any", false, false, false, 35), "html", null, true); + echo "\">"; + echo gettext("Delete"); + echo " +
    +
    + +
    +
    + +"; + } + + // line 43 + public function block_js($context, array $blocks = []) + { + $macros = $this->macros; + // line 45 + echo " +"; + } + + public function getTemplateName() + { + return "mod_email_email.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 191 => 71, 163 => 45, 159 => 43, 145 => 35, 139 => 34, 134 => 32, 130 => 31, 122 => 28, 116 => 27, 110 => 26, 101 => 24, 89 => 17, 82 => 13, 76 => 9, 72 => 8, 66 => 6, 59 => 5, 55 => 4, 48 => 3, 38 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends request.ajax ? \"layout_blank.phtml\" : \"layout_default.phtml\" %} + +{% block meta_title %}{% trans 'Email' %}{% endblock %} +{% block breadcrumb %} +
  • {% trans 'Emails' %}/
  • +{{ email.subject }} +{% endblock %} +{% block content %} +
    +
    +
    +
    +

    {{ email.subject }}

    + +
    +
    + +
    +
    +

    {% trans 'From:' %} {{email.sender}}

    +

    {% trans 'To:' %} {{email.recipients}}

    +

    {% trans 'Created at:' %} {{email.created_at|bb_date}}

    +
    +
    +

    {{ email.subject }}

    +

    {{email.content_html | raw}}

    +
    + {% trans 'Resend' %} + {% trans 'Delete' %} +
    +
    + +
    +
    + +{% endblock %} +{% block js %} +{% autoescape \"js\" %} + +{% endautoescape %} +{% endblock %}", "mod_email_email.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-modules/Email/html_client/mod_email_email.phtml"); + } +} diff --git a/bb-data/cache/03/0303f009459068153f06ff149aacdff2fc84f69ddeb00996ad9edb4a32c41f33.php b/bb-data/cache/03/0303f009459068153f06ff149aacdff2fc84f69ddeb00996ad9edb4a32c41f33.php new file mode 100644 index 000000000..d058e2f2e --- /dev/null +++ b/bb-data/cache/03/0303f009459068153f06ff149aacdff2fc84f69ddeb00996ad9edb4a32c41f33.php @@ -0,0 +1,950 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'content' => [$this, 'block_content'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return "layout_default.phtml"; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 2 + $macros["mf"] = $this->macros["mf"] = $this->loadTemplate("macro_functions.phtml", "mod_servicedomain_index.phtml", 2)->unwrap(); + // line 4 + $context["active_menu"] = "system"; + // line 1 + $this->parent = $this->loadTemplate("layout_default.phtml", "mod_servicedomain_index.phtml", 1); + $this->parent->display($context, array_merge($this->blocks, $blocks)); + } + + // line 3 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo "Domain management"; + } + + // line 6 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 7 + echo " +
    + + + +
    +
    +
    + +
    +
    "; + // line 23 + echo gettext("Manage TLDs"); + echo "
    +

    "; + // line 24 + echo gettext("Setup domain pricing and allowed operations. Assign specific domain registrars for each Top Level Domain (TLD)"); + echo "

    +
    + + + + + + + + + + + + + + + + "; + // line 41 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "servicedomain_tld_get_list", [0 => ["per_page" => 99]], "method", false, false, false, 41), "list", [], "any", false, false, false, 41)); + foreach ($context['_seq'] as $context["_key"] => $context["tld"]) { + // line 42 + echo " + + + + + + + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['_key'], $context['tld'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 59 + echo " + +
    "; + // line 30 + echo gettext("TLD"); + echo ""; + // line 31 + echo gettext("Registration"); + echo ""; + // line 32 + echo gettext("Renew"); + echo ""; + // line 33 + echo gettext("Transfer"); + echo " "; + // line 34 + echo gettext("Operations"); + echo ""; + // line 35 + echo gettext("Registrar"); + echo " 
    "; + // line 43 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["tld"], "tld", [], "any", false, false, false, 43), "html", null, true); + echo ""; + // line 44 + echo twig_call_macro($macros["mf"], "macro_currency_format", [twig_get_attribute($this->env, $this->source, $context["tld"], "price_registration", [], "any", false, false, false, 44)], 44, $context, $this->getSourceContext()); + echo ""; + // line 45 + echo twig_call_macro($macros["mf"], "macro_currency_format", [twig_get_attribute($this->env, $this->source, $context["tld"], "price_renew", [], "any", false, false, false, 45)], 45, $context, $this->getSourceContext()); + echo ""; + // line 46 + echo twig_call_macro($macros["mf"], "macro_currency_format", [twig_get_attribute($this->env, $this->source, $context["tld"], "price_transfer", [], "any", false, false, false, 46)], 46, $context, $this->getSourceContext()); + echo " + "; + // line 48 + echo gettext("Allow register:"); + echo " "; + if (twig_get_attribute($this->env, $this->source, $context["tld"], "allow_register", [], "any", false, false, false, 48)) { + echo gettext("Yes"); + } else { + echo gettext("No"); + } + echo "
    + "; + // line 49 + echo gettext("Allow transfer:"); + echo " "; + if (twig_get_attribute($this->env, $this->source, $context["tld"], "allow_transfer", [], "any", false, false, false, 49)) { + echo gettext("Yes"); + } else { + echo gettext("No"); + } + echo "
    + "; + // line 50 + echo gettext("Active:"); + echo " "; + if (twig_get_attribute($this->env, $this->source, $context["tld"], "active", [], "any", false, false, false, 50)) { + echo gettext("Yes"); + } else { + echo gettext("No"); + } + // line 51 + echo "
    extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("servicedomain/registrar"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["tld"], "registrar", [], "any", false, false, false, 52), "id", [], "any", false, false, false, 52), "html", null, true); + echo "\">"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["tld"], "registrar", [], "any", false, false, false, 52), "title", [], "any", false, false, false, 52), "html", null, true); + echo " + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("servicedomain/tld"); + echo "/"; + echo twig_escape_filter($this->env, twig_slice($this->env, twig_get_attribute($this->env, $this->source, $context["tld"], "tld", [], "any", false, false, false, 54), 1), "html", null, true); + echo "\">\"\" + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/servicedomain/tld_delete", ["tld" => twig_get_attribute($this->env, $this->source, $context["tld"], "tld", [], "any", false, false, false, 55)]); + echo "\">\"\" +
    +
    + +
    + +
    +
    "; + // line 67 + echo gettext("Add new top level domain"); + echo "
    +

    "; + // line 68 + echo gettext("Setup new TLD prices and properties"); + echo "

    +
    + +
    extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/servicedomain/tld_create"); + echo "\" class=\"mainForm save api-form\" data-api-reload=\"1\"> +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + + +
    +
    +
    + +
    + +
    + + +
    +
    +
    + +
    + +
    + + +
    +
    +
    + + +
    +
    + +
    + +
    + +
    +
    "; + // line 160 + echo gettext("Domain registrars"); + echo "
    +

    "; + // line 161 + echo gettext("Manage domain registrars"); + echo "

    +
    + + + + + + + + + + "; + // line 172 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "servicedomain_registrar_get_list", [], "any", false, false, false, 172), "list", [], "any", false, false, false, 172)); + foreach ($context['_seq'] as $context["_key"] => $context["registrar"]) { + // line 173 + echo " + + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['_key'], $context['registrar'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 182 + echo " +
    "; + // line 167 + echo gettext("Title"); + echo " 
    "; + // line 174 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["registrar"], "title", [], "any", false, false, false, 174), "html", null, true); + echo " + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("servicedomain/registrar/"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["registrar"], "id", [], "any", false, false, false, 176), "html", null, true); + echo "\">\"\" + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/servicedomain/registrar_copy", ["id" => twig_get_attribute($this->env, $this->source, $context["registrar"], "id", [], "any", false, false, false, 177)]); + echo "\" data-api-reload=\"1\" title=\"Install\">\"\" + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/servicedomain/registrar_delete", ["id" => twig_get_attribute($this->env, $this->source, $context["registrar"], "id", [], "any", false, false, false, 178)]); + echo "\" data-api-confirm=\"Are you sure?\" data-api-reload=\"1\">\"\" +
    + +
    + +
    + +
    +
    "; + // line 190 + echo gettext("Nameservers"); + echo "
    +

    "; + // line 191 + echo gettext("Setup default nameservers that will be used for new domain registrations if client have not provided his own nameservers in order form"); + echo "

    +
    + +
    extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/system/update_params"); + echo "\" class=\"mainForm api-form\" data-api-msg=\"Nameservers updated\"> +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "system_param", [0 => ["key" => "nameserver_1"]], "method", false, false, false, 199), "html", null, true); + echo "\"> +
    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "system_param", [0 => ["key" => "nameserver_2"]], "method", false, false, false, 207), "html", null, true); + echo "\"> +
    +
    +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "system_param", [0 => ["key" => "nameserver_3"]], "method", false, false, false, 214), "html", null, true); + echo "\"> +
    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "system_param", [0 => ["key" => "nameserver_4"]], "method", false, false, false, 222), "html", null, true); + echo "\"> +
    +
    +
    + +
    +
    +
    + +
    + "; + // line 232 + $this->loadTemplate("partial_extensions.phtml", "mod_servicedomain_index.phtml", 232)->display(twig_to_array(["type" => "domain-registrar", "header" => "List of domain registrars on extensions site"])); + // line 233 + echo "
    +

    "; + // line 234 + echo gettext("Adding new domain registrar"); + echo "

    +

    "; + // line 235 + echo gettext("Follow instructions below to install new domain registrar."); + echo "

    + +
    +
      +
    • "; + // line 239 + echo gettext("Check domain registrar you are looking for is available at"); + echo " BoxBilling extensions site
    • +
    • "; + // line 240 + echo gettext("Download domain registrar file and place to"); + echo " "; + echo twig_escape_filter($this->env, twig_constant("BB_PATH_LIBRARY"), "html", null, true); + echo "/Registrar/Adapter
    • +
    • "; + // line 241 + echo gettext("Reload this page to see newly detected domain registrar"); + echo "
    • +
    • "; + // line 242 + echo gettext("Click on install button. Now you will be able to create top level domains with new domain registrar"); + echo "
    • +
    • "; + // line 243 + echo gettext("For developers. Read"); + echo " "; + echo gettext("BoxBilling documentation"); + echo " "; + echo gettext("to learn how to create your own domain registrar."); + echo "
    • +
    +
    + +
    + + "; + // line 249 + if ((twig_length_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "servicedomain_registrar_get_available", [], "any", false, false, false, 249)) > 0)) { + // line 250 + echo " + + + + + + + + + "; + // line 259 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "servicedomain_registrar_get_available", [], "any", false, false, false, 259)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["_key"] => $context["code"]) { + // line 260 + echo " + + + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 269 + echo " + + + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['_key'], $context['code'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 277 + echo "
    "; + // line 253 + echo gettext("Code"); + echo ""; + // line 254 + echo gettext("Install"); + echo "
    "; + // line 261 + echo twig_escape_filter($this->env, $context["code"], "html", null, true); + echo " + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/servicedomain/registrar_install", ["code" => $context["code"]]); + echo "\" data-api-msg=\"Domain registrar installed\" title=\"Install\">\"\" +
    + "; + // line 272 + echo gettext("All payment gateways installed"); + // line 273 + echo "
    + "; + } + // line 279 + echo "
    +
    +
    +"; + } + + public function getTemplateName() + { + return "mod_servicedomain_index.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 643 => 279, 639 => 277, 630 => 273, 628 => 272, 623 => 269, 612 => 263, 607 => 261, 604 => 260, 599 => 259, 591 => 254, 587 => 253, 582 => 250, 580 => 249, 567 => 243, 563 => 242, 559 => 241, 553 => 240, 549 => 239, 542 => 235, 538 => 234, 535 => 233, 533 => 232, 524 => 226, 517 => 222, 512 => 220, 503 => 214, 498 => 212, 490 => 207, 485 => 205, 476 => 199, 471 => 197, 465 => 194, 459 => 191, 455 => 190, 445 => 182, 435 => 178, 431 => 177, 425 => 176, 420 => 174, 417 => 173, 413 => 172, 405 => 167, 396 => 161, 392 => 160, 380 => 151, 372 => 146, 368 => 145, 363 => 143, 354 => 137, 350 => 136, 345 => 134, 336 => 128, 332 => 127, 327 => 125, 316 => 117, 305 => 109, 294 => 101, 283 => 93, 275 => 87, 264 => 85, 260 => 84, 254 => 81, 244 => 74, 238 => 71, 232 => 68, 228 => 67, 218 => 59, 208 => 55, 202 => 54, 193 => 52, 190 => 51, 182 => 50, 172 => 49, 162 => 48, 157 => 46, 153 => 45, 149 => 44, 145 => 43, 142 => 42, 138 => 41, 129 => 35, 125 => 34, 121 => 33, 117 => 32, 113 => 31, 109 => 30, 100 => 24, 96 => 23, 85 => 15, 81 => 14, 77 => 13, 73 => 12, 69 => 11, 63 => 7, 59 => 6, 52 => 3, 47 => 1, 45 => 4, 43 => 2, 36 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends \"layout_default.phtml\" %} +{% import \"macro_functions.phtml\" as mf %} +{% block meta_title %}Domain management{% endblock %} +{% set active_menu = 'system' %} + +{% block content %} + +
    + + + +
    +
    +
    + +
    +
    {% trans 'Manage TLDs' %}
    +

    {% trans 'Setup domain pricing and allowed operations. Assign specific domain registrars for each Top Level Domain (TLD)' %}

    +
    + + + + + + + + + + + + + + + + {% for tld in admin.servicedomain_tld_get_list({\"per_page\":99}).list %} + + + + + + + + + + {% endfor %} + + +
    {% trans 'TLD' %}{% trans 'Registration' %}{% trans 'Renew' %}{% trans 'Transfer' %} {% trans 'Operations' %}{% trans 'Registrar' %} 
    {{ tld.tld }}{{ mf.currency_format(tld.price_registration) }}{{ mf.currency_format(tld.price_renew) }}{{ mf.currency_format(tld.price_transfer) }} + {% trans 'Allow register:' %} {% if tld.allow_register %}{% trans 'Yes' %}{% else %}{% trans 'No' %}{% endif %}
    + {% trans 'Allow transfer:' %} {% if tld.allow_transfer %}{% trans 'Yes' %}{% else %}{% trans 'No' %}{% endif %}
    + {% trans 'Active:' %} {% if tld.active %}{% trans 'Yes' %}{% else %}{% trans 'No' %}{% endif %} +
    {{ tld.registrar.title }} + \"\" + \"\" +
    +
    + +
    + +
    +
    {% trans 'Add new top level domain' %}
    +

    {% trans 'Setup new TLD prices and properties' %}

    +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + + +
    +
    +
    + +
    + +
    + + +
    +
    +
    + +
    + +
    + + +
    +
    +
    + + +
    +
    + +
    + +
    + +
    +
    {% trans 'Domain registrars' %}
    +

    {% trans 'Manage domain registrars' %}

    +
    + + + + + + + + + + {% for registrar in admin.servicedomain_registrar_get_list.list %} + + + + + {% endfor %} + +
    {% trans 'Title' %} 
    {{ registrar.title }} + \"\" + \"\" + \"\" +
    + +
    + +
    + +
    +
    {% trans 'Nameservers' %}
    +

    {% trans 'Setup default nameservers that will be used for new domain registrations if client have not provided his own nameservers in order form' %}

    +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    +
    +
    + +
    + {% include \"partial_extensions.phtml\" with {'type': 'domain-registrar', 'header':\"List of domain registrars on extensions site\"} only %} +
    +

    {% trans 'Adding new domain registrar' %}

    +

    {% trans 'Follow instructions below to install new domain registrar.' %}

    + +
    +
      +
    • {% trans 'Check domain registrar you are looking for is available at' %} BoxBilling extensions site
    • +
    • {% trans 'Download domain registrar file and place to' %} {{ constant('BB_PATH_LIBRARY') }}/Registrar/Adapter
    • +
    • {% trans 'Reload this page to see newly detected domain registrar' %}
    • +
    • {% trans 'Click on install button. Now you will be able to create top level domains with new domain registrar' %}
    • +
    • {% trans 'For developers. Read' %} {% trans 'BoxBilling documentation' %} {% trans 'to learn how to create your own domain registrar.' %}
    • +
    +
    + +
    + + {% if admin.servicedomain_registrar_get_available|length > 0 %} + + + + + + + + + + {% for code in admin.servicedomain_registrar_get_available %} + + + + + + + {% else %} + + + + + + {% endfor %} +
    {% trans 'Code' %}{% trans 'Install' %}
    {{ code }} + \"\" +
    + {% trans 'All payment gateways installed' %} +
    + {% endif %} +
    +
    +
    +{% endblock %} +", "mod_servicedomain_index.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-themes/admin_default/html/mod_servicedomain_index.phtml"); + } +} diff --git a/bb-data/cache/03/030807951a67ff2e2ea1e6e991f42bcee65d0302eb4296c0bf4d0e91af71c1fb.php b/bb-data/cache/03/030807951a67ff2e2ea1e6e991f42bcee65d0302eb4296c0bf4d0e91af71c1fb.php new file mode 100644 index 000000000..fc87f73b0 --- /dev/null +++ b/bb-data/cache/03/030807951a67ff2e2ea1e6e991f42bcee65d0302eb4296c0bf4d0e91af71c1fb.php @@ -0,0 +1,61 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 1 + echo "["; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "system_company", [], "any", false, false, false, 1), "name", [], "any", false, false, false, 1), "html", null, true); + echo "] Payment Received"; + } + + public function getTemplateName() + { + return "__string_template__f652477160cbed14cd4721f1d07f6b1013dfa5f07a14f6917fca929a906b82cf"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 37 => 1,); + } + + public function getSourceContext() + { + return new Source("[{{ guest.system_company.name }}] Payment Received", "__string_template__f652477160cbed14cd4721f1d07f6b1013dfa5f07a14f6917fca929a906b82cf", ""); + } +} diff --git a/bb-data/cache/05/05a76b95ebe78b940225fd4fcc949ab41374bd0a355187a654a806ab99598be3.php b/bb-data/cache/05/05a76b95ebe78b940225fd4fcc949ab41374bd0a355187a654a806ab99598be3.php new file mode 100644 index 000000000..87ddcfad6 --- /dev/null +++ b/bb-data/cache/05/05a76b95ebe78b940225fd4fcc949ab41374bd0a355187a654a806ab99598be3.php @@ -0,0 +1,971 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'breadcrumbs' => [$this, 'block_breadcrumbs'], + 'content' => [$this, 'block_content'], + 'head' => [$this, 'block_head'], + 'js' => [$this, 'block_js'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return "layout_default.phtml"; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 2 + $macros["mf"] = $this->macros["mf"] = $this->loadTemplate("macro_functions.phtml", "mod_product_manage.phtml", 2)->unwrap(); + // line 3 + $context["active_menu"] = "products"; + // line 1 + $this->parent = $this->loadTemplate("layout_default.phtml", "mod_product_manage.phtml", 1); + $this->parent->display($context, array_merge($this->blocks, $blocks)); + } + + // line 4 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("Product configuration"); + } + + // line 7 + public function block_breadcrumbs($context, array $blocks = []) + { + $macros = $this->macros; + // line 8 + echo " +"; + } + + // line 15 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 16 + echo " +
    + + + +
    +
    +
    +
    + +
    +
    "; + // line 33 + echo twig_escape_filter($this->env, twig_title_string_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "type", [], "any", false, false, false, 33)), "html", null, true); + echo " "; + echo gettext("General settings"); + echo "
    +
    + +
    +
    + +
    + "; + // line 40 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["product_category_id", twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "product_category_get_pairs", [], "any", false, false, false, 40), twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "product_category_id", [], "any", false, false, false, 40), 0, "None"], 40, $context, $this->getSourceContext()); + echo " +
    +
    +
    + + "; + // line 45 + if (twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "extension_is_on", [0 => ["mod" => "formbuilder"]], "method", false, false, false, 45)) { + // line 46 + echo "
    + +
    + "; + // line 49 + $context["tpl"] = (("mod_service" . twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "type", [], "any", false, false, false, 49)) . "_order_form.phtml"); + // line 50 + echo " "; + if (twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "system_template_exists", [0 => ["file" => ($context["tpl"] ?? null)]], "method", false, false, false, 50)) { + // line 51 + echo "

    Please edit "; + echo twig_escape_filter($this->env, ($context["tpl"] ?? null), "html", null, true); + echo " file in order to change order form for "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "type", [], "any", false, false, false, 51), "html", null, true); + echo " category products.

    + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("filemanager/ide"); + echo "\" class=\"button blueBtn\">"; + echo gettext("Open Editor"); + echo " + "; + } else { + // line 54 + echo " "; + echo twig_call_macro($macros["mf"], "macro_selectbox", ["form_id", twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "formbuilder_get_pairs", [], "any", false, false, false, 54), twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "form_id", [], "any", false, false, false, 54), 0, "None"], 54, $context, $this->getSourceContext()); + echo " +             + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("extension/settings/formbuilder"); + if (twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "form_id", [], "any", false, false, false, 56)) { + echo "?id="; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "form_id", [], "any", false, false, false, 56), "html", null, true); + } + echo "\" class=\"button blueBtn\" id=\"formbuilder_btn\">"; + echo ((twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "form_id", [], "any", false, false, false, 56)) ? ("Edit Form") : ("Add new form")); + echo " + "; + } + // line 58 + echo "
    +
    +
    + "; + } + // line 62 + echo "
    + +
    + env, $this->source, ($context["product"] ?? null), "status", [], "any", false, false, false, 65) == "enabled")) { + echo " checked=\"checked\""; + } + echo " id=\"status-enabled\"/> + env, $this->source, ($context["product"] ?? null), "status", [], "any", false, false, false, 66) == "disabled")) { + echo " checked=\"checked\""; + } + echo " id=\"status-disabled\"/> +
    +
    +
    +
    + +
    + env, $this->source, ($context["product"] ?? null), "hidden", [], "any", false, false, false, 73)) { + echo " checked=\"checked\""; + } + echo " id=\"hidden-yes\"/> + env, $this->source, ($context["product"] ?? null), "hidden", [], "any", false, false, false, 74)) { + echo " checked=\"checked\""; + } + echo " id=\"hidden-no\"/> +
    +
    +
    +
    + +
    + env, $this->source, ($context["product"] ?? null), "setup", [], "any", false, false, false, 81) == "after_order")) { + echo " checked=\"checked\""; + } + echo " id=\"activation-after-order\"/> + env, $this->source, ($context["product"] ?? null), "setup", [], "any", false, false, false, 82) == "after_payment")) { + echo " checked=\"checked\""; + } + echo " id=\"activation-after-payment\"/> + env, $this->source, ($context["product"] ?? null), "setup", [], "any", false, false, false, 83) == "manual")) { + echo " checked=\"checked\""; + } + echo " id=\"activation-manual\"/> +
    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "icon_url", [], "any", false, false, false, 91), "html", null, true); + echo "\" placeholder=\"\" style=\"width: 80%\"/> + +
    +
    +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "title", [], "any", false, false, false, 99), "html", null, true); + echo "\" required=\"required\" placeholder=\"\"/> +
    +
    +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "slug", [], "any", false, false, false, 106), "html", null, true); + echo "\" required=\"required\" placeholder=\"\"/> +
    +
    +
    + + "; + // line 111 + $this->loadTemplate("partial_pricing.phtml", "mod_product_manage.phtml", 111)->display(twig_array_merge($context, ["product" => ($context["product"] ?? null)])); + // line 112 + echo " +
    + +
    + "; + // line 116 + echo gettext("Product / service description"); + echo " + + + +
    +
    +
    + +
    +
    +
    "; + // line 126 + echo gettext("Choose which addons you would like to offer with"); + echo " "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "title", [], "any", false, false, false, 126), "html", null, true); + echo "
    +
    + + + + "; + // line 131 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "product_addon_get_pairs", [], "any", false, false, false, 131)); + $context['_iterated'] = false; + $context['loop'] = [ + 'parent' => $context['_parent'], + 'index0' => 0, + 'index' => 1, + 'first' => true, + ]; + if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof \Countable)) { + $length = count($context['_seq']); + $context['loop']['revindex0'] = $length - 1; + $context['loop']['revindex'] = $length; + $context['loop']['length'] = $length; + $context['loop']['last'] = 1 === $length; + } + foreach ($context['_seq'] as $context["addon_id"] => $context["addon_title"]) { + // line 132 + echo " env, $this->source, $context["loop"], "first", [], "any", false, false, false, 132)) { + echo "class=\"noborder\""; + } + echo "> + + + + + "; + $context['_iterated'] = true; + ++$context['loop']['index0']; + ++$context['loop']['index']; + $context['loop']['first'] = false; + if (isset($context['loop']['length'])) { + --$context['loop']['revindex0']; + --$context['loop']['revindex']; + $context['loop']['last'] = 0 === $context['loop']['revindex0']; + } + } + if (!$context['_iterated']) { + // line 141 + echo " + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['addon_id'], $context['addon_title'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 145 + echo " + + + + + +
    + env, $context["addon_id"], "html", null, true); + echo "]\" value=\"0\"> + env, $context["addon_id"], "html", null, true); + echo "]\" value=\"1\" id=\"addon_"; + echo twig_escape_filter($this->env, $context["addon_id"], "html", null, true); + echo "\" "; + if (twig_in_filter($context["addon_id"], ($context["assigned_addons"] ?? null))) { + echo "checked=\"checked\""; + } + echo "/> + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("/product/addon"); + echo "/"; + echo twig_escape_filter($this->env, $context["addon_id"], "html", null, true); + echo "\">\"\"
    "; + // line 142 + echo gettext("The list is empty"); + echo "
    + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("product/addons"); + echo "#tab-new\" title=\"\" class=\"btnIconLeft mr10 mt5\">\"\""; + echo gettext("Create new addon"); + echo " +
    + + + +
    +
    + +
    +
    +
    "; + // line 162 + echo gettext("Choose which products can client upgrade to"); + echo "
    +
    +
    +
    + +
    + "; + // line 168 + $context["products"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "product_get_pairs", [], "any", false, false, false, 168); + // line 169 + echo " + +
    +
    +
    + + env, twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "id", [], "any", false, false, false, 179), "html", null, true); + echo "\" /> +
    +
    + + env, twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "id", [], "any", false, false, false, 183), "html", null, true); + echo "\" /> +
    + +
    + "; + // line 187 + $context["service_partial"] = (("mod_service" . twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "type", [], "any", false, false, false, 187)) . "_config.phtml"); + // line 188 + echo " "; + if (twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "system_template_exists", [0 => ["file" => ($context["service_partial"] ?? null)]], "method", false, false, false, 188)) { + // line 189 + echo " "; + $this->loadTemplate(($context["service_partial"] ?? null), "mod_product_manage.phtml", 189)->display(twig_array_merge($context, ["product" => ($context["product"] ?? null)])); + // line 190 + echo " "; + } else { + // line 191 + echo "
    +
    "; + // line 192 + echo gettext("No additional configuration for this product is required"); + echo "
    +
    + "; + } + // line 195 + echo "
    +
    + +
    +
    +
    +
    "; + // line 201 + echo gettext("Product links"); + echo "
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "id", [], "any", false, false, false, 207), "html", null, true); + echo "\"/> +
    +
    +
    + +
    + +
    + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("order"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "id", [], "any", false, false, false, 215), "html", null, true); + echo "\"/> +
    +
    +
    + +
    + +
    + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("order"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "slug", [], "any", false, false, false, 223), "html", null, true); + echo "\"/> +
    +
    +
    + +
    + + + +
    +
    + +
    + +
    +"; + } + + // line 243 + public function block_head($context, array $blocks = []) + { + $macros = $this->macros; + echo twig_call_macro($macros["mf"], "macro_bb_editor", [".bb-textarea"], 243, $context, $this->getSourceContext()); + } + + // line 245 + public function block_js($context, array $blocks = []) + { + $macros = $this->macros; + // line 246 + echo " +"; + } + + public function getTemplateName() + { + return "mod_product_manage.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 673 => 261, 665 => 256, 653 => 249, 648 => 246, 644 => 245, 637 => 243, 619 => 231, 606 => 223, 601 => 221, 590 => 215, 585 => 213, 576 => 207, 571 => 205, 564 => 201, 556 => 195, 550 => 192, 547 => 191, 544 => 190, 541 => 189, 538 => 188, 536 => 187, 529 => 183, 522 => 179, 518 => 178, 512 => 174, 497 => 172, 493 => 171, 489 => 170, 486 => 169, 484 => 168, 479 => 166, 472 => 162, 461 => 154, 451 => 149, 445 => 145, 436 => 142, 433 => 141, 415 => 138, 409 => 137, 398 => 135, 394 => 134, 386 => 132, 368 => 131, 358 => 126, 348 => 119, 343 => 117, 339 => 116, 333 => 112, 331 => 111, 323 => 106, 318 => 104, 310 => 99, 305 => 97, 297 => 92, 293 => 91, 288 => 89, 275 => 83, 267 => 82, 259 => 81, 254 => 79, 242 => 74, 234 => 73, 229 => 71, 217 => 66, 209 => 65, 204 => 63, 201 => 62, 195 => 58, 184 => 56, 178 => 54, 171 => 52, 164 => 51, 161 => 50, 159 => 49, 154 => 47, 151 => 46, 149 => 45, 141 => 40, 136 => 38, 126 => 33, 114 => 24, 110 => 23, 106 => 22, 102 => 21, 98 => 20, 92 => 16, 88 => 15, 81 => 11, 75 => 10, 69 => 9, 66 => 8, 62 => 7, 55 => 4, 50 => 1, 48 => 3, 46 => 2, 39 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends \"layout_default.phtml\" %} +{% import \"macro_functions.phtml\" as mf %} +{% set active_menu = 'products' %} +{% block meta_title %}{% trans 'Product configuration' %}{% endblock %} + + +{% block breadcrumbs %} + +{% endblock %} + +{% block content %} + +
    + + + +
    +
    +
    +
    + +
    +
    {{ product.type|title }} {% trans 'General settings' %}
    +
    + +
    +
    + +
    + {{ mf.selectbox('product_category_id', guest.product_category_get_pairs, product.product_category_id, 0, 'None') }} +
    +
    +
    + + {% if guest.extension_is_on({\"mod\":\"formbuilder\"}) %} +
    + +
    + {% set tpl = \"mod_service\"~product.type~\"_order_form.phtml\" %} + {% if guest.system_template_exists({\"file\":tpl}) %} +

    Please edit {{tpl}} file in order to change order form for {{product.type}} category products.

    + {% trans 'Open Editor' %} + {% else %} + {{ mf.selectbox('form_id', admin.formbuilder_get_pairs, product.form_id, 0, 'None') }} +             + {{ (product.form_id) ? 'Edit Form' : 'Add new form'}} + {% endif %} +
    +
    +
    + {% endif %} +
    + +
    + + +
    +
    +
    +
    + +
    + + +
    +
    +
    +
    + +
    + + + +
    +
    +
    + +
    + +
    + + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    + + {% include \"partial_pricing.phtml\" with {'product': product} %} + +
    + +
    + {% trans 'Product / service description' %} + + + +
    +
    +
    + +
    +
    +
    {% trans 'Choose which addons you would like to offer with' %} {{ product.title }}
    +
    + + + + {% for addon_id, addon_title in admin.product_addon_get_pairs %} + + + + + + {% else %} + + + + {% endfor %} + + + + + + +
    + + + \"\"
    {% trans 'The list is empty' %}
    + \"\"{% trans 'Create new addon' %} +
    + + + +
    +
    + +
    +
    +
    {% trans 'Choose which products can client upgrade to' %}
    +
    +
    +
    + +
    + {% set products = admin.product_get_pairs %} + + +
    +
    +
    + + +
    +
    + + +
    + +
    + {% set service_partial = \"mod_service\" ~ product.type ~ \"_config.phtml\" %} + {% if admin.system_template_exists({\"file\":service_partial}) %} + {% include service_partial with {'product': product} %} + {% else %} +
    +
    {% trans 'No additional configuration for this product is required' %}
    +
    + {% endif %} +
    +
    + +
    +
    +
    +
    {% trans 'Product links' %}
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + + + +
    +
    + +
    + +
    +{% endblock %} + + +{% block head %}{{ mf.bb_editor('.bb-textarea') }}{% endblock %} + +{% block js %} + +{% endblock %} +", "mod_product_manage.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-themes/admin_default/html/mod_product_manage.phtml"); + } +} diff --git a/bb-data/cache/06/06a21117a2f343a16d05fb14ee939a67a17369625152ea9659a81819175d8063.php b/bb-data/cache/06/06a21117a2f343a16d05fb14ee939a67a17369625152ea9659a81819175d8063.php new file mode 100644 index 000000000..93df79354 --- /dev/null +++ b/bb-data/cache/06/06a21117a2f343a16d05fb14ee939a67a17369625152ea9659a81819175d8063.php @@ -0,0 +1,319 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'breadcrumb' => [$this, 'block_breadcrumb'], + 'content' => [$this, 'block_content'], + 'js' => [$this, 'block_js'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return $this->loadTemplate(((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "ajax", [], "any", false, false, false, 1)) ? ("layout_blank.phtml") : ("layout_default.phtml")), "mod_client_balance.phtml", 1); + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 2 + $macros["mf"] = $this->macros["mf"] = $this->loadTemplate("macro_functions.phtml", "mod_client_balance.phtml", 2)->unwrap(); + // line 5 + $context["profile"] = twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "client_get", [], "any", false, false, false, 5); + // line 1 + $this->getParent($context)->display($context, array_merge($this->blocks, $blocks)); + } + + // line 3 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("Payments history"); + } + + // line 4 + public function block_breadcrumb($context, array $blocks = []) + { + $macros = $this->macros; + echo "
  • "; + echo gettext("Payments history"); + echo "
  • "; + } + + // line 7 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 8 + echo "
    +
    +
    + +
    +

    "; + // line 13 + echo gettext("Payments history"); + echo "

    +

    "; + // line 14 + echo gettext("Here you can track what you have been charged for and add more funds to your account"); + echo "

    +
    + +
    + + + + + + + + + + "; + // line 27 + $context["transactions"] = twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "client_balance_get_list", [0 => ["per_page" => 10, "page" => twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "page", [], "any", false, false, false, 27)]], "method", false, false, false, 27); + // line 28 + echo " "; + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["transactions"] ?? null), "list", [], "any", false, false, false, 28)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["i"] => $context["tx"]) { + // line 29 + echo " env, twig_cycle([0 => "odd", 1 => "even"], $context["i"]), "html", null, true); + echo "\"> + + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 35 + echo " + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['i'], $context['tx'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 39 + echo " + + + + + + +
    "; + // line 21 + echo gettext("Description"); + echo ""; + // line 22 + echo gettext("Date"); + echo ""; + // line 23 + echo gettext("Amount"); + echo "
    "; + // line 30 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["tx"], "description", [], "any", false, false, false, 30), "html", null, true); + echo ""; + // line 31 + echo twig_escape_filter($this->env, $this->extensions['Box_TwigExtensions']->twig_bb_date(twig_get_attribute($this->env, $this->source, $context["tx"], "created_at", [], "any", false, false, false, 31)), "html", null, true); + echo ""; + // line 32 + echo twig_money($this->env, twig_get_attribute($this->env, $this->source, $context["tx"], "amount", [], "any", false, false, false, 32), twig_get_attribute($this->env, $this->source, $context["tx"], "currency", [], "any", false, false, false, 32)); + echo "
    "; + // line 36 + echo gettext("The list is empty"); + echo "
    "; + // line 42 + echo gettext("Total:"); + echo ""; + // line 43 + echo twig_money($this->env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "balance", [], "any", false, false, false, 43), twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "currency", [], "any", false, false, false, 43)); + echo "
    + "; + // line 47 + $this->loadTemplate("partial_pagination.phtml", "mod_client_balance.phtml", 47)->display(twig_array_merge($context, ["list" => ($context["transactions"] ?? null)])); + // line 48 + echo " +
    + +
    +
    extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/client/invoice/funds_invoice"); + echo "\" data-api-jsonp=\"onAfterInvoiceCreated\"> +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    + +
    + +
    + +
    +
    + +"; + } + + // line 74 + public function block_js($context, array $blocks = []) + { + $macros = $this->macros; + // line 75 + echo " +"; + } + + public function getTemplateName() + { + return "mod_client_balance.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 210 => 77, 206 => 75, 202 => 74, 182 => 57, 174 => 52, 168 => 48, 166 => 47, 159 => 43, 155 => 42, 150 => 39, 141 => 36, 138 => 35, 130 => 32, 126 => 31, 122 => 30, 117 => 29, 111 => 28, 109 => 27, 102 => 23, 98 => 22, 94 => 21, 84 => 14, 80 => 13, 73 => 8, 69 => 7, 60 => 4, 53 => 3, 49 => 1, 47 => 5, 45 => 2, 38 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends request.ajax ? \"layout_blank.phtml\" : \"layout_default.phtml\" %} +{% import \"macro_functions.phtml\" as mf %} +{% block meta_title %}{% trans 'Payments history' %}{% endblock %} +{% block breadcrumb %}
  • {% trans 'Payments history' %}
  • {% endblock %} +{% set profile = client.client_get %} + +{% block content %} +
    +
    +
    + +
    +

    {% trans 'Payments history'%}

    +

    {% trans 'Here you can track what you have been charged for and add more funds to your account' %}

    +
    + +
    + + + + + + + + + + {% set transactions = client.client_balance_get_list({\"per_page\":10, \"page\":request.page}) %} + {% for i, tx in transactions.list %} + + + + + + {% else %} + + + + {% endfor %} + + + + + + + +
    {% trans 'Description' %}{% trans 'Date' %}{% trans 'Amount' %}
    {{tx.description}}{{tx.created_at|bb_date}}{{ tx.amount | money(tx.currency) }}
    {% trans 'The list is empty' %}
    {% trans 'Total:' %}{{ profile.balance | money(profile.currency) }}
    + {% include \"partial_pagination.phtml\" with {'list': transactions} %} + +
    + +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    + +
    + +
    + +
    +
    + +{% endblock %} + +{% block js %} + +{% endblock %} + +", "mod_client_balance.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-modules/Client/html_client/mod_client_balance.phtml"); + } +} diff --git a/bb-data/cache/08/0824b7c0c7d034104cb4845ccb78e1303cabd632d665aaccfac3ba974ffac5d9.php b/bb-data/cache/08/0824b7c0c7d034104cb4845ccb78e1303cabd632d665aaccfac3ba974ffac5d9.php new file mode 100644 index 000000000..3fd8787da --- /dev/null +++ b/bb-data/cache/08/0824b7c0c7d034104cb4845ccb78e1303cabd632d665aaccfac3ba974ffac5d9.php @@ -0,0 +1,200 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'content' => [$this, 'block_content'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return $this->loadTemplate(((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "ajax", [], "any", false, false, false, 1)) ? ("layout_blank.phtml") : ("layout_default.phtml")), "mod_invoice_banklink.phtml", 1); + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + $this->getParent($context)->display($context, array_merge($this->blocks, $blocks)); + } + + // line 3 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("Processing payment ..."); + } + + // line 5 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 6 + echo " +"; + // line 11 + echo "
    +
    +
    +
    +

    "; + // line 15 + echo gettext("Processing payment ..."); + echo "

    +

    "; + // line 16 + echo gettext("Thank you for your patience."); + echo "

    +
    +
    + "; + // line 19 + if ((twig_get_attribute($this->env, $this->source, ($context["payment"] ?? null), "type", [], "any", false, false, false, 19) == "html")) { + // line 20 + echo " "; + echo twig_get_attribute($this->env, $this->source, ($context["payment"] ?? null), "result", [], "any", false, false, false, 20); + echo " + "; + } + // line 22 + echo " "; + if ((twig_get_attribute($this->env, $this->source, ($context["payment"] ?? null), "type", [], "any", false, false, false, 22) == "form")) { + // line 23 + echo "

    "; + echo gettext("Redirecting to payment gateway.."); + echo "

    +
    env, twig_get_attribute($this->env, $this->source, ($context["payment"] ?? null), "service_url", [], "any", false, false, false, 24), "html", null, true); + echo "\" method=\"post\"> + "; + // line 25 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["payment"] ?? null), "result", [], "any", false, false, false, 25)); + foreach ($context['_seq'] as $context["key"] => $context["value"]) { + // line 26 + echo " env, $context["key"], "html", null, true); + echo "\" value=\""; + echo twig_escape_filter($this->env, $context["value"], "html", null, true); + echo "\" /> + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['key'], $context['value'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 28 + echo " +
    + + + "; + } + // line 38 + echo "
    +
    +
    +
    + + + + +"; + } + + public function getTemplateName() + { + return "mod_invoice_banklink.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 125 => 38, 111 => 28, 100 => 26, 96 => 25, 92 => 24, 87 => 23, 84 => 22, 78 => 20, 76 => 19, 70 => 16, 66 => 15, 60 => 11, 57 => 6, 53 => 5, 46 => 3, 36 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends request.ajax ? \"layout_blank.phtml\" : \"layout_default.phtml\" %} + +{% block meta_title %}{% trans 'Processing payment ...' %}{% endblock %} + +{% block content %} + +{# +
    {% debug invoice %}
    +
    {% debug payment %}
    +#} +
    +
    +
    +
    +

    {% trans 'Processing payment ...' %}

    +

    {% trans 'Thank you for your patience.' %}

    +
    +
    + {% if payment.type == 'html' %} + {{ payment.result|raw }} + {% endif %} + {% if payment.type == 'form' %} +

    {% trans 'Redirecting to payment gateway..' %}

    +
    + {% for key, value in payment.result %} + + {% endfor %} + +
    + + + {% endif %} +
    +
    +
    +
    + + + + +{% endblock %}", "mod_invoice_banklink.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-modules/Invoice/html_client/mod_invoice_banklink.phtml"); + } +} diff --git a/bb-data/cache/11/1105b5f2968f603b4ca0e3f8b3762b4f51e0385f5ae52641a3dfc2952ee6e77b.php b/bb-data/cache/11/1105b5f2968f603b4ca0e3f8b3762b4f51e0385f5ae52641a3dfc2952ee6e77b.php new file mode 100644 index 000000000..cbba2ad07 --- /dev/null +++ b/bb-data/cache/11/1105b5f2968f603b4ca0e3f8b3762b4f51e0385f5ae52641a3dfc2952ee6e77b.php @@ -0,0 +1,170 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + 'js' => [$this, 'block_js'], + ]; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 1 + echo " \t© Copyright "; + echo twig_escape_filter($this->env, twig_date_format_filter($this->env, ($context["now"] ?? null), "Y"), "html", null, true); + echo ". All rights reserved. Powered by BoxBilling "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "system_version", [], "any", false, false, false, 1), "html", null, true); + echo " + Help + + +
    +
    "; + // line 6 + echo gettext("Help?"); + echo "
    +
    + +
    + +
    +
    +
    + + "; + // line 33 + $this->displayBlock('js', $context, $blocks); + } + + public function block_js($context, array $blocks = []) + { + $macros = $this->macros; + // line 34 + echo " + "; + } + + public function getTemplateName() + { + return "partial_footer.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 95 => 34, 88 => 33, 73 => 21, 66 => 17, 59 => 13, 49 => 6, 38 => 1,); + } + + public function getSourceContext() + { + return new Source(" \t© Copyright {{ now|date('Y') }}. All rights reserved. Powered by BoxBilling {{ guest.system_version }} + Help + + +
    +
    {% trans 'Help?' %}
    +
    + +
    + +
    +
    +
    + + {% block js %} + + {% endblock %}", "partial_footer.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-themes/admin_default/html/partial_footer.phtml"); + } +} diff --git a/bb-data/cache/14/148fd6c1f15c39affd7d29be8798a090e12788406d744a958996158cb77d352a.php b/bb-data/cache/14/148fd6c1f15c39affd7d29be8798a090e12788406d744a958996158cb77d352a.php new file mode 100644 index 000000000..e37197598 --- /dev/null +++ b/bb-data/cache/14/148fd6c1f15c39affd7d29be8798a090e12788406d744a958996158cb77d352a.php @@ -0,0 +1,242 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'head' => [$this, 'block_head'], + 'js' => [$this, 'block_js'], + 'body' => [$this, 'block_body'], + ]; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 1 + echo " + + + + + + "; + // line 7 + $this->displayBlock('meta_title', $context, $blocks); + echo " "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["settings"] ?? null), "meta_title", [], "any", false, false, false, 7), "html", null, true); + echo " + + env, twig_constant("BB_URL"), "html", null, true); + echo "\"> + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("/"); + echo "\"> + + env, twig_get_attribute($this->env, $this->source, ($context["settings"] ?? null), "meta_description", [], "any", false, false, false, 12), "html", null, true); + echo "\"> + env, twig_get_attribute($this->env, $this->source, ($context["settings"] ?? null), "meta_robots", [], "any", false, false, false, 13), "html", null, true); + echo "\"> + env, twig_get_attribute($this->env, $this->source, ($context["settings"] ?? null), "meta_author", [], "any", false, false, false, 14), "html", null, true); + echo "\"> + env, twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "system_version", [], "any", false, false, false, 15), "html", null, true); + echo "\"> + + + env, (("css/huraga-" . twig_get_attribute($this->env, $this->source, ($context["settings"] ?? null), "color_scheme", [], "any", false, false, false, 18)) . ".css")); + echo "\"> + env, "css/plugins/jquery.jgrowl.css"); + echo "\"> + + env, "favicon.ico"); + echo "\"> + env, "img/icons/apple-touch-icon-114-precomposed.png"); + echo "\"> + env, "img/icons/apple-touch-icon-72-precomposed.png"); + echo "\"> + env, "img/icons/apple-touch-icon-57-precomposed.png"); + echo "\"> + + + + + + + + + "; + // line 33 + $this->displayBlock('head', $context, $blocks); + // line 34 + echo " "; + $this->displayBlock('js', $context, $blocks); + // line 35 + echo " + + "; + // line 37 + $this->displayBlock('body', $context, $blocks); + // line 38 + echo " "; + $__internal_f607aeef2c31a95a7bf963452dff024ffaeb6aafbe4603f9ca3bec57be8633f4 = null; + try { + $__internal_f607aeef2c31a95a7bf963452dff024ffaeb6aafbe4603f9ca3bec57be8633f4 = $this->loadTemplate("partial_pending_messages.phtml", "layout_public.phtml", 38); + } catch (LoaderError $e) { + // ignore missing template + } + if ($__internal_f607aeef2c31a95a7bf963452dff024ffaeb6aafbe4603f9ca3bec57be8633f4) { + $__internal_f607aeef2c31a95a7bf963452dff024ffaeb6aafbe4603f9ca3bec57be8633f4->display($context); + } + // line 39 + echo " +"; + } + + // line 7 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + } + + // line 33 + public function block_head($context, array $blocks = []) + { + $macros = $this->macros; + } + + // line 34 + public function block_js($context, array $blocks = []) + { + $macros = $this->macros; + } + + // line 37 + public function block_body($context, array $blocks = []) + { + $macros = $this->macros; + } + + public function getTemplateName() + { + return "layout_public.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 179 => 37, 173 => 34, 167 => 33, 161 => 7, 156 => 39, 145 => 38, 143 => 37, 139 => 35, 136 => 34, 134 => 33, 129 => 31, 125 => 30, 121 => 29, 117 => 28, 113 => 27, 109 => 26, 104 => 24, 100 => 23, 96 => 22, 92 => 21, 87 => 19, 83 => 18, 77 => 15, 73 => 14, 69 => 13, 65 => 12, 60 => 10, 56 => 9, 49 => 7, 41 => 1,); + } + + public function getSourceContext() + { + return new Source(" + + + + + + {% block meta_title %}{% endblock %} {{ settings.meta_title }} + + + + + + + + + + + + + + + + + + + + + + + + + + {% block head %}{% endblock %} + {% block js %}{% endblock %} + + + {% block body %}{% endblock %} + {% include 'partial_pending_messages.phtml' ignore missing %} + +", "layout_public.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/src/bb-themes/huraga/html/layout_public.phtml"); + } +} diff --git a/bb-data/cache/18/1836021b7cf98f0cc0985546d3b24d18833c61f499adc88a78a6da9192a56f6b.php b/bb-data/cache/18/1836021b7cf98f0cc0985546d3b24d18833c61f499adc88a78a6da9192a56f6b.php new file mode 100644 index 000000000..7bc14a661 --- /dev/null +++ b/bb-data/cache/18/1836021b7cf98f0cc0985546d3b24d18833c61f499adc88a78a6da9192a56f6b.php @@ -0,0 +1,64 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 1 + echo " + env, twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "system_version", [], "any", false, false, false, 2), "html", null, true); + echo "\" type=\"text/css\" media=\"screen\" />"; + } + + public function getTemplateName() + { + return "partial_styles.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 40 => 2, 37 => 1,); + } + + public function getSourceContext() + { + return new Source(" + ", "partial_styles.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-themes/admin_default/html/partial_styles.phtml"); + } +} diff --git a/bb-data/cache/1a/1a2b03e77205ad7ee9f7b75e5e38fa647b777411dfc183eda66408bba043dba3.php b/bb-data/cache/1a/1a2b03e77205ad7ee9f7b75e5e38fa647b777411dfc183eda66408bba043dba3.php new file mode 100644 index 000000000..13f2159d1 --- /dev/null +++ b/bb-data/cache/1a/1a2b03e77205ad7ee9f7b75e5e38fa647b777411dfc183eda66408bba043dba3.php @@ -0,0 +1,406 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 1 + if ((twig_get_attribute($this->env, $this->source, ($context["list"] ?? null), "pages", [], "any", false, false, false, 1) > 1)) { + // line 2 + $context["page"] = twig_get_attribute($this->env, $this->source, ($context["list"] ?? null), "page", [], "any", false, false, false, 2); + // line 3 + echo " +
    + +
    +"; + } + } + + public function getTemplateName() + { + return "partial_pagination.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 308 => 29, 302 => 28, 222 => 25, 216 => 24, 213 => 23, 206 => 21, 165 => 19, 159 => 17, 157 => 16, 150 => 15, 146 => 14, 102 => 11, 96 => 10, 52 => 7, 46 => 6, 41 => 3, 39 => 2, 37 => 1,); + } + + public function getSourceContext() + { + return new Source("{% if list.pages > 1 %} +{% set page = list.page %} + +
    + +
    +{% endif %}", "partial_pagination.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-themes/huraga/html/partial_pagination.phtml"); + } +} diff --git a/bb-data/cache/1a/1af5d22c30c43da2fee2c10a13f33d17785de3449238c5ffb145b5678697f207.php b/bb-data/cache/1a/1af5d22c30c43da2fee2c10a13f33d17785de3449238c5ffb145b5678697f207.php new file mode 100644 index 000000000..63d631262 --- /dev/null +++ b/bb-data/cache/1a/1af5d22c30c43da2fee2c10a13f33d17785de3449238c5ffb145b5678697f207.php @@ -0,0 +1,131 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'body_class' => [$this, 'block_body_class'], + 'body' => [$this, 'block_body'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return "layout_default.phtml"; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + $this->parent = $this->loadTemplate("layout_default.phtml", "404.phtml", 1); + $this->parent->display($context, array_merge($this->blocks, $blocks)); + } + + // line 3 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("Error"); + } + + // line 5 + public function block_body_class($context, array $blocks = []) + { + $macros = $this->macros; + echo "error-page"; + } + + // line 6 + public function block_body($context, array $blocks = []) + { + $macros = $this->macros; + // line 7 + echo "
    + "; + // line 8 + if (twig_get_attribute($this->env, $this->source, ($context["exception"] ?? null), "getCode", [], "any", false, false, false, 8)) { + // line 9 + echo "

    "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["exception"] ?? null), "getCode", [], "any", false, false, false, 9), "html", null, true); + echo "

    + "; + } else { + // line 11 + echo "

    404

    + "; + } + // line 13 + echo "

    "; + echo gettext("Whoops! This is not the web page you are looking for."); + echo "

    +

    "; + // line 14 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["exception"] ?? null), "getMessage", [], "any", false, false, false, 14), "html", null, true); + echo ".

    + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("/"); + echo "\" class=\"btn btn-alt btn-primary btn-large\" title=\"Back to Homepage\">Back to Homepage +
    +"; + } + + public function getTemplateName() + { + return "404.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 90 => 15, 86 => 14, 81 => 13, 77 => 11, 71 => 9, 69 => 8, 66 => 7, 62 => 6, 55 => 5, 48 => 3, 37 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends \"layout_default.phtml\" %} + +{% block meta_title %}{% trans 'Error' %}{% endblock %} + +{% block body_class %}error-page{% endblock %} +{% block body %} +
    + {% if exception.getCode %} +

    {{ exception.getCode }}

    + {% else %} +

    404

    + {% endif %} +

    {% trans 'Whoops! This is not the web page you are looking for.' %}

    +

    {{ exception.getMessage }}.

    + Back to Homepage +
    +{% endblock %}", "404.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/src/bb-themes/huraga/html/404.phtml"); + } +} diff --git a/bb-data/cache/1b/1b2c1b724c06448e830395960acb8c16ead5f5968d88f99885877e3e6e1662e1.php b/bb-data/cache/1b/1b2c1b724c06448e830395960acb8c16ead5f5968d88f99885877e3e6e1662e1.php new file mode 100644 index 000000000..8e08ecb02 --- /dev/null +++ b/bb-data/cache/1b/1b2c1b724c06448e830395960acb8c16ead5f5968d88f99885877e3e6e1662e1.php @@ -0,0 +1,1143 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'breadcrumb' => [$this, 'block_breadcrumb'], + 'content' => [$this, 'block_content'], + 'js' => [$this, 'block_js'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return $this->loadTemplate(((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "ajax", [], "any", false, false, false, 1)) ? ("layout_blank.phtml") : ("layout_default.phtml")), "mod_order_manage.phtml", 1); + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 2 + $macros["mf"] = $this->macros["mf"] = $this->loadTemplate("macro_functions.phtml", "mod_order_manage.phtml", 2)->unwrap(); + // line 4 + $context["addons"] = twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "order_addons", [0 => ["id" => twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "id", [], "any", false, false, false, 4)]], "method", false, false, false, 4); + // line 11 + $context["service_partial"] = (("mod_service" . twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "service_type", [], "any", false, false, false, 11)) . "_manage.phtml"); + // line 12 + $context["upgradables"] = twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "order_upgradables", [0 => ["id" => twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "id", [], "any", false, false, false, 12)]], "method", false, false, false, 12); + // line 1 + $this->getParent($context)->display($context, array_merge($this->blocks, $blocks)); + } + + // line 3 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "title", [], "any", false, false, false, 3), "html", null, true); + } + + // line 6 + public function block_breadcrumb($context, array $blocks = []) + { + $macros = $this->macros; + // line 7 + echo "
  • extensions['Box_TwigExtensions']->twig_bb_client_link_filter("service"); + echo "\">"; + echo gettext("Orders"); + echo "/
  • +"; + // line 8 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "title", [], "any", false, false, false, 8), "html", null, true); + echo " +"; + } + + // line 14 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 15 + echo " +
    +
    env, ($context["addons"] ?? null)) > 0)) { + echo "span6"; + } else { + echo "span12"; + } + echo " data-block\"> +
    +
    +

    "; + // line 20 + echo gettext("Service details"); + echo "

    +

    "; + // line 21 + echo gettext("All information about your service"); + echo "

    +
    +
    + + + + + + + + + + + + + + + + + + "; + // line 41 + if (twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "period", [], "any", false, false, false, 41)) { + // line 42 + echo " + + + + "; + } + // line 47 + echo " + + + + + + + + + + + + + + + + "; + // line 63 + if (twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "period", [], "any", false, false, false, 63)) { + // line 64 + echo " + + + + "; + } + // line 69 + echo " + "; + // line 70 + if (twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "notes", [], "any", false, false, false, 70)) { + // line 71 + echo " + + + + "; + } + // line 76 + echo " + "; + // line 77 + if ((twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "active_tickets", [], "any", false, false, false, 77) > 0)) { + // line 78 + echo " + + + + "; + } + // line 87 + echo " + + + + + + +
    #"; + // line 28 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "id", [], "any", false, false, false, 28), "html", null, true); + echo "
    "; + // line 33 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "title", [], "any", false, false, false, 33), "html", null, true); + echo "
    "; + // line 38 + echo twig_money($this->env, twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "total", [], "any", false, false, false, 38), twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "currency", [], "any", false, false, false, 38)); + echo "
    "; + // line 44 + echo twig_period_title($this->env, twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "period", [], "any", false, false, false, 44)); + echo "
    env, $this->source, ($context["order"] ?? null), "status", [], "any", false, false, false, 50) == "active")) { + echo "label-success"; + } elseif ((twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "status", [], "any", false, false, false, 50) == "pending_setup")) { + echo "label-warning"; + } + echo "\">"; + echo twig_call_macro($macros["mf"], "macro_status_name", [twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "status", [], "any", false, false, false, 50)], 50, $context, $this->getSourceContext()); + echo "
    "; + // line 55 + echo twig_escape_filter($this->env, $this->extensions['Box_TwigExtensions']->twig_bb_date(twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "created_at", [], "any", false, false, false, 55)), "html", null, true); + echo "
    "; + // line 60 + if (twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "activated_at", [], "any", false, false, false, 60)) { + echo twig_escape_filter($this->env, $this->extensions['Box_TwigExtensions']->twig_bb_date(twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "activated_at", [], "any", false, false, false, 60)), "html", null, true); + } else { + echo "-"; + } + echo "
    "; + // line 66 + if (twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "expires_at", [], "any", false, false, false, 66)) { + echo twig_escape_filter($this->env, $this->extensions['Box_TwigExtensions']->twig_bb_date(twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "expires_at", [], "any", false, false, false, 66)), "html", null, true); + } else { + echo "-"; + } + echo "
    "; + // line 73 + echo twig_bbmd_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "notes", [], "any", false, false, false, 73)); + echo "
    + + "; + // line 83 + echo " "; + // line 84 + echo "
    + + "; + // line 93 + if (twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "period", [], "any", false, false, false, 93)) { + // line 94 + echo " + "; + } + // line 96 + echo " + "; + // line 97 + if (($context["upgradables"] ?? null)) { + // line 98 + echo " "; + echo gettext("Request Upgrade"); + echo " + "; + } + // line 100 + echo " + "; + // line 101 + echo gettext("Open ticket"); + echo " + + "; + // line 103 + if ((twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "status", [], "any", false, false, false, 103) == "active")) { + // line 104 + echo " "; + echo gettext("Request Cancellation"); + echo " + "; + } + // line 106 + echo " +
    +

    extensions['Box_TwigExtensions']->twig_bb_client_link_filter("/order/service"); + echo "\">"; + echo gettext("Back to services"); + echo "

    +
    +
    +
    + "; + // line 115 + if ((twig_length_filter($this->env, ($context["addons"] ?? null)) < 1)) { + echo "
    "; + } + // line 116 + echo " +"; + // line 117 + if ((twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "group_master", [], "any", false, false, false, 117) == 1)) { + // line 118 + if ((twig_length_filter($this->env, ($context["addons"] ?? null)) > 0)) { + // line 119 + echo "
    +
    +
    +

    "; + // line 122 + echo gettext("Addons"); + echo "

    +

    "; + // line 123 + echo gettext("Addons you have ordered with this service"); + echo "

    +
    +
    + + + + + + + + + + + + + + "; + // line 139 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(($context["addons"] ?? null)); + foreach ($context['_seq'] as $context["i"] => $context["addon"]) { + // line 140 + echo " env, twig_cycle([0 => "odd", 1 => "even"], $context["i"]), "html", null, true); + echo "\"> + + + + + + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['i'], $context['addon'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 149 + echo " +
    "; + // line 130 + echo gettext("Product/Service"); + echo ""; + // line 131 + echo gettext("Price"); + echo ""; + // line 132 + echo gettext("Billing Cycle"); + echo ""; + // line 133 + echo gettext("Next due date"); + echo ""; + // line 134 + echo gettext("Status"); + echo " 
    "; + // line 141 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["addon"], "title", [], "any", false, false, false, 141), "html", null, true); + echo ""; + // line 142 + echo twig_money($this->env, twig_get_attribute($this->env, $this->source, $context["addon"], "total", [], "any", false, false, false, 142), twig_get_attribute($this->env, $this->source, $context["addon"], "currency", [], "any", false, false, false, 142)); + echo ""; + // line 143 + echo twig_period_title($this->env, twig_get_attribute($this->env, $this->source, $context["addon"], "period", [], "any", false, false, false, 143)); + echo ""; + // line 144 + if (twig_get_attribute($this->env, $this->source, $context["addon"], "expires_at", [], "any", false, false, false, 144)) { + echo twig_escape_filter($this->env, $this->extensions['Box_TwigExtensions']->twig_bb_date(twig_get_attribute($this->env, $this->source, $context["addon"], "expires_at", [], "any", false, false, false, 144)), "html", null, true); + } else { + echo "-"; + } + echo "env, $this->source, $context["addon"], "status", [], "any", false, false, false, 145) == "active")) { + echo "label-success"; + } elseif ((twig_get_attribute($this->env, $this->source, $context["addon"], "status", [], "any", false, false, false, 145) == "pending_setup")) { + echo "label-warning"; + } + echo "\">"; + echo twig_call_macro($macros["mf"], "macro_status_name", [twig_get_attribute($this->env, $this->source, $context["addon"], "status", [], "any", false, false, false, 145)], 145, $context, $this->getSourceContext()); + echo "extensions['Box_TwigExtensions']->twig_bb_client_link_filter("/order/service/manage"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["addon"], "id", [], "any", false, false, false, 146), "html", null, true); + echo "\">
    +
    +
    +
    + +"; + } + } + // line 157 + echo " + +
    +
    + +

    + "; + // line 163 + echo gettext("Submit new support ticket"); + // line 164 + echo "

    +
    +
    +
    +
    +
    + +
    + "; + // line 172 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["support_helpdesk_id", twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "support_helpdesk_get_pairs", [], "any", false, false, false, 172), twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "support_helpdesk_id", [], "any", false, false, false, 172), 1], 172, $context, $this->getSourceContext()); + echo " +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "subject", [], "any", false, false, false, 179)); + echo "\" required=\"required\" class=\"span5\"/> +
    +
    + +
    + +
    + +
    +
    + + + env, twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "id", [], "any", false, false, false, 191), "html", null, true); + echo "\"> +
    + + +
    +
    + +
    + +
    + +
    +
    + +

    + "; + // line 206 + echo gettext("Submit cancellation request"); + // line 207 + echo "

    +
    +
    +
    +
    + +
    + "; + // line 214 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["support_helpdesk_id", twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "support_helpdesk_get_pairs", [], "any", false, false, false, 214), twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "support_helpdesk_id", [], "any", false, false, false, 214), 1], 214, $context, $this->getSourceContext()); + echo " +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "title", [], "any", false, false, false, 221), "html", null, true); + echo "\" required=\"required\" class=\"span5\"/> +
    +
    + +
    + +
    + +
    +
    + + env, twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "id", [], "any", false, false, false, 232), "html", null, true); + echo "\"> + +
    +
    + +
    + +
    + +
    +
    + +

    + "; + // line 245 + echo gettext("Submit upgrade request"); + // line 246 + echo "

    +
    +
    +
    +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "title", [], "any", false, false, false, 254), "html", null, true); + echo "\" required=\"required\" class=\"span5\"/> +
    +
    + +
    + +
    + "; + // line 261 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["support_helpdesk_id", twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "support_helpdesk_get_pairs", [], "any", false, false, false, 261), twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "support_helpdesk_id", [], "any", false, false, false, 261), 1], 261, $context, $this->getSourceContext()); + echo " +
    +
    + + +
    + +
    + "; + // line 269 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["rel_new_value", ($context["upgradables"] ?? null), "", 1], 269, $context, $this->getSourceContext()); + echo " +
    +
    + +
    + +
    + +
    +
    + + + env, twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "id", [], "any", false, false, false, 281), "html", null, true); + echo "\"> + +
    +
    +
    + +
    + +
    + +"; + // line 291 + if (twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "system_template_exists", [0 => ["file" => ($context["service_partial"] ?? null)]], "method", false, false, false, 291)) { + // line 292 + echo " "; + $context["service"] = twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "order_service", [0 => ["id" => twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "id", [], "any", false, false, false, 292)]], "method", false, false, false, 292); + // line 293 + echo " "; + $this->loadTemplate(($context["service_partial"] ?? null), "mod_order_manage.phtml", 293)->display(twig_array_merge($context, ["order" => ($context["order"] ?? null), "service" => ($context["service"] ?? null)])); + } else { + // line 295 + echo " "; + } + // line 297 + echo " +"; + } + + // line 300 + public function block_js($context, array $blocks = []) + { + $macros = $this->macros; + // line 302 + echo " +"; + } + + public function getTemplateName() + { + return "mod_order_manage.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 711 => 311, 706 => 309, 697 => 302, 693 => 300, 688 => 297, 685 => 295, 681 => 293, 678 => 292, 676 => 291, 668 => 286, 660 => 281, 650 => 276, 645 => 274, 637 => 269, 632 => 267, 623 => 261, 618 => 259, 608 => 254, 603 => 252, 595 => 246, 593 => 245, 581 => 236, 574 => 232, 567 => 228, 562 => 226, 552 => 221, 547 => 219, 539 => 214, 534 => 212, 527 => 207, 525 => 206, 513 => 197, 504 => 191, 496 => 186, 491 => 184, 483 => 179, 478 => 177, 470 => 172, 465 => 170, 457 => 164, 455 => 163, 447 => 157, 437 => 149, 426 => 146, 416 => 145, 408 => 144, 404 => 143, 400 => 142, 396 => 141, 391 => 140, 387 => 139, 379 => 134, 375 => 133, 371 => 132, 367 => 131, 363 => 130, 353 => 123, 349 => 122, 344 => 119, 342 => 118, 340 => 117, 337 => 116, 333 => 115, 324 => 111, 317 => 106, 311 => 104, 309 => 103, 304 => 101, 301 => 100, 295 => 98, 293 => 97, 290 => 96, 284 => 94, 282 => 93, 274 => 87, 269 => 84, 267 => 83, 261 => 81, 256 => 79, 253 => 78, 251 => 77, 248 => 76, 242 => 73, 238 => 72, 235 => 71, 233 => 70, 230 => 69, 220 => 66, 210 => 65, 207 => 64, 205 => 63, 195 => 60, 191 => 59, 184 => 55, 180 => 54, 167 => 50, 163 => 49, 159 => 47, 153 => 44, 149 => 43, 146 => 42, 144 => 41, 138 => 38, 134 => 37, 127 => 33, 123 => 32, 116 => 28, 112 => 27, 103 => 21, 99 => 20, 89 => 17, 85 => 15, 81 => 14, 75 => 8, 68 => 7, 64 => 6, 57 => 3, 53 => 1, 51 => 12, 49 => 11, 47 => 4, 45 => 2, 38 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends request.ajax ? \"layout_blank.phtml\" : \"layout_default.phtml\" %} +{% import \"macro_functions.phtml\" as mf %} +{% block meta_title %}{{ order.title }}{% endblock %} +{% set addons = client.order_addons({\"id\":order.id}) %} + +{% block breadcrumb %} +
  • {% trans 'Orders' %}/
  • +{{ order.title }} +{% endblock %} + +{% set service_partial = \"mod_service\" ~ order.service_type ~ \"_manage.phtml\" %} +{% set upgradables = client.order_upgradables({'id':order.id}) %} + +{% block content %} + +
    +
    0 %}span6{% else %}span12{% endif %} data-block\"> +
    +
    +

    {% trans 'Service details' %}

    +

    {% trans 'All information about your service' %}

    +
    +
    + + + + + + + + + + + + + + + + + + {% if order.period %} + + + + + {% endif %} + + + + + + + + + + + + + + + + + {% if order.period %} + + + + + {% endif %} + + {% if order.notes %} + + + + + {% endif %} + + {% if order.active_tickets > 0 %} + + + + + {% endif %} + + + + + + + +
    #{{ order.id }}
    {{ order.title }}
    {{ order.total | money(order.currency) }}
    {{ order.period | period_title }}
    {{ mf.status_name(order.status) }}
    {{ order.created_at|bb_date }}
    {% if order.activated_at %}{{ order.activated_at|bb_date }}{% else %}-{% endif %}
    {% if order.expires_at %}{{ order.expires_at|bb_date }}{% else %}-{% endif %}
    {{ order.notes|bbmd }}
    + + {# #} + {# #} +
    + + {% if order.period %} + + {% endif %} + + {% if upgradables %} + {% trans 'Request Upgrade' %} + {% endif %} + + {% trans 'Open ticket' %} + + {% if order.status == 'active' %} + {% trans 'Request Cancellation' %} + {% endif %} + +
    +

    {% trans 'Back to services' %}

    +
    +
    +
    + {% if addons|length < 1 %}
    {% endif %} + +{% if order.group_master == 1 %} +{% if addons|length > 0 %} +
    +
    +
    +

    {% trans 'Addons' %}

    +

    {% trans 'Addons you have ordered with this service' %}

    +
    +
    + + + + + + + + + + + + + + {% for i, addon in addons %} + + + + + + + + + {% endfor %} + +
    {% trans 'Product/Service' %}{% trans 'Price' %}{% trans 'Billing Cycle' %}{% trans 'Next due date' %}{% trans 'Status' %} 
    {{addon.title}}{{ addon.total | money(addon.currency) }}{{ addon.period | period_title }}{% if addon.expires_at %}{{addon.expires_at|bb_date }}{% else %}-{% endif %}{{ mf.status_name(addon.status) }}
    +
    +
    +
    + +{% endif %} +{% endif %} + + +
    +
    + +

    + {% trans 'Submit new support ticket' %} +

    +
    +
    +
    +
    +
    + +
    + {{ mf.selectbox('support_helpdesk_id', client.support_helpdesk_get_pairs, request.support_helpdesk_id, 1) }} +
    +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + + + +
    + + +
    +
    + +
    + +
    + +
    +
    + +

    + {% trans 'Submit cancellation request' %} +

    +
    +
    +
    +
    + +
    + {{ mf.selectbox('support_helpdesk_id', client.support_helpdesk_get_pairs, request.support_helpdesk_id, 1) }} +
    +
    + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + + + +
    +
    + +
    + +
    + +
    +
    + +

    + {% trans 'Submit upgrade request' %} +

    +
    +
    +
    +
    +
    + +
    + +
    +
    + +
    + +
    + {{ mf.selectbox('support_helpdesk_id', client.support_helpdesk_get_pairs, request.support_helpdesk_id, 1) }} +
    +
    + + +
    + +
    + {{ mf.selectbox('rel_new_value', upgradables, '', 1) }} +
    +
    + +
    + +
    + +
    +
    + + + + +
    +
    +
    + +
    + +
    + +{% if guest.system_template_exists({\"file\":service_partial})%} + {% set service = client.order_service({\"id\":order.id}) %} + {% include service_partial with {'order': order, 'service': service} %} +{% else %} + {# trans 'Service does not have configuration page' #} +{% endif %} + +{% endblock %} + +{% block js %} +{% autoescape \"js\" %} + +{% endautoescape %} +{% endblock %}", "mod_order_manage.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-modules/Order/html_client/mod_order_manage.phtml"); + } +} diff --git a/bb-data/cache/1c/1c728d1ec0d524dfbe343c3c963d8c5bfccd93e7f86a524e925531e51bc568e2.php b/bb-data/cache/1c/1c728d1ec0d524dfbe343c3c963d8c5bfccd93e7f86a524e925531e51bc568e2.php new file mode 100644 index 000000000..f45195d28 --- /dev/null +++ b/bb-data/cache/1c/1c728d1ec0d524dfbe343c3c963d8c5bfccd93e7f86a524e925531e51bc568e2.php @@ -0,0 +1,473 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'meta_description' => [$this, 'block_meta_description'], + 'breadcrumb' => [$this, 'block_breadcrumb'], + 'content' => [$this, 'block_content'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return $this->loadTemplate(((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "ajax", [], "any", false, false, false, 1)) ? ("layout_blank.phtml") : ("layout_default.phtml")), "mod_forum_index.phtml", 1); + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + $this->getParent($context)->display($context, array_merge($this->blocks, $blocks)); + } + + // line 3 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("Forum"); + } + + // line 4 + public function block_meta_description($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("Welcome to our forums."); + } + + // line 5 + public function block_breadcrumb($context, array $blocks = []) + { + $macros = $this->macros; + echo "
  • "; + echo gettext("Forum"); + echo "
  • "; + } + + // line 7 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 8 + echo " +"; + // line 9 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "forum_get_categories", [], "any", false, false, false, 9)); + foreach ($context['_seq'] as $context["cat_name"] => $context["forums"]) { + // line 10 + echo "
    +
    +
    +
    +

    "; + // line 14 + echo twig_escape_filter($this->env, $context["cat_name"], "html", null, true); + echo "

    +

    "; + // line 15 + echo gettext("Welcome to our forums. Feel free to join the discussions."); + echo "

    +
    +
    + + + + + + + + + + + + "; + // line 29 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable($context["forums"]); + foreach ($context['_seq'] as $context["_key"] => $context["forum"]) { + // line 30 + echo " + + + + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['_key'], $context['forum'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 44 + echo " +
     "; + // line 22 + echo gettext("Forum"); + echo ""; + // line 23 + echo gettext("Threads"); + echo ""; + // line 24 + echo gettext("Posts"); + echo "
    + env, twig_get_attribute($this->env, $this->source, $context["forum"], "status", [], "any", false, false, false, 32), "html", null, true); + echo "\" style=\"padding-right: 0px; padding-left: 5px\"> + + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("/forum"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["forum"], "slug", [], "any", false, false, false, 35), "html", null, true); + echo "\">"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["forum"], "title", [], "any", false, false, false, 35), "html", null, true); + echo " +

    "; + // line 36 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["forum"], "description", [], "any", false, false, false, 36), "html", null, true); + echo "

    +
    + "; + // line 39 + echo twig_escape_filter($this->env, ((twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["forum"], "stats", [], "any", false, true, false, 39), "topics_count", [], "any", true, true, false, 39)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["forum"], "stats", [], "any", false, true, false, 39), "topics_count", [], "any", false, false, false, 39), 0)) : (0)), "html", null, true); + echo " + "; + // line 41 + echo twig_escape_filter($this->env, ((twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["forum"], "stats", [], "any", false, true, false, 41), "posts_count", [], "any", true, true, false, 41)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["forum"], "stats", [], "any", false, true, false, 41), "posts_count", [], "any", false, false, false, 41), 0)) : (0)), "html", null, true); + echo "
    + "; + // line 46 + if ( !($context["client"] ?? null)) { + // line 47 + echo "

    + "; + } + // line 49 + echo "
    +
    +
    +
    +"; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['cat_name'], $context['forums'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 54 + echo " +"; + // line 55 + if ((($context["client"] ?? null) && twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "forum_favorites", [], "any", false, false, false, 55))) { + // line 56 + echo "
    +
    +
    +
    +

    "; + // line 60 + echo gettext("Favorite topics"); + echo "

    +

    "; + // line 61 + echo gettext("You set this topic as favorite. It can be done by opening any topic and clicking on \"Add to favorites\" button in \"Topic information\" block."); + echo "

    +
    +
    + + + + + + + + + + + + + + "; + // line 77 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "forum_favorites", [], "any", false, false, false, 77)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["i"] => $context["topic"]) { + // line 78 + echo " env, twig_cycle([0 => "odd", 1 => "even"], $context["i"]), "html", null, true); + echo "\"> + + + + + + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 98 + echo " + + + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['i'], $context['topic'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 104 + echo " + + +
      "; + // line 69 + echo gettext("Thread / Thread Starter"); + echo ""; + // line 70 + echo gettext("Last post"); + echo ""; + // line 71 + echo gettext("Replies"); + echo ""; + // line 72 + echo gettext("Views"); + echo "
    + env, twig_get_attribute($this->env, $this->source, $context["topic"], "status", [], "any", false, false, false, 80), "html", null, true); + echo "\" style=\"padding-right: 0px; padding-left: 5px\"> + + env, twig_gravatar_filter(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["topic"], "first", [], "any", false, false, false, 83), "author", [], "any", false, false, false, 83), "email", [], "any", false, false, false, 83)), "html", null, true); + echo "?size=30\" alt=\""; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["topic"], "first", [], "any", false, false, false, 83), "author", [], "any", false, false, false, 83), "name", [], "any", false, false, false, 83), "html", null, true); + echo "\" /> + + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("/forum"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["topic"], "forum", [], "any", false, false, false, 86), "slug", [], "any", false, false, false, 86), "html", null, true); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["topic"], "slug", [], "any", false, false, false, 86), "html", null, true); + echo "\">"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["topic"], "title", [], "any", false, false, false, 86), "html", null, true); + echo " +

    "; + // line 87 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["topic"], "first", [], "any", false, false, false, 87), "author", [], "any", false, false, false, 87), "name", [], "any", false, false, false, 87), "html", null, true); + echo "

    +
    + "; + // line 90 + echo twig_escape_filter($this->env, $this->extensions['Box_TwigExtensions']->twig_bb_date(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["topic"], "last", [], "any", false, false, false, 90), "created_at", [], "any", false, false, false, 90)), "html", null, true); + echo " +

    "; + // line 91 + echo gettext("by"); + echo " extensions['Box_TwigExtensions']->twig_bb_client_link_filter("/forum"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["topic"], "forum", [], "any", false, false, false, 91), "slug", [], "any", false, false, false, 91), "html", null, true); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["topic"], "slug", [], "any", false, false, false, 91), "html", null, true); + echo "#m-"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["topic"], "last", [], "any", false, false, false, 91), "id", [], "any", false, false, false, 91), "html", null, true); + echo "\">"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["topic"], "last", [], "any", false, false, false, 91), "author", [], "any", false, false, false, 91), "name", [], "any", false, false, false, 91), "html", null, true); + echo " "; + echo "

    +
    "; + // line 93 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["topic"], "stats", [], "any", false, false, false, 93), "posts_count", [], "any", false, false, false, 93), "html", null, true); + echo ""; + // line 94 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["topic"], "stats", [], "any", false, false, false, 94), "views_count", [], "any", false, false, false, 94), "html", null, true); + echo "
    "; + // line 100 + echo gettext("The list is empty"); + echo "
    + +
    +
    +
    +
    +"; + } + // line 114 + echo " + + + +"; + } + + public function getTemplateName() + { + return "mod_forum_index.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 330 => 114, 318 => 104, 308 => 100, 304 => 98, 295 => 94, 291 => 93, 275 => 91, 271 => 90, 265 => 87, 255 => 86, 247 => 83, 241 => 80, 235 => 78, 230 => 77, 222 => 72, 218 => 71, 214 => 70, 210 => 69, 199 => 61, 195 => 60, 189 => 56, 187 => 55, 184 => 54, 174 => 49, 166 => 47, 164 => 46, 160 => 44, 151 => 41, 146 => 39, 140 => 36, 132 => 35, 126 => 32, 122 => 30, 118 => 29, 110 => 24, 106 => 23, 102 => 22, 92 => 15, 88 => 14, 82 => 10, 78 => 9, 75 => 8, 71 => 7, 62 => 5, 55 => 4, 48 => 3, 38 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends request.ajax ? \"layout_blank.phtml\" : \"layout_default.phtml\" %} + +{% block meta_title %}{% trans 'Forum' %}{% endblock %} +{% block meta_description %}{% trans 'Welcome to our forums.' %}{% endblock %} +{% block breadcrumb %}
  • {% trans 'Forum' %}
  • {% endblock %} + +{% block content %} + +{% for cat_name, forums in guest.forum_get_categories %} +
    +
    +
    +
    +

    {{cat_name}}

    +

    {% trans 'Welcome to our forums. Feel free to join the discussions.' %}

    +
    +
    + + + + + + + + + + + + {% for forum in forums %} + + + + + + + {% endfor %} + +
     {% trans 'Forum' %}{% trans 'Threads' %}{% trans 'Posts' %}
    + + + {{forum.title}} +

    {{forum.description}}

    +
    + {{forum.stats.topics_count|default(0)}} + {{forum.stats.posts_count|default(0)}}
    + {% if not client %} +

    + {% endif %} +
    +
    +
    +
    +{% endfor %} + +{% if client and client.forum_favorites %} +
    +
    +
    +
    +

    {% trans 'Favorite topics' %}

    +

    {% trans 'You set this topic as favorite. It can be done by opening any topic and clicking on \"Add to favorites\" button in \"Topic information\" block.' %}

    +
    +
    + + + + + + + + + + + + + + {% for i, topic in client.forum_favorites %} + + + + + + + + + + {% else %} + + + + + + {% endfor %} + + + +
      {% trans 'Thread / Thread Starter' %}{% trans 'Last post' %}{% trans 'Replies' %}{% trans 'Views' %}
    + + + \"{{ + + {{topic.title}} +

    {{ topic.first.author.name }}

    +
    + {{ topic.last.created_at|bb_date }} +

    {% trans 'by' %} {{ topic.last.author.name }} {#\"{{#}

    +
    {{ topic.stats.posts_count }}{{ topic.stats.views_count }}
    {% trans 'The list is empty' %}
    + +
    +
    +
    +
    +{% endif %} + + + + +{% endblock %}", "mod_forum_index.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-modules/Forum/html_client/mod_forum_index.phtml"); + } +} diff --git a/bb-data/cache/1d/1dac9bfd66df79cec3a42db6fd0e1ae2719b89392db6e7bf84974174feddbf0b.php b/bb-data/cache/1d/1dac9bfd66df79cec3a42db6fd0e1ae2719b89392db6e7bf84974174feddbf0b.php new file mode 100644 index 000000000..2bfbb8cf8 --- /dev/null +++ b/bb-data/cache/1d/1dac9bfd66df79cec3a42db6fd0e1ae2719b89392db6e7bf84974174feddbf0b.php @@ -0,0 +1,820 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'top_content' => [$this, 'block_top_content'], + 'content' => [$this, 'block_content'], + 'head' => [$this, 'block_head'], + 'js' => [$this, 'block_js'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return $this->loadTemplate(((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "ajax", [], "any", false, false, false, 1)) ? ("layout_blank.phtml") : ("layout_default.phtml")), "mod_order_index.phtml", 1); + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 2 + $context["active_menu"] = "order"; + // line 3 + $macros["mf"] = $this->macros["mf"] = $this->loadTemplate("macro_functions.phtml", "mod_order_index.phtml", 3)->unwrap(); + // line 1 + $this->getParent($context)->display($context, array_merge($this->blocks, $blocks)); + } + + // line 5 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("Orders"); + } + + // line 7 + public function block_top_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 8 + if (twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "show_filter", [], "any", false, false, false, 8)) { + // line 9 + echo "
    +
    "; + // line 10 + echo gettext("Filter orders"); + echo "
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "_url", [], "any", false, false, false, 14), "html", null, true); + echo "\" /> +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "id", [], "any", false, false, false, 19), "html", null, true); + echo "\"> +
    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "title", [], "any", false, false, false, 27), "html", null, true); + echo "\"> +
    +
    +
    + +
    + +
    + "; + // line 35 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["status", twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "order_get_status_pairs", [], "any", false, false, false, 35), twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "status", [], "any", false, false, false, 35), 0, "All statuses"], 35, $context, $this->getSourceContext()); + echo " +
    +
    +
    + +
    + +
    + "; + // line 43 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["type", twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "product_get_types", [], "any", false, false, false, 43), twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "type", [], "any", false, false, false, 43), 0, "All types"], 43, $context, $this->getSourceContext()); + echo " +
    +
    +
    + +
    + +
    + "; + // line 51 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["product_id", twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "product_get_pairs", [], "any", false, false, false, 51), twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "product_id", [], "any", false, false, false, 51), 0, "All products"], 51, $context, $this->getSourceContext()); + echo " +
    +
    +
    + +
    + +
    + "; + // line 59 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["period", twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "system_periods", [], "any", false, false, false, 59), twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "period", [], "any", false, false, false, 59), 0, "All periods"], 59, $context, $this->getSourceContext()); + echo " +
    +
    +
    + +
    + +
    + "; + // line 67 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["invoice_option", twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "order_get_invoice_options", [], "any", false, false, false, 67), twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "invoice_option", [], "any", false, false, false, 67), 0, "All types"], 67, $context, $this->getSourceContext()); + echo " +
    +
    +
    + +
    + +
    +
      +
    • env, $this->source, ($context["request"] ?? null), "date_from", [], "any", false, false, false, 76)) { + echo twig_escape_filter($this->env, twig_date_format_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "date_from", [], "any", false, false, false, 76), "Y-m-d"), "html", null, true); + } + echo "\" placeholder=\""; + echo twig_escape_filter($this->env, twig_date_format_filter($this->env, ($context["now"] ?? null), "Y-m-d"), "html", null, true); + echo "\" class=\"datepicker\"/>
    • +
    • -
    • +
    • env, $this->source, ($context["request"] ?? null), "date_to", [], "any", false, false, false, 78)) { + echo twig_escape_filter($this->env, twig_date_format_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "date_to", [], "any", false, false, false, 78), "Y-m-d"), "html", null, true); + } + echo "\" placeholder=\""; + echo twig_escape_filter($this->env, twig_date_format_filter($this->env, ($context["now"] ?? null), "Y-m-d"), "html", null, true); + echo "\" class=\"datepicker\"/>
    • +
    +
    +
    +
    + + + +
    +
    +
    +
    +
    +"; + } else { + // line 92 + $context["count_orders"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "order_get_statuses", [], "any", false, false, false, 92); + // line 93 + echo "
    + +
    +
    + +"; + } + // line 104 + echo " +"; + } + + // line 107 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 108 + echo " +
    + + +
    +
    +
    + "; + // line 118 + echo twig_call_macro($macros["mf"], "macro_table_search", [], 118, $context, $this->getSourceContext()); + echo " + + + + + + + + + + + + + + + + "; + // line 134 + $context["orders"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "order_get_list", [0 => twig_array_merge(["per_page" => 30, "page" => twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "page", [], "any", false, false, false, 134)], ($context["request"] ?? null))], "method", false, false, false, 134); + // line 135 + echo " "; + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["orders"] ?? null), "list", [], "any", false, false, false, 135)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["i"] => $context["order"]) { + // line 136 + echo " + + + + + + + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 157 + echo " + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['i'], $context['order'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 161 + echo " +
    "; + // line 123 + echo gettext("ID"); + echo ""; + // line 124 + echo gettext("Client"); + echo ""; + // line 125 + echo gettext("Title"); + echo ""; + // line 126 + echo gettext("Amount"); + echo ""; + // line 127 + echo gettext("Period"); + echo ""; + // line 128 + echo gettext("Status"); + echo " 
    env, twig_get_attribute($this->env, $this->source, $context["order"], "id", [], "any", false, false, false, 137), "html", null, true); + echo "\"/>"; + // line 138 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["order"], "id", [], "any", false, false, false, 138), "html", null, true); + echo " + + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("client/manage"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["order"], "client_id", [], "any", false, false, false, 141), "html", null, true); + echo "\">env, twig_gravatar_filter(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["order"], "client", [], "any", false, false, false, 141), "email", [], "any", false, false, false, 141)), "html", null, true); + echo "?size=20\" alt=\""; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["order"], "client", [], "any", false, false, false, 141), "email", [], "any", false, false, false, 141), "html", null, true); + echo "\" /> + + + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("client/manage"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["order"], "client_id", [], "any", false, false, false, 144), "html", null, true); + echo "\">"; + echo twig_escape_filter($this->env, twig_truncate_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["order"], "client", [], "any", false, false, false, 144), "first_name", [], "any", false, false, false, 144), "1", null, "."), "html", null, true); + echo " "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["order"], "client", [], "any", false, false, false, 144), "last_name", [], "any", false, false, false, 144), "html", null, true); + echo " + + "; + // line 147 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["order"], "title", [], "any", false, false, false, 147), "html", null, true); + echo ""; + // line 148 + echo twig_call_macro($macros["mf"], "macro_currency_format", [twig_get_attribute($this->env, $this->source, $context["order"], "total", [], "any", false, false, false, 148), twig_get_attribute($this->env, $this->source, $context["order"], "currency", [], "any", false, false, false, 148)], 148, $context, $this->getSourceContext()); + echo ""; + // line 149 + echo twig_call_macro($macros["mf"], "macro_period_name", [twig_get_attribute($this->env, $this->source, $context["order"], "period", [], "any", false, false, false, 149)], 149, $context, $this->getSourceContext()); + echo ""; + // line 150 + echo twig_call_macro($macros["mf"], "macro_status_name", [twig_get_attribute($this->env, $this->source, $context["order"], "status", [], "any", false, false, false, 150)], 150, $context, $this->getSourceContext()); + echo " + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("/order/manage"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["order"], "id", [], "any", false, false, false, 152), "html", null, true); + echo "\">\"\" + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/order/delete", ["id" => twig_get_attribute($this->env, $this->source, $context["order"], "id", [], "any", false, false, false, 153)]); + echo "\" data-api-redirect=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("order"); + echo "\">\"\" +
    "; + // line 158 + echo gettext("The list is empty"); + echo "
    + "; + // line 163 + $this->loadTemplate("partial_pagination.phtml", "mod_order_index.phtml", 163)->display(twig_array_merge($context, ["list" => ($context["orders"] ?? null), "url" => "order"])); + // line 164 + echo " "; + $this->loadTemplate("partial_batch_delete.phtml", "mod_order_index.phtml", 164)->display(twig_array_merge($context, ["action" => "admin/order/batch_delete"])); + // line 165 + echo "
    +
    + +
    +
    extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("order/new"); + echo "\" class=\"mainForm\"> +
    +
    + +
    + "; + // line 174 + if ( !twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "client_id", [], "any", false, false, false, 174)) { + // line 175 + echo " + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "client_id", [], "any", false, false, false, 176), "html", null, true); + echo "\" id=\"client_id\"/> + "; + } else { + // line 178 + echo " "; + $context["client"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "client_get", [0 => ["id" => twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "client_id", [], "any", false, false, false, 178)]], "method", false, false, false, 178); + // line 179 + echo " "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "first_name", [], "any", false, false, false, 179), "html", null, true); + echo " "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "last_name", [], "any", false, false, false, 179), "html", null, true); + echo " + "; + } + // line 181 + echo "
    +
    +
    +
    + +
    + "; + // line 187 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["product_id", twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "product_get_pairs", [], "any", false, false, false, 187), twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "product_id", [], "any", false, false, false, 187), 1], 187, $context, $this->getSourceContext()); + echo " +
    +
    +
    + + + "; + // line 193 + if (twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "client_id", [], "any", false, false, false, 193)) { + // line 194 + echo " env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "client_id", [], "any", false, false, false, 194), "html", null, true); + echo "\" /> + "; + } + // line 196 + echo "
    +
    +
    +
    + +"; + } + + // line 203 + public function block_head($context, array $blocks = []) + { + $macros = $this->macros; + // line 204 + echo " + +"; + } + + // line 208 + public function block_js($context, array $blocks = []) + { + $macros = $this->macros; + // line 209 + if ( !twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "client_id", [], "any", false, false, false, 209)) { + // line 210 + echo " +"; + } + } + + public function getTemplateName() + { + return "mod_order_index.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 523 => 210, 521 => 209, 517 => 208, 511 => 204, 507 => 203, 498 => 196, 492 => 194, 490 => 193, 486 => 192, 478 => 187, 473 => 185, 467 => 181, 459 => 179, 456 => 178, 451 => 176, 446 => 175, 444 => 174, 439 => 172, 433 => 169, 427 => 165, 424 => 164, 422 => 163, 418 => 161, 409 => 158, 406 => 157, 395 => 153, 389 => 152, 384 => 150, 380 => 149, 376 => 148, 372 => 147, 360 => 144, 348 => 141, 342 => 138, 338 => 137, 335 => 136, 329 => 135, 327 => 134, 318 => 128, 314 => 127, 310 => 126, 306 => 125, 302 => 124, 298 => 123, 290 => 118, 281 => 112, 277 => 111, 272 => 108, 268 => 107, 263 => 104, 250 => 98, 242 => 97, 234 => 96, 226 => 95, 222 => 93, 220 => 92, 210 => 85, 196 => 78, 187 => 76, 181 => 73, 172 => 67, 167 => 65, 158 => 59, 153 => 57, 144 => 51, 139 => 49, 130 => 43, 125 => 41, 116 => 35, 111 => 33, 102 => 27, 97 => 25, 88 => 19, 83 => 17, 77 => 14, 70 => 10, 67 => 9, 65 => 8, 61 => 7, 54 => 5, 50 => 1, 48 => 3, 46 => 2, 39 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends request.ajax ? \"layout_blank.phtml\" : \"layout_default.phtml\" %} +{% set active_menu = 'order' %} +{% import \"macro_functions.phtml\" as mf %} + +{% block meta_title %}{% trans 'Orders' %}{% endblock %} + +{% block top_content %} +{% if request.show_filter %} +
    +
    {% trans 'Filter orders' %}
    +
    + +
    + +
    +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + {{ mf.selectbox('status', admin.order_get_status_pairs, request.status, 0, 'All statuses') }} +
    +
    +
    + +
    + +
    + {{ mf.selectbox('type', admin.product_get_types, request.type, 0, 'All types') }} +
    +
    +
    + +
    + +
    + {{ mf.selectbox('product_id', admin.product_get_pairs, request.product_id, 0, 'All products') }} +
    +
    +
    + +
    + +
    + {{ mf.selectbox('period', guest.system_periods, request.period, 0, 'All periods') }} +
    +
    +
    + +
    + +
    + {{ mf.selectbox('invoice_option', admin.order_get_invoice_options, request.invoice_option, 0, 'All types') }} +
    +
    +
    + +
    + +
    +
      +
    • +
    • -
    • +
    • +
    +
    +
    +
    + + + +
    +
    +
    +
    +
    +{% else %} +{% set count_orders = admin.order_get_statuses %} +
    + +
    +
    + +{% endif %} + +{% endblock %} + +{% block content %} + +
    + + +
    +
    +
    + {{ mf.table_search }} + + + + + + + + + + + + + + + + {% set orders = admin.order_get_list({\"per_page\":30, \"page\":request.page}|merge(request)) %} + {% for i, order in orders.list %} + + + + + + + + + + + {% else %} + + + + {% endfor %} + +
    {% trans 'ID' %}{% trans 'Client' %}{% trans 'Title' %}{% trans 'Amount' %}{% trans 'Period' %}{% trans 'Status' %} 
    {{order.id}} + + \"{{ + + + {{order.client.first_name|truncate('1', null, '.')}} {{order.client.last_name}} + + {{order.title }}{{ mf.currency_format( order.total, order.currency) }}{{ mf.period_name(order.period) }}{{ mf.status_name(order.status) }} + \"\" + \"\" +
    {% trans 'The list is empty' %}
    + {% include \"partial_pagination.phtml\" with {'list': orders, 'url':'order'} %} + {% include \"partial_batch_delete.phtml\" with {'action' : 'admin/order/batch_delete'} %} +
    +
    + +
    +
    +
    +
    + +
    + {% if not request.client_id %} + + + {% else %} + {% set client = admin.client_get({\"id\":request.client_id}) %} + {{ client.first_name }} {{ client.last_name }} + {% endif %} +
    +
    +
    +
    + +
    + {{ mf.selectbox('product_id', admin.product_get_pairs, request.product_id, 1) }} +
    +
    +
    + + + {% if request.client_id %} + + {% endif %} +
    +
    +
    +
    + +{% endblock %} + +{% block head %} + + +{% endblock %} + +{% block js%} +{% if not request.client_id %} + +{% endif %} +{% endblock %}", "mod_order_index.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-themes/admin_default/html/mod_order_index.phtml"); + } +} diff --git a/bb-data/cache/1f/1f0912fca84f7f29b0d49a90b0619105bb853b24e2d786742042d8edcab7e919.php b/bb-data/cache/1f/1f0912fca84f7f29b0d49a90b0619105bb853b24e2d786742042d8edcab7e919.php new file mode 100644 index 000000000..c2862e03b --- /dev/null +++ b/bb-data/cache/1f/1f0912fca84f7f29b0d49a90b0619105bb853b24e2d786742042d8edcab7e919.php @@ -0,0 +1,92 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 1 + echo " + +"; + } + + public function getTemplateName() + { + return "mod_cookieconsent_index.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 40 => 2, 37 => 1,); + } + + public function getSourceContext() + { + return new Source(" + +", "mod_cookieconsent_index.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/src/bb-modules/Cookieconsent/html_client/mod_cookieconsent_index.phtml"); + } +} diff --git a/bb-data/cache/22/2214b4c1a9cde70eab730ef82987a845cf7df5234e5b2a0abd4a4c5d473737a9.php b/bb-data/cache/22/2214b4c1a9cde70eab730ef82987a845cf7df5234e5b2a0abd4a4c5d473737a9.php new file mode 100644 index 000000000..2073b268a --- /dev/null +++ b/bb-data/cache/22/2214b4c1a9cde70eab730ef82987a845cf7df5234e5b2a0abd4a4c5d473737a9.php @@ -0,0 +1,263 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 1 + $context["product"] = ((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "order", [], "any", false, false, false, 1)) ? (twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "product_get", [0 => ["id" => twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "order", [], "any", false, false, false, 1)]], "method", false, false, false, 1)) : (null)); + // line 2 + echo "
    +
    + "; + // line 4 + echo gettext("Product Configuration"); + echo " +
    + "; + // line 6 + if (($context["product"] ?? null)) { + // line 7 + echo "
    env, $this->source, ($context["request"] ?? null), "order", [], "any", false, false, false, 7)) { + echo "in"; + } + echo "\"> +
    +
    env, $this->source, ($context["product"] ?? null), "form_id", [], "any", false, false, false, 9)) ? (print (twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "formbuilder_get", [0 => ["id" => twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "form_id", [], "any", false, false, false, 9)]], "method", false, false, false, 9), "style", [], "any", false, false, false, 9), "type", [], "any", false, false, false, 9), "html", null, true))) : (print (0))); + echo "\" action=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_client_link_filter("/order"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "slug", [], "any", false, false, false, 9), "html", null, true); + echo "\" id=\"add-to-cart\" onsubmit=\"return false;\"> + + "; + // line 11 + ob_start(); + // line 12 + echo "
    + "; + // line 13 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "title", [], "any", false, false, false, 13), "html", null, true); + echo " + "; + // line 14 + echo twig_bbmd_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "description", [], "any", false, false, false, 14)); + echo " + + "; + // line 16 + if ((twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "pricing", [], "any", false, false, false, 16), "type", [], "any", false, false, false, 16) == "recurrent")) { + // line 17 + echo " "; + $context["periods"] = twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "system_periods", [], "any", false, false, false, 17); + // line 18 + echo " + "; + } elseif ((twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, // line 25 +($context["product"] ?? null), "pricing", [], "any", false, false, false, 25), "type", [], "any", false, false, false, 25) == "free")) { + // line 26 + echo " "; + echo gettext("FREE"); + echo " + "; + } else { + // line 28 + echo " "; + echo twig_money_convert($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "pricing", [], "any", false, false, false, 28), "once", [], "any", false, false, false, 28), "price", [], "any", false, false, false, 28)); + echo " + "; + } + // line 30 + echo "
    + "; + $context["product_details"] = ('' === $tmp = ob_get_clean()) ? '' : new Markup($tmp, $this->env->getCharset()); + // line 32 + echo " + "; + // line 33 + $context["tpl"] = (("mod_service" . twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "type", [], "any", false, false, false, 33)) . "_order_form.phtml"); + // line 34 + echo " "; + if (twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "system_template_exists", [0 => ["file" => ($context["tpl"] ?? null)]], "method", false, false, false, 34)) { + // line 35 + echo " "; + $this->loadTemplate(($context["tpl"] ?? null), "mod_orderbutton_product_configuration.phtml", 35)->display(twig_array_merge($context, ($context["product"] ?? null))); + // line 36 + echo " "; + } elseif ((twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "form_id", [], "any", false, false, false, 36) && twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "extension_is_on", [0 => ["mod" => "formbuilder"]], "method", false, false, false, 36))) { + // line 37 + echo " "; + echo twig_escape_filter($this->env, ($context["product_details"] ?? null), "html", null, true); + echo " + "; + // line 38 + $context["form"] = twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "formbuilder_get", [0 => ["id" => twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "form_id", [], "any", false, false, false, 38)]], "method", false, false, false, 38); + // line 39 + echo " "; + $this->loadTemplate("mod_formbuilder_build.phtml", "mod_orderbutton_product_configuration.phtml", 39)->display(twig_array_merge($context, ($context["product"] ?? null))); + // line 40 + echo " "; + } else { + // line 41 + echo " "; + echo twig_escape_filter($this->env, ($context["product_details"] ?? null), "html", null, true); + echo " + "; + } + // line 43 + echo " + "; + // line 44 + $this->loadTemplate("mod_orderbutton_addons.phtml", "mod_orderbutton_product_configuration.phtml", 44)->display(twig_array_merge($context, ($context["product"] ?? null))); + // line 45 + echo " + + env, twig_get_attribute($this->env, $this->source, ($context["product"] ?? null), "id", [], "any", false, false, false, 47), "html", null, true); + echo "\" /> + +
    + +
    + "; + } + // line 53 + echo "
    "; + } + + public function getTemplateName() + { + return "mod_orderbutton_product_configuration.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 189 => 53, 181 => 48, 177 => 47, 173 => 45, 171 => 44, 168 => 43, 162 => 41, 159 => 40, 156 => 39, 154 => 38, 149 => 37, 146 => 36, 143 => 35, 140 => 34, 138 => 33, 135 => 32, 131 => 30, 125 => 28, 119 => 26, 117 => 25, 114 => 24, 108 => 23, 96 => 21, 93 => 20, 89 => 19, 86 => 18, 83 => 17, 81 => 16, 76 => 14, 72 => 13, 69 => 12, 67 => 11, 58 => 9, 50 => 7, 48 => 6, 43 => 4, 39 => 2, 37 => 1,); + } + + public function getSourceContext() + { + return new Source("{% set product = request.order ? guest.product_get({\"id\":request.order}) : null %} +
    +
    + {% trans 'Product Configuration' %} +
    + {% if product %} +
    +
    +
    + + {% set product_details %} +
    + {{ product.title }} + {{ product.description | bbmd }} + + {% if product.pricing.type == 'recurrent' %} + {% set periods = guest.system_periods %} + + {% elseif product.pricing.type == 'free' %} + {% trans 'FREE' %} + {% else %} + {{ product.pricing.once.price | money_convert }} + {% endif %} +
    + {% endset %} + + {% set tpl = \"mod_service\"~product.type~\"_order_form.phtml\" %} + {% if guest.system_template_exists({\"file\":tpl}) %} + {% include tpl with product %} + {% elseif product.form_id and guest.extension_is_on({\"mod\":\"formbuilder\"}) %} + {{ product_details }} + {% set form = guest.formbuilder_get({\"id\":product.form_id}) %} + {% include 'mod_formbuilder_build.phtml' with product %} + {% else %} + {{ product_details }} + {% endif %} + + {% include 'mod_orderbutton_addons.phtml' with product %} + + + + +
    + +
    + {% endif %} +
    ", "mod_orderbutton_product_configuration.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-modules/Orderbutton/html_client/mod_orderbutton_product_configuration.phtml"); + } +} diff --git a/bb-data/cache/24/24d5e372d056fc5fe8f5eb860ae844482e52c4d1c70212e9289dd7f9a6ec9e99.php b/bb-data/cache/24/24d5e372d056fc5fe8f5eb860ae844482e52c4d1c70212e9289dd7f9a6ec9e99.php new file mode 100644 index 000000000..a3623f207 --- /dev/null +++ b/bb-data/cache/24/24d5e372d056fc5fe8f5eb860ae844482e52c4d1c70212e9289dd7f9a6ec9e99.php @@ -0,0 +1,1142 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'top_content' => [$this, 'block_top_content'], + 'content' => [$this, 'block_content'], + 'js' => [$this, 'block_js'], + ]; + } + + protected function doGetParent(array $context) + { + // line 2 + return "layout_default.phtml"; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 1 + $macros["mf"] = $this->macros["mf"] = $this->loadTemplate("macro_functions.phtml", "mod_client_index.phtml", 1)->unwrap(); + // line 3 + $context["active_menu"] = "client"; + // line 2 + $this->parent = $this->loadTemplate("layout_default.phtml", "mod_client_index.phtml", 2); + $this->parent->display($context, array_merge($this->blocks, $blocks)); + } + + // line 4 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("Clients"); + } + + // line 6 + public function block_top_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 7 + if (twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "show_filter", [], "any", false, false, false, 7)) { + // line 8 + echo "
    +
    "; + // line 9 + echo gettext("Filter clients"); + echo "
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "_url", [], "any", false, false, false, 13), "html", null, true); + echo "\" /> +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "id", [], "any", false, false, false, 18), "html", null, true); + echo "\"> +
    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "name", [], "any", false, false, false, 26), "html", null, true); + echo "\"> +
    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "company", [], "any", false, false, false, 34), "html", null, true); + echo "\"> +
    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "email", [], "any", false, false, false, 42), "html", null, true); + echo "\" /> +
    +
    +
    + +
    + +
    + "; + // line 50 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["group_id", twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "client_group_get_pairs", [], "any", false, false, false, 50), twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "group_id", [], "any", false, false, false, 50), 0, "All groups"], 50, $context, $this->getSourceContext()); + echo " +
    +
    +
    + +
    + +
    + env, $this->source, ($context["request"] ?? null), "status", [], "any", false, false, false, 58)) { + echo " checked=\"checked\""; + } + echo "/> + env, $this->source, ($context["request"] ?? null), "status", [], "any", false, false, false, 59) == "active")) { + echo " checked=\"checked\""; + } + echo "/> + env, $this->source, ($context["request"] ?? null), "status", [], "any", false, false, false, 60) == "suspended")) { + echo " checked=\"checked\""; + } + echo " /> + env, $this->source, ($context["request"] ?? null), "status", [], "any", false, false, false, 61) == "canceled")) { + echo " checked=\"checked\""; + } + echo " /> +
    +
    +
    + +
    + +
    +
      +
    • env, $this->source, ($context["request"] ?? null), "date_from", [], "any", false, false, false, 70)) { + echo twig_escape_filter($this->env, twig_date_format_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "date_from", [], "any", false, false, false, 70), "Y-m-d"), "html", null, true); + } + echo "\" placeholder=\""; + echo twig_escape_filter($this->env, twig_date_format_filter($this->env, ($context["now"] ?? null), "Y-m-d"), "html", null, true); + echo "\" class=\"datepicker\"/>
    • +
    • -
    • +
    • env, $this->source, ($context["request"] ?? null), "date_to", [], "any", false, false, false, 72)) { + echo twig_escape_filter($this->env, twig_date_format_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "date_to", [], "any", false, false, false, 72), "Y-m-d"), "html", null, true); + } + echo "\" placeholder=\""; + echo twig_escape_filter($this->env, twig_date_format_filter($this->env, ($context["now"] ?? null), "Y-m-d"), "html", null, true); + echo "\" class=\"datepicker\"/>
    • +
    +
    +
    +
    + + + +
    +
    +
    +
    +
    +"; + } else { + // line 86 + $context["count_clients"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "client_get_statuses", [], "any", false, false, false, 86); + // line 87 + echo "
    + +
    +
    +"; + } + } + + // line 99 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 100 + echo "
    + + + +
    + +
    +
    + "; + // line 113 + echo twig_call_macro($macros["mf"], "macro_table_search", [], 113, $context, $this->getSourceContext()); + echo " + + + + + + + + + + + + + + + "; + // line 128 + $context["clients"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "client_get_list", [0 => twig_array_merge(["per_page" => 30, "page" => twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "page", [], "any", false, false, false, 128)], ($context["request"] ?? null))], "method", false, false, false, 128); + // line 129 + echo " "; + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["clients"] ?? null), "list", [], "any", false, false, false, 129)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["_key"] => $context["client"]) { + // line 130 + echo " + + + + + + + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 148 + echo " + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['_key'], $context['client'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 152 + echo " +
    "; + // line 118 + echo gettext("Name"); + echo ""; + // line 119 + echo gettext("Company"); + echo ""; + // line 120 + echo gettext("Email"); + echo ""; + // line 121 + echo gettext("Status"); + echo ""; + // line 122 + echo gettext("Date"); + echo " 
    env, twig_get_attribute($this->env, $this->source, $context["client"], "id", [], "any", false, false, false, 131), "html", null, true); + echo "\"/> + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("client/manage"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["client"], "id", [], "any", false, false, false, 133), "html", null, true); + echo "\">env, twig_gravatar_filter(twig_get_attribute($this->env, $this->source, $context["client"], "email", [], "any", false, false, false, 133)), "html", null, true); + echo "?size=20\" alt=\""; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["client"], "id", [], "any", false, false, false, 133), "html", null, true); + echo "\" /> + + env, twig_get_attribute($this->env, $this->source, $context["client"], "country", [], "any", false, false, false, 136), "html", null, true); + echo "\" title=\""; + echo twig_escape_filter($this->env, (($__internal_f607aeef2c31a95a7bf963452dff024ffaeb6aafbe4603f9ca3bec57be8633f4 = twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "system_countries", [], "any", false, false, false, 136)) && is_array($__internal_f607aeef2c31a95a7bf963452dff024ffaeb6aafbe4603f9ca3bec57be8633f4) || $__internal_f607aeef2c31a95a7bf963452dff024ffaeb6aafbe4603f9ca3bec57be8633f4 instanceof ArrayAccess ? ($__internal_f607aeef2c31a95a7bf963452dff024ffaeb6aafbe4603f9ca3bec57be8633f4[twig_get_attribute($this->env, $this->source, $context["client"], "country", [], "any", false, false, false, 136)] ?? null) : null), "html", null, true); + echo "\"> + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("client/manage"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["client"], "id", [], "any", false, false, false, 137), "html", null, true); + echo "\" title=\""; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["client"], "first_name", [], "any", false, false, false, 137), "html", null, true); + echo " "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["client"], "last_name", [], "any", false, false, false, 137), "html", null, true); + echo "\">"; + echo twig_escape_filter($this->env, twig_truncate_filter($this->env, twig_get_attribute($this->env, $this->source, $context["client"], "first_name", [], "any", false, false, false, 137), "1", null, "."), "html", null, true); + echo " "; + echo twig_escape_filter($this->env, twig_truncate_filter($this->env, twig_get_attribute($this->env, $this->source, $context["client"], "last_name", [], "any", false, false, false, 137), 15), "html", null, true); + echo "extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("client/manage"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["client"], "id", [], "any", false, false, false, 138), "html", null, true); + echo "\" title=\""; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["client"], "company", [], "any", false, false, false, 138), "html", null, true); + echo "\">"; + echo twig_escape_filter($this->env, twig_truncate_filter($this->env, ((twig_get_attribute($this->env, $this->source, $context["client"], "company", [], "any", true, true, false, 138)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, $context["client"], "company", [], "any", false, false, false, 138), "-")) : ("-")), 30), "html", null, true); + echo "extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("client/manage"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["client"], "id", [], "any", false, false, false, 139), "html", null, true); + echo "\" title=\""; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["client"], "email", [], "any", false, false, false, 139), "html", null, true); + echo "\">"; + echo twig_escape_filter($this->env, twig_truncate_filter($this->env, twig_get_attribute($this->env, $this->source, $context["client"], "email", [], "any", false, false, false, 139), 30), "html", null, true); + echo ""; + // line 140 + echo twig_call_macro($macros["mf"], "macro_status_name", [twig_get_attribute($this->env, $this->source, $context["client"], "status", [], "any", false, false, false, 140)], 140, $context, $this->getSourceContext()); + echo ""; + // line 141 + echo twig_escape_filter($this->env, twig_date_format_filter($this->env, twig_get_attribute($this->env, $this->source, $context["client"], "created_at", [], "any", false, false, false, 141), "Y-m-d"), "html", null, true); + echo " + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/client/delete", ["id" => twig_get_attribute($this->env, $this->source, $context["client"], "id", [], "any", false, false, false, 143)]); + echo "\" data-api-confirm=\"Are you sure?\" data-api-reload=\"1\">\"\" + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("client/manage"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["client"], "id", [], "any", false, false, false, 144), "html", null, true); + echo "\">\"\" +
    "; + // line 149 + echo gettext("The list is empty"); + echo "
    + + "; + // line 155 + $this->loadTemplate("partial_batch_delete.phtml", "mod_client_index.phtml", 155)->display(twig_array_merge($context, ["action" => "admin/client/batch_delete"])); + // line 156 + echo " "; + $this->loadTemplate("partial_pagination.phtml", "mod_client_index.phtml", 156)->display(twig_array_merge($context, ["list" => ($context["clients"] ?? null), "url" => "client"])); + // line 157 + echo "
    + +
    + +
    + +
    extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/client/create"); + echo "\" class=\"mainForm api-form save\" data-api-redirect=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("client"); + echo "\"> +
    +
    + +
    + + +
    +
    +
    +
    + +
    + "; + // line 176 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["group_id", twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "client_group_get_pairs", [], "any", false, false, false, 176), twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "group_id", [], "any", false, false, false, 176), 0, "Select group"], 176, $context, $this->getSourceContext()); + echo " +
    +
    +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "email", [], "any", false, false, false, 183), "html", null, true); + echo "\" required=\"required\"/> +
    +
    +
    +
    + +
    +
      +
    • env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "first_name", [], "any", false, false, false, 191), "html", null, true); + echo "\" required=\"required\"/>
    • +
    • +
    • env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "last_name", [], "any", false, false, false, 193), "html", null, true); + echo "\"/>
    • +
    +
    +
    +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "company", [], "any", false, false, false, 201), "html", null, true); + echo "\"/> +
    +
    +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "address_1", [], "any", false, false, false, 208), "html", null, true); + echo "\"/> +
    +
    +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "address_2", [], "any", false, false, false, 215), "html", null, true); + echo "\"/> +
    +
    +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "city", [], "any", false, false, false, 222), "html", null, true); + echo "\"/> +
    +
    +
    +
    + +
    + "; + // line 230 + echo " env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "state", [], "any", false, false, false, 230), "html", null, true); + echo "\" /> +
    +
    +
    +
    + +
    + "; + // line 237 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["country", twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "system_countries", [], "any", false, false, false, 237), twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "country", [], "any", false, false, false, 237), 0, "Select country"], 237, $context, $this->getSourceContext()); + echo " +
    +
    +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "postcode", [], "any", false, false, false, 244), "html", null, true); + echo "\"/> +
    +
    +
    +
    + +
    +
      +
    • env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "phone_cc", [], "any", false, false, false, 252), "html", null, true); + echo "\"/>
    • +
    • +
    • env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "phone", [], "any", false, false, false, 254), "html", null, true); + echo "\"/>
    • +
    +
    +
    +
    + +
    + +
    + "; + // line 263 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["currency", twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "currency_get_pairs", [], "any", false, false, false, 263), twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "currency", [], "any", false, false, false, 263), 0, "Select currency"], 263, $context, $this->getSourceContext()); + echo " +
    +
    +
    + +
    + +
    + +
    +
    +
    + + +
    +
    +
    + +
    + + + + + + + + + + "; + // line 291 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "client_group_get_pairs", [], "any", false, false, false, 291)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["id"] => $context["group"]) { + // line 292 + echo " + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 300 + echo " + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['id'], $context['group'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 304 + echo " +
    "; + // line 285 + echo gettext("Title"); + echo ""; + // line 286 + echo gettext("Actions"); + echo "
    "; + // line 293 + echo twig_escape_filter($this->env, $context["group"], "html", null, true); + echo " + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("client/group"); + echo "/"; + echo twig_escape_filter($this->env, $context["id"], "html", null, true); + echo "\">\"\" + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/client/group_delete", ["id" => $context["id"]]); + echo "\">\"\" +
    "; + // line 301 + echo gettext("The list is empty"); + echo "
    +
    + + +
    + +
    extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/client/group_create"); + echo "\" class=\"mainForm api-form save\" data-api-redirect=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("client"); + echo "\"> +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "title", [], "any", false, false, false, 316), "html", null, true); + echo "\" required=\"required\"/> +
    +
    +
    + + +
    +
    +
    + +
    +
    + +"; + } + + // line 331 + public function block_js($context, array $blocks = []) + { + $macros = $this->macros; + // line 332 + echo " + + +"; + } + + public function getTemplateName() + { + return "mod_client_index.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 783 => 332, 779 => 331, 766 => 321, 758 => 316, 753 => 314, 745 => 311, 736 => 304, 727 => 301, 724 => 300, 715 => 296, 709 => 295, 704 => 293, 701 => 292, 696 => 291, 688 => 286, 684 => 285, 672 => 276, 662 => 269, 653 => 263, 648 => 261, 638 => 254, 633 => 252, 627 => 249, 619 => 244, 614 => 242, 606 => 237, 601 => 235, 592 => 230, 587 => 227, 579 => 222, 574 => 220, 566 => 215, 561 => 213, 553 => 208, 548 => 206, 540 => 201, 535 => 199, 526 => 193, 521 => 191, 515 => 188, 507 => 183, 502 => 181, 494 => 176, 489 => 174, 481 => 169, 477 => 168, 472 => 166, 464 => 163, 456 => 157, 453 => 156, 451 => 155, 446 => 152, 437 => 149, 434 => 148, 423 => 144, 419 => 143, 414 => 141, 410 => 140, 400 => 139, 390 => 138, 376 => 137, 370 => 136, 358 => 133, 353 => 131, 350 => 130, 344 => 129, 342 => 128, 333 => 122, 329 => 121, 325 => 120, 321 => 119, 317 => 118, 309 => 113, 299 => 106, 295 => 105, 291 => 104, 287 => 103, 282 => 100, 278 => 99, 264 => 92, 256 => 91, 248 => 90, 240 => 89, 236 => 87, 234 => 86, 224 => 79, 210 => 72, 201 => 70, 195 => 67, 182 => 61, 174 => 60, 166 => 59, 158 => 58, 153 => 56, 144 => 50, 139 => 48, 130 => 42, 125 => 40, 116 => 34, 111 => 32, 102 => 26, 97 => 24, 88 => 18, 83 => 16, 77 => 13, 70 => 9, 67 => 8, 65 => 7, 61 => 6, 54 => 4, 49 => 2, 47 => 3, 45 => 1, 38 => 2,); + } + + public function getSourceContext() + { + return new Source("{% import \"macro_functions.phtml\" as mf %} +{% extends \"layout_default.phtml\" %} +{% set active_menu = 'client' %} +{% block meta_title %}{% trans 'Clients' %}{% endblock %} + +{% block top_content %} +{% if request.show_filter %} +
    +
    {% trans 'Filter clients' %}
    +
    + +
    + +
    +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + {{ mf.selectbox('group_id', admin.client_group_get_pairs, request.group_id, 0, 'All groups') }} +
    +
    +
    + +
    + +
    + + + + +
    +
    +
    + +
    + +
    +
      +
    • +
    • -
    • +
    • +
    +
    +
    +
    + + + +
    +
    +
    +
    +
    +{% else %} +{% set count_clients = admin.client_get_statuses %} +
    + +
    +
    +{% endif %} +{% endblock %} + +{% block content %} +
    + + + +
    + +
    +
    + {{ mf.table_search }} + + + + + + + + + + + + + + + {% set clients = admin.client_get_list({\"per_page\":30, \"page\":request.page}|merge(request)) %} + {% for client in clients.list %} + + + + + + + + + + + {% else %} + + + + {% endfor %} + +
    {% trans 'Name' %}{% trans 'Company' %}{% trans 'Email' %}{% trans 'Status' %}{% trans 'Date' %} 
    + \"{{ + + + {{ client.first_name|truncate('1', null, '.') }} {{ client.last_name|truncate(15) }}{{ client.company|default('-')|truncate(30) }}{{ client.email|truncate(30) }}{{ mf.status_name(client.status) }}{{ client.created_at|date('Y-m-d') }} + \"\" + \"\" +
    {% trans 'The list is empty' %}
    + + {% include \"partial_batch_delete.phtml\" with {'action' : 'admin/client/batch_delete'} %} + {% include \"partial_pagination.phtml\" with {'list': clients, 'url':'client'} %} +
    + +
    + +
    + +
    +
    +
    + +
    + + +
    +
    +
    +
    + +
    + {{ mf.selectbox('group_id', admin.client_group_get_pairs, request.group_id, 0, 'Select group') }} +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    +
      +
    • +
    • +
    • +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + {# mf.selectbox('state', guest.system_states, request.state, 0, 'Select state') #} + +
    +
    +
    +
    + +
    + {{ mf.selectbox('country', guest.system_countries, request.country, 0, 'Select country') }} +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    +
      +
    • +
    • +
    • +
    +
    +
    +
    + +
    + +
    + {{ mf.selectbox('currency', guest.currency_get_pairs, request.currency, 0, 'Select currency') }} +
    +
    +
    + +
    + +
    + +
    +
    +
    + + +
    +
    +
    + +
    + + + + + + + + + + {% for id,group in admin.client_group_get_pairs %} + + + + + {% else %} + + + + {% endfor %} + +
    {% trans 'Title' %}{% trans 'Actions' %}
    {{ group }} + \"\" + \"\" +
    {% trans 'The list is empty' %}
    +
    + + +
    + +
    +
    +
    + +
    + +
    +
    +
    + + +
    +
    +
    + +
    +
    + +{% endblock %} + +{% block js %} + + + +{% endblock %}", "mod_client_index.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-themes/admin_default/html/mod_client_index.phtml"); + } +} diff --git a/bb-data/cache/24/24d607f2ec170f1cf3436e863823aeb155766bc8fb56539236bc679bf4d45158.php b/bb-data/cache/24/24d607f2ec170f1cf3436e863823aeb155766bc8fb56539236bc679bf4d45158.php new file mode 100644 index 000000000..420536bb5 --- /dev/null +++ b/bb-data/cache/24/24d607f2ec170f1cf3436e863823aeb155766bc8fb56539236bc679bf4d45158.php @@ -0,0 +1,457 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'breadcrumbs' => [$this, 'block_breadcrumbs'], + 'content' => [$this, 'block_content'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return "layout_default.phtml"; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 3 + $context["active_menu"] = "system"; + // line 1 + $this->parent = $this->loadTemplate("layout_default.phtml", "mod_servicehosting_hp.phtml", 1); + $this->parent->display($context, array_merge($this->blocks, $blocks)); + } + + // line 2 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo "Hosting management"; + } + + // line 5 + public function block_breadcrumbs($context, array $blocks = []) + { + $macros = $this->macros; + // line 6 + echo " +"; + } + + // line 13 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 14 + echo "
    + +
    +
    Manage hosting plan
    +
    + +
    extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/servicehosting/hp_update"); + echo "\" class=\"mainForm api-form\" data-api-msg=\"Hosting plan updated\"> +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["hp"] ?? null), "name", [], "any", false, false, false, 25), "html", null, true); + echo "\" required=\"required\" placeholder=\"Unique name to identify this hosting plan\"> +
    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["hp"] ?? null), "quota", [], "any", false, false, false, 33), "html", null, true); + echo "\" placeholder=\"\"> +
    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["hp"] ?? null), "bandwidth", [], "any", false, false, false, 41), "html", null, true); + echo "\" placeholder=\"\"> +
    +
    +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["hp"] ?? null), "max_addon", [], "any", false, false, false, 48), "html", null, true); + echo "\" placeholder=\"\"> +
    +
    +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["hp"] ?? null), "max_ftp", [], "any", false, false, false, 55), "html", null, true); + echo "\" placeholder=\"\"> +
    +
    +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["hp"] ?? null), "max_sql", [], "any", false, false, false, 62), "html", null, true); + echo "\" placeholder=\"\"> +
    +
    +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["hp"] ?? null), "max_pop", [], "any", false, false, false, 69), "html", null, true); + echo "\" placeholder=\"\"> +
    +
    +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["hp"] ?? null), "max_sub", [], "any", false, false, false, 76), "html", null, true); + echo "\" placeholder=\"\"> +
    +
    +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["hp"] ?? null), "max_park", [], "any", false, false, false, 83), "html", null, true); + echo "\" placeholder=\"\"> +
    +
    +
    +
    + + "; + // line 89 + if ((twig_length_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["hp"] ?? null), "config", [], "any", false, false, false, 89)) > 0)) { + // line 90 + echo "
    + "; + // line 91 + echo gettext("Server manager specific parameters"); + echo " + "; + // line 92 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["hp"] ?? null), "config", [], "any", false, false, false, 92)); + foreach ($context['_seq'] as $context["name"] => $context["value"]) { + // line 93 + echo "
    + +
    + +
    +
    +
    + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['name'], $context['value'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 101 + echo "
    + "; + } + // line 103 + echo " +
    + + env, twig_get_attribute($this->env, $this->source, ($context["hp"] ?? null), "id", [], "any", false, false, false, 106), "html", null, true); + echo "\"/> +
    +
    + +
    +

    "; + // line 111 + echo gettext("Hosting plan additional parameters"); + echo "

    +

    "; + // line 112 + echo gettext("Depending on server manager used to setup hosting account you may require provide additional parameters. List of parameters server managers requires you can find on extensions page."); + echo "

    +
    + +
    extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/servicehosting/hp_update"); + echo "\" class=\"mainForm save api-form\" data-api-reload=\"1\"> +
    +
    +
    +
    +
    +
    + +
    +
    + env, twig_get_attribute($this->env, $this->source, ($context["hp"] ?? null), "id", [], "any", false, false, false, 125), "html", null, true); + echo "\"/> +
    +
    +
    +"; + } + + public function getTemplateName() + { + return "mod_servicehosting_hp.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 302 => 125, 296 => 122, 286 => 115, 280 => 112, 276 => 111, 268 => 106, 264 => 105, 260 => 103, 256 => 101, 243 => 96, 238 => 94, 235 => 93, 231 => 92, 227 => 91, 224 => 90, 222 => 89, 213 => 83, 208 => 81, 200 => 76, 195 => 74, 187 => 69, 182 => 67, 174 => 62, 169 => 60, 161 => 55, 156 => 53, 148 => 48, 143 => 46, 135 => 41, 130 => 39, 121 => 33, 116 => 31, 107 => 25, 102 => 23, 96 => 20, 88 => 14, 84 => 13, 77 => 9, 71 => 8, 65 => 7, 62 => 6, 58 => 5, 51 => 2, 46 => 1, 44 => 3, 37 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends \"layout_default.phtml\" %} +{% block meta_title %}Hosting management{% endblock %} +{% set active_menu = 'system' %} + +{% block breadcrumbs %} + +{% endblock %} + +{% block content %} +
    + +
    +
    Manage hosting plan
    +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + + {% if hp.config|length > 0 %} +
    + {% trans 'Server manager specific parameters' %} + {% for name, value in hp.config %} +
    + +
    + +
    +
    +
    + {% endfor %} +
    + {% endif %} + +
    + + +
    +
    + +
    +

    {% trans 'Hosting plan additional parameters' %}

    +

    {% trans 'Depending on server manager used to setup hosting account you may require provide additional parameters. List of parameters server managers requires you can find on extensions page.' %}

    +
    + +
    +
    +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +{% endblock %}", "mod_servicehosting_hp.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-themes/admin_default/html/mod_servicehosting_hp.phtml"); + } +} diff --git a/bb-data/cache/29/29f9fcd84f85e7a9a84adde845c85a18149195a61f1c92e1765f4df3f626b857.php b/bb-data/cache/29/29f9fcd84f85e7a9a84adde845c85a18149195a61f1c92e1765f4df3f626b857.php new file mode 100644 index 000000000..1d3455dae --- /dev/null +++ b/bb-data/cache/29/29f9fcd84f85e7a9a84adde845c85a18149195a61f1c92e1765f4df3f626b857.php @@ -0,0 +1,306 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + '__internal_fda75832a1532316ef7f49b0da6a17990f7f9d1dda9c017f712c387dfdf1b218' => [$this, 'block___internal_fda75832a1532316ef7f49b0da6a17990f7f9d1dda9c017f712c387dfdf1b218'], + ]; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 1 + echo " +"; + // line 2 + echo twig_markdown_filter($this->env, $this->renderBlock("__internal_fda75832a1532316ef7f49b0da6a17990f7f9d1dda9c017f712c387dfdf1b218", $context, $blocks)); + } + + public function block___internal_fda75832a1532316ef7f49b0da6a17990f7f9d1dda9c017f712c387dfdf1b218($context, array $blocks = []) + { + $macros = $this->macros; + // line 3 + echo " +Hello "; + // line 4 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["c"] ?? null), "first_name", [], "any", false, false, false, 4), "html", null, true); + echo " "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["c"] ?? null), "last_name", [], "any", false, false, false, 4), "html", null, true); + echo ", + +Thank you for ordering with us! Your hosting account has now been set up. This email contains all the information you will need in order to begin using your service. + +If you have requested a domain name during the signup, please keep in mind that +your domain name will not be visible on the internet instantly. +This process is called propagation and can take up to 48 hours. +Your website and email will not function until your domain has propagated. + +**"; + // line 13 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "title", [], "any", false, false, false, 13), "html", null, true); + echo "** + +Activated: "; + // line 15 + echo twig_escape_filter($this->env, $this->extensions['Box_TwigExtensions']->twig_bb_date(twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "activated_at", [], "any", false, false, false, 15)), "html", null, true); + echo " +"; + // line 16 + if (twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "expires_at", [], "any", false, false, false, 16)) { + echo "Expires: "; + echo twig_escape_filter($this->env, $this->extensions['Box_TwigExtensions']->twig_bb_date(twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "expires_at", [], "any", false, false, false, 16)), "html", null, true); + echo " "; + } + // line 17 + if (twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "period", [], "any", false, false, false, 17)) { + // line 18 + echo "Billing period: + +"; + // line 20 + echo twig_money($this->env, twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "total", [], "any", false, false, false, 20), twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "currency", [], "any", false, false, false, 20)); + echo " +"; + // line 21 + echo twig_period_title($this->env, twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "period", [], "any", false, false, false, 21)); + echo " + +"; + } + // line 23 + echo " + +**New Account Information** + + +Hosting Package: "; + // line 28 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["service"] ?? null), "hosting_plan", [], "any", false, false, false, 28), "name", [], "any", false, false, false, 28), "html", null, true); + echo " +Domain: "; + // line 29 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["service"] ?? null), "domain", [], "any", false, false, false, 29), "html", null, true); + echo " +IP Address: "; + // line 30 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["service"] ?? null), "server", [], "any", false, false, false, 30), "ip", [], "any", false, false, false, 30), "html", null, true); + echo " + + +**Control Panel Login Details** + +Username: "; + // line 35 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["service"] ?? null), "username", [], "any", false, false, false, 35), "html", null, true); + echo " +Password: "; + // line 36 + echo twig_escape_filter($this->env, ($context["password"] ?? null), "html", null, true); + echo " +Control Panel URL: "; + // line 37 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["service"] ?? null), "server", [], "any", false, false, false, 37), "cpanel_url", [], "any", false, false, false, 37), "html", null, true); + echo " + + +**Server Information** + +Server Name: "; + // line 42 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["service"] ?? null), "server", [], "any", false, false, false, 42), "name", [], "any", false, false, false, 42), "html", null, true); + echo " +Server IP: "; + // line 43 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["service"] ?? null), "server", [], "any", false, false, false, 43), "ip", [], "any", false, false, false, 43), "html", null, true); + echo " + +If you are using an existing domain with your new hosting account, you will +need to update the domain settings to point it to the nameservers listed below. + +Nameserver 1: "; + // line 48 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["service"] ?? null), "server", [], "any", false, false, false, 48), "ns1", [], "any", false, false, false, 48), "html", null, true); + echo " +Nameserver 2: "; + // line 49 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["service"] ?? null), "server", [], "any", false, false, false, 49), "ns2", [], "any", false, false, false, 49), "html", null, true); + echo " +"; + // line 50 + if (twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["service"] ?? null), "server", [], "any", false, false, false, 50), "ns3", [], "any", false, false, false, 50)) { + echo "Nameserver 3: "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["service"] ?? null), "server", [], "any", false, false, false, 50), "ns3", [], "any", false, false, false, 50), "html", null, true); + echo " "; + } + // line 51 + if (twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["service"] ?? null), "server", [], "any", false, false, false, 51), "ns4", [], "any", false, false, false, 51)) { + echo "Nameserver 4: "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["service"] ?? null), "server", [], "any", false, false, false, 51), "ns4", [], "any", false, false, false, 51), "html", null, true); + echo " "; + } + // line 52 + echo " +**Uploading Your Website** + + +You may use one of the addresses given below to manage your web site: + + +Temporary FTP Hostname: "; + // line 59 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["service"] ?? null), "server", [], "any", false, false, false, 59), "ip", [], "any", false, false, false, 59), "html", null, true); + echo " +Full FTP Hostname: "; + // line 60 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["service"] ?? null), "domain", [], "any", false, false, false, 60), "html", null, true); + echo " +FTP Username: "; + // line 61 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["service"] ?? null), "username", [], "any", false, false, false, 61), "html", null, true); + echo " +FTP Password: "; + // line 62 + echo twig_escape_filter($this->env, ($context["password"] ?? null), "html", null, true); + echo " + +You must upload files to the **public_html** folder! +Thank you for choosing us. + + +Login to members area: "; + // line 68 + echo $this->extensions['Box_TwigExtensions']->twig_bb_client_link_filter("login", ["email" => twig_get_attribute($this->env, $this->source, ($context["c"] ?? null), "email", [], "any", false, false, false, 68)]); + echo " +Manage order: "; + // line 69 + echo $this->extensions['Box_TwigExtensions']->twig_bb_client_link_filter("order/service/manage"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "id", [], "any", false, false, false, 69), "html", null, true); + echo " + +"; + // line 71 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "system_company", [], "any", false, false, false, 71), "signature", [], "any", false, false, false, 71), "html", null, true); + echo " + +"; + } + + public function getTemplateName() + { + return "__string_template__a5fa9baca248410a0311f6bf2d5c0dc7ad007aa35f31f4df6cd1cbf2f87e713b"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 208 => 71, 201 => 69, 197 => 68, 188 => 62, 184 => 61, 180 => 60, 176 => 59, 167 => 52, 161 => 51, 155 => 50, 151 => 49, 147 => 48, 139 => 43, 135 => 42, 127 => 37, 123 => 36, 119 => 35, 111 => 30, 107 => 29, 103 => 28, 96 => 23, 90 => 21, 86 => 20, 82 => 18, 80 => 17, 74 => 16, 70 => 15, 65 => 13, 51 => 4, 48 => 3, 41 => 2, 38 => 1,); + } + + public function getSourceContext() + { + return new Source(" +{% filter markdown %} + +Hello {{ c.first_name }} {{ c.last_name }}, + +Thank you for ordering with us! Your hosting account has now been set up. This email contains all the information you will need in order to begin using your service. + +If you have requested a domain name during the signup, please keep in mind that +your domain name will not be visible on the internet instantly. +This process is called propagation and can take up to 48 hours. +Your website and email will not function until your domain has propagated. + +**{{ order.title }}** + +Activated: {{ order.activated_at|bb_date }} +{% if order.expires_at %}Expires: {{ order.expires_at|bb_date }} {% endif %} +{% if order.period %} +Billing period: + +{{ order.total | money(order.currency) }} +{{ order.period | period_title }} + +{% endif %} + +**New Account Information** + + +Hosting Package: {{ service.hosting_plan.name }} +Domain: {{ service.domain }} +IP Address: {{ service.server.ip }} + + +**Control Panel Login Details** + +Username: {{ service.username }} +Password: {{ password }} +Control Panel URL: {{ service.server.cpanel_url }} + + +**Server Information** + +Server Name: {{ service.server.name }} +Server IP: {{ service.server.ip }} + +If you are using an existing domain with your new hosting account, you will +need to update the domain settings to point it to the nameservers listed below. + +Nameserver 1: {{ service.server.ns1 }} +Nameserver 2: {{ service.server.ns2 }} +{% if service.server.ns3 %}Nameserver 3: {{ service.server.ns3 }} {% endif %} +{% if service.server.ns4 %}Nameserver 4: {{ service.server.ns4 }} {% endif %} + +**Uploading Your Website** + + +You may use one of the addresses given below to manage your web site: + + +Temporary FTP Hostname: {{ service.server.ip }} +Full FTP Hostname: {{ service.domain }} +FTP Username: {{ service.username }} +FTP Password: {{ password }} + +You must upload files to the **public_html** folder! +Thank you for choosing us. + + +Login to members area: {{'login'|link({'email' : c.email }) }} +Manage order: {{ 'order/service/manage'|link }}/{{ order.id }} + +{{ guest.system_company.signature }} + +{% endfilter %} +", "__string_template__a5fa9baca248410a0311f6bf2d5c0dc7ad007aa35f31f4df6cd1cbf2f87e713b", ""); + } +} diff --git a/bb-data/cache/2d/2da9d8c6a14e946e993be25e74a59c7925c28e9ab4825e451c16df55aeaae673.php b/bb-data/cache/2d/2da9d8c6a14e946e993be25e74a59c7925c28e9ab4825e451c16df55aeaae673.php new file mode 100644 index 000000000..8c9e800a9 --- /dev/null +++ b/bb-data/cache/2d/2da9d8c6a14e946e993be25e74a59c7925c28e9ab4825e451c16df55aeaae673.php @@ -0,0 +1,171 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 1 + echo ""; + } + + public function getTemplateName() + { + return "partial_menu.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 131 => 19, 122 => 15, 101 => 12, 89 => 11, 72 => 10, 64 => 7, 58 => 6, 49 => 5, 46 => 4, 42 => 3, 40 => 2, 37 => 1,); + } + + public function getSourceContext() + { + return new Source("", "partial_menu.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/src/bb-themes/admin_default/html/partial_menu.phtml"); + } +} diff --git a/bb-data/cache/2e/2e2012e58cd9ad698e50ec93b5ec0a591216ff09f472ff5fe9f68f8ecfdafed8.php b/bb-data/cache/2e/2e2012e58cd9ad698e50ec93b5ec0a591216ff09f472ff5fe9f68f8ecfdafed8.php new file mode 100644 index 000000000..e76e624f6 --- /dev/null +++ b/bb-data/cache/2e/2e2012e58cd9ad698e50ec93b5ec0a591216ff09f472ff5fe9f68f8ecfdafed8.php @@ -0,0 +1,259 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'content' => [$this, 'block_content'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return "layout_login.phtml"; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + $this->parent = $this->loadTemplate("layout_login.phtml", "mod_staff_login.phtml", 1); + $this->parent->display($context, array_merge($this->blocks, $blocks)); + } + + // line 3 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("Login"); + } + + // line 5 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 6 + echo " + +
    +
    env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "system_company", [], "any", false, false, false, 9), "logo_url", [], "any", false, false, false, 9), "html", null, true); + echo "\" alt=\"\" style=\"max-height: 75px\"/>
    +
    + "; + // line 11 + if (($context["create_admin"] ?? null)) { + // line 12 + echo "
    "; + echo gettext("Create main administrator account"); + echo "
    +
    extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/guest/staff/create"); + echo "\" method=\"post\" data-api-redirect=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("index"); + echo "\"> +
    +
    + +
    env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "email", [], "any", false, false, false, 17), "html", null, true); + echo "\" placeholder=\""; + echo gettext("Enter your email address"); + echo "\"/>
    +
    +
    + +
    + +
    env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "password", [], "any", false, false, false, 23), "html", null, true); + echo "\" placeholder=\""; + echo gettext("Enter your password"); + echo "\"/>
    +
    +
    + +
    + +
    +
    +
    +
    + "; + } else { + // line 34 + echo "
    "; + echo gettext("Login"); + echo "
    +
    extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/guest/staff/login"); + echo "\" method=\"post\" data-api-redirect=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("index"); + echo "\"> +
    +
    + +
    env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "email", [], "any", false, false, false, 39), "html", null, true); + echo "\" placeholder=\""; + echo gettext("Enter your email address"); + echo "\" autofocus/>
    +
    +
    + +
    + +
    env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "password", [], "any", false, false, false, 45), "html", null, true); + echo "\" placeholder=\""; + echo gettext("Enter your password"); + echo "\"/>
    +
    +
    + +
    +
    + +
    +
    +
    +
    + "; + } + // line 57 + echo "
    +
    + +"; + } + + public function getTemplateName() + { + return "mod_staff_login.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 174 => 57, 165 => 51, 161 => 50, 151 => 45, 147 => 44, 137 => 39, 133 => 38, 125 => 35, 120 => 34, 111 => 28, 101 => 23, 97 => 22, 87 => 17, 83 => 16, 75 => 13, 70 => 12, 68 => 11, 63 => 9, 58 => 6, 54 => 5, 47 => 3, 36 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends \"layout_login.phtml\" %} + +{% block meta_title %}{% trans 'Login' %}{% endblock %} + +{% block content %} + + +
    +
    \"\"
    +
    + {% if create_admin %} +
    {% trans 'Create main administrator account' %}
    +
    +
    +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    + {% else %} +
    {% trans 'Login' %}
    +
    +
    +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + +
    +
    +
    +
    + {% endif %} +
    +
    + +{% endblock %} +", "mod_staff_login.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/src/bb-themes/admin_default/html/mod_staff_login.phtml"); + } +} diff --git a/bb-data/cache/2e/2e33db2a865b2e3b650f8d899a9a5bb79bbae9fc74d9f41d6a40ab20eea57515.php b/bb-data/cache/2e/2e33db2a865b2e3b650f8d899a9a5bb79bbae9fc74d9f41d6a40ab20eea57515.php new file mode 100644 index 000000000..b5aa9a32d --- /dev/null +++ b/bb-data/cache/2e/2e33db2a865b2e3b650f8d899a9a5bb79bbae9fc74d9f41d6a40ab20eea57515.php @@ -0,0 +1,285 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'content' => [$this, 'block_content'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return $this->loadTemplate(((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "ajax", [], "any", false, false, false, 1)) ? ("layout_blank.phtml") : ("layout_default.phtml")), "mod_email_history.phtml", 1); + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 2 + $macros["mf"] = $this->macros["mf"] = $this->loadTemplate("macro_functions.phtml", "mod_email_history.phtml", 2)->unwrap(); + // line 4 + $context["active_menu"] = "activity"; + // line 1 + $this->getParent($context)->display($context, array_merge($this->blocks, $blocks)); + } + + // line 3 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("Email history"); + } + + // line 6 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 7 + echo " +"; + // line 8 + $context["config"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "extension_config_get", [0 => ["ext" => "mod_email"]], "method", false, false, false, 8); + // line 9 + if (( !twig_get_attribute($this->env, $this->source, ($context["config"] ?? null), "log_enabled", [], "any", true, true, false, 9) || (twig_get_attribute($this->env, $this->source, ($context["config"] ?? null), "log_enabled", [], "any", false, false, false, 9) != 1))) { + // line 10 + echo "
    +

    "; + // line 11 + echo gettext("INFORMATION"); + echo ": "; + echo gettext("Email logging is not enabled. If you want to log sent mails to database, enable it in"); + // line 12 + echo " extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("extension/settings/email"); + echo "\"> "; + echo gettext("email settings."); + echo " +

    +
    +"; + } + // line 16 + echo " +
    +
    "; + // line 18 + echo gettext("Email history"); + echo "
    + +"; + // line 20 + echo twig_call_macro($macros["mf"], "macro_table_search", [], 20, $context, $this->getSourceContext()); + echo " + + + + + + + + + + + + + + "; + // line 34 + $context["emails"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "email_email_get_list", [0 => twig_array_merge(["per_page" => 30, "page" => twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "page", [], "any", false, false, false, 34)], ($context["request"] ?? null))], "method", false, false, false, 34); + // line 35 + echo " "; + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["emails"] ?? null), "list", [], "any", false, false, false, 35)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["i"] => $context["email"]) { + // line 36 + echo " + + + + + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 48 + echo " + + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['i'], $context['email'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 55 + echo " +
    "; + // line 25 + echo gettext("To"); + echo ""; + // line 26 + echo gettext("From"); + echo ""; + // line 27 + echo gettext("Subject"); + echo ""; + // line 28 + echo gettext("Date"); + echo " 
    env, twig_get_attribute($this->env, $this->source, $context["email"], "id", [], "any", false, false, false, 37), "html", null, true); + echo "\"/>"; + // line 38 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["email"], "recipients", [], "any", false, false, false, 38), "html", null, true); + echo ""; + // line 39 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["email"], "sender", [], "any", false, false, false, 39), "html", null, true); + echo ""; + // line 40 + echo twig_escape_filter($this->env, twig_truncate_filter($this->env, twig_get_attribute($this->env, $this->source, $context["email"], "subject", [], "any", false, false, false, 40), 40), "html", null, true); + echo ""; + // line 41 + echo twig_escape_filter($this->env, twig_date_format_filter($this->env, twig_get_attribute($this->env, $this->source, $context["email"], "created_at", [], "any", false, false, false, 41), "Y-m-d"), "html", null, true); + echo " + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("/email"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["email"], "id", [], "any", false, false, false, 43), "html", null, true); + echo "\">\"\" + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("email/history"); + echo "\" data-api-confirm=\"Are you sure?\" href=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/email/email_delete", ["id" => twig_get_attribute($this->env, $this->source, $context["email"], "id", [], "any", false, false, false, 44)]); + echo "\">\"\" +
    + "; + // line 50 + echo gettext("The list is empty"); + // line 51 + echo "
    + +
    + +"; + // line 60 + $this->loadTemplate("partial_batch_delete.phtml", "mod_email_history.phtml", 60)->display(twig_array_merge($context, ["action" => "admin/email/batch_delete"])); + // line 61 + $this->loadTemplate("partial_pagination.phtml", "mod_email_history.phtml", 61)->display(twig_array_merge($context, ["list" => ($context["emails"] ?? null), "url" => "email/history"])); + // line 62 + echo " +"; + } + + public function getTemplateName() + { + return "mod_email_history.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 199 => 62, 197 => 61, 195 => 60, 188 => 55, 179 => 51, 177 => 50, 173 => 48, 162 => 44, 156 => 43, 151 => 41, 147 => 40, 143 => 39, 139 => 38, 135 => 37, 132 => 36, 126 => 35, 124 => 34, 115 => 28, 111 => 27, 107 => 26, 103 => 25, 95 => 20, 90 => 18, 86 => 16, 76 => 12, 72 => 11, 69 => 10, 67 => 9, 65 => 8, 62 => 7, 58 => 6, 51 => 3, 47 => 1, 45 => 4, 43 => 2, 36 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends request.ajax ? \"layout_blank.phtml\" : \"layout_default.phtml\" %} +{% import \"macro_functions.phtml\" as mf %} +{% block meta_title %}{% trans 'Email history' %}{% endblock %} +{% set active_menu = 'activity' %} + +{% block content %} + +{% set config = admin.extension_config_get({\"ext\":\"mod_email\"}) %} +{% if config.log_enabled is not defined or config.log_enabled != 1 %} +
    +

    {% trans 'INFORMATION' %}: {% trans 'Email logging is not enabled. If you want to log sent mails to database, enable it in' %} + {% trans 'email settings.' %} +

    +
    +{% endif %} + +
    +
    {% trans 'Email history' %}
    + +{{ mf.table_search }} + + + + + + + + + + + + + + {% set emails = admin.email_email_get_list({\"per_page\":30, \"page\":request.page}|merge(request)) %} + {% for i, email in emails.list %} + + + + + + + + + {% else %} + + + + + {% endfor %} + +
    {% trans 'To' %}{% trans 'From' %}{% trans 'Subject' %}{% trans 'Date' %} 
    {{ email.recipients }}{{ email.sender }}{{ email.subject|truncate(40) }}{{ email.created_at|date('Y-m-d') }} + \"\" + \"\" +
    + {% trans 'The list is empty' %} +
    + +
    + +{% include \"partial_batch_delete.phtml\" with {'action' : 'admin/email/batch_delete'} %} +{% include \"partial_pagination.phtml\" with {'list': emails, 'url':'email/history'} %} + +{% endblock %} +", "mod_email_history.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-modules/Email/html_admin/mod_email_history.phtml"); + } +} diff --git a/bb-data/cache/31/31709e05ec1ccb9af78d7b9b313206b19986dbc0beecfe5926c5a8e5a008a3f0.php b/bb-data/cache/31/31709e05ec1ccb9af78d7b9b313206b19986dbc0beecfe5926c5a8e5a008a3f0.php new file mode 100644 index 000000000..f987eba0c --- /dev/null +++ b/bb-data/cache/31/31709e05ec1ccb9af78d7b9b313206b19986dbc0beecfe5926c5a8e5a008a3f0.php @@ -0,0 +1,520 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 9 + echo " +"; + // line 17 + echo " +"; + // line 22 + echo " +"; + // line 27 + echo " +"; + // line 31 + echo " +"; + // line 36 + echo " +"; + // line 45 + echo " + +"; + } + + // line 1 + public function macro_selectbox($__name__ = null, $__options__ = null, $__selected__ = null, $__required__ = null, $__nullOption__ = null, ...$__varargs__) + { + $macros = $this->macros; + $context = $this->env->mergeGlobals([ + "name" => $__name__, + "options" => $__options__, + "selected" => $__selected__, + "required" => $__required__, + "nullOption" => $__nullOption__, + "varargs" => $__varargs__, + ]); + + $blocks = []; + + ob_start(); + try { + // line 2 + echo " +"; + + return ('' === $tmp = ob_get_contents()) ? '' : new Markup($tmp, $this->env->getCharset()); + } finally { + ob_end_clean(); + } + } + + // line 10 + public function macro_selectboxtld($__name__ = null, $__options__ = null, $__selected__ = null, $__required__ = null, ...$__varargs__) + { + $macros = $this->macros; + $context = $this->env->mergeGlobals([ + "name" => $__name__, + "options" => $__options__, + "selected" => $__selected__, + "required" => $__required__, + "varargs" => $__varargs__, + ]); + + $blocks = []; + + ob_start(); + try { + // line 11 + echo " +"; + + return ('' === $tmp = ob_get_contents()) ? '' : new Markup($tmp, $this->env->getCharset()); + } finally { + ob_end_clean(); + } + } + + // line 19 + public function macro_currency_format($__price__ = null, $__currency__ = null, ...$__varargs__) + { + $macros = $this->macros; + $context = $this->env->mergeGlobals([ + "price" => $__price__, + "currency" => $__currency__, + "varargs" => $__varargs__, + ]); + + $blocks = []; + + ob_start(); + try { + // line 20 + echo " "; + echo twig_money($this->env, ($context["price"] ?? null), ($context["currency"] ?? null)); + echo " +"; + + return ('' === $tmp = ob_get_contents()) ? '' : new Markup($tmp, $this->env->getCharset()); + } finally { + ob_end_clean(); + } + } + + // line 24 + public function macro_currency($__price__ = null, $__currency__ = null, ...$__varargs__) + { + $macros = $this->macros; + $context = $this->env->mergeGlobals([ + "price" => $__price__, + "currency" => $__currency__, + "varargs" => $__varargs__, + ]); + + $blocks = []; + + ob_start(); + try { + // line 25 + echo " "; + echo twig_money_convert($this->env, ($context["price"] ?? null), ($context["currency"] ?? null)); + echo " +"; + + return ('' === $tmp = ob_get_contents()) ? '' : new Markup($tmp, $this->env->getCharset()); + } finally { + ob_end_clean(); + } + } + + // line 28 + public function macro_status_name($__status__ = null, ...$__varargs__) + { + $macros = $this->macros; + $context = $this->env->mergeGlobals([ + "status" => $__status__, + "varargs" => $__varargs__, + ]); + + $blocks = []; + + ob_start(); + try { + // line 29 + echo " "; + echo twig_escape_filter($this->env, gettext(twig_title_string_filter($this->env, twig_replace_filter(($context["status"] ?? null), ["_" => " "]))), "html", null, true); + echo " +"; + + return ('' === $tmp = ob_get_contents()) ? '' : new Markup($tmp, $this->env->getCharset()); + } finally { + ob_end_clean(); + } + } + + // line 33 + public function macro_period_name($__period__ = null, ...$__varargs__) + { + $macros = $this->macros; + $context = $this->env->mergeGlobals([ + "period" => $__period__, + "varargs" => $__varargs__, + ]); + + $blocks = []; + + ob_start(); + try { + // line 34 + echo " "; + echo twig_period_title($this->env, ($context["period"] ?? null)); + echo " +"; + + return ('' === $tmp = ob_get_contents()) ? '' : new Markup($tmp, $this->env->getCharset()); + } finally { + ob_end_clean(); + } + } + + // line 37 + public function macro_markdown_quote($__text__ = null, ...$__varargs__) + { + $macros = $this->macros; + $context = $this->env->mergeGlobals([ + "text" => $__text__, + "varargs" => $__varargs__, + ]); + + $blocks = []; + + ob_start(); + try { + // line 38 + echo " + + +"; + // line 41 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_split_filter($this->env, ($context["text"] ?? null), " +")); + foreach ($context['_seq'] as $context["_key"] => $context["line"]) { + // line 42 + echo "> "; + echo twig_escape_filter($this->env, $context["line"], "html", null, true); + echo " +"; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['_key'], $context['line'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + + return ('' === $tmp = ob_get_contents()) ? '' : new Markup($tmp, $this->env->getCharset()); + } finally { + ob_end_clean(); + } + } + + // line 47 + public function macro_recaptcha(...$__varargs__) + { + $macros = $this->macros; + $context = $this->env->mergeGlobals([ + "varargs" => $__varargs__, + ]); + + $blocks = []; + + ob_start(); + try { + // line 48 + echo " +"; + // line 49 + if (twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "extension_is_on", [0 => ["mod" => "spamchecker"]], "method", false, false, false, 49)) { + // line 50 + $context["rc"] = twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "spamchecker_recaptcha", [], "any", false, false, false, 50); + // line 51 + echo " "; + if (twig_get_attribute($this->env, $this->source, ($context["rc"] ?? null), "enabled", [], "any", false, false, false, 51)) { + // line 52 + echo " "; + if ((twig_get_attribute($this->env, $this->source, ($context["rc"] ?? null), "version", [], "any", false, false, false, 52) == 2)) { + // line 53 + echo " +
    env, twig_get_attribute($this->env, $this->source, ($context["rc"] ?? null), "publickey", [], "any", false, false, false, 54), "html", null, true); + echo "\">
    + "; + } else { + // line 56 + echo " + "; + // line 57 + $context["server"] = "https://www.google.com/recaptcha/api"; + // line 58 + echo " + +
    + +
    +
    "; + // line 68 + echo gettext("Incorrect please try again"); + echo "
    + +

    + +
    + + +

    +
    + + + + "; + } + // line 85 + echo " "; + } + } + + return ('' === $tmp = ob_get_contents()) ? '' : new Markup($tmp, $this->env->getCharset()); + } finally { + ob_end_clean(); + } + } + + public function getTemplateName() + { + return "macro_functions.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 405 => 85, 395 => 80, 388 => 78, 378 => 71, 372 => 68, 360 => 58, 358 => 57, 355 => 56, 350 => 54, 347 => 53, 344 => 52, 341 => 51, 339 => 50, 337 => 49, 334 => 48, 322 => 47, 306 => 42, 301 => 41, 296 => 38, 283 => 37, 271 => 34, 258 => 33, 246 => 29, 233 => 28, 221 => 25, 207 => 24, 195 => 20, 181 => 19, 171 => 15, 154 => 13, 150 => 12, 141 => 11, 125 => 10, 115 => 7, 98 => 5, 93 => 4, 87 => 3, 78 => 2, 61 => 1, 55 => 45, 52 => 36, 49 => 31, 46 => 27, 43 => 22, 40 => 17, 37 => 9,); + } + + public function getSourceContext() + { + return new Source("{% macro selectbox(name, options, selected, required, nullOption) %} + +{% endmacro %} + +{% macro selectboxtld(name, options, selected, required) %} + +{% endmacro %} + +{# deprecated - use money filter #} +{% macro currency_format(price, currency) %} + {{ price | money(currency) }} +{% endmacro %} + +{# deprecated - use money_convert filter #} +{% macro currency(price, currency) %} + {{ price | money_convert(currency) }} +{% endmacro %} + +{% macro status_name(status) %} + {{ status|replace({'_': \" \"})|title|trans }} +{% endmacro %} + +{# deprecated - use period_title filter #} +{% macro period_name(period) %} + {{ period | period_title }} +{% endmacro %} + +{% macro markdown_quote(text) %} + + + +{% for line in text|split('\\n') %} +> {{ line }} +{% endfor %} +{% endmacro %} + + +{% macro recaptcha() %} + +{% if guest.extension_is_on({\"mod\":\"spamchecker\"}) %} +{% set rc = guest.spamchecker_recaptcha %} + {% if rc.enabled %} + {% if rc.version == 2 %} + +
    + {% else %} + + {% set server = \"https://www.google.com/recaptcha/api\" %} + + +
    + +
    +
    {% trans 'Incorrect please try again' %}
    + +

    + +
    + + +

    +
    + + + + {% endif %} + {% endif %} +{% endif %} +{% endmacro %}", "macro_functions.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/src/bb-themes/huraga/html/macro_functions.phtml"); + } +} diff --git a/bb-data/cache/32/32075df229ab62484a79b090a5505cee4e21d0d607cf56cdd8254722c7d44126.php b/bb-data/cache/32/32075df229ab62484a79b090a5505cee4e21d0d607cf56cdd8254722c7d44126.php new file mode 100644 index 000000000..4c15c9882 --- /dev/null +++ b/bb-data/cache/32/32075df229ab62484a79b090a5505cee4e21d0d607cf56cdd8254722c7d44126.php @@ -0,0 +1,203 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'content' => [$this, 'block_content'], + 'js' => [$this, 'block_js'], + ]; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 1 + echo " + + + "; + // line 4 + $this->displayBlock('meta_title', $context, $blocks); + echo " + + + + "; + // line 8 + $this->loadTemplate("partial_bb_meta.phtml", "layout_login.phtml", 8)->display($context); + // line 9 + echo " + + + + + + + + + +
    +
    + +
    +
    + +"; + // line 34 + $this->displayBlock('content', $context, $blocks); + // line 35 + echo " + +
    +\t
    + \t"; + // line 39 + $this->loadTemplate("partial_footer.phtml", "layout_login.phtml", 39)->display(twig_array_merge($context, ["product" => ($context["product"] ?? null)])); + // line 40 + echo "
    +
    +"; + // line 42 + $this->displayBlock('js', $context, $blocks); + // line 43 + echo " + +"; + } + + // line 4 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + } + + // line 34 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + } + + // line 42 + public function block_js($context, array $blocks = []) + { + $macros = $this->macros; + } + + public function getTemplateName() + { + return "layout_login.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 135 => 42, 129 => 34, 123 => 4, 117 => 43, 115 => 42, 111 => 40, 109 => 39, 103 => 35, 101 => 34, 84 => 26, 80 => 25, 72 => 22, 61 => 14, 54 => 9, 52 => 8, 45 => 4, 40 => 1,); + } + + public function getSourceContext() + { + return new Source(" + + + {% block meta_title %}{% endblock %} + + + + {% include \"partial_bb_meta.phtml\" %} + + + + + + + + + + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    + +{% block content %}{% endblock %} + + +
    +\t
    + \t{% include \"partial_footer.phtml\" with {'product': product} %} +
    +
    +{% block js %}{% endblock %} + + +", "layout_login.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-themes/admin_default/html/layout_login.phtml"); + } +} diff --git a/bb-data/cache/34/347c877aec85b2d5108d5e86196446adf38cd795d87fe1875e0674681e25bd7c.php b/bb-data/cache/34/347c877aec85b2d5108d5e86196446adf38cd795d87fe1875e0674681e25bd7c.php new file mode 100644 index 000000000..c032bf2b8 --- /dev/null +++ b/bb-data/cache/34/347c877aec85b2d5108d5e86196446adf38cd795d87fe1875e0674681e25bd7c.php @@ -0,0 +1,1160 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'breadcrumbs' => [$this, 'block_breadcrumbs'], + 'content' => [$this, 'block_content'], + 'js' => [$this, 'block_js'], + 'head' => [$this, 'block_head'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return $this->loadTemplate(((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "ajax", [], "any", false, false, false, 1)) ? ("layout_blank.phtml") : ("layout_default.phtml")), "mod_support_ticket.phtml", 1); + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 2 + $macros["mf"] = $this->macros["mf"] = $this->loadTemplate("macro_functions.phtml", "mod_support_ticket.phtml", 2)->unwrap(); + // line 13 + $context["active_menu"] = "support"; + // line 1 + $this->getParent($context)->display($context, array_merge($this->blocks, $blocks)); + } + + // line 3 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "subject", [], "any", false, false, false, 3), "html", null, true); + echo " - "; + echo twig_escape_filter($this->env, twig_length_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "messages", [], "any", false, false, false, 3)), "html", null, true); + echo " "; + echo gettext("message(s)"); + } + + // line 5 + public function block_breadcrumbs($context, array $blocks = []) + { + $macros = $this->macros; + // line 6 + echo " +"; + } + + // line 14 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 15 + echo " +
    +
    +
    "; + // line 18 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "subject", [], "any", false, false, false, 18), "html", null, true); + echo "
    +
    + + + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "; + // line 66 + $context["task"] = twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "rel", [], "any", false, false, false, 66); + // line 67 + echo " + "; + // line 68 + if (twig_get_attribute($this->env, $this->source, ($context["task"] ?? null), "task", [], "any", false, false, false, 68)) { + // line 69 + echo " + + + + "; + } + // line 74 + echo " + "; + // line 75 + if ((twig_get_attribute($this->env, $this->source, ($context["task"] ?? null), "type", [], "any", false, false, false, 75) == "order")) { + // line 76 + echo " + + + + "; + } + // line 81 + echo " + "; + // line 82 + if ((twig_get_attribute($this->env, $this->source, ($context["task"] ?? null), "task", [], "any", false, false, false, 82) == "upgrade")) { + // line 83 + echo " + + + + "; + } + // line 88 + echo " + + + + + + + +
    "; + // line 34 + echo gettext("Ticket ID"); + echo "#"; + // line 35 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "id", [], "any", false, false, false, 35), "html", null, true); + echo "
    "; + // line 39 + echo gettext("Client"); + echo "#"; + // line 40 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "client", [], "any", false, false, false, 40), "id", [], "any", false, false, false, 40), "html", null, true); + echo " extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("client/manage"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "client", [], "any", false, false, false, 40), "id", [], "any", false, false, false, 40), "html", null, true); + echo "\">"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "client", [], "any", false, false, false, 40), "first_name", [], "any", false, false, false, 40), "html", null, true); + echo " "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "client", [], "any", false, false, false, 40), "last_name", [], "any", false, false, false, 40), "html", null, true); + echo "
    "; + // line 44 + echo gettext("Help desk"); + echo " + "; + // line 46 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["support_helpdesk_id", twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "support_helpdesk_get_pairs", [], "any", false, false, false, 46), twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "support_helpdesk_id", [], "any", false, false, false, 46), 1], 46, $context, $this->getSourceContext()); + echo " +
    "; + // line 51 + echo gettext("Status"); + echo " + "; + // line 53 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "support_ticket_get_statuses", [0 => ["titles" => 1]], "method", false, false, false, 53)); + foreach ($context['_seq'] as $context["tcode"] => $context["tstatus"]) { + // line 54 + echo " + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['tcode'], $context['tstatus'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 56 + echo "
    "; + // line 60 + echo gettext("Time opened"); + echo ""; + // line 61 + echo twig_escape_filter($this->env, twig_date_format_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "created_at", [], "any", false, false, false, 61), "l, d F Y"), "html", null, true); + echo "
    "; + // line 71 + echo twig_call_macro($macros["mf"], "macro_status_name", [twig_get_attribute($this->env, $this->source, ($context["task"] ?? null), "task", [], "any", false, false, false, 71)], 71, $context, $this->getSourceContext()); + echo "
    extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("order/manage"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["task"] ?? null), "id", [], "any", false, false, false, 78), "html", null, true); + echo "\">Order #"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["task"] ?? null), "id", [], "any", false, false, false, 78), "html", null, true); + echo "
    extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("product/manage"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["task"] ?? null), "new_value", [], "any", false, false, false, 85), "html", null, true); + echo "\">"; + echo twig_escape_filter($this->env, (($__internal_f607aeef2c31a95a7bf963452dff024ffaeb6aafbe4603f9ca3bec57be8633f4 = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "product_get_pairs", [], "any", false, false, false, 85)) && is_array($__internal_f607aeef2c31a95a7bf963452dff024ffaeb6aafbe4603f9ca3bec57be8633f4) || $__internal_f607aeef2c31a95a7bf963452dff024ffaeb6aafbe4603f9ca3bec57be8633f4 instanceof ArrayAccess ? ($__internal_f607aeef2c31a95a7bf963452dff024ffaeb6aafbe4603f9ca3bec57be8633f4[twig_get_attribute($this->env, $this->source, ($context["task"] ?? null), "new_value", [], "any", false, false, false, 85)] ?? null) : null), "html", null, true); + echo "
    +
    + "; + // line 95 + if ((twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "status", [], "any", false, false, false, 95) != "closed")) { + // line 96 + echo " extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/support/ticket_close", ["id" => twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "id", [], "any", false, false, false, 96)]); + echo "\" data-api-confirm=\"Are you sure?\" data-api-redirect=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("support", ["status" => "open"]); + echo "\" class=\"btn55 mr10 api-link\" >\"\""; + echo gettext("Close ticket"); + echo " + "; + } + // line 98 + echo " extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/support/ticket_delete", ["id" => twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "id", [], "any", false, false, false, 98)]); + echo "\" data-api-confirm=\"Are you sure?\" data-api-redirect=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("support"); + echo "\" class=\"btn55 mr10 api-link\">\"\""; + echo gettext("Delete"); + echo " + + "; + // line 100 + if ((twig_get_attribute($this->env, $this->source, ($context["task"] ?? null), "status", [], "any", false, false, false, 100) == "pending")) { + // line 101 + echo " extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/support/task_complete", ["id" => twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "id", [], "any", false, false, false, 101)]); + echo "\" class=\"btn55 mr10 api-link\" data-api-reload=\"1\">\"\""; + echo gettext("Set Task complete"); + echo " + "; + } + // line 103 + echo "
    +
    +
    +
    + +
    +
    extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/support/ticket_update"); + echo "\" class=\"mainForm api-form\" data-api-reload=\"1\"> +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "subject", [], "any", false, false, false, 117), "html", null, true); + echo "\" required=\"required\"/> +
    +
    +
    + +
    + +
    + "; + // line 125 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["support_helpdesk_id", twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "support_helpdesk_get_pairs", [], "any", false, false, false, 125), twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "support_helpdesk_id", [], "any", false, false, false, 125), 1], 125, $context, $this->getSourceContext()); + echo " +
    +
    +
    + +
    + +
    + "; + // line 133 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["status", twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "support_ticket_get_statuses", [0 => ["titles" => 1]], "method", false, false, false, 133), twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "status", [], "any", false, false, false, 133), 1], 133, $context, $this->getSourceContext()); + echo " +
    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "priority", [], "any", false, false, false, 141), "html", null, true); + echo "\"/> +
    +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "id", [], "any", false, false, false, 147), "html", null, true); + echo "\"> +
    +
    + +
    + + + "; + // line 154 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "notes", [], "any", false, false, false, 154)); + $context['loop'] = [ + 'parent' => $context['_parent'], + 'index0' => 0, + 'index' => 1, + 'first' => true, + ]; + if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof \Countable)) { + $length = count($context['_seq']); + $context['loop']['revindex0'] = $length - 1; + $context['loop']['revindex'] = $length; + $context['loop']['length'] = $length; + $context['loop']['last'] = 1 === $length; + } + foreach ($context['_seq'] as $context["_key"] => $context["note"]) { + // line 155 + echo " env, $this->source, $context["loop"], "first", [], "any", false, false, false, 155)) { + echo "class=\"noborder\""; + } + echo "> + + + + + "; + ++$context['loop']['index0']; + ++$context['loop']['index']; + $context['loop']['first'] = false; + if (isset($context['loop']['length'])) { + --$context['loop']['revindex0']; + --$context['loop']['revindex']; + $context['loop']['last'] = 0 === $context['loop']['revindex0']; + } + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['_key'], $context['note'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 163 + echo " + + + + +
    "; + // line 156 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["note"], "note", [], "any", false, false, false, 156), "html", null, true); + echo "extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("staff"); + echo "/manage/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["note"], "admin_id", [], "any", false, false, false, 157), "html", null, true); + echo "\">"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["note"], "author", [], "any", false, false, false, 157), "name", [], "any", false, false, false, 157), "html", null, true); + echo " + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/support/note_delete", ["id" => twig_get_attribute($this->env, $this->source, $context["note"], "id", [], "any", false, false, false, 159)]); + echo "\" data-api-confirm=\"Are you sure?\" data-api-reload=\"1\" class=\"bb-button btn14 api-link\">\"\" +
    env, twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "notes", [], "any", false, false, false, 165)) == 0)) { + echo "class=\"noborder\""; + } + echo "> + +
    extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/support/note_create"); + echo "\" class=\"mainForm api-form\" data-api-reload=\"1\"> +
    + + + env, twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "id", [], "any", false, false, false, 171), "html", null, true); + echo "\"> +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + "; + // line 194 + $context["tickets"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "support_ticket_get_list", [0 => ["per_page" => "20", "client_id" => twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "client", [], "any", false, false, false, 194), "id", [], "any", false, false, false, 194)]], "method", false, false, false, 194); + // line 195 + echo " "; + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["tickets"] ?? null), "list", [], "any", false, false, false, 195)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["_key"] => $context["ticket"]) { + // line 196 + echo " + + + + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 204 + echo " + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['_key'], $context['ticket'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 208 + echo " + + + + + + +
    IDSubjectHelp deskStatus 
    "; + // line 197 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["ticket"], "id", [], "any", false, false, false, 197), "html", null, true); + echo ""; + // line 198 + echo twig_escape_filter($this->env, twig_truncate_filter($this->env, twig_get_attribute($this->env, $this->source, $context["ticket"], "subject", [], "any", false, false, false, 198), 30), "html", null, true); + echo ""; + // line 199 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["ticket"], "helpdesk", [], "any", false, false, false, 199), "name", [], "any", false, false, false, 199), "html", null, true); + echo ""; + // line 200 + echo twig_call_macro($macros["mf"], "macro_status_name", [twig_get_attribute($this->env, $this->source, $context["ticket"], "status", [], "any", false, false, false, 200)], 200, $context, $this->getSourceContext()); + echo "extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("/support/ticket"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["ticket"], "id", [], "any", false, false, false, 201), "html", null, true); + echo "\">\"\"
    "; + // line 205 + echo gettext("The list is empty"); + echo "
    + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("support", ["client_id" => twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "id", [], "any", false, false, false, 213)]); + echo "#tab-new\" class=\"btnIconLeft mr10 mt5\" >\"\""; + echo gettext("New support ticket"); + echo " +
    +
    + +
    +
    + +
    +"; + // line 224 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "messages", [], "any", false, false, false, 224)); + $context['loop'] = [ + 'parent' => $context['_parent'], + 'index0' => 0, + 'index' => 1, + 'first' => true, + ]; + if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof \Countable)) { + $length = count($context['_seq']); + $context['loop']['revindex0'] = $length - 1; + $context['loop']['revindex'] = $length; + $context['loop']['length'] = $length; + $context['loop']['last'] = 1 === $length; + } + foreach ($context['_seq'] as $context["i"] => $context["message"]) { + // line 225 + echo "
    env, $this->source, $context["loop"], "last", [], "any", false, false, false, 225)) ? ("last") : ("")); + echo "\" id=\""; + echo (((twig_get_attribute($this->env, $this->source, $context["message"], "id", [], "any", false, false, false, 225) == ($context["request_message"] ?? null))) ? ("direct-msg") : ("")); + echo "\"> +
    +
    env, twig_gravatar_filter(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["message"], "author", [], "any", false, false, false, 227), "email", [], "any", false, false, false, 227)), "html", null, true); + echo "?size=20\" alt=\""; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["message"], "author", [], "any", false, false, false, 227), "name", [], "any", false, false, false, 227), "html", null, true); + echo "\" class=\"gravatar\"/> "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["message"], "author", [], "any", false, false, false, 227), "name", [], "any", false, false, false, 227), "html", null, true); + echo "
    +
    extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("/support/ticket"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "id", [], "any", false, false, false, 228), "html", null, true); + echo "/message/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["message"], "id", [], "any", false, false, false, 228), "html", null, true); + echo "\" style=\"color:inherit\">"; + echo twig_escape_filter($this->env, $this->extensions['Box_TwigExtensions']->twig_bb_datetime(twig_get_attribute($this->env, $this->source, $context["message"], "created_at", [], "any", false, false, false, 228)), "html", null, true); + echo "
    +
    + +
    env, $this->source, $context["loop"], "last", [], "any", false, false, false, 231) || ((twig_get_attribute($this->env, $this->source, $context["loop"], "index", [], "any", false, false, false, 231) + 1) == twig_length_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "messages", [], "any", false, false, false, 231))))) ? ("block") : ("none")); + echo ";\"> + "; + // line 232 + echo twig_bbmd_filter($this->env, twig_get_attribute($this->env, $this->source, $context["message"], "content", [], "any", false, false, false, 232)); + echo " +
    +
    +
    +"; + ++$context['loop']['index0']; + ++$context['loop']['index']; + $context['loop']['first'] = false; + if (isset($context['loop']['length'])) { + --$context['loop']['revindex0']; + --$context['loop']['revindex']; + $context['loop']['last'] = 0 === $context['loop']['revindex0']; + } + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['i'], $context['message'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 237 + echo "
    + + +
    +
    +
    "; + // line 242 + echo gettext("Reply as"); + echo " "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "name", [], "any", false, false, false, 242), "html", null, true); + echo "
    + "; + // line 243 + $this->loadTemplate("mod_support_canned_selector.phtml", "mod_support_ticket.phtml", 243)->display($context); + // line 244 + echo "
    + +
    extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/support/ticket_reply"); + echo "\" class=\"mainForm api-form\" data-api-redirect=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("support", ["status" => "open"]); + echo "\"> +
    + + env, twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "id", [], "any", false, false, false, 255), "html", null, true); + echo "\"> + + + +
    + "; + // line 260 + echo gettext("Show/Hide messages"); + echo " + + "; + // line 262 + if (((twig_length_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "messages", [], "any", false, false, false, 262)) > 2) && (twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "status", [], "any", false, false, false, 262) != "closed"))) { + // line 263 + echo " extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/support/ticket_close", ["id" => twig_get_attribute($this->env, $this->source, ($context["ticket"] ?? null), "id", [], "any", false, false, false, 263)]); + echo "\" data-api-confirm=\"Are you sure?\" data-api-redirect=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("support", ["status" => "open"]); + echo "\" class=\"btnIconLeft mr10 api-link\" >"; + echo gettext("Close ticket"); + echo " + "; + } + // line 265 + echo "
    +
    +
    + +
    +
    + +"; + } + + // line 274 + public function block_js($context, array $blocks = []) + { + $macros = $this->macros; + // line 275 + echo " +"; + } + + // line 330 + public function block_head($context, array $blocks = []) + { + $macros = $this->macros; + echo twig_call_macro($macros["mf"], "macro_bb_editor", [".bb-textarea"], 330, $context, $this->getSourceContext()); + } + + public function getTemplateName() + { + return "mod_support_ticket.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 806 => 330, 774 => 301, 767 => 297, 743 => 275, 739 => 274, 728 => 265, 718 => 263, 716 => 262, 711 => 260, 704 => 256, 700 => 255, 696 => 254, 692 => 253, 685 => 249, 681 => 248, 674 => 246, 670 => 244, 668 => 243, 662 => 242, 655 => 237, 636 => 232, 632 => 231, 620 => 228, 612 => 227, 604 => 225, 587 => 224, 571 => 213, 564 => 208, 555 => 205, 552 => 204, 542 => 201, 538 => 200, 534 => 199, 530 => 198, 526 => 197, 523 => 196, 517 => 195, 515 => 194, 489 => 171, 485 => 170, 479 => 167, 472 => 165, 468 => 163, 450 => 159, 441 => 157, 437 => 156, 430 => 155, 413 => 154, 403 => 147, 398 => 145, 391 => 141, 386 => 139, 377 => 133, 372 => 131, 363 => 125, 358 => 123, 349 => 117, 344 => 115, 338 => 112, 327 => 103, 319 => 101, 317 => 100, 307 => 98, 297 => 96, 295 => 95, 286 => 88, 276 => 85, 272 => 84, 269 => 83, 267 => 82, 264 => 81, 254 => 78, 250 => 77, 247 => 76, 245 => 75, 242 => 74, 236 => 71, 232 => 70, 229 => 69, 227 => 68, 224 => 67, 222 => 66, 214 => 61, 210 => 60, 204 => 56, 189 => 54, 185 => 53, 180 => 51, 172 => 46, 167 => 44, 152 => 40, 148 => 39, 141 => 35, 137 => 34, 125 => 25, 117 => 24, 113 => 23, 109 => 22, 102 => 18, 97 => 15, 93 => 14, 84 => 9, 78 => 8, 72 => 7, 69 => 6, 65 => 5, 54 => 3, 50 => 1, 48 => 13, 46 => 2, 39 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends request.ajax ? \"layout_blank.phtml\" : \"layout_default.phtml\" %} +{% import \"macro_functions.phtml\" as mf %} +{% block meta_title %}{{ticket.subject}} - {{ ticket.messages|length }} {% trans 'message(s)' %}{% endblock %} + +{% block breadcrumbs %} + +{% endblock %} + +{% set active_menu = 'support' %} +{% block content %} + +
    +
    +
    {{ ticket.subject }}
    +
    + + + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {% set task = ticket.rel %} + + {% if task.task %} + + + + + {% endif %} + + {% if task.type == 'order' %} + + + + + {% endif %} + + {% if task.task == 'upgrade' %} + + + + + {% endif %} + + + + + + + + +
    {% trans 'Ticket ID' %}#{{ticket.id}}
    {% trans 'Client' %}#{{ticket.client.id}} {{ticket.client.first_name}} {{ticket.client.last_name}}
    {% trans 'Help desk' %} + {{ mf.selectbox('support_helpdesk_id', admin.support_helpdesk_get_pairs, ticket.support_helpdesk_id, 1) }} +
    {% trans 'Status' %} + {% for tcode,tstatus in admin.support_ticket_get_statuses({\"titles\":1}) %} + + {% endfor %} +
    {% trans 'Time opened' %}{{ticket.created_at|date('l, d F Y')}}
    {{ mf.status_name(task.task) }}
    Order #{{ task.id }}
    {{ admin.product_get_pairs[task.new_value] }}
    +
    + {% if ticket.status != 'closed' %} + \"\"{% trans 'Close ticket' %} + {% endif %} + \"\"{% trans 'Delete' %} + + {% if task.status == 'pending' %} + \"\"{% trans 'Set Task complete' %} + {% endif %} +
    +
    +
    +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    + {{ mf.selectbox('support_helpdesk_id', admin.support_helpdesk_get_pairs, ticket.support_helpdesk_id, 1) }} +
    +
    +
    + +
    + +
    + {{ mf.selectbox('status', admin.support_ticket_get_statuses({\"titles\":1}), ticket.status, 1) }} +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    + +
    + + + {% for note in ticket.notes %} + + + + + + {% endfor %} + + + + + +
    {{ note.note }}{{ note.author.name }} + \"\" +
    + +
    +
    + + + +
    +
    + +
    +
    + +
    + + + + + + + + + + + + + {% set tickets = admin.support_ticket_get_list({\"per_page\":\"20\", \"client_id\":ticket.client.id}) %} + {% for ticket in tickets.list %} + + + + + + + + {% else %} + + + + {% endfor %} + + + + + + + +
    IDSubjectHelp deskStatus 
    {{ ticket.id }}{{ ticket.subject|truncate(30) }}{{ ticket.helpdesk.name }}{{ mf.status_name(ticket.status) }}\"\"
    {% trans 'The list is empty' %}
    + \"\"{% trans 'New support ticket' %} +
    +
    + +
    +
    + +
    +{% for i, message in ticket.messages %} +
    +
    +
    \"{{ {{ message.author.name }}
    +
    {{ message.created_at|bb_datetime }}
    +
    + +
    + {{ message.content|bbmd }} +
    +
    +
    +{% endfor %} +
    + + +
    +
    +
    {% trans 'Reply as' %} {{ profile.name }}
    + {% include 'mod_support_canned_selector.phtml' %} +
    + +
    +
    + + + + + +
    + {% trans 'Show/Hide messages' %} + + {% if ticket.messages|length > 2 and ticket.status != 'closed' %} + {% trans 'Close ticket' %} + {% endif %} +
    +
    +
    + +
    +
    + +{% endblock %} + +{% block js%} + +{% endblock %} + +{% block head %}{{ mf.bb_editor('.bb-textarea') }}{% endblock %}", "mod_support_ticket.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-themes/admin_default/html/mod_support_ticket.phtml"); + } +} diff --git a/bb-data/cache/35/35d2c60674efdd23363eac6f083d58c83fff068b984e4e7141870c7502a24bd7.php b/bb-data/cache/35/35d2c60674efdd23363eac6f083d58c83fff068b984e4e7141870c7502a24bd7.php new file mode 100644 index 000000000..76b9f44e3 --- /dev/null +++ b/bb-data/cache/35/35d2c60674efdd23363eac6f083d58c83fff068b984e4e7141870c7502a24bd7.php @@ -0,0 +1,573 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'top_content' => [$this, 'block_top_content'], + 'content' => [$this, 'block_content'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return $this->loadTemplate(((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "ajax", [], "any", false, false, false, 1)) ? ("layout_blank.phtml") : ("layout_default.phtml")), "mod_invoice_transactions.phtml", 1); + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 2 + $macros["mf"] = $this->macros["mf"] = $this->loadTemplate("macro_functions.phtml", "mod_invoice_transactions.phtml", 2)->unwrap(); + // line 4 + $context["active_menu"] = "invoice"; + // line 1 + $this->getParent($context)->display($context, array_merge($this->blocks, $blocks)); + } + + // line 3 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("Transactions"); + } + + // line 7 + public function block_top_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 8 + if (twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "show_filter", [], "any", false, false, false, 8)) { + // line 9 + echo "
    +
    "; + // line 10 + echo gettext("Filter transactions"); + echo "
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "_url", [], "any", false, false, false, 14), "html", null, true); + echo "\" /> +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "id", [], "any", false, false, false, 19), "html", null, true); + echo "\"> +
    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "txn_id", [], "any", false, false, false, 27), "html", null, true); + echo "\"> +
    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "invoice_id", [], "any", false, false, false, 35), "html", null, true); + echo "\"> +
    +
    +
    + +
    + +
    + "; + // line 43 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["currency", twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "currency_get_pairs", [], "any", false, false, false, 43), twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "currency", [], "any", false, false, false, 43), 0, "All currencies"], 43, $context, $this->getSourceContext()); + echo " +
    +
    +
    + +
    + +
    + "; + // line 51 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["status", twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "invoice_transaction_get_statuses_pairs", [], "any", false, false, false, 51), twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "status", [], "any", false, false, false, 51), 0, "All statuses"], 51, $context, $this->getSourceContext()); + echo " +
    +
    +
    + +
    + +
    + "; + // line 59 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["gateway_id", twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "invoice_gateway_get_pairs", [], "any", false, false, false, 59), twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "gateway_id", [], "any", false, false, false, 59), 0, "All payment gateways"], 59, $context, $this->getSourceContext()); + echo " +
    +
    +
    + +
    + +
    +
      +
    • env, $this->source, ($context["request"] ?? null), "date_from", [], "any", false, false, false, 68)) { + echo twig_escape_filter($this->env, twig_date_format_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "date_from", [], "any", false, false, false, 68), "Y-m-d"), "html", null, true); + } + echo "\" placeholder=\""; + echo twig_escape_filter($this->env, twig_date_format_filter($this->env, ($context["now"] ?? null), "Y-m-d"), "html", null, true); + echo "\" class=\"datepicker\"/>
    • +
    • -
    • +
    • env, $this->source, ($context["request"] ?? null), "date_to", [], "any", false, false, false, 70)) { + echo twig_escape_filter($this->env, twig_date_format_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "date_to", [], "any", false, false, false, 70), "Y-m-d"), "html", null, true); + } + echo "\" placeholder=\""; + echo twig_escape_filter($this->env, twig_date_format_filter($this->env, ($context["now"] ?? null), "Y-m-d"), "html", null, true); + echo "\" class=\"datepicker\"/>
    • +
    +
    +
    +
    + + + +
    +
    +
    +
    +
    +"; + } else { + // line 84 + $context["statuses"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "invoice_transaction_get_statuses", [], "any", false, false, false, 84); + // line 85 + echo "
    + +
    +
    +"; + } + // line 95 + echo " +"; + } + + // line 98 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 99 + echo " +
    +
    "; + // line 101 + echo gettext("Transactions"); + echo "
    + + "; + // line 103 + echo twig_call_macro($macros["mf"], "macro_table_search", [], 103, $context, $this->getSourceContext()); + echo " + + + + + + + + + + + + + + + + "; + // line 119 + $context["transactions"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "invoice_transaction_get_list", [0 => twig_array_merge(["per_page" => 30, "page" => twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "page", [], "any", false, false, false, 119)], ($context["request"] ?? null))], "method", false, false, false, 119); + // line 120 + echo " "; + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["transactions"] ?? null), "list", [], "any", false, false, false, 120)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["i"] => $context["tx"]) { + // line 121 + echo " + + + + + + + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 136 + echo " + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['i'], $context['tx'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 142 + echo " +
    "; + // line 108 + echo gettext("Invoice"); + echo ""; + // line 109 + echo gettext("Type"); + echo ""; + // line 110 + echo gettext("Status"); + echo ""; + // line 111 + echo gettext("Gateway"); + echo ""; + // line 112 + echo gettext("Amount"); + echo ""; + // line 113 + echo gettext("Date"); + echo " 
    env, twig_get_attribute($this->env, $this->source, $context["tx"], "id", [], "any", false, false, false, 122), "html", null, true); + echo "\"/>"; + // line 123 + if (twig_get_attribute($this->env, $this->source, $context["tx"], "invoice_id", [], "any", false, false, false, 123)) { + echo "extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("invoice/manage"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["tx"], "invoice_id", [], "any", false, false, false, 123), "html", null, true); + echo "\">#"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["tx"], "invoice_id", [], "any", false, false, false, 123), "html", null, true); + echo ""; + } else { + echo "n/a"; + } + echo ""; + // line 124 + echo twig_call_macro($macros["mf"], "macro_status_name", [((twig_get_attribute($this->env, $this->source, $context["tx"], "type", [], "any", true, true, false, 124)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, $context["tx"], "type", [], "any", false, false, false, 124), "-")) : ("-"))], 124, $context, $this->getSourceContext()); + echo ""; + // line 125 + if (twig_get_attribute($this->env, $this->source, $context["tx"], "error", [], "any", false, false, false, 125)) { + echo "env, twig_get_attribute($this->env, $this->source, $context["tx"], "error", [], "any", false, false, false, 125), "html", null, true); + echo "','"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["tx"], "error_code", [], "any", false, false, false, 125), "html", null, true); + echo "'); return false;\">"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["tx"], "error_code", [], "any", false, false, false, 125), "html", null, true); + echo ""; + } else { + echo twig_call_macro($macros["mf"], "macro_status_name", [twig_get_attribute($this->env, $this->source, $context["tx"], "status", [], "any", false, false, false, 125)], 125, $context, $this->getSourceContext()); + } + echo ""; + // line 126 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["tx"], "gateway", [], "any", false, false, false, 126), "html", null, true); + echo ""; + // line 127 + echo twig_call_macro($macros["mf"], "macro_currency_format", [twig_get_attribute($this->env, $this->source, $context["tx"], "amount", [], "any", false, false, false, 127), twig_get_attribute($this->env, $this->source, $context["tx"], "currency", [], "any", false, false, false, 127)], 127, $context, $this->getSourceContext()); + echo ""; + // line 128 + echo twig_escape_filter($this->env, twig_date_format_filter($this->env, twig_get_attribute($this->env, $this->source, $context["tx"], "created_at", [], "any", false, false, false, 128), "Y-m-d H:i"), "html", null, true); + echo " + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("invoice/transaction"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["tx"], "id", [], "any", false, false, false, 130), "html", null, true); + echo "\">\"\" + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/invoice/transaction_process", ["id" => twig_get_attribute($this->env, $this->source, $context["tx"], "id", [], "any", false, false, false, 131)]); + echo "\" data-api-msg=\"Processed\" title=\"Process again\">\"\" + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/invoice/transaction_delete", ["id" => twig_get_attribute($this->env, $this->source, $context["tx"], "id", [], "any", false, false, false, 132)]); + echo "\" data-api-confirm=\"Are you sure?\" data-api-reload=\"1\">\"\" +
    + "; + // line 138 + echo gettext("The list is empty"); + // line 139 + echo "
    + + +
    +"; + // line 147 + $this->loadTemplate("partial_batch_delete.phtml", "mod_invoice_transactions.phtml", 147)->display(twig_array_merge($context, ["action" => "admin/invoice/batch_delete_transaction"])); + // line 148 + $this->loadTemplate("partial_pagination.phtml", "mod_invoice_transactions.phtml", 148)->display(twig_array_merge($context, ["list" => ($context["transactions"] ?? null), "url" => "invoice/transactions"])); + } + + public function getTemplateName() + { + return "mod_invoice_transactions.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 403 => 148, 401 => 147, 394 => 142, 386 => 139, 384 => 138, 380 => 136, 371 => 132, 367 => 131, 361 => 130, 356 => 128, 352 => 127, 348 => 126, 334 => 125, 330 => 124, 316 => 123, 312 => 122, 309 => 121, 303 => 120, 301 => 119, 292 => 113, 288 => 112, 284 => 111, 280 => 110, 276 => 109, 272 => 108, 264 => 103, 259 => 101, 255 => 99, 251 => 98, 246 => 95, 234 => 90, 226 => 89, 218 => 88, 210 => 87, 206 => 85, 204 => 84, 194 => 77, 180 => 70, 171 => 68, 165 => 65, 156 => 59, 151 => 57, 142 => 51, 137 => 49, 128 => 43, 123 => 41, 114 => 35, 109 => 33, 100 => 27, 95 => 25, 86 => 19, 81 => 17, 75 => 14, 68 => 10, 65 => 9, 63 => 8, 59 => 7, 52 => 3, 48 => 1, 46 => 4, 44 => 2, 37 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends request.ajax ? \"layout_blank.phtml\" : \"layout_default.phtml\" %} +{% import \"macro_functions.phtml\" as mf %} +{% block meta_title %}{% trans 'Transactions' %}{% endblock %} +{% set active_menu = 'invoice' %} + + +{% block top_content %} +{% if request.show_filter %} +
    +
    {% trans 'Filter transactions' %}
    +
    + +
    + +
    +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + {{ mf.selectbox('currency', guest.currency_get_pairs, request.currency, 0, 'All currencies') }} +
    +
    +
    + +
    + +
    + {{ mf.selectbox('status', admin.invoice_transaction_get_statuses_pairs, request.status, 0, 'All statuses') }} +
    +
    +
    + +
    + +
    + {{ mf.selectbox('gateway_id', admin.invoice_gateway_get_pairs, request.gateway_id, 0, 'All payment gateways') }} +
    +
    +
    + +
    + +
    +
      +
    • +
    • -
    • +
    • +
    +
    +
    +
    + + + +
    +
    +
    +
    +
    +{% else %} +{% set statuses = admin.invoice_transaction_get_statuses %} +
    + +
    +
    +{% endif %} + +{% endblock %} + +{% block content %} + +
    +
    {% trans 'Transactions' %}
    + + {{ mf.table_search }} + + + + + + + + + + + + + + + + {% set transactions = admin.invoice_transaction_get_list({\"per_page\":30, \"page\":request.page}|merge(request)) %} + {% for i, tx in transactions.list %} + + + + + + + + + + + {% else %} + + + + {% endfor %} + +
    {% trans 'Invoice' %}{% trans 'Type' %}{% trans 'Status' %}{% trans 'Gateway' %}{% trans 'Amount' %}{% trans 'Date' %} 
    {% if tx.invoice_id %}#{{ tx.invoice_id }}{%else%}n/a{% endif %}{{mf.status_name(tx.type|default('-')) }}{% if tx.error %}{{ tx.error_code }}{% else %}{{mf.status_name(tx.status) }}{% endif %}{{tx.gateway}}{{ mf.currency_format( tx.amount, tx.currency) }}{{tx.created_at|date('Y-m-d H:i')}} + \"\" + \"\" + \"\" +
    + {% trans 'The list is empty' %} +
    + + +
    +{% include \"partial_batch_delete.phtml\" with {'action':'admin/invoice/batch_delete_transaction'} %} +{% include \"partial_pagination.phtml\" with {'list': transactions, 'url':'invoice/transactions'} %} +{% endblock %}", "mod_invoice_transactions.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-themes/admin_default/html/mod_invoice_transactions.phtml"); + } +} diff --git a/bb-data/cache/37/375d39a6e7ada9d707a53d666e2f41122496a40bb88c8ca1767ef7c1f3a4506d.php b/bb-data/cache/37/375d39a6e7ada9d707a53d666e2f41122496a40bb88c8ca1767ef7c1f3a4506d.php new file mode 100644 index 000000000..db0d6d448 --- /dev/null +++ b/bb-data/cache/37/375d39a6e7ada9d707a53d666e2f41122496a40bb88c8ca1767ef7c1f3a4506d.php @@ -0,0 +1,63 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 1 + echo "["; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["guest"] ?? null), "system_company", [], "any", false, false, false, 1), "name", [], "any", false, false, false, 1), "html", null, true); + echo "] "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["order"] ?? null), "title", [], "any", false, false, false, 1), "html", null, true); + echo " Activated"; + } + + public function getTemplateName() + { + return "__string_template__e0b4a447ea77919c587fd7446d546131270bebd3aa2d3890259ac52bf591721d"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 37 => 1,); + } + + public function getSourceContext() + { + return new Source("[{{ guest.system_company.name }}] {{ order.title }} Activated", "__string_template__e0b4a447ea77919c587fd7446d546131270bebd3aa2d3890259ac52bf591721d", ""); + } +} diff --git a/bb-data/cache/3d/3d8f64578c1a35973108ced2f72a250a49686c8295c175b7b53488ccfcb4c816.php b/bb-data/cache/3d/3d8f64578c1a35973108ced2f72a250a49686c8295c175b7b53488ccfcb4c816.php new file mode 100644 index 000000000..2147a43ff --- /dev/null +++ b/bb-data/cache/3d/3d8f64578c1a35973108ced2f72a250a49686c8295c175b7b53488ccfcb4c816.php @@ -0,0 +1,883 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'page_header' => [$this, 'block_page_header'], + 'breadcrumb' => [$this, 'block_breadcrumb'], + 'content' => [$this, 'block_content'], + 'js' => [$this, 'block_js'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return $this->loadTemplate(((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "ajax", [], "any", false, false, false, 1)) ? ("layout_blank.phtml") : ("layout_default.phtml")), "mod_client_profile.phtml", 1); + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + $this->getParent($context)->display($context, array_merge($this->blocks, $blocks)); + } + + // line 3 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("Profile details"); + } + + // line 4 + public function block_page_header($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("User profile settings"); + } + + // line 5 + public function block_breadcrumb($context, array $blocks = []) + { + $macros = $this->macros; + echo "
  • "; + echo gettext("Profile"); + echo "
  • "; + } + + // line 7 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 8 + echo " +
    + +
    +
    + +
    + +
    + + +
    + + +
    + +
    +
    +

    "; + // line 31 + echo gettext("Update details"); + echo "

    +

    "; + // line 32 + echo gettext("Keep your personal data up to date."); + echo "

    +
    +
    +
    +
    +
    +
    env, twig_gravatar_filter(twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "email", [], "any", false, false, false, 38)), "html", null, true); + echo "\" alt=\"Gravatar\">
    +
    "; + // line 39 + echo gettext("Please register with"); + echo " "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "email", [], "any", false, false, false, 39), "html", null, true); + echo " "; + echo gettext("at "); + echo "Gravatar.com "; + echo gettext("to change your profile image. Gravatar image updates may not appear immediately."); + echo "
    +
    +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "email", [], "any", false, false, false, 45), "html", null, true); + echo "\" required=\"required\"> +

    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "first_name", [], "any", false, false, false, 53), "html", null, true); + echo "\" required=\"required\"> +

    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "last_name", [], "any", false, false, false, 61), "html", null, true); + echo "\" required=\"required\"> +

    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "birthday", [], "any", false, false, false, 69), "html", null, true); + echo "\" > +

    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "company", [], "any", false, false, false, 77), "html", null, true); + echo "\"> +

    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "company_vat", [], "any", false, false, false, 85), "html", null, true); + echo "\"> +

    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "company_number", [], "any", false, false, false, 93), "html", null, true); + echo "\"> +

    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "phone_cc", [], "any", false, false, false, 101), "html", null, true); + echo "\" required=\"required\"> +

    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "phone", [], "any", false, false, false, 109), "html", null, true); + echo "\" required=\"required\"> +

    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "address_1", [], "any", false, false, false, 117), "html", null, true); + echo "\" required=\"required\"> +

    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "address_2", [], "any", false, false, false, 125), "html", null, true); + echo "\"> +

    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "city", [], "any", false, false, false, 133), "html", null, true); + echo "\" required=\"required\"> +

    +
    +
    + +
    + +
    + +

    +
    +
    + +
    + +
    + "; + // line 155 + echo " env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "state", [], "any", false, false, false, 155), "html", null, true); + echo "\" /> +

    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "postcode", [], "any", false, false, false, 163), "html", null, true); + echo "\" required=\"required\"> +

    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "document_nr", [], "any", false, false, false, 171), "html", null, true); + echo "\" > +

    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +

    "; + // line 184 + echo gettext("New password"); + echo "

    +

    "; + // line 185 + echo gettext("Please enter new password two times in order avoid mistypes"); + echo "

    +
    +
    +
    +
    + +
    + +

    +
    +
    + +
    + +
    + +

    +
    +
    +
    + +
    +
    +
    +
    +

    "; + // line 210 + echo gettext("API key"); + echo "

    +

    "; + // line 211 + echo gettext("API key allows integration with external applications. You will need this key for authentication."); + echo "

    +
    +
    +
    +
    +

    "; + // line 216 + echo gettext("Warning! Resetting the key will break existing applications using it!"); + echo "

    +
    +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "profile_api_key_get", [], "any", false, false, false, 221), "html", null, true); + echo "\" class=\"input-xlarge\" id=\"api-key\"> +
    +
    + +
    +
    +
    +
    +
    +

    "; + // line 230 + echo gettext("Currency"); + echo "

    +

    "; + // line 231 + echo gettext("Your profile currency is defined after your first order. Once your currency is set, all your profile accounting will be managed in that currency and can not be changed."); + echo "

    +
    + "; + // line 233 + if (twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "currency", [], "any", false, false, false, 233)) { + // line 234 + echo "

    "; + echo gettext("Your profile currency is"); + echo " "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "currency", [], "any", false, false, false, 234), "html", null, true); + echo "

    +

    "; + // line 235 + echo gettext("Create new client profile if you want to manage your money in other currency"); + echo "

    + "; + } + // line 237 + echo " +
    +
    +
    + +
    + +
    +
    +
    + +
    + +"; + } + + // line 253 + public function block_js($context, array $blocks = []) + { + $macros = $this->macros; + // line 254 + echo " +"; + } + + public function getTemplateName() + { + return "mod_client_profile.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 526 => 254, 522 => 253, 505 => 237, 500 => 235, 493 => 234, 491 => 233, 486 => 231, 482 => 230, 473 => 224, 467 => 221, 462 => 219, 456 => 216, 448 => 211, 444 => 210, 436 => 205, 426 => 198, 415 => 190, 407 => 185, 403 => 184, 393 => 177, 384 => 171, 379 => 169, 370 => 163, 365 => 161, 355 => 155, 350 => 152, 342 => 146, 325 => 144, 321 => 143, 317 => 142, 311 => 139, 302 => 133, 297 => 131, 288 => 125, 283 => 123, 274 => 117, 269 => 115, 260 => 109, 255 => 107, 246 => 101, 241 => 99, 232 => 93, 227 => 91, 218 => 85, 213 => 83, 204 => 77, 199 => 75, 190 => 69, 185 => 67, 176 => 61, 171 => 59, 162 => 53, 157 => 51, 148 => 45, 143 => 43, 130 => 39, 126 => 38, 117 => 32, 113 => 31, 103 => 24, 99 => 23, 95 => 22, 91 => 21, 76 => 8, 72 => 7, 63 => 5, 56 => 4, 49 => 3, 39 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends request.ajax ? \"layout_blank.phtml\" : \"layout_default.phtml\" %} + +{% block meta_title %}{% trans 'Profile details' %}{% endblock %} +{% block page_header %}{% trans 'User profile settings' %}{% endblock %} +{% block breadcrumb %}
  • {% trans 'Profile' %}
  • {% endblock %} + +{% block content %} + +
    + +
    +
    + +
    + +
    + + +
    + + +
    + +
    +
    +

    {% trans 'Update details' %}

    +

    {% trans 'Keep your personal data up to date.' %}

    +
    +
    +
    +
    +
    +
    \"Gravatar\"
    +
    {% trans 'Please register with'%} {{ profile.email }} {% trans 'at ' %}Gravatar.com {% trans 'to change your profile image. Gravatar image updates may not appear immediately.' %}
    +
    +
    +
    + +
    + +

    +
    +
    + +
    + +
    + +

    +
    +
    + +
    + +
    + +

    +
    +
    + +
    + +
    + +

    +
    +
    + +
    + +
    + +

    +
    +
    + +
    + +
    + +

    +
    +
    + +
    + +
    + +

    +
    +
    + +
    + +
    + +

    +
    +
    + +
    + +
    + +

    +
    +
    + +
    + +
    + +

    +
    +
    + +
    + +
    + +

    +
    +
    + +
    + +
    + +

    +
    +
    + +
    + +
    + +

    +
    +
    + +
    + +
    + {# mf.selectbox('state', guest.system_states, profile.state, 0, 'Select state') #} + +

    +
    +
    + +
    + +
    + +

    +
    +
    + +
    + +
    + +

    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +

    {% trans 'New password' %}

    +

    {% trans 'Please enter new password two times in order avoid mistypes' %}

    +
    +
    +
    +
    + +
    + +

    +
    +
    + +
    + +
    + +

    +
    +
    +
    + +
    +
    +
    +
    +

    {% trans 'API key' %}

    +

    {% trans 'API key allows integration with external applications. You will need this key for authentication.' %}

    +
    +
    +
    +
    +

    {% trans 'Warning! Resetting the key will break existing applications using it!' %}

    +
    +
    + +
    + +
    +
    + +
    +
    +
    +
    +
    +

    {% trans 'Currency' %}

    +

    {% trans 'Your profile currency is defined after your first order. Once your currency is set, all your profile accounting will be managed in that currency and can not be changed.' %}

    +
    + {% if profile.currency %} +

    {% trans 'Your profile currency is' %} {{ profile.currency }}

    +

    {% trans 'Create new client profile if you want to manage your money in other currency' %}

    + {% endif %} + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +{% endblock %} + + +{% block js %} + +{% endblock %}", "mod_client_profile.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-modules/Client/html_client/mod_client_profile.phtml"); + } +} diff --git a/bb-data/cache/3e/3e1dfd2188cc5c64d4da4a969ddf94ff0b2abab7c08a05e8ae59910bc466a6e3.php b/bb-data/cache/3e/3e1dfd2188cc5c64d4da4a969ddf94ff0b2abab7c08a05e8ae59910bc466a6e3.php new file mode 100644 index 000000000..6547c3446 --- /dev/null +++ b/bb-data/cache/3e/3e1dfd2188cc5c64d4da4a969ddf94ff0b2abab7c08a05e8ae59910bc466a6e3.php @@ -0,0 +1,898 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'content' => [$this, 'block_content'], + 'js' => [$this, 'block_js'], + ]; + } + + protected function doGetParent(array $context) + { + // line 2 + return "layout_default.phtml"; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 1 + $macros["mf"] = $this->macros["mf"] = $this->loadTemplate("macro_functions.phtml", "mod_servicehosting_index.phtml", 1)->unwrap(); + // line 4 + $context["active_menu"] = "system"; + // line 2 + $this->parent = $this->loadTemplate("layout_default.phtml", "mod_servicehosting_index.phtml", 2); + $this->parent->display($context, array_merge($this->blocks, $blocks)); + } + + // line 3 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("Hosting plans and servers"); + } + + // line 6 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 7 + echo "
    + + + +
    +
    +
    + +
    +
    "; + // line 20 + echo gettext("Servers"); + echo "
    +
    + + + + + + + + + + + + + "; + // line 34 + $context["servers"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "servicehosting_server_get_list", [0 => ["per_page" => 100]], "method", false, false, false, 34); + // line 35 + echo " "; + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["servers"] ?? null), "list", [], "any", false, false, false, 35)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["_key"] => $context["server"]) { + // line 36 + echo " + + + + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 49 + echo " + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['_key'], $context['server'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 53 + echo " + + + + + +
    "; + // line 26 + echo gettext("Name"); + echo ""; + // line 27 + echo gettext("IP"); + echo ""; + // line 28 + echo gettext("Server manager"); + echo ""; + // line 29 + echo gettext("Active"); + echo " 
    "; + // line 37 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["server"], "name", [], "any", false, false, false, 37), "html", null, true); + echo ""; + // line 38 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["server"], "ip", [], "any", false, false, false, 38), "html", null, true); + echo ""; + // line 39 + echo twig_call_macro($macros["mf"], "macro_status_name", [twig_get_attribute($this->env, $this->source, $context["server"], "manager", [], "any", false, false, false, 39)], 39, $context, $this->getSourceContext()); + echo ""; + // line 40 + echo twig_call_macro($macros["mf"], "macro_q", [twig_get_attribute($this->env, $this->source, $context["server"], "active", [], "any", false, false, false, 40)], 40, $context, $this->getSourceContext()); + echo " + env, twig_get_attribute($this->env, $this->source, $context["server"], "cpanel_url", [], "any", false, false, false, 42), "html", null, true); + echo "\" target=\"_blank\">\"\" + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/servicehosting/server_test_connection", ["id" => twig_get_attribute($this->env, $this->source, $context["server"], "id", [], "any", false, false, false, 43)]); + echo "\" title=\"Test connection\">\"\" + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("/servicehosting/server"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["server"], "id", [], "any", false, false, false, 44), "html", null, true); + echo "\">\"\" + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("servicehosting"); + echo "\" href=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/servicehosting/server_delete", ["id" => twig_get_attribute($this->env, $this->source, $context["server"], "id", [], "any", false, false, false, 45)]); + echo "\">\"\" +
    "; + // line 50 + echo gettext("The list is empty"); + echo "
    + +
    +
    "; + // line 62 + echo gettext("Hosting plans"); + echo "
    +
    + + + + + + + + + + + + + + "; + // line 77 + $context["hps"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "servicehosting_hp_get_list", [0 => ["per_page" => 100]], "method", false, false, false, 77); + // line 78 + echo " "; + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["hps"] ?? null), "list", [], "any", false, false, false, 78)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["_key"] => $context["hp"]) { + // line 79 + echo " + + + + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 90 + echo " + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['_key'], $context['hp'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 94 + echo " +
    "; + // line 68 + echo gettext("Title"); + echo ""; + // line 69 + echo gettext("Addon domains"); + echo ""; + // line 70 + echo gettext("Disk space"); + echo ""; + // line 71 + echo gettext("Bandwidth"); + echo " 
    "; + // line 80 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["hp"], "name", [], "any", false, false, false, 80), "html", null, true); + echo ""; + // line 81 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["hp"], "max_addon", [], "any", false, false, false, 81), "html", null, true); + echo ""; + // line 82 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["hp"], "quota", [], "any", false, false, false, 82), "html", null, true); + echo ""; + // line 83 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["hp"], "bandwidth", [], "any", false, false, false, 83), "html", null, true); + echo " + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("/servicehosting/plan"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["hp"], "id", [], "any", false, false, false, 85), "html", null, true); + echo "\">\"\" + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("servicehosting"); + echo "\" href=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/servicehosting/hp_delete", ["id" => twig_get_attribute($this->env, $this->source, $context["hp"], "id", [], "any", false, false, false, 86)]); + echo "\">\"\" +
    "; + // line 91 + echo gettext("The list is empty"); + echo "
    + + +
    + +
    +
    extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("servicehosting"); + echo "\"> +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    + + +
    +
    +
    +
    + +
    + Nameservers +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + Server manager +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    + + +
    +
    +
    + +
    +
    +
    + +
    +
    +

    "; + // line 228 + echo gettext("Adding new hosting plan"); + echo "

    +

    "; + // line 229 + echo gettext("Depending on server manager used to setup hosting account you may require provide additional parameters in next step. In this step provide basic hosting plan information."); + echo "

    +
    +
    extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/servicehosting/hp_create"); + echo "\" class=\"mainForm api-form\" data-api-jsonp=\"onAfterHostingPlanCreate\"> +
    +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    + + +
    +
    +
    +
    +
    + + + +"; + } + + // line 268 + public function block_js($context, array $blocks = []) + { + $macros = $this->macros; + // line 269 + echo " +"; + } + + public function getTemplateName() + { + return "mod_servicehosting_index.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 595 => 275, 587 => 269, 583 => 268, 569 => 256, 559 => 249, 549 => 242, 540 => 236, 535 => 234, 529 => 231, 524 => 229, 520 => 228, 510 => 221, 503 => 217, 499 => 216, 494 => 214, 483 => 206, 475 => 201, 470 => 199, 461 => 193, 456 => 191, 448 => 185, 437 => 183, 433 => 182, 427 => 179, 415 => 170, 410 => 168, 402 => 163, 397 => 161, 388 => 155, 383 => 153, 374 => 147, 369 => 145, 357 => 136, 353 => 135, 348 => 133, 339 => 127, 334 => 125, 326 => 120, 321 => 118, 313 => 113, 308 => 111, 300 => 106, 295 => 104, 289 => 101, 280 => 94, 271 => 91, 268 => 90, 257 => 86, 251 => 85, 246 => 83, 242 => 82, 238 => 81, 234 => 80, 231 => 79, 225 => 78, 223 => 77, 214 => 71, 210 => 70, 206 => 69, 202 => 68, 193 => 62, 182 => 53, 173 => 50, 170 => 49, 159 => 45, 153 => 44, 149 => 43, 145 => 42, 140 => 40, 136 => 39, 132 => 38, 128 => 37, 125 => 36, 119 => 35, 117 => 34, 109 => 29, 105 => 28, 101 => 27, 97 => 26, 88 => 20, 77 => 12, 73 => 11, 69 => 10, 64 => 7, 60 => 6, 53 => 3, 48 => 2, 46 => 4, 44 => 1, 37 => 2,); + } + + public function getSourceContext() + { + return new Source("{% import \"macro_functions.phtml\" as mf %} +{% extends \"layout_default.phtml\" %} +{% block meta_title %}{% trans 'Hosting plans and servers' %}{% endblock %} +{% set active_menu = 'system' %} + +{% block content %} +
    + + + +
    +
    +
    + +
    +
    {% trans 'Servers' %}
    +
    + + + + + + + + + + + + + {% set servers = admin.servicehosting_server_get_list({\"per_page\":100}) %} + {% for server in servers.list %} + + + + + + + + {% else %} + + + + {% endfor %} + + + + + + +
    {% trans 'Name' %}{% trans 'IP' %}{% trans 'Server manager' %}{% trans 'Active' %} 
    {{server.name}}{{server.ip}}{{ mf.status_name(server.manager) }}{{ mf.q(server.active) }} + \"\" + \"\" + \"\" + \"\" +
    {% trans 'The list is empty' %}
    + +
    +
    {% trans 'Hosting plans' %}
    +
    + + + + + + + + + + + + + + {% set hps = admin.servicehosting_hp_get_list({\"per_page\":100}) %} + {% for hp in hps.list %} + + + + + + + + {% else %} + + + + {% endfor %} + +
    {% trans 'Title' %}{% trans 'Addon domains' %}{% trans 'Disk space' %}{% trans 'Bandwidth' %} 
    {{hp.name}}{{hp.max_addon}}{{hp.quota}}{{hp.bandwidth}} + \"\" + \"\" +
    {% trans 'The list is empty' %}
    + + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    + + +
    +
    +
    +
    + +
    + Nameservers +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + Server manager +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    + + +
    +
    +
    + +
    +
    +
    + +
    +
    +

    {% trans 'Adding new hosting plan' %}

    +

    {% trans 'Depending on server manager used to setup hosting account you may require provide additional parameters in next step. In this step provide basic hosting plan information.' %}

    +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    + + +
    +
    +
    +
    +
    + + + +{% endblock %} + + +{% block js%} + +{% endblock %}", "mod_servicehosting_index.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-themes/admin_default/html/mod_servicehosting_index.phtml"); + } +} diff --git a/bb-data/cache/3e/3e7a5ba789e4968c245f57a3c9eeab9c7a84602235d817c68acf2bb4ddd24f10.php b/bb-data/cache/3e/3e7a5ba789e4968c245f57a3c9eeab9c7a84602235d817c68acf2bb4ddd24f10.php new file mode 100644 index 000000000..b2ddbe83e --- /dev/null +++ b/bb-data/cache/3e/3e7a5ba789e4968c245f57a3c9eeab9c7a84602235d817c68acf2bb4ddd24f10.php @@ -0,0 +1,842 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'page_header' => [$this, 'block_page_header'], + 'breadcrumbs' => [$this, 'block_breadcrumbs'], + 'content' => [$this, 'block_content'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return $this->loadTemplate(((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "ajax", [], "any", false, false, false, 1)) ? ("layout_blank.phtml") : ("layout_default.phtml")), "mod_index_dashboard.phtml", 1); + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 15 + $macros["mf"] = $this->macros["mf"] = $this->loadTemplate("macro_functions.phtml", "mod_index_dashboard.phtml", 15)->unwrap(); + // line 1 + $this->getParent($context)->display($context, array_merge($this->blocks, $blocks)); + } + + // line 3 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("Client Area"); + } + + // line 4 + public function block_page_header($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("Dashboard"); + } + + // line 6 + public function block_breadcrumbs($context, array $blocks = []) + { + $macros = $this->macros; + // line 7 + echo " "; + if ( !twig_get_attribute($this->env, $this->source, ($context["settings"] ?? null), "hide_dashboard_breadcrumb", [], "any", false, false, false, 7)) { + // line 8 + echo " + "; + } + } + + // line 17 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 18 + echo " +"; + // line 19 + if (twig_get_attribute($this->env, $this->source, ($context["settings"] ?? null), "showcase_enabled", [], "any", false, false, false, 19)) { + // line 20 + echo "
    +

    "; + // line 21 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["settings"] ?? null), "showcase_heading", [], "any", false, false, false, 21), "html", null, true); + echo "

    +

    "; + // line 22 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["settings"] ?? null), "showcase_text", [], "any", false, false, false, 22), "html", null, true); + echo "

    +

    env, twig_get_attribute($this->env, $this->source, ($context["settings"] ?? null), "showcase_button_url", [], "any", false, false, false, 23), "html", null, true); + echo "\">"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["settings"] ?? null), "showcase_button_title", [], "any", false, false, false, 23), "html", null, true); + echo "

    +
    +"; + } + // line 26 + echo " +"; + // line 27 + if (($context["client"] ?? null)) { + // line 28 + echo " +"; + // line 29 + $context["tickets"] = twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "support_ticket_get_list", [0 => ["status" => "on_hold"]], "method", false, false, false, 29); + // line 30 + if ((twig_get_attribute($this->env, $this->source, ($context["tickets"] ?? null), "total", [], "any", false, false, false, 30) > 0)) { + // line 31 + echo "
    +
    +
    +
    +

    "; + // line 35 + echo gettext("Tickets waiting your reply"); + echo "

    +
    +
    + + + + + + + + + + + + + "; + // line 50 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["tickets"] ?? null), "list", [], "any", false, false, false, 50)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["i"] => $context["ticket"]) { + // line 51 + echo " + env, twig_cycle([0 => "odd", 1 => "even"], $context["i"]), "html", null, true); + echo "\"> + + + + + + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 62 + echo " + + + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['i'], $context['ticket'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 68 + echo " + +
    "; + // line 41 + echo gettext("Id"); + echo ""; + // line 42 + echo gettext("Subject"); + echo ""; + // line 43 + echo gettext("Help desk"); + echo ""; + // line 44 + echo gettext("Status"); + echo ""; + // line 45 + echo gettext("Submitted"); + echo ""; + // line 46 + echo gettext("Actions"); + echo "
    "; + // line 53 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["ticket"], "id", [], "any", false, false, false, 53), "html", null, true); + echo "extensions['Box_TwigExtensions']->twig_bb_client_link_filter("support/ticket"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["ticket"], "id", [], "any", false, false, false, 54), "html", null, true); + echo "\">"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["ticket"], "subject", [], "any", false, false, false, 54), "html", null, true); + echo ""; + // line 55 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["ticket"], "helpdesk", [], "any", false, false, false, 55), "name", [], "any", false, false, false, 55), "html", null, true); + echo ""; + // line 56 + echo twig_call_macro($macros["mf"], "macro_status_name", [twig_get_attribute($this->env, $this->source, $context["ticket"], "status", [], "any", false, false, false, 56)], 56, $context, $this->getSourceContext()); + echo ""; + // line 57 + echo twig_escape_filter($this->env, $this->extensions['Box_TwigExtensions']->twig_bb_date(twig_get_attribute($this->env, $this->source, $context["ticket"], "created_at", [], "any", false, false, false, 57)), "html", null, true); + echo "extensions['Box_TwigExtensions']->twig_bb_client_link_filter("support/ticket"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["ticket"], "id", [], "any", false, false, false, 58), "html", null, true); + echo "\" class=\"btn btn-small btn-inverse\">"; + echo gettext("Reply"); + echo "
    "; + // line 64 + echo gettext("The list is empty"); + echo "
    +
    +
    +
    +
    +"; + } + // line 76 + echo " +
    +"; + // line 78 + $context["profile"] = twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "client_get", [], "any", false, false, false, 78); + // line 79 + echo "
    +
    +
    +

    "; + // line 82 + echo gettext("Profile"); + echo "

    + +
    +
    +
    +
    "; + // line 91 + echo gettext("ID"); + echo "
    +
    #"; + // line 92 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "id", [], "any", false, false, false, 92), "html", null, true); + echo "
    +
    "; + // line 93 + echo gettext("Email"); + echo "
    +
    "; + // line 94 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "email", [], "any", false, false, false, 94), "html", null, true); + echo "
    +
    "; + // line 95 + echo gettext("Balance"); + echo "
    +
    "; + // line 96 + echo twig_money($this->env, twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "balance", [], "any", false, false, false, 96), twig_get_attribute($this->env, $this->source, ($context["profile"] ?? null), "currency", [], "any", false, false, false, 96)); + echo "
    +
    +
    +
    +
    + +
    +
    +
    +

    "; + // line 105 + echo gettext("Invoices"); + echo "

    + +
    +
    +
    +
    "; + // line 114 + echo gettext("Total"); + echo "
    +
    "; + // line 115 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "invoice_get_list", [], "method", false, false, false, 115), "total", [], "any", false, false, false, 115), "html", null, true); + echo "
    +
    "; + // line 116 + echo gettext("Paid"); + echo "
    +
    "; + // line 117 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "invoice_get_list", [0 => ["status" => "paid"]], "method", false, false, false, 117), "total", [], "any", false, false, false, 117), "html", null, true); + echo "
    +
    "; + // line 118 + echo gettext("Unpaid"); + echo "
    +
    "; + // line 119 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "invoice_get_list", [0 => ["status" => "unpaid"]], "method", false, false, false, 119), "total", [], "any", false, false, false, 119), "html", null, true); + echo "
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +

    "; + // line 131 + echo gettext("Orders"); + echo "

    + +
    +
    +
    +
    "; + // line 141 + echo gettext("Total"); + echo "
    +
    "; + // line 142 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "order_get_list", [0 => ["hide_addons" => 1]], "method", false, false, false, 142), "total", [], "any", false, false, false, 142), "html", null, true); + echo "
    +
    "; + // line 143 + echo gettext("Active"); + echo "
    +
    "; + // line 144 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "order_get_list", [0 => ["hide_addons" => 1, "status" => "active"]], "method", false, false, false, 144), "total", [], "any", false, false, false, 144), "html", null, true); + echo "
    +
    "; + // line 145 + echo gettext("Expiring"); + echo "
    +
    "; + // line 146 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "order_get_list", [0 => ["expiring" => 1]], "method", false, false, false, 146), "total", [], "any", false, false, false, 146), "html", null, true); + echo "
    +
    +
    +
    +
    + +
    +
    +
    +

    "; + // line 155 + echo gettext("Tickets"); + echo "

    + +
    +
    +
    +
    "; + // line 165 + echo gettext("Total"); + echo "
    +
    "; + // line 166 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "support_ticket_get_list", [], "method", false, false, false, 166), "total", [], "any", false, false, false, 166), "html", null, true); + echo "
    +
    "; + // line 167 + echo gettext("Open"); + echo "
    +
    "; + // line 168 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "support_ticket_get_list", [0 => ["status" => "open"]], "method", false, false, false, 168), "total", [], "any", false, false, false, 168), "html", null, true); + echo "
    +
    "; + // line 169 + echo gettext("On Hold"); + echo "
    +
    "; + // line 170 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "support_ticket_get_list", [0 => ["status" => "on_hold"]], "method", false, false, false, 170), "total", [], "any", false, false, false, 170), "html", null, true); + echo "
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +

    "; + // line 182 + echo gettext("Recent orders"); + echo "

    +
    +
    + + + "; + // line 187 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "order_get_list", [0 => ["per_page" => 5, "page" => twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "page", [], "any", false, false, false, 187), "hide_addons" => 1]], "method", false, false, false, 187), "list", [], "any", false, false, false, 187)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["i"] => $context["order"]) { + // line 188 + echo " env, twig_cycle([0 => "odd", 1 => "even"], $context["i"]), "html", null, true); + echo "\"> + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 193 + echo " + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['i'], $context['order'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 197 + echo " +
    extensions['Box_TwigExtensions']->twig_bb_client_link_filter("order/service/manage"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["order"], "id", [], "any", false, false, false, 189), "html", null, true); + echo "\">"; + echo twig_escape_filter($this->env, twig_truncate_filter($this->env, twig_get_attribute($this->env, $this->source, $context["order"], "title", [], "any", false, false, false, 189), 30), "html", null, true); + echo "env, $this->source, $context["order"], "status", [], "any", false, false, false, 190) == "active")) { + echo "label-success"; + } elseif ((twig_get_attribute($this->env, $this->source, $context["order"], "status", [], "any", false, false, false, 190) == "pending_setup")) { + echo "label-warning"; + } + echo "\">"; + echo twig_call_macro($macros["mf"], "macro_status_name", [twig_get_attribute($this->env, $this->source, $context["order"], "status", [], "any", false, false, false, 190)], 190, $context, $this->getSourceContext()); + echo "
    "; + // line 194 + echo gettext("The list is empty"); + echo "
    +
    +
    +
    + +
    +
    +
    +

    "; + // line 206 + echo gettext("Recent emails"); + echo "

    +
    +
    + + + "; + // line 211 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "email_get_list", [0 => ["per_page" => 5]], "method", false, false, false, 211), "list", [], "any", false, false, false, 211)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["i"] => $context["email"]) { + // line 212 + echo " env, twig_cycle([0 => "odd", 1 => "even"], $context["i"]), "html", null, true); + echo "\"> + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 217 + echo " + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['i'], $context['email'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 221 + echo " +
    extensions['Box_TwigExtensions']->twig_bb_client_link_filter("email"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["email"], "id", [], "any", false, false, false, 213), "html", null, true); + echo "\">"; + echo twig_escape_filter($this->env, twig_truncate_filter($this->env, twig_get_attribute($this->env, $this->source, $context["email"], "subject", [], "any", false, false, false, 213), 30), "html", null, true); + echo "env, $this->extensions['Box_TwigExtensions']->twig_bb_date(twig_get_attribute($this->env, $this->source, $context["email"], "created_at", [], "any", false, false, false, 214)), "html", null, true); + echo "\">"; + echo twig_escape_filter($this->env, twig_timeago_filter(twig_get_attribute($this->env, $this->source, $context["email"], "created_at", [], "any", false, false, false, 214)), "html", null, true); + echo " "; + echo gettext("ago"); + echo "
    "; + // line 218 + echo gettext("The list is empty"); + echo "
    +
    +
    +
    + +
    + +"; + } + } + + public function getTemplateName() + { + return "mod_index_dashboard.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 582 => 221, 573 => 218, 570 => 217, 558 => 214, 550 => 213, 545 => 212, 540 => 211, 532 => 206, 521 => 197, 512 => 194, 509 => 193, 495 => 190, 487 => 189, 482 => 188, 477 => 187, 469 => 182, 454 => 170, 450 => 169, 446 => 168, 442 => 167, 438 => 166, 434 => 165, 423 => 159, 417 => 158, 411 => 155, 399 => 146, 395 => 145, 391 => 144, 387 => 143, 383 => 142, 379 => 141, 368 => 135, 362 => 134, 356 => 131, 341 => 119, 337 => 118, 333 => 117, 329 => 116, 325 => 115, 321 => 114, 310 => 108, 304 => 105, 292 => 96, 288 => 95, 284 => 94, 280 => 93, 276 => 92, 272 => 91, 261 => 85, 255 => 82, 250 => 79, 248 => 78, 244 => 76, 234 => 68, 224 => 64, 220 => 62, 207 => 58, 203 => 57, 199 => 56, 195 => 55, 187 => 54, 183 => 53, 179 => 52, 176 => 51, 171 => 50, 164 => 46, 160 => 45, 156 => 44, 152 => 43, 148 => 42, 144 => 41, 135 => 35, 129 => 31, 127 => 30, 125 => 29, 122 => 28, 120 => 27, 117 => 26, 109 => 23, 105 => 22, 101 => 21, 98 => 20, 96 => 19, 93 => 18, 89 => 17, 81 => 10, 75 => 9, 72 => 8, 69 => 7, 65 => 6, 58 => 4, 51 => 3, 47 => 1, 45 => 15, 38 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends request.ajax ? \"layout_blank.phtml\" : \"layout_default.phtml\" %} + +{% block meta_title %}{% trans 'Client Area' %}{% endblock %} +{% block page_header %}{% trans 'Dashboard' %}{% endblock %} + +{% block breadcrumbs %} + {% if not settings.hide_dashboard_breadcrumb %} + + {% endif %} +{% endblock %} + +{% import \"macro_functions.phtml\" as mf %} + +{% block content %} + +{% if settings.showcase_enabled %} +
    +

    {{ settings.showcase_heading }}

    +

    {{ settings.showcase_text }}

    +

    {{ settings.showcase_button_title }}

    +
    +{% endif %} + +{% if client %} + +{% set tickets = client.support_ticket_get_list({\"status\":'on_hold'}) %} +{% if tickets.total > 0 %} +
    +
    +
    +
    +

    {% trans 'Tickets waiting your reply' %}

    +
    +
    + + + + + + + + + + + + + {% for i, ticket in tickets.list %} + + + + + + + + + + + {% else %} + + + + + + {% endfor %} + + +
    {% trans 'Id' %}{% trans 'Subject' %}{% trans 'Help desk' %}{% trans 'Status' %}{% trans 'Submitted' %}{% trans 'Actions' %}
    {{ticket.id}}{{ticket.subject}}{{ticket.helpdesk.name}}{{mf.status_name(ticket.status)}}{{ticket.created_at|bb_date}}{% trans 'Reply' %}
    {% trans 'The list is empty' %}
    +
    +
    +
    +
    +{% endif %} + +
    +{% set profile = client.client_get %} +
    +
    +
    +

    {% trans 'Profile' %}

    + +
    +
    +
    +
    {% trans 'ID' %}
    +
    #{{ profile.id }}
    +
    {% trans 'Email' %}
    +
    {{ profile.email }}
    +
    {% trans 'Balance' %}
    +
    {{ profile.balance | money(profile.currency) }}
    +
    +
    +
    +
    + +
    +
    +
    +

    {% trans 'Invoices' %}

    + +
    +
    +
    +
    {% trans 'Total' %}
    +
    {{ client.invoice_get_list().total }}
    +
    {% trans 'Paid' %}
    +
    {{ client.invoice_get_list({\"status\":\"paid\"}).total }}
    +
    {% trans 'Unpaid' %}
    +
    {{ client.invoice_get_list({\"status\":\"unpaid\"}).total }}
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +

    {% trans 'Orders' %}

    + +
    +
    +
    +
    {% trans 'Total' %}
    +
    {{ client.order_get_list({\"hide_addons\":1}).total }}
    +
    {% trans 'Active' %}
    +
    {{ client.order_get_list({\"hide_addons\":1, \"status\":\"active\"}).total }}
    +
    {% trans 'Expiring' %}
    +
    {{ client.order_get_list({\"expiring\":1}).total }}
    +
    +
    +
    +
    + +
    +
    +
    +

    {% trans 'Tickets' %}

    + +
    +
    +
    +
    {% trans 'Total' %}
    +
    {{ client.support_ticket_get_list().total }}
    +
    {% trans 'Open' %}
    +
    {{ client.support_ticket_get_list({\"status\":'open'}).total }}
    +
    {% trans 'On Hold' %}
    +
    {{ client.support_ticket_get_list({\"status\":'on_hold'}).total }}
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    +

    {% trans 'Recent orders' %}

    +
    +
    + + + {% for i, order in client.order_get_list({\"per_page\":5, \"page\":request.page, \"hide_addons\":1}).list %} + + + + + {% else %} + + + + {% endfor %} + +
    {{ order.title|truncate(30) }}{{ mf.status_name(order.status) }}
    {% trans 'The list is empty' %}
    +
    +
    +
    + +
    +
    +
    +

    {% trans 'Recent emails' %}

    +
    +
    + + + {% for i, email in client.email_get_list({\"per_page\":5}).list %} + + + + + {% else %} + + + + {% endfor %} + +
    {{email.subject|truncate(30)}}{{ email.created_at|timeago }} {% trans 'ago' %}
    {% trans 'The list is empty' %}
    +
    +
    +
    + +
    + +{% endif %} +{% endblock %}", "mod_index_dashboard.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/src/bb-modules/Index/html_client/mod_index_dashboard.phtml"); + } +} diff --git a/bb-data/cache/3f/3f570f54e7db219374b3c08518306338246b9063b1db5ca9ca65cbac7af0b2e3.php b/bb-data/cache/3f/3f570f54e7db219374b3c08518306338246b9063b1db5ca9ca65cbac7af0b2e3.php new file mode 100644 index 000000000..4e3ed734a --- /dev/null +++ b/bb-data/cache/3f/3f570f54e7db219374b3c08518306338246b9063b1db5ca9ca65cbac7af0b2e3.php @@ -0,0 +1,156 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + 'head' => [$this, 'block_head'], + ]; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 1 + $this->displayBlock('head', $context, $blocks); + // line 4 + echo "
    + +
    + + + +"; + } + + // line 1 + public function block_head($context, array $blocks = []) + { + $macros = $this->macros; + // line 2 + echo " +"; + } + + public function getTemplateName() + { + return "mod_support_canned_selector.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 102 => 2, 98 => 1, 76 => 14, 69 => 12, 58 => 10, 54 => 9, 49 => 8, 45 => 7, 40 => 4, 38 => 1,); + } + + public function getSourceContext() + { + return new Source("{% block head%} + +{% endblock %} +
    + +
    + + + +", "mod_support_canned_selector.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-modules/Support/html_admin/mod_support_canned_selector.phtml"); + } +} diff --git a/bb-data/cache/41/412ca7f915cdbac1085e872e3b222a9964108bde44a47956342eb13c398026ba.php b/bb-data/cache/41/412ca7f915cdbac1085e872e3b222a9964108bde44a47956342eb13c398026ba.php new file mode 100644 index 000000000..0e0048cf0 --- /dev/null +++ b/bb-data/cache/41/412ca7f915cdbac1085e872e3b222a9964108bde44a47956342eb13c398026ba.php @@ -0,0 +1,675 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 1 + $context["background_opacity"] = ((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "background_opacity", [], "any", true, true, false, 1)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "background_opacity", [], "any", false, false, false, 1), "50")) : ("50")); + // line 2 + $context["popup_top"] = ((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "top", [], "any", true, true, false, 2)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "top", [], "any", false, false, false, 2), "200")) : ("200")); + // line 3 + $context["popup_left"] = ((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "left", [], "any", true, true, false, 3)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "left", [], "any", false, false, false, 3), "200")) : ("200")); + // line 4 + $context["width"] = ((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "width", [], "any", true, true, false, 4)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "width", [], "any", false, false, false, 4), "600")) : ("600")); + // line 5 + $context["height"] = ((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "height", [], "any", true, true, false, 5)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "height", [], "any", false, false, false, 5), "700")) : ("700")); + // line 6 + $context["background_color"] = ((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "background_color", [], "any", true, true, false, 6)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "background_color", [], "any", false, false, false, 6), "black")) : ("black")); + // line 7 + $context["theme_color"] = ((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "theme_color", [], "any", true, true, false, 7)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "theme_color", [], "any", false, false, false, 7), "green")) : ("green")); + // line 8 + $context["loader_nr"] = ((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "loader", [], "any", true, true, false, 8)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "loader", [], "any", false, false, false, 8), "8")) : ("8")); + // line 9 + $context["loader_url"] = (("img/assets/loaders/loader" . ($context["loader_nr"] ?? null)) . ".gif"); + // line 10 + $context["border_radius"] = ((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "border_radius", [], "any", true, true, false, 10)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "border_radius", [], "any", false, false, false, 10), 0)) : (0)); + // line 11 + $context["bind_selector"] = ((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "bind_selector", [], "any", true, true, false, 11)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "bind_selector", [], "any", false, false, false, 11), ".order-button")) : (".order-button")); + // line 12 + echo " + var orderbutton = function (){ + this.data_product_id = null; + this.backgroundElem = null; + this.iframeElem = null; + this.loaderImageElem = null; + }; + + orderbutton.prototype.setDataProductId = function (product_id){ + this.data_product_id = product_id; + }; + + orderbutton.prototype.getDataProductId = function (){ + return this.data_product_id; + }; + + orderbutton.prototype.hideElements = function(){ + this.backgroundElem.hide(); + this.iframeElem.hide(); + }; + + orderbutton.prototype.attachEvents = function() { + var _this = this; + \$(document).keyup(function(e) { // esc + if (e.keyCode == 27) { + _this.hideElements(); + } + }); + var bodyElem = \$('body'); + + bodyElem.undelegate('"; + // line 42 + echo twig_escape_filter($this->env, ($context["bind_selector"] ?? null), "html", null, true); + echo "', 'click'); + bodyElem.delegate('"; + // line 43 + echo twig_escape_filter($this->env, ($context["bind_selector"] ?? null), "html", null, true); + echo "', 'click', function (event) { + event.preventDefault(); + _this.setDataProductId(\$(this).data('product')) + _this.popup(); + }); + // Create the event. + var event = document.createEvent('Event'); + event.initEvent('OrderButtonEventsReady', true, true); + + // target can be any Element or other EventTarget. + document.dispatchEvent(event); + }; + + orderbutton.prototype.srclink = function(){ + var params = [ + { name: \"theme_color\", value: \""; + // line 58 + echo twig_escape_filter($this->env, ((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "theme_color", [], "any", true, true, false, 58)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "theme_color", [], "any", false, false, false, 58), "green")) : ("green")), "html", null, true); + echo "\" }, + { name: \"loader\", value: \"1\" } + ]; + var product_id = this.getDataProductId(); + + "; + // line 63 + if (twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "product_id", [], "any", false, false, false, 63)) { + // line 64 + echo " // request has product_id + product_id = "; + // line 65 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "product_id", [], "any", false, false, false, 65), "html", null, true); + echo "; + "; + } + // line 67 + echo " + if (product_id) + params.push({'name' : 'order', 'value' : product_id}); + "; + // line 70 + if (twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "show_custom_form_values", [], "any", false, false, false, 70)) { + // line 71 + echo " params['show_custom_form_values'] = 1; + "; + } + // line 73 + echo " + return \""; + // line 74 + echo $this->extensions['Box_TwigExtensions']->twig_bb_client_link_filter("orderbutton"); + echo "&\"+jQuery.param(params); + }; + + orderbutton.prototype.createIframe = function (){ + + this.iframeElem = \$('
    + + + + "; + } + // line 85 + echo " "; + } + } + + return ('' === $tmp = ob_get_contents()) ? '' : new Markup($tmp, $this->env->getCharset()); + } finally { + ob_end_clean(); + } + } + + public function getTemplateName() + { + return "macro_functions.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 405 => 85, 395 => 80, 388 => 78, 378 => 71, 372 => 68, 360 => 58, 358 => 57, 355 => 56, 350 => 54, 347 => 53, 344 => 52, 341 => 51, 339 => 50, 337 => 49, 334 => 48, 322 => 47, 306 => 42, 301 => 41, 296 => 38, 283 => 37, 271 => 34, 258 => 33, 246 => 29, 233 => 28, 221 => 25, 207 => 24, 195 => 20, 181 => 19, 171 => 15, 154 => 13, 150 => 12, 141 => 11, 125 => 10, 115 => 7, 98 => 5, 93 => 4, 87 => 3, 78 => 2, 61 => 1, 55 => 45, 52 => 36, 49 => 31, 46 => 27, 43 => 22, 40 => 17, 37 => 9,); + } + + public function getSourceContext() + { + return new Source("{% macro selectbox(name, options, selected, required, nullOption) %} + +{% endmacro %} + +{% macro selectboxtld(name, options, selected, required) %} + +{% endmacro %} + +{# deprecated - use money filter #} +{% macro currency_format(price, currency) %} + {{ price | money(currency) }} +{% endmacro %} + +{# deprecated - use money_convert filter #} +{% macro currency(price, currency) %} + {{ price | money_convert(currency) }} +{% endmacro %} + +{% macro status_name(status) %} + {{ status|replace({'_': \" \"})|title|trans }} +{% endmacro %} + +{# deprecated - use period_title filter #} +{% macro period_name(period) %} + {{ period | period_title }} +{% endmacro %} + +{% macro markdown_quote(text) %} + + + +{% for line in text|split('\\n') %} +> {{ line }} +{% endfor %} +{% endmacro %} + + +{% macro recaptcha() %} + +{% if guest.extension_is_on({\"mod\":\"spamchecker\"}) %} +{% set rc = guest.spamchecker_recaptcha %} + {% if rc.enabled %} + {% if rc.version == 2 %} + +
    + {% else %} + + {% set server = \"https://www.google.com/recaptcha/api\" %} + + +
    + +
    +
    {% trans 'Incorrect please try again' %}
    + +

    + +
    + + +

    +
    + + + + {% endif %} + {% endif %} +{% endif %} +{% endmacro %}", "macro_functions.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-themes/huraga/html/macro_functions.phtml"); + } +} diff --git a/bb-data/cache/f4/f4ddd0386270815a5a4e8e8794f78b7ebff856939b12d1d9dcc66d78e2bb72e0.php b/bb-data/cache/f4/f4ddd0386270815a5a4e8e8794f78b7ebff856939b12d1d9dcc66d78e2bb72e0.php new file mode 100644 index 000000000..d7bd13579 --- /dev/null +++ b/bb-data/cache/f4/f4ddd0386270815a5a4e8e8794f78b7ebff856939b12d1d9dcc66d78e2bb72e0.php @@ -0,0 +1,124 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 1 + $context["bb_editor"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "wysiwyg_editor", [], "any", false, false, false, 1); + // line 2 + echo " +"; + // line 3 + if ((($context["bb_editor"] ?? null) == "markitup")) { + // line 4 + echo twig_stylesheet_tag(twig_mod_asset_url("markitup/skins/boxbilling/style.css", "wysiwyg")); + echo " +"; + // line 5 + echo twig_stylesheet_tag(twig_mod_asset_url("markitup/sets/markdown/style.css", "wysiwyg")); + echo " +"; + // line 6 + echo twig_script_tag(twig_mod_asset_url("markitup/jquery.markitup.js", "wysiwyg")); + echo " +"; + // line 7 + echo twig_script_tag(twig_mod_asset_url("markitup/sets/markdown/set.js", "wysiwyg")); + echo " + +"; + } + // line 14 + echo " +"; + // line 15 + if ((($context["bb_editor"] ?? null) == "ckeditor")) { + // line 16 + echo twig_script_tag(twig_mod_asset_url("ckeditor/ckeditor.js", "wysiwyg")); + echo " + +"; + } + } + + public function getTemplateName() + { + return "mod_wysiwyg_js.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 79 => 18, 74 => 16, 72 => 15, 69 => 14, 62 => 10, 56 => 7, 52 => 6, 48 => 5, 44 => 4, 42 => 3, 39 => 2, 37 => 1,); + } + + public function getSourceContext() + { + return new Source("{% set bb_editor = admin.wysiwyg_editor %} + +{% if bb_editor == 'markitup' %} +{{ 'markitup/skins/boxbilling/style.css' | mod_asset_url('wysiwyg') | stylesheet_tag }} +{{ 'markitup/sets/markdown/style.css' | mod_asset_url('wysiwyg') | stylesheet_tag }} +{{ 'markitup/jquery.markitup.js' | mod_asset_url('wysiwyg') | script_tag }} +{{ 'markitup/sets/markdown/set.js' | mod_asset_url('wysiwyg') | script_tag }} + +{% endif %} + +{% if bb_editor == 'ckeditor' %} +{{ 'ckeditor/ckeditor.js' | mod_asset_url('wysiwyg') | script_tag }} + +{% endif %}", "mod_wysiwyg_js.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-modules/Wysiwyg/html_admin/mod_wysiwyg_js.phtml"); + } +} diff --git a/bb-data/cache/f8/f8859931c97c9f408aae6f7f8525f11b5645b62c803225dcee88e804acfed922.php b/bb-data/cache/f8/f8859931c97c9f408aae6f7f8525f11b5645b62c803225dcee88e804acfed922.php new file mode 100644 index 000000000..c46923f04 --- /dev/null +++ b/bb-data/cache/f8/f8859931c97c9f408aae6f7f8525f11b5645b62c803225dcee88e804acfed922.php @@ -0,0 +1,201 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 1 + if (($context["header"] ?? null)) { + // line 2 + echo "
    +
    "; + // line 3 + echo twig_escape_filter($this->env, ($context["header"] ?? null), "html", null, true); + echo "
    +
    +"; + } + // line 6 + echo " + + + + + + + + + + + "; + // line 17 + $context["extensions"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "extension_get_latest", [0 => ["type" => ($context["type"] ?? null)]], "method", false, false, false, 17); + // line 18 + echo " "; + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(($context["extensions"] ?? null)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["_key"] => $context["extension"]) { + // line 19 + echo " + + + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 33 + echo " + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['_key'], $context['extension'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 37 + echo " + + + + + + +
     ExtensionDescription 
    env, twig_get_attribute($this->env, $this->source, $context["extension"], "icon_url", [], "any", false, false, false, 20), "html", null, true); + echo "\" alt=\""; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["extension"], "name", [], "any", false, false, false, 20), "html", null, true); + echo "\" style=\"width: 32px; height: 32px;\"/> + env, twig_get_attribute($this->env, $this->source, $context["extension"], "project_url", [], "any", false, false, false, 22), "html", null, true); + echo "\" target=\"_blank\" title=\"View extension details\">"; + echo twig_escape_filter($this->env, twig_truncate_filter($this->env, twig_get_attribute($this->env, $this->source, $context["extension"], "name", [], "any", false, false, false, 22), 40), "html", null, true); + echo " "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["extension"], "version", [], "any", false, false, false, 22), "html", null, true); + echo " +
    by env, twig_get_attribute($this->env, $this->source, $context["extension"], "author_url", [], "any", false, false, false, 23), "html", null, true); + echo "\" target=\"_blank\">"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["extension"], "author", [], "any", false, false, false, 23), "html", null, true); + echo " +
    "; + // line 25 + echo twig_escape_filter($this->env, twig_truncate_filter($this->env, twig_get_attribute($this->env, $this->source, $context["extension"], "description", [], "any", false, false, false, 25), 150), "html", null, true); + echo " + env, twig_get_attribute($this->env, $this->source, $context["extension"], "name", [], "any", false, false, false, 27), "html", null, true); + echo "' you agree with terms and conditions. Install only extensions you trust. Continue?\" data-api-reload=\"1\" href=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/extension/install", ["type" => twig_get_attribute($this->env, $this->source, $context["extension"], "type", [], "any", false, false, false, 27), "id" => twig_get_attribute($this->env, $this->source, $context["extension"], "id", [], "any", false, false, false, 27)]); + echo "\" title=\"Install extension\">\"\" + env, twig_get_attribute($this->env, $this->source, $context["extension"], "project_url", [], "any", false, false, false, 28), "html", null, true); + echo "\" target=\"_blank\" title=\"Details\">\"\" + env, twig_get_attribute($this->env, $this->source, $context["extension"], "download_url", [], "any", false, false, false, 29), "html", null, true); + echo "\" title=\"Download "; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["extension"], "name", [], "any", false, false, false, 29), "html", null, true); + echo "\">\"\" +
    Explore BoxBilling extensions
    "; + } + + public function getTemplateName() + { + return "partial_extensions.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 129 => 37, 120 => 33, 109 => 29, 105 => 28, 99 => 27, 94 => 25, 87 => 23, 79 => 22, 72 => 20, 69 => 19, 63 => 18, 61 => 17, 48 => 6, 42 => 3, 39 => 2, 37 => 1,); + } + + public function getSourceContext() + { + return new Source("{% if header %} +
    +
    {{ header }}
    +
    +{% endif %} + + + + + + + + + + + + {% set extensions = admin.extension_get_latest({\"type\":type}) %} + {% for extension in extensions %} + + + + + + + {% else %} + + + + {% endfor %} + + + + + + + +
     ExtensionDescription 
    \"{{ + {{ extension.name|truncate(40) }} {{ extension.version }} +
    by {{extension.author}} +
    {{ extension.description|truncate(150) }} + \"\" + \"\" + \"\" +
    Explore BoxBilling extensions
    ", "partial_extensions.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-themes/admin_default/html/partial_extensions.phtml"); + } +} diff --git a/bb-data/cache/f8/f8d008503b0613a0b5d1d8bdf4341d44ed77a54bee1cd44af1180b17bfadaee6.php b/bb-data/cache/f8/f8d008503b0613a0b5d1d8bdf4341d44ed77a54bee1cd44af1180b17bfadaee6.php new file mode 100644 index 000000000..1f13e3ee0 --- /dev/null +++ b/bb-data/cache/f8/f8d008503b0613a0b5d1d8bdf4341d44ed77a54bee1cd44af1180b17bfadaee6.php @@ -0,0 +1,92 @@ +source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 1 + echo " + +"; + } + + public function getTemplateName() + { + return "mod_cookieconsent_index.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 40 => 2, 37 => 1,); + } + + public function getSourceContext() + { + return new Source(" + +", "mod_cookieconsent_index.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-modules/Cookieconsent/html_client/mod_cookieconsent_index.phtml"); + } +} diff --git a/bb-data/cache/f9/f9a63a6ef41a967201deb4d943ae8e35b5449a78fea5ffa2d5373e9a6d10edd1.php b/bb-data/cache/f9/f9a63a6ef41a967201deb4d943ae8e35b5449a78fea5ffa2d5373e9a6d10edd1.php new file mode 100644 index 000000000..36d03f9de --- /dev/null +++ b/bb-data/cache/f9/f9a63a6ef41a967201deb4d943ae8e35b5449a78fea5ffa2d5373e9a6d10edd1.php @@ -0,0 +1,444 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'content' => [$this, 'block_content'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return $this->loadTemplate(((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "ajax", [], "any", false, false, false, 1)) ? ("layout_blank.phtml") : ("layout_default.phtml")), "mod_invoice_gateways.phtml", 1); + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 2 + $macros["mf"] = $this->macros["mf"] = $this->loadTemplate("macro_functions.phtml", "mod_invoice_gateways.phtml", 2)->unwrap(); + // line 3 + $context["active_menu"] = "system"; + // line 1 + $this->getParent($context)->display($context, array_merge($this->blocks, $blocks)); + } + + // line 4 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo "Payment gateways"; + } + + // line 6 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 7 + echo "
    + + + +
    +
    +
    + "; + // line 17 + echo twig_call_macro($macros["mf"], "macro_table_search", [], 17, $context, $this->getSourceContext()); + echo " + + + + + + + + + + + + + + "; + // line 31 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "invoice_gateway_get_list", [0 => twig_array_merge(["per_page" => 100], ($context["request"] ?? null))], "method", false, false, false, 31), "list", [], "any", false, false, false, 31)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["_key"] => $context["gateway"]) { + // line 32 + echo " + + + + + + + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 47 + echo " + + + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['_key'], $context['gateway'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 55 + echo "
    "; + // line 21 + echo gettext("Title"); + echo ""; + // line 22 + echo gettext("Code"); + echo ""; + // line 23 + echo gettext("Enabled"); + echo ""; + // line 24 + echo gettext("Allow one time payments"); + echo ""; + // line 25 + echo gettext("Allow subscriptions"); + echo " 
    "; + // line 33 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["gateway"], "title", [], "any", false, false, false, 33), "html", null, true); + echo ""; + // line 34 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["gateway"], "code", [], "any", false, false, false, 34), "html", null, true); + echo ""; + // line 35 + echo twig_call_macro($macros["mf"], "macro_q", [twig_get_attribute($this->env, $this->source, $context["gateway"], "enabled", [], "any", false, false, false, 35)], 35, $context, $this->getSourceContext()); + echo ""; + // line 36 + echo twig_call_macro($macros["mf"], "macro_q", [twig_get_attribute($this->env, $this->source, $context["gateway"], "allow_single", [], "any", false, false, false, 36)], 36, $context, $this->getSourceContext()); + echo ""; + // line 37 + echo twig_call_macro($macros["mf"], "macro_q", [twig_get_attribute($this->env, $this->source, $context["gateway"], "allow_recurrent", [], "any", false, false, false, 37)], 37, $context, $this->getSourceContext()); + echo " + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("/invoice/gateway"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["gateway"], "id", [], "any", false, false, false, 39), "html", null, true); + echo "\">\"\" + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/invoice/gateway_copy", ["id" => twig_get_attribute($this->env, $this->source, $context["gateway"], "id", [], "any", false, false, false, 40)]); + echo "\" data-api-redirect=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("invoice/gateways"); + echo "\" title=\"Copy\">\"\" + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("invoice/gateways"); + echo "\" href=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/invoice/gateway_delete", ["id" => twig_get_attribute($this->env, $this->source, $context["gateway"], "id", [], "any", false, false, false, 41)]); + echo "\">\"\" +
    + "; + // line 50 + echo gettext("The list is empty"); + // line 51 + echo "
    +
    + +
    + "; + // line 59 + $this->loadTemplate("partial_extensions.phtml", "mod_invoice_gateways.phtml", 59)->display(twig_to_array(["type" => "payment-gateway", "header" => "List of payment gateways on extensions site"])); + // line 60 + echo "
    +

    "; + // line 61 + echo gettext("Adding new payment gateway"); + echo "

    +

    "; + // line 62 + echo gettext("Although BoxBilling ships with most popular payment gateways, you can install other gateways."); + echo "

    +

    "; + // line 63 + echo gettext("Follow these instructions to install new payment gateway."); + echo "

    +
    +
      +
    • "; + // line 66 + echo gettext("Check for payment gateway at"); + echo " BoxBilling extensions site "; + echo gettext("for more payment gateways"); + echo "
    • +
    • "; + // line 67 + echo gettext("Download payment gateway extension file and place it to"); + echo ""; + echo twig_escape_filter($this->env, twig_constant("BB_PATH_LIBRARY"), "html", null, true); + echo "/Payment/Adapter
    • +
    • "; + // line 68 + echo gettext("After file is uploaded in place, reload this page."); + echo "
    • +
    • "; + // line 69 + echo gettext("Select uploaded file name and click on install."); + echo "
    • +
    • "; + // line 70 + echo gettext("Payment gateway will be installed in BoxBilling and can be configured in \"Payment gateways\" tab."); + echo "
    • +
    • "; + // line 71 + echo gettext("For developers. Read"); + echo " BoxBilling documentation "; + echo gettext("to learn how to create your own payment gateway and share it with community"); + echo "
    • +
    +
    +
    + + "; + // line 76 + if ((twig_length_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "invoice_gateway_get_available", [], "any", false, false, false, 76)) > 0)) { + // line 77 + echo " + + + + + + + + + "; + // line 86 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "invoice_gateway_get_available", [], "any", false, false, false, 86)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["_key"] => $context["gtw"]) { + // line 87 + echo " + + + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 96 + echo " + + + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['_key'], $context['gtw'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 104 + echo "
    "; + // line 80 + echo gettext("Code"); + echo ""; + // line 81 + echo gettext("Install"); + echo "
    "; + // line 88 + echo twig_escape_filter($this->env, $context["gtw"], "html", null, true); + echo " + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/invoice/gateway_install", ["code" => $context["gtw"]]); + echo "\" data-api-redirect=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("invoice/gateways"); + echo "\" title=\"Install\">\"\" +
    + "; + // line 99 + echo gettext("All payment gateways installed"); + // line 100 + echo "
    + "; + } + // line 106 + echo "
    + +
    +
    + +"; + } + + public function getTemplateName() + { + return "mod_invoice_gateways.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 306 => 106, 302 => 104, 293 => 100, 291 => 99, 286 => 96, 273 => 90, 268 => 88, 265 => 87, 260 => 86, 252 => 81, 248 => 80, 243 => 77, 241 => 76, 231 => 71, 227 => 70, 223 => 69, 219 => 68, 213 => 67, 207 => 66, 201 => 63, 197 => 62, 193 => 61, 190 => 60, 188 => 59, 182 => 55, 173 => 51, 171 => 50, 166 => 47, 153 => 41, 147 => 40, 141 => 39, 136 => 37, 132 => 36, 128 => 35, 124 => 34, 120 => 33, 117 => 32, 112 => 31, 103 => 25, 99 => 24, 95 => 23, 91 => 22, 87 => 21, 80 => 17, 71 => 11, 67 => 10, 62 => 7, 58 => 6, 51 => 4, 47 => 1, 45 => 3, 43 => 2, 36 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends request.ajax ? \"layout_blank.phtml\" : \"layout_default.phtml\" %} +{% import \"macro_functions.phtml\" as mf %} +{% set active_menu = 'system' %} +{% block meta_title %}Payment gateways{% endblock %} + +{% block content %} +
    + + + +
    +
    +
    + {{ mf.table_search }} + + + + + + + + + + + + + + {% for gateway in admin.invoice_gateway_get_list({\"per_page\":100}|merge(request)).list %} + + + + + + + + + + + {% else %} + + + + + + {% endfor %} +
    {% trans 'Title' %}{% trans 'Code' %}{% trans 'Enabled' %}{% trans 'Allow one time payments' %}{% trans 'Allow subscriptions' %} 
    {{ gateway.title }}{{ gateway.code }}{{ mf.q(gateway.enabled) }}{{ mf.q(gateway.allow_single) }}{{ mf.q(gateway.allow_recurrent) }} + \"\" + \"\" + \"\" +
    + {% trans 'The list is empty' %} +
    +
    + +
    + {% include \"partial_extensions.phtml\" with {'type': 'payment-gateway', 'header':\"List of payment gateways on extensions site\"} only %} +
    +

    {% trans 'Adding new payment gateway' %}

    +

    {% trans 'Although BoxBilling ships with most popular payment gateways, you can install other gateways.' %}

    +

    {% trans 'Follow these instructions to install new payment gateway.' %}

    +
    +
      +
    • {% trans 'Check for payment gateway at' %} BoxBilling extensions site {% trans 'for more payment gateways' %}
    • +
    • {% trans 'Download payment gateway extension file and place it to' %}{{ constant('BB_PATH_LIBRARY') }}/Payment/Adapter
    • +
    • {% trans 'After file is uploaded in place, reload this page.' %}
    • +
    • {% trans 'Select uploaded file name and click on install.' %}
    • +
    • {% trans 'Payment gateway will be installed in BoxBilling and can be configured in \\\"Payment gateways\\\" tab.' %}
    • +
    • {% trans 'For developers. Read' %} BoxBilling documentation {% trans 'to learn how to create your own payment gateway and share it with community' %}
    • +
    +
    +
    + + {% if admin.invoice_gateway_get_available|length > 0 %} + + + + + + + + + + {% for gtw in admin.invoice_gateway_get_available %} + + + + + + + {% else %} + + + + + + {% endfor %} +
    {% trans 'Code' %}{% trans 'Install' %}
    {{ gtw }} + \"\" +
    + {% trans 'All payment gateways installed' %} +
    + {% endif %} +
    + +
    +
    + +{% endblock %} +", "mod_invoice_gateways.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-themes/admin_default/html/mod_invoice_gateways.phtml"); + } +} diff --git a/bb-data/cache/fb/fb118fc25eaefdda3e8d26c88f9443a266782ca93bdff8030d4fac85e15dc52c.php b/bb-data/cache/fb/fb118fc25eaefdda3e8d26c88f9443a266782ca93bdff8030d4fac85e15dc52c.php new file mode 100644 index 000000000..c8997484e --- /dev/null +++ b/bb-data/cache/fb/fb118fc25eaefdda3e8d26c88f9443a266782ca93bdff8030d4fac85e15dc52c.php @@ -0,0 +1,267 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'breadcrumb' => [$this, 'block_breadcrumb'], + 'content' => [$this, 'block_content'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return $this->loadTemplate(((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "ajax", [], "any", false, false, false, 1)) ? ("layout_blank.phtml") : ("layout_default.phtml")), "mod_order_list.phtml", 1); + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 3 + $macros["mf"] = $this->macros["mf"] = $this->loadTemplate("macro_functions.phtml", "mod_order_list.phtml", 3)->unwrap(); + // line 1 + $this->getParent($context)->display($context, array_merge($this->blocks, $blocks)); + } + + // line 5 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("My Products & Services"); + } + + // line 7 + public function block_breadcrumb($context, array $blocks = []) + { + $macros = $this->macros; + // line 8 + echo "
  • "; + echo gettext("Orders"); + echo "
  • +"; + } + + // line 11 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 12 + echo "
    +
    +
    +
    +

    "; + // line 16 + echo gettext("Orders"); + echo "

    +

    "; + // line 17 + echo gettext("All of your orders are displayed here. Click on any order to get full information about it."); + echo "

    +
    + +
    + + + + + + + + + + + + "; + // line 32 + $context["orders"] = twig_get_attribute($this->env, $this->source, ($context["client"] ?? null), "order_get_list", [0 => ["per_page" => 10, "page" => twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "page", [], "any", false, false, false, 32), "hide_addons" => 1]], "method", false, false, false, 32); + // line 33 + echo " "; + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["orders"] ?? null), "list", [], "any", false, false, false, 33)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["i"] => $context["order"]) { + // line 34 + echo " env, twig_cycle([0 => "odd", 1 => "even"], $context["i"]), "html", null, true); + echo "\"> + + + + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 42 + echo " + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['i'], $context['order'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 46 + echo " + +
    "; + // line 24 + echo gettext("Product/Service"); + echo ""; + // line 25 + echo gettext("Price"); + echo ""; + // line 26 + echo gettext("Next due date"); + echo ""; + // line 27 + echo gettext("Status"); + echo " 
    extensions['Box_TwigExtensions']->twig_bb_client_link_filter("/order/service/manage"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["order"], "id", [], "any", false, false, false, 35), "html", null, true); + echo "\">"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["order"], "title", [], "any", false, false, false, 35), "html", null, true); + echo ""; + // line 36 + echo twig_money($this->env, twig_get_attribute($this->env, $this->source, $context["order"], "total", [], "any", false, false, false, 36), twig_get_attribute($this->env, $this->source, $context["order"], "currency", [], "any", false, false, false, 36)); + echo " "; + if (twig_get_attribute($this->env, $this->source, $context["order"], "period", [], "any", false, false, false, 36)) { + echo twig_period_title($this->env, twig_get_attribute($this->env, $this->source, $context["order"], "period", [], "any", false, false, false, 36)); + } + echo ""; + // line 37 + if (twig_get_attribute($this->env, $this->source, $context["order"], "expires_at", [], "any", false, false, false, 37)) { + echo twig_escape_filter($this->env, $this->extensions['Box_TwigExtensions']->twig_bb_date(twig_get_attribute($this->env, $this->source, $context["order"], "expires_at", [], "any", false, false, false, 37)), "html", null, true); + } else { + echo "-"; + } + echo "env, $this->source, $context["order"], "status", [], "any", false, false, false, 38) == "active")) { + echo "label-success"; + } elseif ((twig_get_attribute($this->env, $this->source, $context["order"], "status", [], "any", false, false, false, 38) == "pending_setup")) { + echo "label-warning"; + } + echo "\">"; + echo twig_call_macro($macros["mf"], "macro_status_name", [twig_get_attribute($this->env, $this->source, $context["order"], "status", [], "any", false, false, false, 38)], 38, $context, $this->getSourceContext()); + echo "extensions['Box_TwigExtensions']->twig_bb_client_link_filter("/order/service/manage"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["order"], "id", [], "any", false, false, false, 39), "html", null, true); + echo "\">
    "; + // line 43 + echo gettext("The list is empty"); + echo "
    + "; + // line 49 + $this->loadTemplate("partial_pagination.phtml", "mod_order_list.phtml", 49)->display(twig_array_merge($context, ["list" => ($context["orders"] ?? null)])); + // line 50 + echo "
    +
    +
    + +"; + } + + public function getTemplateName() + { + return "mod_order_list.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 188 => 50, 186 => 49, 181 => 46, 172 => 43, 169 => 42, 159 => 39, 149 => 38, 141 => 37, 133 => 36, 125 => 35, 120 => 34, 114 => 33, 112 => 32, 104 => 27, 100 => 26, 96 => 25, 92 => 24, 82 => 17, 78 => 16, 72 => 12, 68 => 11, 61 => 8, 57 => 7, 50 => 5, 46 => 1, 44 => 3, 37 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends request.ajax ? \"layout_blank.phtml\" : \"layout_default.phtml\" %} + +{% import \"macro_functions.phtml\" as mf %} + +{% block meta_title %}{% trans 'My Products & Services' %}{% endblock %} + +{% block breadcrumb %} +
  • {% trans 'Orders' %}
  • +{% endblock %} + +{% block content %} +
    +
    +
    +
    +

    {% trans 'Orders' %}

    +

    {% trans 'All of your orders are displayed here. Click on any order to get full information about it.' %}

    +
    + +
    + + + + + + + + + + + + {% set orders = client.order_get_list({\"per_page\":10, \"page\":request.page, \"hide_addons\":1}) %} + {% for i, order in orders.list %} + + + + + + + + {% else %} + + + + {% endfor %} + + +
    {% trans 'Product/Service' %}{% trans 'Price' %}{% trans 'Next due date' %}{% trans 'Status' %} 
    {{order.title}}{{ order.total | money(order.currency) }} {% if order.period%}{{ order.period | period_title }}{% endif %}{% if order.expires_at %}{{order.expires_at|bb_date}}{% else %}-{% endif %}{{ mf.status_name(order.status) }}
    {% trans 'The list is empty' %}
    + {% include \"partial_pagination.phtml\" with {'list': orders} %} +
    +
    +
    + +{% endblock %}", "mod_order_list.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-modules/Order/html_client/mod_order_list.phtml"); + } +} diff --git a/bb-data/cache/fc/fc1523bc32b1c0fb662a2cd94005effec7f00f3038593bcab43bdec8ff419c21.php b/bb-data/cache/fc/fc1523bc32b1c0fb662a2cd94005effec7f00f3038593bcab43bdec8ff419c21.php new file mode 100644 index 000000000..4228c65e6 --- /dev/null +++ b/bb-data/cache/fc/fc1523bc32b1c0fb662a2cd94005effec7f00f3038593bcab43bdec8ff419c21.php @@ -0,0 +1,559 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'content' => [$this, 'block_content'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return $this->loadTemplate(((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "ajax", [], "any", false, false, false, 1)) ? ("layout_blank.phtml") : ("layout_default.phtml")), "mod_kb_index.phtml", 1); + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 2 + $macros["mf"] = $this->macros["mf"] = $this->loadTemplate("macro_functions.phtml", "mod_kb_index.phtml", 2)->unwrap(); + // line 4 + $context["active_menu"] = "kb"; + // line 1 + $this->getParent($context)->display($context, array_merge($this->blocks, $blocks)); + } + + // line 3 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("Knowledge Base"); + } + + // line 5 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 6 + echo " +
    + + + +
    + +
    +
    + + "; + // line 21 + echo twig_call_macro($macros["mf"], "macro_table_search", [], 21, $context, $this->getSourceContext()); + echo " + + + + + + + + + + + + + "; + // line 34 + $context["posts"] = twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "kb_article_get_list", [0 => twig_array_merge(["per_page" => 30, "page" => twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "page", [], "any", false, false, false, 34)], ($context["request"] ?? null))], "method", false, false, false, 34); + // line 35 + echo " "; + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["posts"] ?? null), "list", [], "any", false, false, false, 35)); + $context['_iterated'] = false; + foreach ($context['_seq'] as $context["i"] => $context["post"]) { + // line 36 + echo " + + + + + + + "; + $context['_iterated'] = true; + } + if (!$context['_iterated']) { + // line 47 + echo " + + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['i'], $context['post'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 54 + echo " +
    "; + // line 25 + echo gettext("Title"); + echo ""; + // line 26 + echo gettext("Category"); + echo ""; + // line 27 + echo gettext("Status"); + echo ""; + // line 28 + echo gettext("Views"); + echo " 
    "; + // line 37 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["post"], "title", [], "any", false, false, false, 37), "html", null, true); + echo "extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("/kb/category"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["post"], "category", [], "any", false, false, false, 38), "id", [], "any", false, false, false, 38), "html", null, true); + echo "\">"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, $context["post"], "category", [], "any", false, false, false, 38), "title", [], "any", false, false, false, 38), "html", null, true); + echo ""; + // line 39 + echo twig_call_macro($macros["mf"], "macro_status_name", [twig_get_attribute($this->env, $this->source, $context["post"], "status", [], "any", false, false, false, 39)], 39, $context, $this->getSourceContext()); + echo ""; + // line 40 + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["post"], "views", [], "any", false, false, false, 40), "html", null, true); + echo " + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("/kb/article"); + echo "/"; + echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, $context["post"], "id", [], "any", false, false, false, 42), "html", null, true); + echo "\">\"\" + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("kb"); + echo "\" href=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/kb/article_delete", ["id" => twig_get_attribute($this->env, $this->source, $context["post"], "id", [], "any", false, false, false, 43)]); + echo "\">\"\" +
    + "; + // line 49 + echo gettext("The list is empty"); + // line 50 + echo "
    + + "; + // line 57 + $this->loadTemplate("partial_pagination.phtml", "mod_kb_index.phtml", 57)->display(twig_array_merge($context, ["list" => ($context["posts"] ?? null), "url" => "kb"])); + // line 58 + echo "
    + + +
    +
    extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/kb/article_create"); + echo "\" class=\"mainForm api-form\" data-api-reload=\"1\"> +
    +
    + +
    + "; + // line 67 + echo twig_call_macro($macros["mf"], "macro_selectbox", ["kb_article_category_id", twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "kb_category_get_pairs", [], "any", false, false, false, 67), twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "kb_article_category_id", [], "any", false, false, false, 67), 1], 67, $context, $this->getSourceContext()); + echo " +
    +
    +
    + +
    + +
    + env, twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "title", [], "any", false, false, false, 75), "html", null, true); + echo "\" required=\"required\" placeholder=\"\"/> +
    +
    +
    + +
    + +
    + + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    +
    +
    + +
    + +
    extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/kb/category_create"); + echo "\" class=\"mainForm save api-form\" data-api-reload=\""; + echo gettext("Category created"); + echo "\"> +
    +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + + +
    +
    +
    + +
    + + + "; + // line 129 + $context['_parent'] = $context; + $context['_seq'] = twig_ensure_traversable(twig_get_attribute($this->env, $this->source, ($context["admin"] ?? null), "kb_category_get_pairs", [], "any", false, false, false, 129)); + $context['_iterated'] = false; + $context['loop'] = [ + 'parent' => $context['_parent'], + 'index0' => 0, + 'index' => 1, + 'first' => true, + ]; + if (is_array($context['_seq']) || (is_object($context['_seq']) && $context['_seq'] instanceof \Countable)) { + $length = count($context['_seq']); + $context['loop']['revindex0'] = $length - 1; + $context['loop']['revindex'] = $length; + $context['loop']['length'] = $length; + $context['loop']['last'] = 1 === $length; + } + foreach ($context['_seq'] as $context["cat_id"] => $context["cat_title"]) { + // line 130 + echo " env, $this->source, $context["loop"], "first", [], "any", false, false, false, 130)) { + echo "class=\"noborder\""; + } + echo "> + + + + "; + $context['_iterated'] = true; + ++$context['loop']['index0']; + ++$context['loop']['index']; + $context['loop']['first'] = false; + if (isset($context['loop']['length'])) { + --$context['loop']['revindex0']; + --$context['loop']['revindex']; + $context['loop']['last'] = 0 === $context['loop']['revindex0']; + } + } + if (!$context['_iterated']) { + // line 138 + echo " + + + "; + } + $_parent = $context['_parent']; + unset($context['_seq'], $context['_iterated'], $context['cat_id'], $context['cat_title'], $context['_parent'], $context['loop']); + $context = array_intersect_key($context, $_parent) + $_parent; + // line 142 + echo " +
    "; + // line 131 + echo twig_escape_filter($this->env, $context["cat_title"], "html", null, true); + echo " + extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("/kb/category"); + echo "/"; + echo twig_escape_filter($this->env, $context["cat_id"], "html", null, true); + echo "\">\"\" + extensions['Box_TwigExtensions']->twig_bb_client_link_filter("api/admin/kb/category_delete", ["id" => $context["cat_id"]]); + echo "\" data-api-redirect=\""; + echo $this->extensions['Box_TwigExtensions']->twig_bb_admin_link_filter("kb/new"); + echo "\">\"\" +
    "; + // line 139 + echo gettext("The list is empty"); + echo "
    +
    + +
    + +
    +
    + +"; + } + + public function getTemplateName() + { + return "mod_kb_index.phtml"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array ( 377 => 142, 368 => 139, 365 => 138, 346 => 134, 340 => 133, 335 => 131, 328 => 130, 310 => 129, 299 => 121, 289 => 114, 278 => 106, 270 => 103, 260 => 96, 253 => 92, 248 => 90, 239 => 84, 235 => 83, 230 => 81, 221 => 75, 216 => 73, 207 => 67, 202 => 65, 196 => 62, 190 => 58, 188 => 57, 183 => 54, 174 => 50, 172 => 49, 168 => 47, 157 => 43, 151 => 42, 146 => 40, 142 => 39, 134 => 38, 130 => 37, 127 => 36, 121 => 35, 119 => 34, 110 => 28, 106 => 27, 102 => 26, 98 => 25, 91 => 21, 80 => 13, 76 => 12, 72 => 11, 68 => 10, 62 => 6, 58 => 5, 51 => 3, 47 => 1, 45 => 4, 43 => 2, 36 => 1,); + } + + public function getSourceContext() + { + return new Source("{% extends request.ajax ? \"layout_blank.phtml\" : \"layout_default.phtml\" %} +{% import \"macro_functions.phtml\" as mf %} +{% block meta_title %}{% trans 'Knowledge Base' %}{% endblock %} +{% set active_menu = 'kb' %} +{% block content %} + +
    + + + +
    + +
    +
    + + {{ mf.table_search }} + + + + + + + + + + + + + {% set posts = admin.kb_article_get_list({\"per_page\":30, \"page\":request.page}|merge(request)) %} + {% for i, post in posts.list %} + + + + + + + + {% else %} + + + + + {% endfor %} + +
    {% trans 'Title' %}{% trans 'Category' %}{% trans 'Status' %}{% trans 'Views' %} 
    {{ post.title }}{{post.category.title}}{{ mf.status_name(post.status) }}{{ post.views }} + \"\" + \"\" +
    + {% trans 'The list is empty' %} +
    + + {% include \"partial_pagination.phtml\" with {'list': posts, 'url':'kb'} %} +
    + + +
    +
    +
    +
    + +
    + {{ mf.selectbox('kb_article_category_id', admin.kb_category_get_pairs, request.kb_article_category_id, 1) }} +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    + +
    + + +
    +
    +
    + +
    + +
    + +
    +
    +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    + +
    +
    +
    + + +
    +
    +
    + +
    + + + {% for cat_id, cat_title in admin.kb_category_get_pairs %} + + + + + {% else %} + + + + {% endfor %} + +
    {{cat_title}} + \"\" + \"\" +
    {% trans 'The list is empty' %}
    +
    + +
    + +
    +
    + +{% endblock %} +", "mod_kb_index.phtml", "/var/www/vhosts/webbhostingservices.com/httpdocs/boxbilling/bb-modules/Kb/html_admin/mod_kb_index.phtml"); + } +} diff --git a/bb-data/cache/fe/fefaf3f52f69800a759a783737ca5fcb9e226fb65ad21962e440aba851908a3d.php b/bb-data/cache/fe/fefaf3f52f69800a759a783737ca5fcb9e226fb65ad21962e440aba851908a3d.php new file mode 100644 index 000000000..057424bdc --- /dev/null +++ b/bb-data/cache/fe/fefaf3f52f69800a759a783737ca5fcb9e226fb65ad21962e440aba851908a3d.php @@ -0,0 +1,197 @@ +source = $this->getSourceContext(); + + $this->blocks = [ + 'meta_title' => [$this, 'block_meta_title'], + 'content_before' => [$this, 'block_content_before'], + 'content' => [$this, 'block_content'], + 'sidebar2' => [$this, 'block_sidebar2'], + 'js' => [$this, 'block_js'], + ]; + } + + protected function doGetParent(array $context) + { + // line 1 + return $this->loadTemplate(((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "ajax", [], "any", false, false, false, 1)) ? ("layout_blank.phtml") : ("layout_default.phtml")), "mod_order_product.phtml", 1); + } + + protected function doDisplay(array $context, array $blocks = []) + { + $macros = $this->macros; + // line 2 + $macros["mf"] = $this->macros["mf"] = $this->loadTemplate("macro_functions.phtml", "mod_order_product.phtml", 2)->unwrap(); + // line 5 + $context["loader_nr"] = ((twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "loader", [], "any", true, true, false, 5)) ? (_twig_default_filter(twig_get_attribute($this->env, $this->source, ($context["request"] ?? null), "loader", [], "any", false, false, false, 5), "8")) : ("8")); + // line 6 + $context["loader_url"] = (("img/assets/loaders/loader" . ($context["loader_nr"] ?? null)) . ".gif"); + // line 1 + $this->getParent($context)->display($context, array_merge($this->blocks, $blocks)); + } + + // line 3 + public function block_meta_title($context, array $blocks = []) + { + $macros = $this->macros; + echo gettext("Order"); + } + + // line 8 + public function block_content_before($context, array $blocks = []) + { + $macros = $this->macros; + } + + // line 11 + public function block_content($context, array $blocks = []) + { + $macros = $this->macros; + // line 12 + echo " +
    +
    +
    +
    +

    "; + // line 17 + echo gettext("Select Product"); + echo "

    +

    "; + // line 18 + echo gettext("Choose products we offer for selling"); + echo "

    +
    +
    + env, twig_mod_asset_url(($context["loader_url"] ?? null), "orderbutton"), "html", null, true); + echo "\" style=\"display: block; margin-left: auto; margin-right: auto; position: relative; top: 50%\" /> + - -
  • - - -
  • -
  • - - -
  • - -
    - -
    - -

    Introducing Guzzle

    - -

    Guzzle takes the pain out of sending HTTP requests and the redundancy out of creating web service clients. It's - a framework that includes the tools needed to create a robust web service client, including: - Service descriptions for defining the inputs and outputs of an API, resource iterators for traversing - paginated resources, batching for sending a large number of requests as efficiently as possible.

    - -
      -
    • All the power of cURL with a simple interface.
    • -
    • Persistent connections and parallel requests.
    • -
    • Streams request and response bodies
    • -
    • Service descriptions for quickly building clients.
    • -
    • Powered by the Symfony2 EventDispatcher.
    • -
    • Use all of the code or only specific components.
    • -
    • Plugins for caching, logging, OAuth, mocks, and more
    • -
    • Includes a custom node.js webserver to test your clients.
    • -
    - -
    - Guzzle is now part of Drupal 8 core and powers the official AWS SDK for PHP -
    - -

    GitHub Example

    - -
    <?php
    -require_once 'vendor/autoload.php';
    -use Guzzle\Http\Client;
    -
    -// Create a client and provide a base URL
    -$client = new Client('https://api.github.com');
    -// Create a request with basic Auth
    -$request = $client->get('/user')->setAuth('user', 'pass');
    -// Send the request and get the response
    -$response = $request->send();
    -echo $response->getBody();
    -// >>> {"type":"User", ...
    -echo $response->getHeader('Content-Length');
    -// >>> 792
    -
    - -

    Twitter Example

    -
    <?php
    -// Create a client to work with the Twitter API
    -$client = new Client('https://api.twitter.com/{version}', array(
    -    'version' => '1.1'
    -));
    -
    -// Sign all requests with the OauthPlugin
    -$client->addSubscriber(new Guzzle\Plugin\Oauth\OauthPlugin(array(
    -    'consumer_key'  => '***',
    -    'consumer_secret' => '***',
    -    'token'       => '***',
    -    'token_secret'  => '***'
    -)));
    -
    -echo $client->get('statuses/user_timeline.json')->send()->getBody();
    -// >>> {"public_gists":6,"type":"User" ...
    -
    -// Create a tweet using POST
    -$request = $client->post('statuses/update.json', null, array(
    -    'status' => 'Tweeted with Guzzle, http://guzzlephp.org'
    -));
    -
    -// Send the request and parse the JSON response into an array
    -$data = $request->send()->json();
    -echo $data['text'];
    -// >>> Tweeted with Guzzle, http://t.co/kngJMfRk
    -
    -
    - - diff --git a/bb-vendor/guzzle/guzzle/docs/_templates/leftbar.html b/bb-vendor/guzzle/guzzle/docs/_templates/leftbar.html deleted file mode 100644 index e69de29bb..000000000 diff --git a/bb-vendor/guzzle/guzzle/docs/_templates/nav_links.html b/bb-vendor/guzzle/guzzle/docs/_templates/nav_links.html deleted file mode 100644 index d4f2165bb..000000000 --- a/bb-vendor/guzzle/guzzle/docs/_templates/nav_links.html +++ /dev/null @@ -1,5 +0,0 @@ -
  • Docs
  • -
  • API
  • -
  • GitHub
  • -
  • Forum
  • -
  • IRC
  • diff --git a/bb-vendor/guzzle/guzzle/docs/batching/batching.rst b/bb-vendor/guzzle/guzzle/docs/batching/batching.rst deleted file mode 100644 index 57f04d80f..000000000 --- a/bb-vendor/guzzle/guzzle/docs/batching/batching.rst +++ /dev/null @@ -1,183 +0,0 @@ -======== -Batching -======== - -Guzzle provides a fairly generic and very customizable batching framework that allows developers to efficiently -transfer requests in parallel. - -Sending requests and commands in parallel ------------------------------------------ - -You can send HTTP requests in parallel by passing an array of ``Guzzle\Http\Message\RequestInterface`` objects to -``Guzzle\Http\Client::send()``: - -.. code-block:: php - - $responses = $client->send(array( - $client->get('http://www.example.com/foo'), - $client->get('http://www.example.com/baz') - $client->get('http://www.example.com/bar') - )); - -You can send commands in parallel by passing an array of ``Guzzle\Service\Command\CommandInterface`` objects -``Guzzle\Service\Client::execute()``: - -.. code-block:: php - - $commands = $client->execute(array( - $client->getCommand('foo'), - $client->getCommand('baz'), - $client->getCommand('bar') - )); - -These approaches work well for most use-cases. When you need more control over the requests that are sent in -parallel or you need to send a large number of requests, you need to use the functionality provided in the -``Guzzle\Batch`` namespace. - -Batching overview ------------------ - -The batch object, ``Guzzle\Batch\Batch``, is a queue. You add requests to the queue until you are ready to transfer -all of the requests. In order to efficiently transfer the items in the queue, the batch object delegates the -responsibility of dividing the queue into manageable parts to a divisor (``Guzzle\Batch\BatchDivisorInterface``). -The batch object then iterates over each array of items created by the divisor and sends them to the batch object's -``Guzzle\Batch\BatchTransferInterface``. - -.. code-block:: php - - use Guzzle\Batch\Batch; - use Guzzle\Http\BatchRequestTransfer; - - // BatchRequestTransfer acts as both the divisor and transfer strategy - $transferStrategy = new BatchRequestTransfer(10); - $divisorStrategy = $transferStrategy; - - $batch = new Batch($transferStrategy, $divisorStrategy); - - // Add some requests to the batch queue - $batch->add($request1) - ->add($request2) - ->add($request3); - - // Flush the queue and retrieve the flushed items - $arrayOfTransferredRequests = $batch->flush(); - -.. note:: - - You might find that your transfer strategy will need to act as both the divisor and transfer strategy. - -Using the BatchBuilder ----------------------- - -The ``Guzzle\Batch\BatchBuilder`` makes it easier to create batch objects. The batch builder also provides an easier -way to add additional behaviors to your batch object. - -Transferring requests -~~~~~~~~~~~~~~~~~~~~~ - -The ``Guzzle\Http\BatchRequestTransfer`` class efficiently transfers HTTP requests in parallel by grouping batches of -requests by the curl_multi handle that is used to transfer the requests. - -.. code-block:: php - - use Guzzle\Batch\BatchBuilder; - - $batch = BatchBuilder::factory() - ->transferRequests(10) - ->build(); - -Transferring commands -~~~~~~~~~~~~~~~~~~~~~ - -The ``Guzzle\Service\Command\BatchCommandTransfer`` class efficiently transfers service commands by grouping commands -by the client that is used to transfer them. You can add commands to a batch object that are transferred by different -clients, and the batch will handle the rest. - -.. code-block:: php - - use Guzzle\Batch\BatchBuilder; - - $batch = BatchBuilder::factory() - ->transferCommands(10) - ->build(); - - $batch->add($client->getCommand('foo')) - ->add($client->getCommand('baz')) - ->add($client->getCommand('bar')); - - $commands = $batch->flush(); - -Batch behaviors ---------------- - -You can add various behaviors to your batch that allow for more customizable transfers. - -Automatically flushing a queue -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Use the ``Guzzle\Batch\FlushingBatch`` decorator when you want to pump a large number of items into a batch queue and -have the queue automatically flush when the size of the queue reaches a certain threshold. - -.. code-block:: php - - use Guzzle\Batch\BatchBuilder; - - $batch = BatchBuilder::factory() - ->transferRequests(10) - ->autoFlushAt(10) - ->build(); - -Batch builder method: ``autoFlushAt($threshold)`` - -Notifying on flush -~~~~~~~~~~~~~~~~~~ - -Use the ``Guzzle\Batch\NotifyingBatch`` decorator if you want a function to be notified each time the batch queue is -flushed. This is useful when paired with the flushing batch decorator. Pass a callable to the ``notify()`` method of -a batch builder to use this decorator with the builder. - -.. code-block:: php - - use Guzzle\Batch\BatchBuilder; - - $batch = BatchBuilder::factory() - ->transferRequests(10) - ->autoFlushAt(10) - ->notify(function (array $transferredItems) { - echo 'Transferred ' . count($transferredItems) . "items\n"; - }) - ->build(); - -Batch builder method:: ``notify(callable $callback)`` - -Keeping a history -~~~~~~~~~~~~~~~~~ - -Use the ``Guzzle\Batch\HistoryBatch`` decorator if you want to maintain a history of all the items transferred with -the batch queue. - -.. code-block:: php - - use Guzzle\Batch\BatchBuilder; - - $batch = BatchBuilder::factory() - ->transferRequests(10) - ->keepHistory() - ->build(); - -After transferring items, you can use the ``getHistory()`` of a batch to retrieve an array of transferred items. Be -sure to periodically clear the history using ``clearHistory()``. - -Batch builder method: ``keepHistory()`` - -Exception buffering -~~~~~~~~~~~~~~~~~~~ - -Use the ``Guzzle\Batch\ExceptionBufferingBatch`` decorator to buffer exceptions during a transfer so that you can -transfer as many items as possible then deal with the errored batches after the transfer completes. After transfer, -use the ``getExceptions()`` method of a batch to retrieve an array of -``Guzzle\Batch\Exception\BatchTransferException`` objects. You can use these exceptions to attempt to retry the -failed batches. Be sure to clear the buffered exceptions when you are done with them by using the -``clearExceptions()`` method. - -Batch builder method: ``bufferExceptions()`` diff --git a/bb-vendor/guzzle/guzzle/docs/conf.py b/bb-vendor/guzzle/guzzle/docs/conf.py deleted file mode 100644 index 92bc46bb5..000000000 --- a/bb-vendor/guzzle/guzzle/docs/conf.py +++ /dev/null @@ -1,94 +0,0 @@ -import sys, os -from sphinx.highlighting import lexers -from pygments.lexers.web import PhpLexer - -lexers['php'] = PhpLexer(startinline=True, linenos=1) -lexers['php-annotations'] = PhpLexer(startinline=True, linenos=1) -primary_domain = 'php' - -# -- General configuration ----------------------------------------------------- - -extensions = [] -templates_path = ['_templates'] -source_suffix = '.rst' -master_doc = 'index' - -project = u'Guzzle' -copyright = u'2012, Michael Dowling' -version = '3.0.0' -release = '3.0.0' - -exclude_patterns = ['_build'] - -# -- Options for HTML output --------------------------------------------------- - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -html_title = "Guzzle documentation" -html_short_title = "Guzzle" - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] - -# Custom sidebar templates, maps document names to template names. -html_sidebars = { - '**': ['localtoc.html', 'leftbar.html', 'searchbox.html'] -} - -# Output file base name for HTML help builder. -htmlhelp_basename = 'Guzzledoc' - -# -- Guzzle Sphinx theme setup ------------------------------------------------ - -sys.path.insert(0, '/Users/dowling/projects/guzzle_sphinx_theme') - -import guzzle_sphinx_theme -html_translator_class = 'guzzle_sphinx_theme.HTMLTranslator' -html_theme_path = guzzle_sphinx_theme.html_theme_path() -html_theme = 'guzzle_sphinx_theme' - -# Guzzle theme options (see theme.conf for more information) -html_theme_options = { - "index_template": "index.html", - "project_nav_name": "Guzzle", - "github_user": "guzzle", - "github_repo": "guzzle", - "disqus_comments_shortname": "guzzle", - "google_analytics_account": "UA-22752917-1" -} - -# -- Options for LaTeX output -------------------------------------------------- - -latex_elements = {} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass [howto/manual]). -latex_documents = [ - ('index', 'Guzzle.tex', u'Guzzle Documentation', - u'Michael Dowling', 'manual'), -] - -# -- Options for manual page output -------------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'guzzle', u'Guzzle Documentation', - [u'Michael Dowling'], 1) -] - -# If true, show URL addresses after external links. -#man_show_urls = False - -# -- Options for Texinfo output ------------------------------------------------ - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ('index', 'Guzzle', u'Guzzle Documentation', - u'Michael Dowling', 'Guzzle', 'One line description of project.', - 'Miscellaneous'), -] diff --git a/bb-vendor/guzzle/guzzle/docs/docs.rst b/bb-vendor/guzzle/guzzle/docs/docs.rst deleted file mode 100644 index cf87908bd..000000000 --- a/bb-vendor/guzzle/guzzle/docs/docs.rst +++ /dev/null @@ -1,73 +0,0 @@ -.. title:: Guzzle | PHP HTTP client and framework for consuming RESTful web services - -==================== -Guzzle Documentation -==================== - -Getting started ---------------- - -.. toctree:: - :maxdepth: 1 - - getting-started/overview - getting-started/installation - getting-started/faq - -The HTTP client ---------------- - -.. toctree:: - :maxdepth: 2 - - http-client/client - http-client/request - http-client/response - http-client/entity-bodies - http-client/http-redirects - http-client/uri-templates - -Plugins -------- - -.. toctree:: - :maxdepth: 1 - - plugins/plugins-overview - plugins/creating-plugins - plugins/async-plugin - plugins/backoff-plugin - plugins/cache-plugin - plugins/cookie-plugin - plugins/curl-auth-plugin - plugins/history-plugin - plugins/log-plugin - plugins/md5-validator-plugin - plugins/mock-plugin - plugins/oauth-plugin - -The web service client ----------------------- - -.. toctree:: - :maxdepth: 1 - - webservice-client/webservice-client - webservice-client/using-the-service-builder - webservice-client/guzzle-service-descriptions - batching/batching - iterators/resource-iterators - iterators/guzzle-iterators - -Testing -------- - -.. toctree:: - :maxdepth: 2 - - testing/unit-testing - -API Docs --------- - -`Read the API docs `_ diff --git a/bb-vendor/guzzle/guzzle/docs/getting-started/faq.rst b/bb-vendor/guzzle/guzzle/docs/getting-started/faq.rst deleted file mode 100644 index a0a3fdbb6..000000000 --- a/bb-vendor/guzzle/guzzle/docs/getting-started/faq.rst +++ /dev/null @@ -1,29 +0,0 @@ -=== -FAQ -=== - -What should I do if I get this error: Fatal error: Maximum function nesting level of '100' reached, aborting! -------------------------------------------------------------------------------------------------------------- - -You could run into this error if you have the XDebug extension installed and you execute a lot of requests in -callbacks. This error message comes specifically from the XDebug extension. PHP itself does not have a function -nesting limit. Change this setting in your php.ini to increase the limit:: - - xdebug.max_nesting_level = 1000 - -[`source `_] - -How can I speed up my client? ------------------------------ - -There are several things you can do to speed up your client: - -1. Utilize a C based HTTP message parser (e.g. ``Guzzle\Parser\Message\PeclHttpMessageParser``) -2. Disable operation validation by setting the ``command.disable_validation`` option to true on a command - -Why am I getting a 417 error response? --------------------------------------- - -This can occur for a number of reasons, but if you are sending PUT, POST, or PATCH requests with an -``Expect: 100-Continue`` header, a server that does not support this header will return a 417 response. You can work -around this by calling ``$request->removeHeader('Expect');`` after setting the entity body of a request. diff --git a/bb-vendor/guzzle/guzzle/docs/getting-started/installation.rst b/bb-vendor/guzzle/guzzle/docs/getting-started/installation.rst deleted file mode 100644 index 77d400131..000000000 --- a/bb-vendor/guzzle/guzzle/docs/getting-started/installation.rst +++ /dev/null @@ -1,154 +0,0 @@ -============ -Installation -============ - -Requirements ------------- - -#. PHP 5.3.3+ compiled with the cURL extension -#. A recent version of cURL 7.16.2+ compiled with OpenSSL and zlib - -Installing Guzzle ------------------ - -Composer -~~~~~~~~ - -The recommended way to install Guzzle is with `Composer `_. Composer is a dependency -management tool for PHP that allows you to declare the dependencies your project needs and installs them into your -project. - -.. code-block:: bash - - # Install Composer - curl -sS https://getcomposer.org/installer | php - - # Add Guzzle as a dependency - php composer.phar require guzzle/guzzle:~3.9 - -After installing, you need to require Composer's autoloader: - -.. code-block:: php - - require 'vendor/autoload.php'; - -You can find out more on how to install Composer, configure autoloading, and other best-practices for defining -dependencies at `getcomposer.org `_. - -Using only specific parts of Guzzle -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -While you can always just rely on ``guzzle/guzzle``, Guzzle provides several smaller parts of Guzzle as individual -packages available through Composer. - -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| Package name | Description | -+===============================================================================================+==========================================+ -| `guzzle/common `_ | Provides ``Guzzle\Common`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/http `_ | Provides ``Guzzle\Http`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/parser `_ | Provides ``Guzzle\Parser`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/batch `_ | Provides ``Guzzle\Batch`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/cache `_ | Provides ``Guzzle\Cache`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/inflection `_ | Provides ``Guzzle\Inflection`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/iterator `_ | Provides ``Guzzle\Iterator`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/log `_ | Provides ``Guzzle\Log`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/plugin `_ | Provides ``Guzzle\Plugin`` (all plugins) | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/plugin-async `_ | Provides ``Guzzle\Plugin\Async`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/plugin-backoff `_ | Provides ``Guzzle\Plugin\BackoffPlugin`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/plugin-cache `_ | Provides ``Guzzle\Plugin\Cache`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/plugin-cookie `_ | Provides ``Guzzle\Plugin\Cookie`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/plugin-error-response `_ | Provides ``Guzzle\Plugin\ErrorResponse`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/plugin-history `_ | Provides ``Guzzle\Plugin\History`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/plugin-log `_ | Provides ``Guzzle\Plugin\Log`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/plugin-md5 `_ | Provides ``Guzzle\Plugin\Md5`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/plugin-mock `_ | Provides ``Guzzle\Plugin\Mock`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/plugin-oauth `_ | Provides ``Guzzle\Plugin\Oauth`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/service `_ | Provides ``Guzzle\Service`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ -| `guzzle/stream `_ | Provides ``Guzzle\Stream`` | -+-----------------------------------------------------------------------------------------------+------------------------------------------+ - -Bleeding edge -^^^^^^^^^^^^^ - -During your development, you can keep up with the latest changes on the master branch by setting the version -requirement for Guzzle to ``dev-master``. - -.. code-block:: js - - { - "require": { - "guzzle/guzzle": "dev-master" - } - } - -PEAR -~~~~ - -Guzzle can be installed through PEAR: - -.. code-block:: bash - - pear channel-discover guzzlephp.org/pear - pear install guzzle/guzzle - -You can install a specific version of Guzzle by providing a version number suffix: - -.. code-block:: bash - - pear install guzzle/guzzle-3.9.0 - -Contributing to Guzzle ----------------------- - -In order to contribute, you'll need to checkout the source from GitHub and install Guzzle's dependencies using -Composer: - -.. code-block:: bash - - git clone https://github.com/guzzle/guzzle.git - cd guzzle && curl -s http://getcomposer.org/installer | php && ./composer.phar install --dev - -Guzzle is unit tested with PHPUnit. You will need to create your own phpunit.xml file in order to run the unit tests -(or just copy phpunit.xml.dist to phpunit.xml). Run the tests using the vendored PHPUnit binary: - -.. code-block:: bash - - vendor/bin/phpunit - -You'll need to install node.js v0.5.0 or newer in order to test the cURL implementation. - -Framework integrations ----------------------- - -Using Guzzle with Symfony -~~~~~~~~~~~~~~~~~~~~~~~~~ - -Bundles are available on GitHub: - -- `DdeboerGuzzleBundle `_ for Guzzle 2 -- `MisdGuzzleBundle `_ for Guzzle 3 - -Using Guzzle with Silex -~~~~~~~~~~~~~~~~~~~~~~~ - -A `Guzzle Silex service provider `_ is available on GitHub. diff --git a/bb-vendor/guzzle/guzzle/docs/getting-started/overview.rst b/bb-vendor/guzzle/guzzle/docs/getting-started/overview.rst deleted file mode 100644 index 505b40978..000000000 --- a/bb-vendor/guzzle/guzzle/docs/getting-started/overview.rst +++ /dev/null @@ -1,85 +0,0 @@ -================= -Welcome to Guzzle -================= - -What is Guzzle? -~~~~~~~~~~~~~~~ - -Guzzle is a PHP HTTP client and framework for building web service clients. Guzzle takes the pain out of sending HTTP -requests and the redundancy out of creating web service clients. - -Features at a glance --------------------- - -- All the power of cURL with a simple interface. -- Persistent connections and parallel requests. -- Streams request and response bodies -- Service descriptions for quickly building clients. -- Powered by the Symfony2 EventDispatcher. -- Use all of the code or only specific components. -- Plugins for caching, logging, OAuth, mocks, and more -- Includes a custom node.js webserver to test your clients. -- Service descriptions for defining the inputs and outputs of an API -- Resource iterators for traversing paginated resources -- Batching for sending a large number of requests as efficiently as possible - -.. code-block:: php - - // Really simple using a static facade - Guzzle\Http\StaticClient::mount(); - $response = Guzzle::get('http://guzzlephp.org'); - - // More control using a client class - $client = new \Guzzle\Http\Client('http://guzzlephp.org'); - $request = $client->get('/'); - $response = $request->send(); - -License -------- - -Licensed using the `MIT license `_. - - Copyright (c) 2013 Michael Dowling - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - -Contributing ------------- - -Guidelines -~~~~~~~~~~ - -This is still a work in progress, but there are only a few rules: - -1. Guzzle follows PSR-0, PSR-1, and PSR-2 -2. All pull requests must include unit tests to ensure the change works as expected and to prevent future regressions - -Reporting a security vulnerability -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -We want to ensure that Guzzle is a secure HTTP client library for everyone. If you've discovered a security -vulnerability in Guzzle, we appreciate your help in disclosing it to us in a -`responsible manner `_. - -Publicly disclosing a vulnerability can put the entire community at risk. If you've discovered a security concern, -please email us at security@guzzlephp.org. We'll work with you to make sure that we understand the scope of the issue, -and that we fully address your concern. We consider correspondence sent to security@guzzlephp.org our highest priority, -and work to address any issues that arise as quickly as possible. - -After a security vulnerability has been corrected, a security hotfix release will be deployed as soon as possible. diff --git a/bb-vendor/guzzle/guzzle/docs/http-client/client.rst b/bb-vendor/guzzle/guzzle/docs/http-client/client.rst deleted file mode 100644 index 723d729db..000000000 --- a/bb-vendor/guzzle/guzzle/docs/http-client/client.rst +++ /dev/null @@ -1,569 +0,0 @@ -====================== -The Guzzle HTTP client -====================== - -Guzzle gives PHP developers complete control over HTTP requests while utilizing HTTP/1.1 best practices. Guzzle's HTTP -functionality is a robust framework built on top of the `PHP libcurl bindings `_. - -The three main parts of the Guzzle HTTP client are: - -+--------------+-------------------------------------------------------------------------------------------------------+ -| Clients | ``Guzzle\Http\Client`` (creates and sends requests, associates a response with a request) | -+--------------+-------------------------------------------------------------------------------------------------------+ -| Requests | ``Guzzle\Http\Message\Request`` (requests with no body), | -| | ``Guzzle\Http\Message\EntityEnclosingRequest`` (requests with a body) | -+--------------+-------------------------------------------------------------------------------------------------------+ -| Responses | ``Guzzle\Http\Message\Response`` | -+--------------+-------------------------------------------------------------------------------------------------------+ - -Creating a Client ------------------ - -Clients create requests, send requests, and set responses on a request object. When instantiating a client object, -you can pass an optional "base URL" and optional array of configuration options. A base URL is a -:doc:`URI template ` that contains the URL of a remote server. When creating requests with a relative -URL, the base URL of a client will be merged into the request's URL. - -.. code-block:: php - - use Guzzle\Http\Client; - - // Create a client and provide a base URL - $client = new Client('https://api.github.com'); - - $request = $client->get('/user'); - $request->setAuth('user', 'pass'); - echo $request->getUrl(); - // >>> https://api.github.com/user - - // You must send a request in order for the transfer to occur - $response = $request->send(); - - echo $response->getBody(); - // >>> {"type":"User", ... - - echo $response->getHeader('Content-Length'); - // >>> 792 - - $data = $response->json(); - echo $data['type']; - // >>> User - -Base URLs -~~~~~~~~~ - -Notice that the URL provided to the client's ``get()`` method is relative. Relative URLs will always merge into the -base URL of the client. There are a few rules that control how the URLs are merged. - -.. tip:: - - Guzzle follows `RFC 3986 `_ when merging base URLs and - relative URLs. - -In the above example, we passed ``/user`` to the ``get()`` method of the client. This is a relative URL, so it will -merge into the base URL of the client-- resulting in the derived URL of ``https://api.github.com/users``. - -``/user`` is a relative URL but uses an absolute path because it contains the leading slash. Absolute paths will -overwrite any existing path of the base URL. If an absolute path is provided (e.g. ``/path/to/something``), then the -path specified in the base URL of the client will be replaced with the absolute path, and the query string provided -by the relative URL will replace the query string of the base URL. - -Omitting the leading slash and using relative paths will add to the path of the base URL of the client. So using a -client base URL of ``https://api.twitter.com/v1.1`` and creating a GET request with ``statuses/user_timeline.json`` -will result in a URL of ``https://api.twitter.com/v1.1/statuses/user_timeline.json``. If a relative path and a query -string are provided, then the relative path will be appended to the base URL path, and the query string provided will -be merged into the query string of the base URL. - -If an absolute URL is provided (e.g. ``http://httpbin.org/ip``), then the request will completely use the absolute URL -as-is without merging in any of the URL parts specified in the base URL. - -Configuration options -~~~~~~~~~~~~~~~~~~~~~ - -The second argument of the client's constructor is an array of configuration data. This can include URI template data -or special options that alter the client's behavior: - -+-------------------------------+-------------------------------------------------------------------------------------+ -| ``request.options`` | Associative array of :ref:`Request options ` to apply to every | -| | request created by the client. | -+-------------------------------+-------------------------------------------------------------------------------------+ -| ``redirect.disable`` | Disable HTTP redirects for every request created by the client. | -+-------------------------------+-------------------------------------------------------------------------------------+ -| ``curl.options`` | Associative array of cURL options to apply to every request created by the client. | -| | if either the key or value of an entry in the array is a string, Guzzle will | -| | attempt to find a matching defined cURL constant automatically (e.g. | -| | "CURLOPT_PROXY" will be converted to the constant ``CURLOPT_PROXY``). | -+-------------------------------+-------------------------------------------------------------------------------------+ -| ``ssl.certificate_authority`` | Set to true to use the Guzzle bundled SSL certificate bundle (this is used by | -| | default, 'system' to use the bundle on your system, a string pointing to a file to | -| | use a specific certificate file, a string pointing to a directory to use multiple | -| | certificates, or ``false`` to disable SSL validation (not recommended). | -| | | -| | When using Guzzle inside of a phar file, the bundled SSL certificate will be | -| | extracted to your system's temp folder, and each time a client is created an MD5 | -| | check will be performed to ensure the integrity of the certificate. | -+-------------------------------+-------------------------------------------------------------------------------------+ -| ``command.params`` | When using a ``Guzzle\Service\Client`` object, this is an associative array of | -| | default options to set on each command created by the client. | -+-------------------------------+-------------------------------------------------------------------------------------+ - -Here's an example showing how to set various configuration options, including default headers to send with each request, -default query string parameters to add to each request, a default auth scheme for each request, and a proxy to use for -each request. Values can be injected into the client's base URL using variables from the configuration array. - -.. code-block:: php - - use Guzzle\Http\Client; - - $client = new Client('https://api.twitter.com/{version}', array( - 'version' => 'v1.1', - 'request.options' => array( - 'headers' => array('Foo' => 'Bar'), - 'query' => array('testing' => '123'), - 'auth' => array('username', 'password', 'Basic|Digest|NTLM|Any'), - 'proxy' => 'tcp://localhost:80' - ) - )); - -Setting a custom User-Agent -~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The default Guzzle User-Agent header is ``Guzzle/ curl/ PHP/``. You can -customize the User-Agent header of a client by calling the ``setUserAgent()`` method of a Client object. - -.. code-block:: php - - // Completely override the default User-Agent - $client->setUserAgent('Test/123'); - - // Prepend a string to the default User-Agent - $client->setUserAgent('Test/123', true); - -Creating requests with a client -------------------------------- - -A Client object exposes several methods used to create Request objects: - -* Create a custom HTTP request: ``$client->createRequest($method, $uri, array $headers, $body, $options)`` -* Create a GET request: ``$client->get($uri, array $headers, $options)`` -* Create a HEAD request: ``$client->head($uri, array $headers, $options)`` -* Create a DELETE request: ``$client->delete($uri, array $headers, $body, $options)`` -* Create a POST request: ``$client->post($uri, array $headers, $postBody, $options)`` -* Create a PUT request: ``$client->put($uri, array $headers, $body, $options)`` -* Create a PATCH request: ``$client->patch($uri, array $headers, $body, $options)`` - -.. code-block:: php - - use Guzzle\Http\Client; - - $client = new Client('http://baseurl.com/api/v1'); - - // Create a GET request using Relative to base URL - // URL of the request: http://baseurl.com/api/v1/path?query=123&value=abc) - $request = $client->get('path?query=123&value=abc'); - $response = $request->send(); - - // Create HEAD request using a relative URL with an absolute path - // URL of the request: http://baseurl.com/path?query=123&value=abc - $request = $client->head('/path?query=123&value=abc'); - $response = $request->send(); - - // Create a DELETE request using an absolute URL - $request = $client->delete('http://www.example.com/path?query=123&value=abc'); - $response = $request->send(); - - // Create a PUT request using the contents of a PHP stream as the body - // Specify custom HTTP headers - $request = $client->put('http://www.example.com/upload', array( - 'X-Header' => 'My Header' - ), fopen('http://www.test.com/', 'r')); - $response = $request->send(); - - // Create a POST request and add the POST files manually - $request = $client->post('http://localhost:8983/solr/update') - ->addPostFiles(array('file' => '/path/to/documents.xml')); - $response = $request->send(); - - // Check if a resource supports the DELETE method - $supportsDelete = $client->options('/path')->send()->isMethodAllowed('DELETE'); - $response = $request->send(); - -Client objects create Request objects using a request factory (``Guzzle\Http\Message\RequestFactoryInterface``). -You can inject a custom request factory into the Client using ``$client->setRequestFactory()``, but you can typically -rely on a Client's default request factory. - -Static clients --------------- - -You can use Guzzle's static client facade to more easily send simple HTTP requests. - -.. code-block:: php - - // Mount the client so that you can access it at \Guzzle - Guzzle\Http\StaticClient::mount(); - $response = Guzzle::get('http://guzzlephp.org'); - -Each request method of the static client (e.g. ``get()``, ``post()`, ``put()``, etc) accepts an associative array of request -options to apply to the request. - -.. code-block:: php - - $response = Guzzle::post('http://test.com', array( - 'headers' => array('X-Foo' => 'Bar'), - 'body' => array('Test' => '123'), - 'timeout' => 10 - )); - -.. _request-options: - -Request options ---------------- - -Request options can be specified when creating a request or in the ``request.options`` parameter of a client. These -options can control various aspects of a request including: headers to send, query string data, where the response -should be downloaded, proxies, auth, etc. - -headers -~~~~~~~ - -Associative array of headers to apply to the request. When specified in the ``$options`` argument of a client creational -method (e.g. ``get()``, ``post()``, etc), the headers in the ``$options`` array will overwrite headers specified in the -``$headers`` array. - -.. code-block:: php - - $request = $client->get($url, array(), array( - 'headers' => array('X-Foo' => 'Bar') - )); - -Headers can be specified on a client to add default headers to every request sent by a client. - -.. code-block:: php - - $client = new Guzzle\Http\Client(); - - // Set a single header using path syntax - $client->setDefaultOption('headers/X-Foo', 'Bar'); - - // Set all headers - $client->setDefaultOption('headers', array('X-Foo' => 'Bar')); - -.. note:: - - In addition to setting request options when creating requests or using the ``setDefaultOption()`` method, any - default client request option can be set using a client's config object: - - .. code-block:: php - - $client->getConfig()->setPath('request.options/headers/X-Foo', 'Bar'); - -query -~~~~~ - -Associative array of query string parameters to the request. When specified in the ``$options`` argument of a client -creational method, the query string parameters in the ``$options`` array will overwrite query string parameters -specified in the `$url`. - -.. code-block:: php - - $request = $client->get($url, array(), array( - 'query' => array('abc' => '123') - )); - -Query string parameters can be specified on a client to add default query string parameters to every request sent by a -client. - -.. code-block:: php - - $client = new Guzzle\Http\Client(); - - // Set a single query string parameter using path syntax - $client->setDefaultOption('query/abc', '123'); - - // Set an array of default query string parameters - $client->setDefaultOption('query', array('abc' => '123')); - -body -~~~~ - -Sets the body of a request. The value supplied to the body option can be a ``Guzzle\Http\EntityBodyInterface``, string, -fopen resource, or array when sending POST requests. When a ``body`` request option is supplied, the option value will -overwrite the ``$body`` argument of a client creational method. - -auth -~~~~ - -Specifies and array of HTTP authorization parameters parameters to use with the request. The array must contain the -username in index [0], the password in index [1], and can optionally contain the authentication type in index [2]. -The available authentication types are: "Basic" (default), "Digest", "NTLM", or "Any". - -.. code-block:: php - - $request = $client->get($url, array(), array( - 'auth' => array('username', 'password', 'Digest') - )); - - // You can add auth headers to every request of a client - $client->setDefaultOption('auth', array('username', 'password', 'Digest')); - -cookies -~~~~~~~ - -Specifies an associative array of cookies to add to the request. - -allow_redirects -~~~~~~~~~~~~~~~ - -Specifies whether or not the request should follow redirects. Requests will follow redirects by default. Set -``allow_redirects`` to ``false`` to disable redirects. - -save_to -~~~~~~~ - -The ``save_to`` option specifies where the body of a response is downloaded. You can pass the path to a file, an fopen -resource, or a ``Guzzle\Http\EntityBodyInterface`` object. - -See :ref:`Changing where a response is downloaded ` for more information on setting the -`save_to` option. - -events -~~~~~~ - -The `events` option makes it easy to attach listeners to the various events emitted by a request object. The `events` -options must be an associative array mapping an event name to a Closure or array the contains a Closure and the -priority of the event. - -.. code-block:: php - - $request = $client->get($url, array(), array( - 'events' => array( - 'request.before_send' => function (\Guzzle\Common\Event $e) { - echo 'About to send ' . $e['request']; - } - ) - )); - - // Using the static client: - Guzzle::get($url, array( - 'events' => array( - 'request.before_send' => function (\Guzzle\Common\Event $e) { - echo 'About to send ' . $e['request']; - } - ) - )); - -plugins -~~~~~~~ - -The `plugins` options makes it easy to attach an array of plugins to a request. - -.. code-block:: php - - // Using the static client: - Guzzle::get($url, array( - 'plugins' => array( - new Guzzle\Plugin\Cache\CachePlugin(), - new Guzzle\Plugin\Cookie\CookiePlugin() - ) - )); - -exceptions -~~~~~~~~~~ - -The `exceptions` option can be used to disable throwing exceptions for unsuccessful HTTP response codes -(e.g. 404, 500, etc). Set `exceptions` to false to not throw exceptions. - -params -~~~~~~ - -The `params` options can be used to specify an associative array of data parameters to add to a request. Note that -these are not query string parameters. - -timeout / connect_timeout -~~~~~~~~~~~~~~~~~~~~~~~~~ - -You can specify the maximum number of seconds to allow for an entire transfer to take place before timing out using -the `timeout` request option. You can specify the maximum number of seconds to wait while trying to connect using the -`connect_timeout` request option. Set either of these options to 0 to wait indefinitely. - -.. code-block:: php - - $request = $client->get('http://www.example.com', array(), array( - 'timeout' => 20, - 'connect_timeout' => 1.5 - )); - -verify -~~~~~~ - -Set to true to enable SSL certificate validation (the default), false to disable SSL certificate validation, or supply -the path to a CA bundle to enable verification using a custom certificate. - -cert -~~~~ - -The `cert` option lets you specify a PEM formatted SSL client certificate to use with servers that require one. If the -certificate requires a password, provide an array with the password as the second item. - -This would typically be used in conjunction with the `ssl_key` option. - -.. code-block:: php - - $request = $client->get('https://www.example.com', array(), array( - 'cert' => '/etc/pki/client_certificate.pem' - ) - - $request = $client->get('https://www.example.com', array(), array( - 'cert' => array('/etc/pki/client_certificate.pem', 's3cr3tp455w0rd') - ) - -ssl_key -~~~~~~~ - -The `ssl_key` option lets you specify a file containing your PEM formatted private key, optionally protected by a password. -Note: your password is sensitive, keep the PHP script containing it safe. - -This would typically be used in conjunction with the `cert` option. - -.. code-block:: php - - $request = $client->get('https://www.example.com', array(), array( - 'ssl_key' => '/etc/pki/private_key.pem' - ) - - $request = $client->get('https://www.example.com', array(), array( - 'ssl_key' => array('/etc/pki/private_key.pem', 's3cr3tp455w0rd') - ) - -proxy -~~~~~ - -The `proxy` option is used to specify an HTTP proxy (e.g. `http://username:password@192.168.16.1:10`). - -debug -~~~~~ - -The `debug` option is used to show verbose cURL output for a transfer. - -stream -~~~~~~ - -When using a static client, you can set the `stream` option to true to return a `Guzzle\Stream\Stream` object that can -be used to pull data from a stream as needed (rather than have cURL download the entire contents of a response to a -stream all at once). - -.. code-block:: php - - $stream = Guzzle::get('http://guzzlephp.org', array('stream' => true)); - while (!$stream->feof()) { - echo $stream->readLine(); - } - -Sending requests ----------------- - -Requests can be sent by calling the ``send()`` method of a Request object, but you can also send requests using the -``send()`` method of a Client. - -.. code-block:: php - - $request = $client->get('http://www.amazon.com'); - $response = $client->send($request); - -Sending requests in parallel -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The Client's ``send()`` method accept a single ``Guzzle\Http\Message\RequestInterface`` object or an array of -RequestInterface objects. When an array is specified, the requests will be sent in parallel. - -Sending many HTTP requests serially (one at a time) can cause an unnecessary delay in a script's execution. Each -request must complete before a subsequent request can be sent. By sending requests in parallel, a pool of HTTP -requests can complete at the speed of the slowest request in the pool, significantly reducing the amount of time -needed to execute multiple HTTP requests. Guzzle provides a wrapper for the curl_multi functions in PHP. - -Here's an example of sending three requests in parallel using a client object: - -.. code-block:: php - - use Guzzle\Common\Exception\MultiTransferException; - - try { - $responses = $client->send(array( - $client->get('http://www.google.com/'), - $client->head('http://www.google.com/'), - $client->get('https://www.github.com/') - )); - } catch (MultiTransferException $e) { - - echo "The following exceptions were encountered:\n"; - foreach ($e as $exception) { - echo $exception->getMessage() . "\n"; - } - - echo "The following requests failed:\n"; - foreach ($e->getFailedRequests() as $request) { - echo $request . "\n\n"; - } - - echo "The following requests succeeded:\n"; - foreach ($e->getSuccessfulRequests() as $request) { - echo $request . "\n\n"; - } - } - -If the requests succeed, an array of ``Guzzle\Http\Message\Response`` objects are returned. A single request failure -will not cause the entire pool of requests to fail. Any exceptions thrown while transferring a pool of requests will -be aggregated into a ``Guzzle\Common\Exception\MultiTransferException`` exception. - -Plugins and events ------------------- - -Guzzle provides easy to use request plugins that add behavior to requests based on signal slot event notifications -powered by the -`Symfony2 Event Dispatcher component `_. Any -event listener or subscriber attached to a Client object will automatically be attached to each request created by the -client. - -Using the same cookie session for each request -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Attach a ``Guzzle\Plugin\Cookie\CookiePlugin`` to a client which will in turn add support for cookies to every request -created by a client, and each request will use the same cookie session: - -.. code-block:: php - - use Guzzle\Plugin\Cookie\CookiePlugin; - use Guzzle\Plugin\Cookie\CookieJar\ArrayCookieJar; - - // Create a new cookie plugin - $cookiePlugin = new CookiePlugin(new ArrayCookieJar()); - - // Add the cookie plugin to the client - $client->addSubscriber($cookiePlugin); - -.. _client-events: - -Events emitted from a client -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -A ``Guzzle\Http\Client`` object emits the following events: - -+------------------------------+--------------------------------------------+------------------------------------------+ -| Event name | Description | Event data | -+==============================+============================================+==========================================+ -| client.create_request | Called when a client creates a request | * client: The client | -| | | * request: The created request | -+------------------------------+--------------------------------------------+------------------------------------------+ - -.. code-block:: php - - use Guzzle\Common\Event; - use Guzzle\Http\Client; - - $client = new Client(); - - // Add a listener that will echo out requests as they are created - $client->getEventDispatcher()->addListener('client.create_request', function (Event $e) { - echo 'Client object: ' . spl_object_hash($e['client']) . "\n"; - echo "Request object: {$e['request']}\n"; - }); diff --git a/bb-vendor/guzzle/guzzle/docs/http-client/entity-bodies.rst b/bb-vendor/guzzle/guzzle/docs/http-client/entity-bodies.rst deleted file mode 100644 index 823b0c022..000000000 --- a/bb-vendor/guzzle/guzzle/docs/http-client/entity-bodies.rst +++ /dev/null @@ -1,151 +0,0 @@ -=========================== -Request and response bodies -=========================== - -`Entity body `_ is the term used for the body of an HTTP -message. The entity body of requests and responses is inherently a -`PHP stream `_ in Guzzle. The body of the request can be either a string or -a PHP stream which are converted into a ``Guzzle\Http\EntityBody`` object using its factory method. When using a -string, the entity body is stored in a `temp PHP stream `_. The use of -temp PHP streams helps to protect your application from running out of memory when sending or receiving large entity -bodies in your messages. When more than 2MB of data is stored in a temp stream, it automatically stores the data on -disk rather than in memory. - -EntityBody objects provide a great deal of functionality: compression, decompression, calculate the Content-MD5, -calculate the Content-Length (when the resource is repeatable), guessing the Content-Type, and more. Guzzle doesn't -need to load an entire entity body into a string when sending or retrieving data; entity bodies are streamed when -being uploaded and downloaded. - -Here's an example of gzip compressing a text file then sending the file to a URL: - -.. code-block:: php - - use Guzzle\Http\EntityBody; - - $body = EntityBody::factory(fopen('/path/to/file.txt', 'r+')); - echo $body->read(1024); - $body->seek(0, SEEK_END); - $body->write('foo'); - echo $body->ftell(); - $body->rewind(); - - // Send a request using the body - $response = $client->put('http://localhost:8080/uploads', null, $body)->send(); - -The body of the request can be specified in the ``Client::put()`` or ``Client::post()`` method, or, you can specify -the body of the request by calling the ``setBody()`` method of any -``Guzzle\Http\Message\EntityEnclosingRequestInterface`` object. - -Compression ------------ - -You can compress the contents of an EntityBody object using the ``compress()`` method. The compress method accepts a -filter that must match to one of the supported -`PHP stream filters `_ on your system (e.g. `zlib.deflate`, -``bzip2.compress``, etc). Compressing an entity body will stream the entire entity body through a stream compression -filter into a temporary PHP stream. You can uncompress an entity body using the ``uncompress()`` method and passing -the PHP stream filter to use when decompressing the stream (e.g. ``zlib.inflate``). - -.. code-block:: php - - use Guzzle\Http\EntityBody; - - $body = EntityBody::factory(fopen('/tmp/test.txt', 'r+')); - echo $body->getSize(); - // >>> 1048576 - - // Compress using the default zlib.deflate filter - $body->compress(); - echo $body->getSize(); - // >>> 314572 - - // Decompress the stream - $body->uncompress(); - echo $body->getSize(); - // >>> 1048576 - -Decorators ----------- - -Guzzle provides several EntityBody decorators that can be used to add functionality to an EntityBody at runtime. - -IoEmittingEntityBody -~~~~~~~~~~~~~~~~~~~~ - -This decorator will emit events when data is read from a stream or written to a stream. Add an event subscriber to the -entity body's ``body.read`` or ``body.write`` methods to receive notifications when data data is transferred. - -.. code-block:: php - - use Guzzle\Common\Event; - use Guzzle\Http\EntityBody; - use Guzzle\Http\IoEmittingEntityBody; - - $original = EntityBody::factory(fopen('/tmp/test.txt', 'r+')); - $body = new IoEmittingEntityBody($original); - - // Listen for read events - $body->getEventDispatcher()->addListener('body.read', function (Event $e) { - // Grab data from the event - $entityBody = $e['body']; - // Amount of data retrieved from the body - $lengthOfData = $e['length']; - // The actual data that was read - $data = $e['read']; - }); - - // Listen for write events - $body->getEventDispatcher()->addListener('body.write', function (Event $e) { - // Grab data from the event - $entityBody = $e['body']; - // The data that was written - $data = $e['write']; - // The actual amount of data that was written - $data = $e['read']; - }); - -ReadLimitEntityBody -~~~~~~~~~~~~~~~~~~~ - -The ReadLimitEntityBody decorator can be used to transfer a subset or slice of an existing EntityBody object. This can -be useful for breaking a large file into smaller pieces to be sent in chunks (e.g. Amazon S3's multipart upload API). - -.. code-block:: php - - use Guzzle\Http\EntityBody; - use Guzzle\Http\ReadLimitEntityBody; - - $original = EntityBody::factory(fopen('/tmp/test.txt', 'r+')); - echo $original->getSize(); - // >>> 1048576 - - // Limit the size of the body to 1024 bytes and start reading from byte 2048 - $body = new ReadLimitEntityBody($original, 1024, 2048); - echo $body->getSize(); - // >>> 1024 - echo $body->ftell(); - // >>> 0 - -CachingEntityBody -~~~~~~~~~~~~~~~~~ - -The CachingEntityBody decorator is used to allow seeking over previously read bytes on non-seekable read streams. This -can be useful when transferring a non-seekable entity body fails due to needing to rewind the stream (for example, -resulting from a redirect). Data that is read from the remote stream will be buffered in a PHP temp stream so that -previously read bytes are cached first in memory, then on disk. - -.. code-block:: php - - use Guzzle\Http\EntityBody; - use Guzzle\Http\CachingEntityBody; - - $original = EntityBody::factory(fopen('http://www.google.com', 'r')); - $body = new CachingEntityBody($original); - - $body->read(1024); - echo $body->ftell(); - // >>> 1024 - - $body->seek(0); - echo $body->ftell(); - // >>> 0 diff --git a/bb-vendor/guzzle/guzzle/docs/http-client/http-redirects.rst b/bb-vendor/guzzle/guzzle/docs/http-client/http-redirects.rst deleted file mode 100644 index 32ba26891..000000000 --- a/bb-vendor/guzzle/guzzle/docs/http-client/http-redirects.rst +++ /dev/null @@ -1,99 +0,0 @@ -============== -HTTP redirects -============== - -By default, Guzzle will automatically follow redirects using the non-RFC compliant implementation used by most web -browsers. This means that redirects for POST requests are followed by a GET request. You can force RFC compliance by -enabling the strict mode on a request's parameter object: - -.. code-block:: php - - // Set per request - $request = $client->post(); - $request->getParams()->set('redirect.strict', true); - - // You can set globally on a client so all requests use strict redirects - $client->getConfig()->set('request.params', array( - 'redirect.strict' => true - )); - -By default, Guzzle will redirect up to 5 times before throwing a ``Guzzle\Http\Exception\TooManyRedirectsException``. -You can raise or lower this value using the ``redirect.max`` parameter of a request object: - -.. code-block:: php - - $request->getParams()->set('redirect.max', 2); - -Redirect history ----------------- - -You can get the number of redirects of a request using the resulting response object's ``getRedirectCount()`` method. -Similar to cURL's ``effective_url`` property, Guzzle provides the effective URL, or the last redirect URL that returned -the request, in a response's ``getEffectiveUrl()`` method. - -When testing or debugging, it is often useful to see a history of redirects for a particular request. This can be -achieved using the HistoryPlugin. - -.. code-block:: php - - $request = $client->get('/'); - $history = new Guzzle\Plugin\History\HistoryPlugin(); - $request->addSubscriber($history); - $response = $request->send(); - - // Get the last redirect URL or the URL of the request that received - // this response - echo $response->getEffectiveUrl(); - - // Get the number of redirects - echo $response->getRedirectCount(); - - // Iterate over each sent request and response - foreach ($history->getAll() as $transaction) { - // Request object - echo $transaction['request']->getUrl() . "\n"; - // Response object - echo $transaction['response']->getEffectiveUrl() . "\n"; - } - - // Or, simply cast the HistoryPlugin to a string to view each request and response - echo $history; - -Disabling redirects -------------------- - -You can disable redirects on a client by passing a configuration option in the client's constructor: - -.. code-block:: php - - $client = new Client(null, array('redirect.disable' => true)); - -You can also disable redirects per request: - -.. code-block:: php - - $request = $client->get($url, array(), array('allow_redirects' => false)); - -Redirects and non-repeatable streams ------------------------------------- - -If you are redirected when sending data from a non-repeatable stream and some of the data has been read off of the -stream, then you will get a ``Guzzle\Http\Exception\CouldNotRewindStreamException``. You can get around this error by -adding a custom rewind method to the entity body object being sent in the request. - -.. code-block:: php - - $request = $client->post( - 'http://httpbin.com/redirect/2', - null, - fopen('http://httpbin.com/get', 'r') - ); - - // Add a custom function that can be used to rewind the stream - // (reopen in this example) - $request->getBody()->setRewindFunction(function ($body) { - $body->setStream(fopen('http://httpbin.com/get', 'r')); - return true; - ); - - $response = $client->send(); diff --git a/bb-vendor/guzzle/guzzle/docs/http-client/request.rst b/bb-vendor/guzzle/guzzle/docs/http-client/request.rst deleted file mode 100644 index a8387a915..000000000 --- a/bb-vendor/guzzle/guzzle/docs/http-client/request.rst +++ /dev/null @@ -1,667 +0,0 @@ -===================== -Using Request objects -===================== - -HTTP request messages ---------------------- - -Request objects are all about building an HTTP message. Each part of an HTTP request message can be set individually -using methods on the request object or set in bulk using the ``setUrl()`` method. Here's the format of an HTTP request -with each part of the request referencing the method used to change it:: - - PUT(a) /path(b)?query=123(c) HTTP/1.1(d) - X-Header(e): header - Content-Length(e): 4 - - data(f) - -+-------------------------+---------------------------------------------------------------------------------+ -| a. **Method** | The request method can only be set when instantiating a request | -+-------------------------+---------------------------------------------------------------------------------+ -| b. **Path** | ``$request->setPath('/path');`` | -+-------------------------+---------------------------------------------------------------------------------+ -| c. **Query** | ``$request->getQuery()->set('query', '123');`` | -+-------------------------+---------------------------------------------------------------------------------+ -| d. **Protocol version** | ``$request->setProtocolVersion('1.1');`` | -+-------------------------+---------------------------------------------------------------------------------+ -| e. **Header** | ``$request->setHeader('X-Header', 'header');`` | -+-------------------------+---------------------------------------------------------------------------------+ -| f. **Entity Body** | ``$request->setBody('data'); // Only available with PUT, POST, PATCH, DELETE`` | -+-------------------------+---------------------------------------------------------------------------------+ - -Creating requests with a client -------------------------------- - -Client objects are responsible for creating HTTP request objects. - -GET requests -~~~~~~~~~~~~ - -`GET requests `_ are the most common form of HTTP -requests. When you visit a website in your browser, the HTML of the website is downloaded using a GET request. GET -requests are idempotent requests that are typically used to download content (an entity) identified by a request URL. - -.. code-block:: php - - use Guzzle\Http\Client; - - $client = new Client(); - - // Create a request that has a query string and an X-Foo header - $request = $client->get('http://www.amazon.com?a=1', array('X-Foo' => 'Bar')); - - // Send the request and get the response - $response = $request->send(); - -You can change where the body of a response is downloaded on any request using the -``$request->setResponseBody(string|EntityBodyInterface|resource)`` method of a request. You can also set the ``save_to`` -option of a request: - -.. code-block:: php - - // Send the response body to a file - $request = $client->get('http://test.com', array(), array('save_to' => '/path/to/file')); - - // Send the response body to an fopen resource - $request = $client->get('http://test.com', array(), array('save_to' => fopen('/path/to/file', 'w'))); - -HEAD requests -~~~~~~~~~~~~~ - -`HEAD requests `_ work exactly like GET requests except -that they do not actually download the response body (entity) of the response message. HEAD requests are useful for -retrieving meta information about an entity identified by a Request-URI. - -.. code-block:: php - - $client = new Guzzle\Http\Client(); - $request = $client->head('http://www.amazon.com'); - $response = $request->send(); - echo $response->getContentLength(); - // >>> Will output the Content-Length header value - -DELETE requests -~~~~~~~~~~~~~~~ - -A `DELETE method `_ requests that the origin server -delete the resource identified by the Request-URI. - -.. code-block:: php - - $client = new Guzzle\Http\Client(); - $request = $client->delete('http://example.com'); - $response = $request->send(); - -POST requests -~~~~~~~~~~~~~ - -While `POST requests `_ can be used for a number of -reasons, POST requests are often used when submitting HTML form data to a website. POST requests can include an entity -body in the HTTP request. - -POST requests in Guzzle are sent with an ``application/x-www-form-urlencoded`` Content-Type header if POST fields are -present but no files are being sent in the POST. If files are specified in the POST request, then the Content-Type -header will become ``multipart/form-data``. - -The ``post()`` method of a client object accepts four arguments: the URL, optional headers, post fields, and an array of -request options. To send files in the POST request, prepend the ``@`` symbol to the array value (just like you would if -you were using the PHP ``curl_setopt`` function). - -Here's how to create a multipart/form-data POST request containing files and fields: - -.. code-block:: php - - $request = $client->post('http://httpbin.org/post', array(), array( - 'custom_field' => 'my custom value', - 'file_field' => '@/path/to/file.xml' - )); - - $response = $request->send(); - -.. note:: - - Remember to **always** sanitize user input when sending POST requests: - - .. code-block:: php - - // Prevent users from accessing sensitive files by sanitizing input - $_POST = array('firstname' => '@/etc/passwd'); - $request = $client->post('http://www.example.com', array(), array ( - 'firstname' => str_replace('@', '', $_POST['firstname']) - )); - -You can alternatively build up the contents of a POST request. - -.. code-block:: php - - $request = $client->post('http://httpbin.org/post') - ->setPostField('custom_field', 'my custom value') - ->addPostFile('file', '/path/to/file.xml'); - - $response = $request->send(); - -Raw POST data -^^^^^^^^^^^^^ - -POST requests can also contain raw POST data that is not related to HTML forms. - -.. code-block:: php - - $request = $client->post('http://httpbin.org/post', array(), 'this is the body'); - $response = $request->send(); - -You can set the body of POST request using the ``setBody()`` method of the -``Guzzle\Http\Message\EntityEnclosingRequest`` object. This method accepts a string, a resource returned from -``fopen``, or a ``Guzzle\Http\EntityBodyInterface`` object. - -.. code-block:: php - - $request = $client->post('http://httpbin.org/post'); - // Set the body of the POST to stream the contents of /path/to/large_body.txt - $request->setBody(fopen('/path/to/large_body.txt', 'r')); - $response = $request->send(); - -PUT requests -~~~~~~~~~~~~ - -The `PUT method `_ requests that the enclosed entity be -stored under the supplied Request-URI. PUT requests are similar to POST requests in that they both can send an entity -body in the request message. - -The body of a PUT request (any any ``Guzzle\Http\Message\EntityEnclosingRequestInterface`` object) is always stored as -a ``Guzzle\Http\Message\EntityBodyInterface`` object. This allows a great deal of flexibility when sending data to a -remote server. For example, you can stream the contents of a stream returned by fopen, stream the contents of a -callback function, or simply send a string of data. - -.. code-block:: php - - $request = $client->put('http://httpbin.org/put', array(), 'this is the body'); - $response = $request->send(); - -Just like with POST, PATH, and DELETE requests, you can set the body of a PUT request using the ``setBody()`` method. - -.. code-block:: php - - $request = $client->put('http://httpbin.org/put'); - $request->setBody(fopen('/path/to/large_body.txt', 'r')); - $response = $request->send(); - -PATCH requests -~~~~~~~~~~~~~~ - -`PATCH requests `_ are used to modify a resource. - -.. code-block:: php - - $request = $client->patch('http://httpbin.org', array(), 'this is the body'); - $response = $request->send(); - -OPTIONS requests -~~~~~~~~~~~~~~~~ - -The `OPTIONS method `_ represents a request for -information about the communication options available on the request/response chain identified by the Request-URI. - -.. code-block:: php - - $request = $client->options('http://httpbin.org'); - $response = $request->send(); - - // Check if the PUT method is supported by this resource - var_export($response->isMethodAllows('PUT')); - -Custom requests -~~~~~~~~~~~~~~~ - -You can create custom HTTP requests that use non-standard HTTP methods using the ``createRequest()`` method of a -client object. - -.. code-block:: php - - $request = $client->createRequest('COPY', 'http://example.com/foo', array( - 'Destination' => 'http://example.com/bar', - 'Overwrite' => 'T' - )); - $response = $request->send(); - -Query string parameters ------------------------ - -Query string parameters of a request are owned by a request's ``Guzzle\Http\Query`` object that is accessible by -calling ``$request->getQuery()``. The Query class extends from ``Guzzle\Common\Collection`` and allows you to set one -or more query string parameters as key value pairs. You can set a parameter on a Query object using the -``set($key, $value)`` method or access the query string object like an associative array. Any previously specified -value for a key will be overwritten when using ``set()``. Use ``add($key, $value)`` to add a value to query string -object, and in the event of a collision with an existing value at a specific key, the value will be converted to an -array that contains all of the previously set values. - -.. code-block:: php - - $request = new Guzzle\Http\Message\Request('GET', 'http://www.example.com?foo=bar&abc=123'); - - $query = $request->getQuery(); - echo "{$query}\n"; - // >>> foo=bar&abc=123 - - $query->remove('abc'); - echo "{$query}\n"; - // >>> foo=bar - - $query->set('foo', 'baz'); - echo "{$query}\n"; - // >>> foo=baz - - $query->add('foo', 'bar'); - echo "{$query}\n"; - // >>> foo%5B0%5D=baz&foo%5B1%5D=bar - -Whoah! What happened there? When ``foo=bar`` was added to the existing ``foo=baz`` query string parameter, the -aggregator associated with the Query object was used to help convert multi-value query string parameters into a string. -Let's disable URL-encoding to better see what's happening. - -.. code-block:: php - - $query->useUrlEncoding(false); - echo "{$query}\n"; - // >>> foo[0]=baz&foo[1]=bar - -.. note:: - - URL encoding can be disabled by passing false, enabled by passing true, set to use RFC 1738 by passing - ``Query::FORM_URLENCODED`` (internally uses PHP's ``urlencode`` function), or set to RFC 3986 by passing - ``Query::RFC_3986`` (this is the default and internally uses PHP's ``rawurlencode`` function). - -As you can see, the multiple values were converted into query string parameters following the default PHP convention of -adding numerically indexed square bracket suffixes to each key (``foo[0]=baz&foo[1]=bar``). The strategy used to convert -multi-value parameters into a string can be customized using the ``setAggregator()`` method of the Query class. Guzzle -ships with the following query string aggregators by default: - -1. ``Guzzle\Http\QueryAggregator\PhpAggregator``: Aggregates using PHP style brackets (e.g. ``foo[0]=baz&foo[1]=bar``) -2. ``Guzzle\Http\QueryAggregator\DuplicateAggregator``: Performs no aggregation and allows for key value pairs to be - repeated in a URL (e.g. ``foo=baz&foo=bar``) -3. ``Guzzle\Http\QueryAggregator\CommaAggregator``: Aggregates using commas (e.g. ``foo=baz,bar``) - -.. _http-message-headers: - -HTTP Message Headers --------------------- - -HTTP message headers are case insensitive, multiple occurrences of any header can be present in an HTTP message -(whether it's valid or not), and some servers require specific casing of particular headers. Because of this, request -and response headers are stored in ``Guzzle\Http\Message\Header`` objects. The Header object can be cast as a string, -counted, or iterated to retrieve each value from the header. Casting a Header object to a string will return all of -the header values concatenated together using a glue string (typically ", "). - -A request (and response) object have several methods that allow you to retrieve and modify headers. - -* ``getHeaders()``: Get all of the headers of a message as a ``Guzzle\Http\Message\Header\HeaderCollection`` object. -* ``getHeader($header)``: Get a specific header from a message. If the header exists, you'll get a - ``Guzzle\Http\Message\Header`` object. If the header does not exist, this methods returns ``null``. -* ``hasHeader($header)``: Returns true or false based on if the message has a particular header. -* ``setHeader($header, $value)``: Set a header value and overwrite any previously set value for this header. -* ``addHeader($header, $value)``: Add a header with a particular name. If a previous value was already set by the same, - then the header will contain multiple values. -* ``removeHeader($header)``: Remove a header by name from the message. - -.. code-block:: php - - $request = new Request('GET', 'http://httpbin.com/cookies'); - // addHeader will set and append to any existing header values - $request->addHeader('Foo', 'bar'); - $request->addHeader('foo', 'baz'); - // setHeader overwrites any existing values - $request->setHeader('Test', '123'); - - // Request headers can be cast as a string - echo $request->getHeader('Foo'); - // >>> bar, baz - echo $request->getHeader('Test'); - // >>> 123 - - // You can count the number of headers of a particular case insensitive name - echo count($request->getHeader('foO')); - // >>> 2 - - // You can iterate over Header objects - foreach ($request->getHeader('foo') as $header) { - echo $header . "\n"; - } - - // You can get all of the request headers as a Guzzle\Http\Message\Header\HeaderCollection object - $headers = $request->getHeaders(); - - // Missing headers return NULL - var_export($request->getHeader('Missing')); - // >>> null - - // You can see all of the different variations of a header by calling raw() on the Header - var_export($request->getHeader('foo')->raw()); - -Setting the body of a request ------------------------------ - -Requests that can send a body (e.g. PUT, POST, DELETE, PATCH) are instances of -``Guzzle\Http\Message\EntityEnclosingRequestInterface``. Entity enclosing requests contain several methods that allow -you to specify the body to send with a request. - -Use the ``setBody()`` method of a request to set the body that will be sent with a request. This method accepts a -string, a resource returned by ``fopen()``, an array, or an instance of ``Guzzle\Http\EntityBodyInterface``. The body -will then be streamed from the underlying ``EntityBodyInterface`` object owned by the request. When setting the body -of the request, you can optionally specify a Content-Type header and whether or not to force the request to use -chunked Transfer-Encoding. - -.. code-block:: php - - $request = $client->put('/user.json'); - $request->setBody('{"foo":"baz"}', 'application/json'); - -Content-Type header -~~~~~~~~~~~~~~~~~~~ - -Guzzle will automatically add a Content-Type header to a request if the Content-Type can be guessed based on the file -extension of the payload being sent or the file extension present in the path of a request. - -.. code-block:: php - - $request = $client->put('/user.json', array(), '{"foo":"bar"}'); - // The Content-Type was guessed based on the path of the request - echo $request->getHeader('Content-Type'); - // >>> application/json - - $request = $client->put('/user.json'); - $request->setBody(fopen('/tmp/user_data.json', 'r')); - // The Content-Type was guessed based on the path of the entity body - echo $request->getHeader('Content-Type'); - // >>> application/json - -Transfer-Encoding: chunked header -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -When sending HTTP requests that contain a payload, you must let the remote server know how to determine when the entire -message has been sent. This usually is done by supplying a ``Content-Length`` header that tells the origin server the -size of the body that is to be sent. In some cases, the size of the payload being sent in a request cannot be known -before initiating the transfer. In these cases (when using HTTP/1.1), you can use the ``Transfer-Encoding: chunked`` -header. - -If the Content-Length cannot be determined (i.e. using a PHP ``http://`` stream), then Guzzle will automatically add -the ``Transfer-Encoding: chunked`` header to the request. - -.. code-block:: php - - $request = $client->put('/user.json'); - $request->setBody(fopen('http://httpbin.org/get', 'r')); - - // The Content-Length could not be determined - echo $request->getHeader('Transfer-Encoding'); - // >>> chunked - -See :doc:`/http-client/entity-bodies` for more information on entity bodies. - -Expect: 100-Continue header -~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The ``Expect: 100-Continue`` header is used to help a client prevent sending a large payload to a server that will -reject the request. This allows clients to fail fast rather than waste bandwidth sending an erroneous payload. Guzzle -will automatically add the ``Expect: 100-Continue`` header to a request when the size of the payload exceeds 1MB or if -the body of the request is not seekable (this helps to prevent errors when a non-seekable body request is redirected). - -.. note:: - - If you find that your larger requests are taking too long to complete, you should first check if the - ``Expect: 100-Continue`` header is being sent with the request. Some servers do not respond well to this header, - which causes cURL to sleep for `1 second `_. - -POST fields and files -~~~~~~~~~~~~~~~~~~~~~ - -Any entity enclosing request can send POST style fields and files. This includes POST, PUT, PATCH, and DELETE requests. -Any request that has set POST fields or files will use cURL's POST message functionality. - -.. code-block:: php - - $request = $client->post('/post'); - // Set an overwrite any previously specified value - $request->setPostField('foo', 'bar'); - // Append a value to any existing values - $request->getPostFields()->add('foo', 'baz'); - // Remove a POST field by name - $request->removePostField('fizz'); - - // Add a file to upload (forces multipart/form-data) - $request->addPostFile('my_file', '/path/to/file', 'plain/text'); - // Remove a POST file by POST key name - $request->removePostFile('my_other_file'); - -.. tip:: - - Adding a large number of POST fields to a POST request is faster if you use the ``addPostFields()`` method so that - you can add and process multiple fields with a single call. Adding multiple POST files is also faster using - ``addPostFiles()``. - -Working with cookies --------------------- - -Cookies can be modified and retrieved from a request using the following methods: - -.. code-block:: php - - $request->addCookie($name, $value); - $request->removeCookie($name); - $value = $request->getCookie($name); - $valueArray = $request->getCookies(); - -Use the :doc:`cookie plugin ` if you need to reuse cookies between requests. - -.. _request-set-response-body: - -Changing where a response is downloaded ----------------------------------------- - -When a request is sent, the body of the response will be stored in a PHP temp stream by default. You can change the -location in which the response will be downloaded using ``$request->setResponseBody($body)`` or the ``save_to`` request -option. This can be useful for downloading the contents of a URL to a specific file. - -Here's an example of using request options: - -.. code-block:: php - - $request = $this->client->get('http://example.com/large.mov', array(), array( - 'save_to' => '/tmp/large_file.mov' - )); - $request->send(); - var_export(file_exists('/tmp/large_file.mov')); - // >>> true - -Here's an example of using ``setResponseBody()``: - -.. code-block:: php - - $body = fopen('/tmp/large_file.mov', 'w'); - $request = $this->client->get('http://example.com/large.mov'); - $request->setResponseBody($body); - - // You can more easily specify the name of a file to save the contents - // of the response to by passing a string to ``setResponseBody()``. - - $request = $this->client->get('http://example.com/large.mov'); - $request->setResponseBody('/tmp/large_file.mov'); - -Custom cURL options -------------------- - -Most of the functionality implemented in the libcurl bindings has been simplified and abstracted by Guzzle. Developers -who need access to `cURL specific functionality `_ can still add cURL handle -specific behavior to Guzzle HTTP requests by modifying the cURL options collection of a request: - -.. code-block:: php - - $request->getCurlOptions()->set(CURLOPT_LOW_SPEED_LIMIT, 200); - -Other special options that can be set in the ``curl.options`` array include: - -+-------------------------+---------------------------------------------------------------------------------+ -| debug | Adds verbose cURL output to a temp stream owned by the cURL handle object | -+-------------------------+---------------------------------------------------------------------------------+ -| progress | Instructs cURL to emit events when IO events occur. This allows you to be | -| | notified when bytes are transferred over the wire by subscribing to a request's | -| | ``curl.callback.read``, ``curl.callback.write``, and ``curl.callback.progress`` | -| | events. | -+-------------------------+---------------------------------------------------------------------------------+ - -Request options ---------------- - -Requests options can be specified when creating a request or in the ``request.options`` parameter of a client. These -options can control various aspects of a request including: headers to send, query string data, where the response -should be downloaded, proxies, auth, etc. - -.. code-block:: php - - $request = $client->get($url, $headers, array('proxy' => 'http://proxy.com')); - -See :ref:`Request options ` for more information. - -Working with errors -------------------- - -HTTP errors -~~~~~~~~~~~ - -Requests that receive a 4xx or 5xx response will throw a ``Guzzle\Http\Exception\BadResponseException``. More -specifically, 4xx errors throw a ``Guzzle\Http\Exception\ClientErrorResponseException``, and 5xx errors throw a -``Guzzle\Http\Exception\ServerErrorResponseException``. You can catch the specific exceptions or just catch the -BadResponseException to deal with either type of error. Here's an example of catching a generic BadResponseException: - -.. code-block:: php - - try { - $response = $client->get('/not_found.xml')->send(); - } catch (Guzzle\Http\Exception\BadResponseException $e) { - echo 'Uh oh! ' . $e->getMessage(); - echo 'HTTP request URL: ' . $e->getRequest()->getUrl() . "\n"; - echo 'HTTP request: ' . $e->getRequest() . "\n"; - echo 'HTTP response status: ' . $e->getResponse()->getStatusCode() . "\n"; - echo 'HTTP response: ' . $e->getResponse() . "\n"; - } - -Throwing an exception when a 4xx or 5xx response is encountered is the default behavior of Guzzle requests. This -behavior can be overridden by adding an event listener with a higher priority than -255 that stops event propagation. -You can subscribe to ``request.error`` to receive notifications any time an unsuccessful response is received. - -You can change the response that will be associated with the request by calling ``setResponse()`` on the -``$event['request']`` object passed into your listener, or by changing the ``$event['response']`` value of the -``Guzzle\Common\Event`` object that is passed to your listener. Transparently changing the response associated with a -request by modifying the event allows you to retry failed requests without complicating the code that uses the client. -This might be useful for sending requests to a web service that has expiring auth tokens. When a response shows that -your token has expired, you can get a new token, retry the request with the new token, and return the successful -response to the user. - -Here's an example of retrying a request using updated authorization credentials when a 401 response is received, -overriding the response of the original request with the new response, and still allowing the default exception -behavior to be called when other non-200 response status codes are encountered: - -.. code-block:: php - - // Add custom error handling to any request created by this client - $client->getEventDispatcher()->addListener('request.error', function(Event $event) { - - if ($event['response']->getStatusCode() == 401) { - - $newRequest = $event['request']->clone(); - $newRequest->setHeader('X-Auth-Header', MyApplication::getNewAuthToken()); - $newResponse = $newRequest->send(); - - // Set the response object of the request without firing more events - $event['response'] = $newResponse; - - // You can also change the response and fire the normal chain of - // events by calling $event['request']->setResponse($newResponse); - - // Stop other events from firing when you override 401 responses - $event->stopPropagation(); - } - - }); - -cURL errors -~~~~~~~~~~~ - -Connection problems and cURL specific errors can also occur when transferring requests using Guzzle. When Guzzle -encounters cURL specific errors while transferring a single request, a ``Guzzle\Http\Exception\CurlException`` is -thrown with an informative error message and access to the cURL error message. - -A ``Guzzle\Http\Exception\MultiTransferException`` exception is thrown when a cURL specific error occurs while -transferring multiple requests in parallel. You can then iterate over all of the exceptions encountered during the -transfer. - -Plugins and events ------------------- - -Guzzle request objects expose various events that allow you to hook in custom logic. A request object owns a -``Symfony\Component\EventDispatcher\EventDispatcher`` object that can be accessed by calling -``$request->getEventDispatcher()``. You can use the event dispatcher to add listeners (a simple callback function) or -event subscribers (classes that listen to specific events of a dispatcher). You can add event subscribers to a request -directly by just calling ``$request->addSubscriber($mySubscriber);``. - -.. _request-events: - -Events emitted from a request -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -A ``Guzzle\Http\Message\Request`` and ``Guzzle\Http\Message\EntityEnclosingRequest`` object emit the following events: - -+------------------------------+--------------------------------------------+------------------------------------------+ -| Event name | Description | Event data | -+==============================+============================================+==========================================+ -| request.before_send | About to send request | * request: Request to be sent | -+------------------------------+--------------------------------------------+------------------------------------------+ -| request.sent | Sent the request | * request: Request that was sent | -| | | * response: Received response | -+------------------------------+--------------------------------------------+------------------------------------------+ -| request.complete | Completed a full HTTP transaction | * request: Request that was sent | -| | | * response: Received response | -+------------------------------+--------------------------------------------+------------------------------------------+ -| request.success | Completed a successful request | * request: Request that was sent | -| | | * response: Received response | -+------------------------------+--------------------------------------------+------------------------------------------+ -| request.error | Completed an unsuccessful request | * request: Request that was sent | -| | | * response: Received response | -+------------------------------+--------------------------------------------+------------------------------------------+ -| request.exception | An unsuccessful response was | * request: Request | -| | received. | * response: Received response | -| | | * exception: BadResponseException | -+------------------------------+--------------------------------------------+------------------------------------------+ -| request.receive.status_line | Received the start of a response | * line: Full response start line | -| | | * status_code: Status code | -| | | * reason_phrase: Reason phrase | -| | | * previous_response: (e.g. redirect) | -+------------------------------+--------------------------------------------+------------------------------------------+ -| curl.callback.progress | cURL progress event (only dispatched when | * handle: CurlHandle | -| | ``emit_io`` is set on a request's curl | * download_size: Total download size | -| | options) | * downloaded: Bytes downloaded | -| | | * upload_size: Total upload bytes | -| | | * uploaded: Bytes uploaded | -+------------------------------+--------------------------------------------+------------------------------------------+ -| curl.callback.write | cURL event called when data is written to | * request: Request | -| | an outgoing stream | * write: Data being written | -+------------------------------+--------------------------------------------+------------------------------------------+ -| curl.callback.read | cURL event called when data is written to | * request: Request | -| | an incoming stream | * read: Data being read | -+------------------------------+--------------------------------------------+------------------------------------------+ - -Creating a request event listener -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Here's an example that listens to the ``request.complete`` event of a request and prints the request and response. - -.. code-block:: php - - use Guzzle\Common\Event; - - $request = $client->get('http://www.google.com'); - - // Echo out the response that was received - $request->getEventDispatcher()->addListener('request.complete', function (Event $e) { - echo $e['request'] . "\n\n"; - echo $e['response']; - }); diff --git a/bb-vendor/guzzle/guzzle/docs/http-client/response.rst b/bb-vendor/guzzle/guzzle/docs/http-client/response.rst deleted file mode 100644 index ba487316f..000000000 --- a/bb-vendor/guzzle/guzzle/docs/http-client/response.rst +++ /dev/null @@ -1,141 +0,0 @@ -====================== -Using Response objects -====================== - -Sending a request will return a ``Guzzle\Http\Message\Response`` object. You can view the raw HTTP response message by -casting the Response object to a string. Casting the response to a string will return the entity body of the response -as a string too, so this might be an expensive operation if the entity body is stored in a file or network stream. If -you only want to see the response headers, you can call ``getRawHeaders()``. - -Response status line --------------------- - -The different parts of a response's `status line `_ -(the first line of the response HTTP message) are easily retrievable. - -.. code-block:: php - - $response = $client->get('http://www.amazon.com')->send(); - - echo $response->getStatusCode(); // >>> 200 - echo $response->getReasonPhrase(); // >>> OK - echo $response->getProtocol(); // >>> HTTP - echo $response->getProtocolVersion(); // >>> 1.1 - -You can determine the type of the response using several helper methods: - -.. code-block:: php - - $response->isSuccessful(); // true - $response->isInformational(); - $response->isRedirect(); - $response->isClientError(); - $response->isServerError(); - -Response headers ----------------- - -The Response object contains helper methods for retrieving common response headers. These helper methods normalize the -variations of HTTP response headers. - -.. code-block:: php - - $response->getCacheControl(); - $response->getContentType(); - $response->getContentLength(); - $response->getContentEncoding(); - $response->getContentMd5(); - $response->getEtag(); - // etc... There are methods for every known response header - -You can interact with the Response headers using the same exact methods used to interact with Request headers. See -:ref:`http-message-headers` for more information. - -.. code-block:: php - - echo $response->getHeader('Content-Type'); - echo $response->getHeader('Content-Length'); - echo $response->getHeaders()['Content-Type']; // PHP 5.4 - -Response body -------------- - -The entity body object of a response can be retrieved by calling ``$response->getBody()``. The response EntityBody can -be cast to a string, or you can pass ``true`` to this method to retrieve the body as a string. - -.. code-block:: php - - $request = $client->get('http://www.amazon.com'); - $response = $request->send(); - echo $response->getBody(); - -See :doc:`/http-client/entity-bodies` for more information on entity bodies. - -JSON Responses -~~~~~~~~~~~~~~ - -You can easily parse and use a JSON response as an array using the ``json()`` method of a response. This method will -always return an array if the response is valid JSON or if the response body is empty. You will get an exception if you -call this method and the response is not valid JSON. - -.. code-block:: php - - $data = $response->json(); - echo gettype($data); - // >>> array - -XML Responses -~~~~~~~~~~~~~ - -You can easily parse and use a XML response as SimpleXMLElement object using the ``xml()`` method of a response. This -method will always return a SimpleXMLElement object if the response is valid XML or if the response body is empty. You -will get an exception if you call this method and the response is not valid XML. - -.. code-block:: php - - $xml = $response->xml(); - echo $xml->foo; - // >>> Bar! - -Streaming responses -------------------- - -Some web services provide streaming APIs that allow a client to keep a HTTP request open for an extended period of -time while polling and reading. Guzzle provides a simple way to convert HTTP request messages into -``Guzzle\Stream\Stream`` objects so that you can send the initial headers of a request, read the response headers, and -pull in the response body manually as needed. - -Here's an example using the Twitter Streaming API to track the keyword "bieber": - -.. code-block:: php - - use Guzzle\Http\Client; - use Guzzle\Stream\PhpStreamRequestFactory; - - $client = new Client('https://stream.twitter.com/1'); - - $request = $client->post('statuses/filter.json', null, array( - 'track' => 'bieber' - )); - - $request->setAuth('myusername', 'mypassword'); - - $factory = new PhpStreamRequestFactory(); - $stream = $factory->fromRequest($request); - - // Read until the stream is closed - while (!$stream->feof()) { - // Read a line from the stream - $line = $stream->readLine(); - // JSON decode the line of data - $data = json_decode($line, true); - } - -You can use the ``stream`` request option when using a static client to more easily create a streaming response. - -.. code-block:: php - - $stream = Guzzle::get('http://guzzlephp.org', array('stream' => true)); - while (!$stream->feof()) { - echo $stream->readLine(); - } diff --git a/bb-vendor/guzzle/guzzle/docs/http-client/uri-templates.rst b/bb-vendor/guzzle/guzzle/docs/http-client/uri-templates.rst deleted file mode 100644 index c18ac3e8d..000000000 --- a/bb-vendor/guzzle/guzzle/docs/http-client/uri-templates.rst +++ /dev/null @@ -1,52 +0,0 @@ -============= -URI templates -============= - -The ``$uri`` passed to one of the client's request creational methods or the base URL of a client can utilize URI -templates. Guzzle supports the entire `URI templates RFC `_. URI templates add a -special syntax to URIs that replace template place holders with user defined variables. - -Every request created by a Guzzle HTTP client passes through a URI template so that URI template expressions are -automatically expanded: - -.. code-block:: php - - $client = new Guzzle\Http\Client('https://example.com/', array('a' => 'hi')); - $request = $client->get('/{a}'); - -Because of URI template expansion, the URL of the above request will become ``https://example.com/hi``. Notice that -the template was expanded using configuration variables of the client. You can pass in custom URI template variables -by passing the URI of your request as an array where the first index of the array is the URI template and the second -index of the array are template variables that are merged into the client's configuration variables. - -.. code-block:: php - - $request = $client->get(array('/test{?a,b}', array('b' => 'there'))); - -The URL for this request will become ``https://test.com?a=hi&b=there``. URI templates aren't limited to just simple -variable replacements; URI templates can provide an enormous amount of flexibility when creating request URIs. - -.. code-block:: php - - $request = $client->get(array('http://example.com{+path}{/segments*}{?query,data*}', array( - 'path' => '/foo/bar', - 'segments' => array('one', 'two'), - 'query' => 'test', - 'data' => array( - 'more' => 'value' - ) - ))); - -The resulting URL would become ``http://example.com/foo/bar/one/two?query=test&more=value``. - -By default, URI template expressions are enclosed in an opening and closing brace (e.g. ``{var}``). If you are working -with a web service that actually uses braces (e.g. Solr), then you can specify a custom regular expression to use to -match URI template expressions. - -.. code-block:: php - - $client->getUriTemplate()->setRegex('/\<\$(.+)\>/'); - $client->get('/<$a>'); - -You can learn about all of the different features of URI templates by reading the -`URI templates RFC `_. diff --git a/bb-vendor/guzzle/guzzle/docs/index.rst b/bb-vendor/guzzle/guzzle/docs/index.rst deleted file mode 100644 index f76f3bbe6..000000000 --- a/bb-vendor/guzzle/guzzle/docs/index.rst +++ /dev/null @@ -1,5 +0,0 @@ -.. title:: Guzzle | PHP HTTP client and framework for consuming RESTful web services -.. toctree:: - :hidden: - - docs.rst diff --git a/bb-vendor/guzzle/guzzle/docs/iterators/guzzle-iterators.rst b/bb-vendor/guzzle/guzzle/docs/iterators/guzzle-iterators.rst deleted file mode 100644 index a5c7fd33f..000000000 --- a/bb-vendor/guzzle/guzzle/docs/iterators/guzzle-iterators.rst +++ /dev/null @@ -1,97 +0,0 @@ -================ -Guzzle iterators -================ - -Guzzle provides several SPL iterators that can be used with other SPL iterators, including Guzzle resource iterators. -Guzzle's ``guzzle/iterator`` component can also be used independently of the rest of Guzzle through Packagist and -Composer: https://packagist.org/packages/guzzle/iterator - -ChunkedIterator ---------------- - -Pulls out multiple values from an inner iterator and yields and array of values for each outer iteration -- essentially -pulling out chunks of values from the inner iterator. - -.. code-block:: php - - use Guzzle\Iterator\ChunkedIterator; - - $inner = new ArrayIterator(range(0, 8)); - $chunkedIterator = new ChunkedIterator($inner, 2); - - foreach ($chunkedIterator as $chunk) { - echo implode(', ', $chunk) . "\n"; - } - - // >>> 0, 1 - // >>> 2, 3 - // >>> 4, 5 - // >>> 6, 7 - // >>> 8 - -FilterIterator --------------- - -This iterator is used to filter values out of the inner iterator. This iterator can be used when PHP 5.4's -CallbackFilterIterator is not available. - -.. code-block:: php - - use Guzzle\Iterator\FilterIterator; - - $inner = new ArrayIterator(range(1, 10)); - $filterIterator = new FilterIterator($inner, function ($value) { - return $value % 2; - }); - - foreach ($filterIterator as $value) { - echo $value . "\n"; - } - - // >>> 2 - // >>> 4 - // >>> 6 - // >>> 8 - // >>> 10 - -MapIterator ------------ - -This iterator modifies the values of the inner iterator before yielding. - -.. code-block:: php - - use Guzzle\Iterator\MapIterator; - - $inner = new ArrayIterator(range(0, 3)); - - $mapIterator = new MapIterator($inner, function ($value) { - return $value * 10; - }); - - foreach ($mapIterator as $value) { - echo $value . "\n"; - } - - // >>> 0 - // >>> 10 - // >>> 20 - // >>> 30 - -MethodProxyIterator -------------------- - -This decorator is useful when you need to expose a specific method from an inner iterator that might be wrapper -by one or more iterator decorators. This decorator proxies missing method calls to each inner iterator until one -of the inner iterators can fulfill the call. - -.. code-block:: php - - use Guzzle\Iterator\MethodProxyIterator; - - $inner = new \ArrayIterator(); - $proxy = new MethodProxyIterator($inner); - - // Proxy method calls to the ArrayIterator - $proxy->append('a'); - $proxy->append('b'); diff --git a/bb-vendor/guzzle/guzzle/docs/iterators/resource-iterators.rst b/bb-vendor/guzzle/guzzle/docs/iterators/resource-iterators.rst deleted file mode 100644 index ce0bee59f..000000000 --- a/bb-vendor/guzzle/guzzle/docs/iterators/resource-iterators.rst +++ /dev/null @@ -1,149 +0,0 @@ -================== -Resource iterators -================== - -Web services often implement pagination in their responses which requires the end-user to issue a series of consecutive -requests in order to fetch all of the data they asked for. Users of your web service client should not be responsible -for implementing the logic involved in iterating through pages of results. Guzzle provides a simple resource iterator -foundation to make it easier on web service client developers to offer a useful abstraction layer. - -Getting an iterator from a client ---------------------------------- - - ResourceIteratorInterface Guzzle\Service\Client::getIterator($command [, array $commandOptions, array $iteratorOptions ]) - -The ``getIterator`` method of a ``Guzzle\Service\ClientInterface`` object provides a convenient interface for -instantiating a resource iterator for a specific command. This method implicitly uses a -``Guzzle\Service\Resource\ResourceIteratorFactoryInterface`` object to create resource iterators. Pass an -instantiated command object or the name of a command in the first argument. When passing the name of a command, the -command factory of the client will create the command by name using the ``$commandOptions`` array. The third argument -may be used to pass an array of options to the constructor of the instantiated ``ResourceIteratorInterface`` object. - -.. code-block:: php - - $iterator = $client->getIterator('get_users'); - - foreach ($iterator as $user) { - echo $user['name'] . ' age ' . $user['age'] . PHP_EOL; - } - -The above code sample might execute a single request or a thousand requests. As a consumer of a web service, I don't -care. I just want to iterate over all of the users. - -Iterator options -~~~~~~~~~~~~~~~~ - -The two universal options that iterators should support are ``limit`` and ``page_size``. Using the ``limit`` option -tells the resource iterator to attempt to limit the total number of iterated resources to a specific amount. Keep in -mind that this is not always possible due to limitations that may be inherent to a web service. The ``page_size`` -option is used to tell a resource iterator how many resources to request per page of results. Much like the ``limit`` -option, you can not rely on getting back exactly the number of resources your specify in the ``page_size`` option. - -.. note:: - - The ``limit`` and ``page_size`` options can also be specified on an iterator using the ``setLimit($limit)`` and - ``setPageSize($pageSize)`` methods. - -Resolving iterator class names -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The default resource iterator factory of a client object expects that your iterators are stored under the ``Model`` -folder of your client and that an iterator is names after the CamelCase name of a command followed by the word -"Iterator". For example, if you wanted to create an iterator for the ``get_users`` command, then your iterator class -would be ``Model\GetUsersIterator`` and would be stored in ``Model/GetUsersIterator.php``. - -Creating an iterator --------------------- - -While not required, resource iterators in Guzzle typically iterate using a ``Guzzle\Service\Command\CommandInterface`` -object. ``Guzzle\Service\Resource\ResourceIterator``, the default iterator implementation that you should extend, -accepts a command object and array of iterator options in its constructor. The command object passed to the resource -iterator is expected to be ready to execute and not previously executed. The resource iterator keeps a reference of -this command and clones the original command each time a subsequent request needs to be made to fetch more data. - -Implement the sendRequest method -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The most important thing (and usually the only thing) you need to do when creating a resource iterator is to implement -the ``sendRequest()`` method of the resource iterator. The ``sendRequest()`` method is called when you begin -iterating or if there are no resources left to iterate and it you expect to retrieve more resources by making a -subsequent request. The ``$this->command`` property of the resource iterator is updated with a cloned copy of the -original command object passed into the constructor of the iterator. Use this command object to issue your subsequent -requests. - -The ``sendRequest()`` method must return an array of the resources you retrieved from making the subsequent call. -Returning an empty array will stop the iteration. If you suspect that your web service client will occasionally return -an empty result set but still requires further iteration, then you must implement a sort of loop in your -``sendRequest()`` method that will continue to issue subsequent requests until your reach the end of the paginated -result set or until additional resources are retrieved from the web service. - -Update the nextToken property -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Beyond fetching more results, the ``sendRequest()`` method is responsible for updating the ``$this->nextToken`` -property of the iterator. Setting this property to anything other than null tells the iterator that issuing a -subsequent request using the nextToken value will probably return more results. You must continually update this -value in your ``sendRequest()`` method as each response is received from the web service. - -Example iterator ----------------- - -Let's say you want to implement a resource iterator for the ``get_users`` command of your web service. The -``get_users`` command receives a response that contains a list of users, and if there are more pages of results to -retrieve, returns a value called ``next_user``. This return value is known as the **next token** and should be used to -issue subsequent requests. - -Assume the response to a ``get_users`` command returns JSON data that looks like this: - -.. code-block:: javascript - - { - "users": [ - { "name": "Craig Johnson", "age": 10 }, - { "name": "Tom Barker", "age": 20 }, - { "name": "Bob Mitchell", "age": 74 } - ], - "next_user": "Michael Dowling" - } - -Assume that because there is a ``next_user`` value, there will be more users if a subsequent request is issued. If the -``next_user`` value is missing or null, then we know there are no more results to fetch. Let's implement a resource -iterator for this command. - -.. code-block:: php - - namespace MyService\Model; - - use Guzzle\Service\Resource\ResourceIterator; - - /** - * Iterate over a get_users command - */ - class GetUsersIterator extends ResourceIterator - { - protected function sendRequest() - { - // If a next token is set, then add it to the command - if ($this->nextToken) { - $this->command->set('next_user', $this->nextToken); - } - - // Execute the command and parse the result - $result = $this->command->execute(); - - // Parse the next token - $this->nextToken = isset($result['next_user']) ? $result['next_user'] : false; - - return $result['users']; - } - } - -As you can see, it's pretty simple to implement an iterator. There are a few things that you should notice from this -example: - -1. You do not need to create a new command in the ``sendRequest()`` method. A new command object is cloned from the - original command passed into the constructor of the iterator before the ``sendRequest()`` method is called. - Remember that the resource iterator expects a command that has not been executed. -2. When the ``sendRequest()`` method is first called, you will not have a ``$this->nextToken`` value, so always check - before setting it on a command. Notice that the next token is being updated each time a request is sent. -3. After fetching more resources from the service, always return an array of resources. diff --git a/bb-vendor/guzzle/guzzle/docs/plugins/async-plugin.rst b/bb-vendor/guzzle/guzzle/docs/plugins/async-plugin.rst deleted file mode 100644 index 9bd8f4251..000000000 --- a/bb-vendor/guzzle/guzzle/docs/plugins/async-plugin.rst +++ /dev/null @@ -1,18 +0,0 @@ -============ -Async plugin -============ - -The AsyncPlugin allows you to send requests that do not wait on a response. This is handled through cURL by utilizing -the progress event. When a request has sent all of its data to the remote server, Guzzle adds a 1ms timeout on the -request and instructs cURL to not download the body of the response. The async plugin then catches the exception and -adds a mock response to the request, along with an X-Guzzle-Async header to let you know that the response was not -fully downloaded. - -.. code-block:: php - - use Guzzle\Http\Client; - use Guzzle\Plugin\Async\AsyncPlugin; - - $client = new Client('http://www.example.com'); - $client->addSubscriber(new AsyncPlugin()); - $response = $client->get()->send(); diff --git a/bb-vendor/guzzle/guzzle/docs/plugins/backoff-plugin.rst b/bb-vendor/guzzle/guzzle/docs/plugins/backoff-plugin.rst deleted file mode 100644 index 5a7694141..000000000 --- a/bb-vendor/guzzle/guzzle/docs/plugins/backoff-plugin.rst +++ /dev/null @@ -1,22 +0,0 @@ -==================== -Backoff retry plugin -==================== - -The ``Guzzle\Plugin\Backoff\BackoffPlugin`` automatically retries failed HTTP requests using custom backoff strategies: - -.. code-block:: php - - use Guzzle\Http\Client; - use Guzzle\Plugin\Backoff\BackoffPlugin; - - $client = new Client('http://www.test.com/'); - // Use a static factory method to get a backoff plugin using the exponential backoff strategy - $backoffPlugin = BackoffPlugin::getExponentialBackoff(); - - // Add the backoff plugin to the client object - $client->addSubscriber($backoffPlugin); - -The BackoffPlugin's constructor accepts a ``Guzzle\Plugin\Backoff\BackoffStrategyInterface`` object that is used to -determine when a retry should be issued and how long to delay between retries. The above code example shows how to -attach a BackoffPlugin to a client that is pre-configured to retry failed 500 and 503 responses using truncated -exponential backoff (emulating the behavior of Guzzle 2's ExponentialBackoffPlugin). diff --git a/bb-vendor/guzzle/guzzle/docs/plugins/cache-plugin.rst b/bb-vendor/guzzle/guzzle/docs/plugins/cache-plugin.rst deleted file mode 100644 index d2fd5df26..000000000 --- a/bb-vendor/guzzle/guzzle/docs/plugins/cache-plugin.rst +++ /dev/null @@ -1,169 +0,0 @@ -================= -HTTP Cache plugin -================= - -Guzzle can leverage HTTP's caching specifications using the ``Guzzle\Plugin\Cache\CachePlugin``. The CachePlugin -provides a private transparent proxy cache that caches HTTP responses. The caching logic, based on -`RFC 2616 `_, uses HTTP headers to control caching behavior, -cache lifetime, and supports Vary, ETag, and Last-Modified based revalidation: - -.. code-block:: php - - use Guzzle\Http\Client; - use Doctrine\Common\Cache\FilesystemCache; - use Guzzle\Cache\DoctrineCacheAdapter; - use Guzzle\Plugin\Cache\CachePlugin; - use Guzzle\Plugin\Cache\DefaultCacheStorage; - - $client = new Client('http://www.test.com/'); - - $cachePlugin = new CachePlugin(array( - 'storage' => new DefaultCacheStorage( - new DoctrineCacheAdapter( - new FilesystemCache('/path/to/cache/files') - ) - ) - )); - - // Add the cache plugin to the client object - $client->addSubscriber($cachePlugin); - $client->get('http://www.wikipedia.org/')->send(); - - // The next request will revalidate against the origin server to see if it - // has been modified. If a 304 response is received the response will be - // served from cache - $client->get('http://www.wikipedia.org/')->send(); - -The cache plugin intercepts GET and HEAD requests before they are actually transferred to the origin server. The cache -plugin then generates a hash key based on the request method and URL, and checks to see if a response exists in the cache. If -a response exists in the cache, the cache adapter then checks to make sure that the caching rules associated with the response -satisfy the request, and ensures that response still fresh. If the response is acceptable for the request any required -revalidation, then the cached response is served instead of contacting the origin server. - -Vary ----- - -Cache keys are derived from a request method and a request URL. Multiple responses can map to the same cache key and -stored in Guzzle's underlying cache storage object. You should use the ``Vary`` HTTP header to tell the cache storage -object that the cache response must have been cached for a request that matches the headers specified in the Vary header -of the request. This allows you to have specific cache entries for the same request URL but variations in a request's -headers determine which cache entry is served. Please see the http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.44 -for more information. - -Cache options -------------- - -There are several options you can add to requests or clients to modify the behavior of the cache plugin. - -Override cache TTL -~~~~~~~~~~~~~~~~~~ - -You can override the number of seconds a cacheable response is stored in the cache by setting the -``cache.override_ttl`` parameter on the params object of a request: - -.. code-block:: php - - // If the response to the request is cacheable, then the response will be cached for 100 seconds - $request->getParams()->set('cache.override_ttl', 100); - -If a response doesn't specify any freshness policy, it will be kept in cache for 3600 seconds by default. - -Custom caching decision -~~~~~~~~~~~~~~~~~~~~~~~ - -If the service you are interacting with does not return caching headers or returns responses that are normally -something that would not be cached, you can set a custom ``can_cache`` object on the constructor of the CachePlugin -and provide a ``Guzzle\Plugin\Cache\CanCacheInterface`` object. You can use the -``Guzzle\Plugin\Cache\CallbackCanCacheStrategy`` to easily make a caching decision based on an HTTP request and -response. - -Revalidation options -~~~~~~~~~~~~~~~~~~~~ - -You can change the revalidation behavior of a request using the ``cache.revalidate`` parameter. Setting this -parameter to ``never`` will ensure that a revalidation request is never sent, and the response is always served from -the origin server. Setting this parameter to ``skip`` will never revalidate and uses the response stored in the cache. - -Normalizing requests for caching -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Use the ``cache.key_filter`` parameter if you wish to strip certain query string parameters from your -request before creating a unique hash for the request. This parameter can be useful if your requests have query -string values that cause each request URL to be unique (thus preventing a cache hit). The ``cache.key_filter`` -format is simply a comma separated list of query string values to remove from the URL when creating a cache key. -For example, here we are saying that the ``a`` and ``q`` query string variables should be ignored when generating a -cache key for the request: - -.. code-block:: php - - $request->getParams()->set('cache.key_filter', 'a, q'); - -Other options -~~~~~~~~~~~~~ - -There are many other options available to the CachePlugin that can meet almost any caching requirement, including -custom revalidation implementations, custom cache key generators, custom caching decision strategies, and custom -cache storage objects. Take a look the constructor of ``Guzzle\Plugin\Cache\CachePlugin`` for more information. - -Setting Client-wide cache settings -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You can specify cache settings for every request created by a client by adding cache settings to the configuration -options of a client. - -.. code-block:: php - - $client = new Guzzle\Http\Client('http://www.test.com', array( - 'request.params' => array( - 'cache.override_ttl' => 3600, - 'params.cache.revalidate' => 'never' - ) - )); - - echo $client->get('/')->getParams()->get('cache.override_ttl'); - // >>> 3600 - - echo $client->get('/')->getParams()->get('cache.revalidate'); - // >>> never - -Cache revalidation ------------------- - -If the cache plugin determines that a response to a GET request needs revalidation, a conditional GET is transferred -to the origin server. If the origin server returns a 304 response, then a response containing the merged headers of -the cached response with the new response and the entity body of the cached response is returned. Custom revalidation -strategies can be injected into a CachePlugin if needed. - -Cache adapters --------------- - -Guzzle doesn't try to reinvent the wheel when it comes to caching or logging. Plenty of other frameworks have -excellent solutions in place that you are probably already using in your applications. Guzzle uses adapters for -caching and logging. The cache plugin requires a cache adapter so that is can store responses in a cache. Guzzle -currently supports cache adapters for `Doctrine 2.0 `_ and the -`Zend Framework `_. - -Doctrine cache adapter -~~~~~~~~~~~~~~~~~~~~~~ - -.. code-block:: php - - use Doctrine\Common\Cache\ArrayCache; - use Guzzle\Cache\DoctrineCacheAdapter; - use Guzzle\Plugin\Cache\CachePlugin; - - $backend = new ArrayCache(); - $adapter = new DoctrineCacheAdapter($backend); - $cache = new CachePlugin($adapter); - -Zend Framework cache adapter -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. code-block:: php - - use Guzzle\Cache\ZendCacheAdapter; - use Zend\Cache\Backend\TestBackend; - - $backend = new TestBackend(); - $adapter = new ZendCacheAdapter($backend); - $cache = new CachePlugin($adapter); diff --git a/bb-vendor/guzzle/guzzle/docs/plugins/cookie-plugin.rst b/bb-vendor/guzzle/guzzle/docs/plugins/cookie-plugin.rst deleted file mode 100644 index a6cc7d924..000000000 --- a/bb-vendor/guzzle/guzzle/docs/plugins/cookie-plugin.rst +++ /dev/null @@ -1,33 +0,0 @@ -============= -Cookie plugin -============= - -Some web services require a Cookie in order to maintain a session. The ``Guzzle\Plugin\Cookie\CookiePlugin`` will add -cookies to requests and parse cookies from responses using a CookieJar object: - -.. code-block:: php - - use Guzzle\Http\Client; - use Guzzle\Plugin\Cookie\CookiePlugin; - use Guzzle\Plugin\Cookie\CookieJar\ArrayCookieJar; - - $cookiePlugin = new CookiePlugin(new ArrayCookieJar()); - - // Add the cookie plugin to a client - $client = new Client('http://www.test.com/'); - $client->addSubscriber($cookiePlugin); - - // Send the request with no cookies and parse the returned cookies - $client->get('http://www.yahoo.com/')->send(); - - // Send the request again, noticing that cookies are being sent - $request = $client->get('http://www.yahoo.com/'); - $request->send(); - - echo $request; - -You can disable cookies per-request by setting the ``cookies.disable`` value to true on a request's params object. - -.. code-block:: php - - $request->getParams()->set('cookies.disable', true); diff --git a/bb-vendor/guzzle/guzzle/docs/plugins/creating-plugins.rst b/bb-vendor/guzzle/guzzle/docs/plugins/creating-plugins.rst deleted file mode 100644 index 0870155b5..000000000 --- a/bb-vendor/guzzle/guzzle/docs/plugins/creating-plugins.rst +++ /dev/null @@ -1,93 +0,0 @@ -================ -Creating plugins -================ - -.. highlight:: php - -Guzzle is extremely extensible because of the behavioral modifications that can be added to requests, clients, and -commands using an event system. Before and after the majority of actions are taken in the library, an event is emitted -with the name of the event and context surrounding the event. Observers can subscribe to a subject and modify the -subject based on the events received. Guzzle's event system utilizes the Symfony2 EventDispatcher and is the backbone -of its plugin architecture. - -Overview --------- - -Plugins must implement the ``Symfony\Component\EventDispatcher\EventSubscriberInterface`` interface. The -``EventSubscriberInterface`` requires that your class implements a static method, ``getSubscribedEvents()``, that -returns an associative array mapping events to methods on the object. See the -`Symfony2 documentation `_ for more information. - -Plugins can be attached to any subject, or object in Guzzle that implements that -``Guzzle\Common\HasDispatcherInterface``. - -Subscribing to a subject -~~~~~~~~~~~~~~~~~~~~~~~~ - -You can subscribe an instantiated observer to an event by calling ``addSubscriber`` on a subject. - -.. code-block:: php - - $testPlugin = new TestPlugin(); - $client->addSubscriber($testPlugin); - -You can also subscribe to only specific events using a closure:: - - $client->getEventDispatcher()->addListener('request.create', function(Event $event) { - echo $event->getName(); - echo $event['request']; - }); - -``Guzzle\Common\Event`` objects are passed to notified functions. The Event object has a ``getName()`` method which -return the name of the emitted event and may contain contextual information that can be accessed like an array. - -Knowing what events to listen to -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Any class that implements the ``Guzzle\Common\HasDispatcherInterface`` must implement a static method, -``getAllEvents()``, that returns an array of the events that are emitted from the object. You can browse the source -to see each event, or you can call the static method directly in your code to get a list of available events. - -Event hooks ------------ - -* :ref:`client-events` -* :ref:`service-client-events` -* :ref:`request-events` -* ``Guzzle\Http\Curl\CurlMulti``: -* :ref:`service-builder-events` - -Examples of the event system ----------------------------- - -Simple Echo plugin -~~~~~~~~~~~~~~~~~~ - -This simple plugin prints a string containing the request that is about to be sent by listening to the -``request.before_send`` event:: - - use Symfony\Component\EventDispatcher\EventSubscriberInterface; - - class EchoPlugin implements EventSubscriberInterface - { - public static function getSubscribedEvents() - { - return array('request.before_send' => 'onBeforeSend'); - } - - public function onBeforeSend(Guzzle\Common\Event $event) - { - echo 'About to send a request: ' . $event['request'] . "\n"; - } - } - - $client = new Guzzle\Service\Client('http://www.test.com/'); - - // Create the plugin and add it as an event subscriber - $plugin = new EchoPlugin(); - $client->addSubscriber($plugin); - - // Send a request and notice that the request is printed to the screen - $client->get('/')->send(); - -Running the above code will print a string containing the HTTP request that is about to be sent. diff --git a/bb-vendor/guzzle/guzzle/docs/plugins/curl-auth-plugin.rst b/bb-vendor/guzzle/guzzle/docs/plugins/curl-auth-plugin.rst deleted file mode 100644 index 66d4a01e3..000000000 --- a/bb-vendor/guzzle/guzzle/docs/plugins/curl-auth-plugin.rst +++ /dev/null @@ -1,32 +0,0 @@ -========================== -cURL authentication plugin -========================== - -.. warning:: - - The CurlAuthPlugin is deprecated. You should use the `auth` parameter of a client to add authorization headers to - every request created by a client. - - .. code-block:: php - - $client->setDefaultOption('auth', array('username', 'password', 'Basic|Digest|NTLM|Any')); - -If your web service client requires basic authorization, then you can use the CurlAuthPlugin to easily add an -Authorization header to each request sent by the client. - -.. code-block:: php - - use Guzzle\Http\Client; - use Guzzle\Plugin\CurlAuth\CurlAuthPlugin; - - $client = new Client('http://www.test.com/'); - - // Add the auth plugin to the client object - $authPlugin = new CurlAuthPlugin('username', 'password'); - $client->addSubscriber($authPlugin); - - $response = $client->get('projects/1/people')->send(); - $xml = new SimpleXMLElement($response->getBody(true)); - foreach ($xml->person as $person) { - echo $person->email . "\n"; - } diff --git a/bb-vendor/guzzle/guzzle/docs/plugins/history-plugin.rst b/bb-vendor/guzzle/guzzle/docs/plugins/history-plugin.rst deleted file mode 100644 index b96befe79..000000000 --- a/bb-vendor/guzzle/guzzle/docs/plugins/history-plugin.rst +++ /dev/null @@ -1,24 +0,0 @@ -============== -History plugin -============== - -The history plugin tracks all of the requests and responses sent through a request or client. This plugin can be -useful for crawling or unit testing. By default, the history plugin stores up to 10 requests and responses. - -.. code-block:: php - - use Guzzle\Http\Client; - use Guzzle\Plugin\History\HistoryPlugin; - - $client = new Client('http://www.test.com/'); - - // Add the history plugin to the client object - $history = new HistoryPlugin(); - $history->setLimit(5); - $client->addSubscriber($history); - - $client->get('http://www.yahoo.com/')->send(); - - echo $history->getLastRequest(); - echo $history->getLastResponse(); - echo count($history); diff --git a/bb-vendor/guzzle/guzzle/docs/plugins/log-plugin.rst b/bb-vendor/guzzle/guzzle/docs/plugins/log-plugin.rst deleted file mode 100644 index 3e2b22944..000000000 --- a/bb-vendor/guzzle/guzzle/docs/plugins/log-plugin.rst +++ /dev/null @@ -1,69 +0,0 @@ -========== -Log plugin -========== - -Use the ``Guzzle\Plugin\Log\LogPlugin`` to view all data sent over the wire, including entity bodies and redirects. - -.. code-block:: php - - use Guzzle\Http\Client; - use Guzzle\Log\Zf1LogAdapter; - use Guzzle\Plugin\Log\LogPlugin; - use Guzzle\Log\MessageFormatter; - - $client = new Client('http://www.test.com/'); - - $adapter = new Zf1LogAdapter( - new \Zend_Log(new \Zend_Log_Writer_Stream('php://output')) - ); - $logPlugin = new LogPlugin($adapter, MessageFormatter::DEBUG_FORMAT); - - // Attach the plugin to the client, which will in turn be attached to all - // requests generated by the client - $client->addSubscriber($logPlugin); - - $response = $client->get('http://google.com')->send(); - -The code sample above wraps a ``Zend_Log`` object using a ``Guzzle\Log\Zf1LogAdapter``. After attaching the plugin to -the client, all data sent over the wire will be logged to stdout. - -The first argument of the LogPlugin's constructor accepts a ``Guzzle\Log\LogAdapterInterface`` object. This object is -an adapter that allows you to use the logging capabilities of your favorite log implementation. The second argument of -the constructor accepts a ``Guzzle\Log\MessageFormatter`` or a log messaged format string. The format string uses -variable substitution and allows you to define the log data that is important to your application. The different -variables that can be injected are as follows: - -================== ==================================================================================== -Variable Substitution -================== ==================================================================================== -{request} Full HTTP request message -{response} Full HTTP response message -{ts} Timestamp -{host} Host of the request -{method} Method of the request -{url} URL of the request -{host} Host of the request -{protocol} Request protocol -{version} Protocol version -{resource} Resource of the request (path + query + fragment) -{port} Port of the request -{hostname} Hostname of the machine that sent the request -{code} Status code of the response (if available) -{phrase} Reason phrase of the response (if available) -{curl_error} Curl error message (if available) -{curl_code} Curl error code (if available) -{curl_stderr} Curl standard error (if available) -{connect_time} Time in seconds it took to establish the connection (if available) -{total_time} Total transaction time in seconds for last transfer (if available) -{req_header_*} Replace `*` with the lowercased name of a request header to add to the message -{res_header_*} Replace `*` with the lowercased name of a response header to add to the message -{req_body} Request body -{res_body} Response body -================== ==================================================================================== - -The LogPlugin has a helper method that can be used when debugging that will output the full HTTP request and -response of a transaction: - -.. code-block:: php - - $client->addSubscriber(LogPlugin::getDebugPlugin()); diff --git a/bb-vendor/guzzle/guzzle/docs/plugins/md5-validator-plugin.rst b/bb-vendor/guzzle/guzzle/docs/plugins/md5-validator-plugin.rst deleted file mode 100644 index 1b1cfa8a8..000000000 --- a/bb-vendor/guzzle/guzzle/docs/plugins/md5-validator-plugin.rst +++ /dev/null @@ -1,29 +0,0 @@ -==================== -MD5 validator plugin -==================== - -Entity bodies can sometimes be modified over the wire due to a faulty TCP transport or misbehaving proxy. If an HTTP -response contains a Content-MD5 header, then a MD5 hash of the entity body of a response can be compared against the -Content-MD5 header of the response to determine if the response was delivered intact. The -``Guzzle\Plugin\Md5\Md5ValidatorPlugin`` will throw an ``UnexpectedValueException`` if the calculated MD5 hash does -not match the Content-MD5 header value: - -.. code-block:: php - - use Guzzle\Http\Client; - use Guzzle\Plugin\Md5\Md5ValidatorPlugin; - - $client = new Client('http://www.test.com/'); - - $md5Plugin = new Md5ValidatorPlugin(); - - // Add the md5 plugin to the client object - $client->addSubscriber($md5Plugin); - - $request = $client->get('http://www.yahoo.com/'); - $request->send(); - -Calculating the MD5 hash of a large entity body or an entity body that was transferred using a Content-Encoding is an -expensive operation. When working in high performance applications, you might consider skipping the MD5 hash -validation for entity bodies bigger than a certain size or Content-Encoded entity bodies -(see ``Guzzle\Plugin\Md5\Md5ValidatorPlugin`` for more information). diff --git a/bb-vendor/guzzle/guzzle/docs/plugins/mock-plugin.rst b/bb-vendor/guzzle/guzzle/docs/plugins/mock-plugin.rst deleted file mode 100644 index 4900cb565..000000000 --- a/bb-vendor/guzzle/guzzle/docs/plugins/mock-plugin.rst +++ /dev/null @@ -1,27 +0,0 @@ -=========== -Mock plugin -=========== - -The mock plugin is useful for testing Guzzle clients. The mock plugin allows you to queue an array of responses that -will satisfy requests sent from a client by consuming the request queue in FIFO order. - -.. code-block:: php - - use Guzzle\Http\Client; - use Guzzle\Plugin\Mock\MockPlugin; - use Guzzle\Http\Message\Response; - - $client = new Client('http://www.test.com/'); - - $mock = new MockPlugin(); - $mock->addResponse(new Response(200)) - ->addResponse(new Response(404)); - - // Add the mock plugin to the client object - $client->addSubscriber($mock); - - // The following request will receive a 200 response from the plugin - $client->get('http://www.example.com/')->send(); - - // The following request will receive a 404 response from the plugin - $client->get('http://www.test.com/')->send(); diff --git a/bb-vendor/guzzle/guzzle/docs/plugins/oauth-plugin.rst b/bb-vendor/guzzle/guzzle/docs/plugins/oauth-plugin.rst deleted file mode 100644 index e67eabaa1..000000000 --- a/bb-vendor/guzzle/guzzle/docs/plugins/oauth-plugin.rst +++ /dev/null @@ -1,30 +0,0 @@ -============ -OAuth plugin -============ - -Guzzle ships with an OAuth 1.0 plugin that can sign requests using a consumer key, consumer secret, OAuth token, -and OAuth secret. Here's an example showing how to send an authenticated request to the Twitter REST API: - -.. code-block:: php - - use Guzzle\Http\Client; - use Guzzle\Plugin\Oauth\OauthPlugin; - - $client = new Client('http://api.twitter.com/1'); - $oauth = new OauthPlugin(array( - 'consumer_key' => 'my_key', - 'consumer_secret' => 'my_secret', - 'token' => 'my_token', - 'token_secret' => 'my_token_secret' - )); - $client->addSubscriber($oauth); - - $response = $client->get('statuses/public_timeline.json')->send(); - -If you need to use a custom signing method, you can pass a ``signature_method`` configuration option in the -constructor of the OAuth plugin. The ``signature_method`` option must be a callable variable that accepts a string to -sign and signing key and returns a signed string. - -.. note:: - - You can omit the ``token`` and ``token_secret`` options to use two-legged OAuth. diff --git a/bb-vendor/guzzle/guzzle/docs/plugins/plugins-list.rst.inc b/bb-vendor/guzzle/guzzle/docs/plugins/plugins-list.rst.inc deleted file mode 100644 index 8d6d09b46..000000000 --- a/bb-vendor/guzzle/guzzle/docs/plugins/plugins-list.rst.inc +++ /dev/null @@ -1,9 +0,0 @@ -* :doc:`/plugins/async-plugin` -* :doc:`/plugins/backoff-plugin` -* :doc:`/plugins/cache-plugin` -* :doc:`/plugins/cookie-plugin` -* :doc:`/plugins/history-plugin` -* :doc:`/plugins/log-plugin` -* :doc:`/plugins/md5-validator-plugin` -* :doc:`/plugins/mock-plugin` -* :doc:`/plugins/oauth-plugin` diff --git a/bb-vendor/guzzle/guzzle/docs/plugins/plugins-overview.rst b/bb-vendor/guzzle/guzzle/docs/plugins/plugins-overview.rst deleted file mode 100644 index 19ae57ece..000000000 --- a/bb-vendor/guzzle/guzzle/docs/plugins/plugins-overview.rst +++ /dev/null @@ -1,59 +0,0 @@ -====================== -Plugin system overview -====================== - -The workflow of sending a request and parsing a response is driven by Guzzle's event system, which is powered by the -`Symfony2 Event Dispatcher component `_. - -Any object in Guzzle that emits events will implement the ``Guzzle\Common\HasEventDispatcher`` interface. You can add -event subscribers directly to these objects using the ``addSubscriber()`` method, or you can grab the -``Symfony\Component\EventDispatcher\EventDispatcher`` object owned by the object using ``getEventDispatcher()`` and -add a listener or event subscriber. - -Adding event subscribers to clients ------------------------------------ - -Any event subscriber or event listener attached to the EventDispatcher of a ``Guzzle\Http\Client`` or -``Guzzle\Service\Client`` object will automatically be attached to all request objects created by the client. This -allows you to attach, for example, a HistoryPlugin to a client object, and from that point on, every request sent -through that client will utilize the HistoryPlugin. - -.. code-block:: php - - use Guzzle\Plugin\History\HistoryPlugin; - use Guzzle\Service\Client; - - $client = new Client(); - - // Create a history plugin and attach it to the client - $history = new HistoryPlugin(); - $client->addSubscriber($history); - - // Create and send a request. This request will also utilize the HistoryPlugin - $client->get('http://httpbin.org')->send(); - - // Echo out the last sent request by the client - echo $history->getLastRequest(); - -.. tip:: - - :doc:`Create event subscribers `, or *plugins*, to implement reusable logic that can be - shared across clients. Event subscribers are also easier to test than anonymous functions. - -Pre-Built plugins ------------------ - -Guzzle provides easy to use request plugins that add behavior to requests based on signal slot event notifications -powered by the Symfony2 Event Dispatcher component. - -* :doc:`async-plugin` -* :doc:`backoff-plugin` -* :doc:`cache-plugin` -* :doc:`cookie-plugin` -* :doc:`curl-auth-plugin` -* :doc:`history-plugin` -* :doc:`log-plugin` -* :doc:`md5-validator-plugin` -* :doc:`mock-plugin` -* :doc:`oauth-plugin` - diff --git a/bb-vendor/guzzle/guzzle/docs/requirements.txt b/bb-vendor/guzzle/guzzle/docs/requirements.txt deleted file mode 100644 index f62e31837..000000000 --- a/bb-vendor/guzzle/guzzle/docs/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -Sphinx>=1.2b1 -guzzle_sphinx_theme>=0.5.0 diff --git a/bb-vendor/guzzle/guzzle/docs/testing/unit-testing.rst b/bb-vendor/guzzle/guzzle/docs/testing/unit-testing.rst deleted file mode 100644 index f4297af30..000000000 --- a/bb-vendor/guzzle/guzzle/docs/testing/unit-testing.rst +++ /dev/null @@ -1,201 +0,0 @@ -=========================== -Unit Testing Guzzle clients -=========================== - -Guzzle provides several tools that will enable you to easily unit test your web service clients. - -* PHPUnit integration -* Mock responses -* node.js web server for integration testing - -PHPUnit integration -------------------- - -Guzzle is unit tested using `PHPUnit `_. Your web service client's unit tests should extend -``Guzzle\Tests\GuzzleTestCase`` so that you can take advantage of some of the built in helpers. - -In order to unit test your client, a developer would need to copy phpunit.xml.dist to phpunit.xml and make any needed -modifications. As a best practice and security measure for you and your contributors, it is recommended to add an -ignore statement to your SCM so that phpunit.xml is ignored. - -Bootstrapping -~~~~~~~~~~~~~ - -Your web service client should have a tests/ folder that contains a bootstrap.php file. The bootstrap.php file -responsible for autoloading and configuring a ``Guzzle\Service\Builder\ServiceBuilder`` that is used throughout your -unit tests for loading a configured client. You can add custom parameters to your phpunit.xml file that expects users -to provide the path to their configuration data. - -.. code-block:: php - - Guzzle\Tests\GuzzleTestCase::setServiceBuilder(Aws\Common\Aws::factory($_SERVER['CONFIG'])); - - Guzzle\Tests\GuzzleTestCase::setServiceBuilder(Guzzle\Service\Builder\ServiceBuilder::factory(array( - 'test.unfuddle' => array( - 'class' => 'Guzzle.Unfuddle.UnfuddleClient', - 'params' => array( - 'username' => 'test_user', - 'password' => '****', - 'subdomain' => 'test' - ) - ) - ))); - -The above code registers a service builder that can be used throughout your unit tests. You would then be able to -retrieve an instantiated and configured Unfuddle client by calling ``$this->getServiceBuilder()->get('test.unfuddle)``. -The above code assumes that ``$_SERVER['CONFIG']`` contains the path to a file that stores service description -configuration. - -Unit testing remote APIs ------------------------- - -Mock responses -~~~~~~~~~~~~~~ - -One of the benefits of unit testing is the ability to quickly determine if there are errors in your code. If your -unit tests run slowly, then they become tedious and will likely be run less frequently. Guzzle's philosophy on unit -testing web service clients is that no network access should be required to run the unit tests. This means that -responses are served from mock responses or local servers. By adhering to this principle, tests will run much faster -and will not require an external resource to be available. The problem with this approach is that your mock responses -must first be gathered and then subsequently updated each time the remote API changes. - -Integration testing over the internet -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You can perform integration testing with a web service over the internet by making calls directly to the service. If -the web service you are requesting uses a complex signing algorithm or some other specific implementation, then you -may want to include at least one actual network test that can be run specifically through the command line using -`PHPUnit group annotations `_. - -@group internet annotation -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -When creating tests that require an internet connection, it is recommended that you add ``@group internet`` annotations -to your unit tests to specify which tests require network connectivity. - -You can then `run PHPUnit tests `_ that exclude the @internet -group by running ``phpunit --exclude-group internet``. - -API credentials -^^^^^^^^^^^^^^^ - -If API credentials are required to run your integration tests, you must add ```` parameters to your -phpunit.xml.dist file and extract these parameters in your bootstrap.php file. - -.. code-block:: xml - - - - - - - - - - - - - ./Tests - - - - -You can then extract the ``server`` variables in your bootstrap.php file by grabbing them from the ``$_SERVER`` -superglobal: ``$apiUser = $_SERVER['API_USER'];`` - -Further reading -^^^^^^^^^^^^^^^ - -A good discussion on the topic of testing remote APIs can be found in Sebastian Bergmann's -`Real-World Solutions for Developing High-Quality PHP Frameworks and Applications `_. - -Queueing Mock responses ------------------------ - -Mock responses can be used to test if requests are being generated correctly and responses and handled correctly by -your client. Mock responses can be queued up for a client using the ``$this->setMockResponse($client, $path)`` method -of your test class. Pass the client you are adding mock responses to and a single path or array of paths to mock -response files relative to the ``/tests/mock/ folder``. This will queue one or more mock responses for your client by -creating a simple observer on the client. Mock response files must contain a full HTTP response message: - -.. code-block:: none - - HTTP/1.1 200 OK - Date: Wed, 25 Nov 2009 12:00:00 GMT - Connection: close - Server: AmazonS3 - Content-Type: application/xml - - - EU - -After queuing mock responses for a client, you can get an array of the requests that were sent by the client that -were issued a mock response by calling ``$this->getMockedRequests()``. - -You can also use the ``Guzzle\Plugin\Mock\MockPlugin`` object directly with your clients. - -.. code-block:: php - - $plugin = new Guzzle\Plugin\Mock\MockPlugin(); - $plugin->addResponse(new Guzzle\Http\Message\Response(200)); - $client = new Guzzle\Http\Client(); - $client->addSubscriber($plugin); - - // The following request will get the mock response from the plugin in FIFO order - $request = $client->get('http://www.test.com/'); - $request->send(); - - // The MockPlugin maintains a list of requests that were mocked - $this->assertContainsOnly($request, $plugin->getReceivedRequests()); - -node.js web server for integration testing ------------------------------------------- - -Using mock responses is usually enough when testing a web service client. If your client needs to add custom cURL -options to requests, then you should use the node.js test web server to ensure that your HTTP request message is -being created correctly. - -Guzzle is based around PHP's libcurl bindings. cURL sometimes modifies an HTTP request message based on -``CURLOPT_*`` options. Headers that are added to your request by cURL will not be accounted for if you inject mock -responses into your tests. Additionally, some request entity bodies cannot be loaded by the client before transmitting -it to the sever (for example, when using a client as a sort of proxy and streaming content from a remote server). You -might also need to inspect the entity body of a ``multipart/form-data`` POST request. - -.. note:: - - You can skip all of the tests that require the node.js test web server by excluding the ``server`` group: - ``phpunit --exclude-group server`` - -Using the test server -~~~~~~~~~~~~~~~~~~~~~ - -The node.js test server receives requests and returns queued responses. The test server exposes a simple API that is -used to enqueue responses and inspect the requests that it has received. - -Retrieve the server object by calling ``$this->getServer()``. If the node.js server is not running, it will be -started as a forked process and an object that interfaces with the server will be returned. (note: stopping the -server is handled internally by Guzzle.) - -You can queue an HTTP response or an array of responses by calling ``$this->getServer()->enqueue()``: - -.. code-block:: php - - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - -The above code queues a single 200 response with an empty body. Responses are queued using a FIFO order; this -response will be returned by the server when it receives the first request and then removed from the queue. If a -request is received by a server with no queued responses, an exception will be thrown in your unit test. - -You can inspect the requests that the server has retrieved by calling ``$this->getServer()->getReceivedRequests()``. -This method accepts an optional ``$hydrate`` parameter that specifies if you are retrieving an array of string HTTP -requests or an array of ``Guzzle\Http\RequestInterface`` subclassed objects. "Hydrating" the requests will allow -greater flexibility in your unit tests so that you can easily assert the state of the various parts of a request. - -You will need to modify the base_url of your web service client in order to use it against the test server. - -.. code-block:: php - - $client = $this->getServiceBuilder()->get('my_client'); - $client->setBaseUrl($this->getServer()->getUrl()); - -After running the above code, all calls made from the ``$client`` object will be sent to the test web server. diff --git a/bb-vendor/guzzle/guzzle/docs/webservice-client/guzzle-service-descriptions.rst b/bb-vendor/guzzle/guzzle/docs/webservice-client/guzzle-service-descriptions.rst deleted file mode 100644 index ad6070b27..000000000 --- a/bb-vendor/guzzle/guzzle/docs/webservice-client/guzzle-service-descriptions.rst +++ /dev/null @@ -1,619 +0,0 @@ -=========================== -Guzzle service descriptions -=========================== - -Guzzle allows you to serialize HTTP requests and parse HTTP responses using a DSL called a service descriptions. -Service descriptions define web service APIs by documenting each operation, the operation's parameters, validation -options for each parameter, an operation's response, how the response is parsed, and any errors that can be raised for -an operation. Writing a service description for a web service allows you to more quickly consume a web service than -writing concrete commands for each web service operation. - -Guzzle service descriptions can be representing using a PHP array or JSON document. Guzzle's service descriptions are -heavily inspired by `Swagger `_. - -Service description schema -========================== - -A Guzzle Service description must match the following JSON schema document. This document can also serve as a guide when -implementing a Guzzle service description. - -Download the schema here: :download:`Guzzle JSON schema document ` - -.. class:: overflow-height-500px - - .. literalinclude:: ../_downloads/guzzle-schema-1.0.json - :language: json - -Top-level attributes --------------------- - -Service descriptions are comprised of the following top-level attributes: - -.. code-block:: json - - { - "name": "string", - "apiVersion": "string|number", - "baseUrl": "string", - "description": "string", - "operations": {}, - "models": {}, - "includes": ["string.php", "string.json"] - } - -+-----------------------------------------+-------------------------+-----------------------------------------------------------------------------------------------------------------------+ -| Property Name | Value | Description | -+=========================================+=========================+=======================================================================================================================+ -| name | string | Name of the web service | -+-----------------------------------------+-------------------------+-----------------------------------------------------------------------------------------------------------------------+ -| apiVersion | string|number | Version identifier that the service description is compatible with | -+-----------------------------------------+-------------------------+-----------------------------------------------------------------------------------------------------------------------+ -| baseUrl or basePath | string | Base URL of the web service. Any relative URI specified in an operation will be merged with the baseUrl using the | -| | | process defined in RFC 2396. Some clients require custom logic to determine the baseUrl. In those cases, it is best | -| | | to not include a baseUrl in the service description, but rather allow the factory method of the client to configure | -| | | the client’s baseUrl. | -+-----------------------------------------+-------------------------+-----------------------------------------------------------------------------------------------------------------------+ -| description | string | Short summary of the web service | -+-----------------------------------------+-------------------------+-----------------------------------------------------------------------------------------------------------------------+ -| operations | object containing | Operations of the service. The key is the name of the operation and value is the attributes of the operation. | -| | :ref:`operation-schema` | | -| | | | -+-----------------------------------------+-------------------------+-----------------------------------------------------------------------------------------------------------------------+ -| models | object containing | Schema models that can be referenced throughout the service description. Models can be used to define how an HTTP | -| | :ref:`model-schema` | response is parsed into a ``Guzzle\Service\Resource\Model`` object when an operation uses a ``model`` ``responseType``| -+-----------------------------------------+-------------------------+-----------------------------------------------------------------------------------------------------------------------+ -| includes | array of .js, | Service description files to include and extend from (can be a .json, .js, or .php file) | -| | .json, or .php | | -| | files. | | -+-----------------------------------------+-------------------------+-----------------------------------------------------------------------------------------------------------------------+ -| (any additional properties) | mixed | Any additional properties specified as top-level attributes are allowed and will be treated as arbitrary data | -+-----------------------------------------+-------------------------+-----------------------------------------------------------------------------------------------------------------------+ - -.. _operation-schema: - -Operations ----------- - -Operations are the actions that can be taken on a service. Each operation is given a unique name and has a distinct -endpoint and HTTP method. If an API has a ``DELETE /users/:id`` operation, a satisfactory operation name might be -``DeleteUser`` with a parameter of ``id`` that is inserted into the URI. - -.. class:: overflow-height-250px - - .. code-block:: json - - { - "operations": { - "operationName": { - "extends": "string", - "httpMethod": "GET|POST|PUT|DELETE|PATCH|string", - "uri": "string", - "summary": "string", - "class": "string", - "responseClass": "string", - "responseNotes": "string", - "type": "string", - "description": "string", - "responseType": "primitive|class|(model by name)|documentation|(string)", - "deprecated": false, - "errorResponses": [ - { - "code": 500, - "reason": "Unexpected Error", - "class": "string" - } - ], - "data": { - "foo": "bar", - "baz": "bam" - }, - "parameters": {} - } - } - } - -.. csv-table:: - :header: "Property Name", "Value", "Description" - :widths: 20, 15, 65 - - "extends", "string", "Extend from another operation by name. The parent operation must be defined before the child." - "httpMethod", "string", "HTTP method used with the operation (e.g. GET, POST, PUT, DELETE, PATCH, etc)" - "uri", "string", "URI of the operation. The uri attribute can contain URI templates. The variables of the URI template are parameters of the operation with a location value of uri" - "summary", "string", "Short summary of what the operation does" - "class", "string", "Custom class to instantiate instead of the default Guzzle\\Service\\Command\\OperationCommand. Using this attribute allows you to define an operation using a service description, but allows more customized logic to be implemented in user-land code." - "responseClass", "string", "Defined what is returned from the method. Can be a primitive, class name, or model name. You can specify the name of a class to return a more customized result from the operation (for example, a domain model object). When using the name of a PHP class, the class must implement ``Guzzle\Service\Command\ResponseClassInterface``." - "responseNotes", "string", "A description of the response returned by the operation" - "responseType", "string", "The type of response that the operation creates: one of primitive, class, model, or documentation. If not specified, this value will be automatically inferred based on whether or not there is a model matching the name, if a matching class name is found, or set to 'primitive' by default." - "deprecated", "boolean", "Whether or not the operation is deprecated" - "errorResponses", "array", "Errors that could occur while executing the operation. Each item of the array is an object that can contain a 'code' (HTTP response status code of the error), 'reason' (reason phrase or description of the error), and 'class' (an exception class that will be raised when this error is encountered)" - "data", "object", "Any arbitrary data to associate with the operation" - "parameters", "object containing :ref:`parameter-schema` objects", "Parameters of the operation. Parameters are used to define how input data is serialized into a HTTP request." - "additionalParameters", "A single :ref:`parameter-schema` object", "Validation and serialization rules for any parameter supplied to the operation that was not explicitly defined." - -additionalParameters -~~~~~~~~~~~~~~~~~~~~ - -When a webservice offers a large number of parameters that all are set in the same location (for example the query -string or a JSON document), defining each parameter individually can require a lot of time and repetition. Furthermore, -some web services allow for completely arbitrary parameters to be supplied for an operation. The -``additionalParameters`` attribute can be used to solve both of these issues. - -As an example, we can define a Twitter API operation quite easily using ``additionalParameters``. The -GetMentions operation accepts a large number of query string parameters. Defining each of these parameters -is ideal because it provide much more introspection for the client and opens the possibility to use the description with -other tools (e.g. a documentation generator). However, you can very quickly provide a "catch-all" serialization rule -that will place any custom parameters supplied to an operation the generated request's query string parameters. - -.. class:: overflow-height-250px - - .. code-block:: json - - { - "name": "Twitter", - "apiVersion": "1.1", - "baseUrl": "https://api.twitter.com/1.1", - "operations": { - "GetMentions": { - "httpMethod": "GET", - "uri": "statuses/mentions_timeline.json", - "responseClass": "GetMentionsOutput", - "additionalParameters": { - "location": "query" - } - } - }, - "models": { - "GetMentionsOutput": { - "type": "object", - "additionalProperties": { - "location": "json" - } - } - } - } - -responseClass -~~~~~~~~~~~~~ - -The ``responseClass`` attribute is used to define the return value of an operation (what is returned by calling the -``getResult()`` method of a command object). The value set in the responseClass attribute can be one of "primitive" -(meaning the result with be primitive type like a string), a class name meaning the result will be an instance of a -specific user-land class, or a model name meaning the result will be a ``Guzzle\Service\Resource\Model`` object that -uses a :ref:`model schema ` to define how the HTTP response is parsed. - -.. note:: - - Using a class name with a ``responseClass`` will only work if it is supported by the ``class`` that is instantiated - for the operation. Keep this in mind when specifying a custom ``class`` attribute that points to a custom - ``Guzzle\Service\Command\CommandInterface`` class. The default ``class``, - ``Guzzle\Service\Command\OperationCommand``, does support setting custom ``class`` attributes. - -You can specify the name of a class to return a more customized result from the operation (for example, a domain model -object). When using the name of a PHP class, the class must implement ``Guzzle\Service\Command\ResponseClassInterface``. -Here's a very simple example of implementing a custom responseClass object. - -.. code-block:: json - - { - "operations": { - "test": { - "responseClass": "MyApplication\\User" - } - } - } - -.. code-block:: php - - namespace MyApplication; - - use Guzzle\Service\Command\ResponseClassInterface; - use Guzzle\Service\Command\OperationCommand; - - class User implements ResponseClassInterface - { - protected $name; - - public static function fromCommand(OperationCommand $command) - { - $response = $command->getResponse(); - $xml = $response->xml(); - - return new self((string) $xml->name); - } - - public function __construct($name) - { - $this->name = $name; - } - } - -errorResponses -~~~~~~~~~~~~~~ - -``errorResponses`` is an array containing objects that define the errors that could occur while executing the -operation. Each item of the array is an object that can contain a 'code' (HTTP response status code of the error), -'reason' (reason phrase or description of the error), and 'class' (an exception class that will be raised when this -error is encountered). - -ErrorResponsePlugin -^^^^^^^^^^^^^^^^^^^ - -Error responses are by default only used for documentation. If you don't need very complex exception logic for your web -service errors, then you can use the ``Guzzle\Plugin\ErrorResponse\ErrorResponsePlugin`` to automatically throw defined -exceptions when one of the ``errorResponse`` rules are matched. The error response plugin will listen for the -``request.complete`` event of a request created by a command object. Every response (including a successful response) is -checked against the list of error responses for an exact match using the following order of checks: - -1. Does the errorResponse have a defined ``class``? -2. Is the errorResponse ``code`` equal to the status code of the response? -3. Is the errorResponse ``reason`` equal to the reason phrase of the response? -4. Throw the exception stored in the ``class`` attribute of the errorResponse. - -The ``class`` attribute must point to a class that implements -``Guzzle\Plugin\ErrorResponse\ErrorResponseExceptionInterface``. This interface requires that an error response class -implements ``public static function fromCommand(CommandInterface $command, Response $response)``. This method must -return an object that extends from ``\Exception``. After an exception is returned, it is thrown by the plugin. - -.. _parameter-schema: - -Parameter schema ----------------- - -Parameters in both operations and models are represented using the -`JSON schema `_ syntax. - -.. csv-table:: - :header: "Property Name", "Value", "Description" - :widths: 20, 15, 65 - - "name", "string", "Unique name of the parameter" - "type", "string|array", "Type of variable (string, number, integer, boolean, object, array, numeric, null, any). Types are using for validation and determining the structure of a parameter. You can use a union type by providing an array of simple types. If one of the union types matches the provided value, then the value is valid." - "instanceOf", "string", "When the type is an object, you can specify the class that the object must implement" - "required", "boolean", "Whether or not the parameter is required" - "default", "mixed", "Default value to use if no value is supplied" - "static", "boolean", "Set to true to specify that the parameter value cannot be changed from the default setting" - "description", "string", "Documentation of the parameter" - "location", "string", "The location of a request used to apply a parameter. Custom locations can be registered with a command, but the defaults are uri, query, statusCode, reasonPhrase, header, body, json, xml, postField, postFile, responseBody" - "sentAs", "string", "Specifies how the data being modeled is sent over the wire. For example, you may wish to include certain headers in a response model that have a normalized casing of FooBar, but the actual header is x-foo-bar. In this case, sentAs would be set to x-foo-bar." - "filters", "array", "Array of functions to to run a parameter value through." - -filters -~~~~~~~ - -Each value in the array must be a string containing the full class path to a static method or an array of complex -filter information. You can specify static methods of classes using the full namespace class name followed by -"::" (e.g. ``FooBar::baz()``). Some filters require arguments in order to properly filter a value. For complex filters, -use an object containing a ``method`` attribute pointing to a function, and an ``args`` attribute containing an -array of positional arguments to pass to the function. Arguments can contain keywords that are replaced when filtering -a value: ``@value`` is replaced with the value being filtered, and ``@api`` is replaced with the actual Parameter -object. - -.. code-block:: json - - { - "filters": [ - "strtolower", - { - "method": "MyClass::convertString", - "args": [ "test", "@value", "@api" ] - } - ] - } - -The above example will filter a parameter using ``strtolower``. It will then call the ``convertString`` static method -of ``MyClass``, passing in "test", the actual value of the parameter, and a ``Guzzle\Service\Description\Parameter`` -object. - -Operation parameter location attributes -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The location field of top-level parameters control how a parameter is serialized when generating a request. - -uri location -^^^^^^^^^^^^ - -Parameters are injected into the ``uri`` attribute of the operation using -`URI-template expansion `_. - -.. code-block:: json - - { - "operations": { - "uriTest": { - "uri": "/test/{testValue}", - "parameters": { - "testValue": { - "location": "uri" - } - } - } - } - } - -query location -^^^^^^^^^^^^^^ - -Parameters are injected into the query string of a request. Query values can be nested, which would result in a PHP -style nested query string. The name of a parameter is the default name of the query string parameter added to the -request. You can override this behavior by specifying the ``sentAs`` attribute on the parameter. - -.. code-block:: json - - { - "operations": { - "queryTest": { - "parameters": { - "testValue": { - "location": "query", - "sentAs": "test_value" - } - } - } - } - } - -header location -^^^^^^^^^^^^^^^ - -Parameters are injected as headers on an HTTP request. The name of the parameter is used as the name of the header by -default. You can change the name of the header created by the parameter using the ``sentAs`` attribute. - -Headers that are of type ``object`` will be added as multiple headers to a request using the key of the input array as -the header key. Setting a ``sentAs`` attribute along with a type ``object`` will use the value of ``sentAs`` as a -prefix for each header key. - -body location -^^^^^^^^^^^^^ - -Parameters are injected as the body of a request. The input of these parameters may be anything that can be cast to a -string or a ``Guzzle\Http\EntityBodyInterface`` object. - -postField location -^^^^^^^^^^^^^^^^^^ - -Parameters are inserted as POST fields in a request. Nested values may be supplied and will be represented using -PHP style nested query strings. The POST field name is the same as the parameter name by default. You can use the -``sentAs`` parameter to override the POST field name. - -postFile location -^^^^^^^^^^^^^^^^^ - -Parameters are added as POST files. A postFile value may be a string pointing to a local filename or a -``Guzzle\Http\Message\PostFileInterface`` object. The name of the POST file will be the name of the parameter by -default. You can use a custom POST file name by using the ``sentAs`` attribute. - -Supports "string" and "array" types. - -json location -^^^^^^^^^^^^^ - -Parameters are added to the body of a request as top level keys of a JSON document. Nested values may be specified, -with any number of nested ``Guzzle\Common\ToArrayInterface`` objects. When JSON parameters are specified, the -``Content-Type`` of the request will change to ``application/json`` if a ``Content-Type`` has not already been specified -on the request. - -xml location -^^^^^^^^^^^^ - -Parameters are added to the body of a request as top level nodes of an XML document. Nested values may be specified, -with any number of nested ``Guzzle\Common\ToArrayInterface`` objects. When XML parameters are specified, the -``Content-Type`` of the request will change to ``application/xml`` if a ``Content-Type`` has not already been specified -on the request. - -responseBody location -^^^^^^^^^^^^^^^^^^^^^ - -Specifies the EntityBody of a response. This can be used to download the response body to a file or a custom Guzzle -EntityBody object. - -No location -^^^^^^^^^^^ - -If a parameter has no location attribute, then the parameter is simply used as a data value. - -Other locations -^^^^^^^^^^^^^^^ - -Custom locations can be registered as new locations or override default locations if needed. - -.. _model-schema: - -Model Schema ------------- - -Models are used in service descriptions to provide generic JSON schema definitions that can be extended from or used in -``$ref`` attributes. Models can also be referenced in a ``responseClass`` attribute to provide valuable output to an -operation. Models are JSON schema documents and use the exact syntax and attributes used in parameters. - -Response Models -~~~~~~~~~~~~~~~ - -Response models describe how a response is parsed into a ``Guzzle\Service\Resource\Model`` object. Response models are -always modeled as JSON schema objects. When an HTTP response is parsed using a response model, the rules specified on -each property of a response model will translate 1:1 as keys in a PHP associative array. When a ``sentAs`` attribute is -found in response model parameters, the value retrieved from the HTTP response is retrieved using the ``sentAs`` -parameter but stored in the response model using the name of the parameter. - -The location field of top-level parameters in a response model tell response parsers how data is retrieved from a -response. - -statusCode location -^^^^^^^^^^^^^^^^^^^ - -Retrieves the status code of the response. - -reasonPhrase location -^^^^^^^^^^^^^^^^^^^^^ - -Retrieves the reason phrase of the response. - -header location -^^^^^^^^^^^^^^^ - -Retrieves a header from the HTTP response. - -body location -^^^^^^^^^^^^^ - -Retrieves the body of an HTTP response. - -json location -^^^^^^^^^^^^^ - -Retrieves a top-level parameter from a JSON document contained in an HTTP response. - -You can use ``additionalProperties`` if the JSON document is wrapped in an outer array. This allows you to parse the -contents of each item in the array using the parsing rules defined in the ``additionalProperties`` schema. - -xml location -^^^^^^^^^^^^ - -Retrieves a top-level node value from an XML document contained in an HTTP response. - -Other locations -^^^^^^^^^^^^^^^ - -Custom locations can be registered as new locations or override default locations if needed. - -Example service description ---------------------------- - -Let's say you're interacting with a web service called 'Foo' that allows for the following routes and methods:: - - GET/POST /users - GET/DELETE /users/:id - -The following JSON service description implements this simple web service: - -.. class:: overflow-height-500px - - .. code-block:: json - - { - "name": "Foo", - "apiVersion": "2012-10-14", - "baseUrl": "http://api.foo.com", - "description": "Foo is an API that allows you to Baz Bar", - "operations": { - "GetUsers": { - "httpMethod": "GET", - "uri": "/users", - "summary": "Gets a list of users", - "responseClass": "GetUsersOutput" - }, - "CreateUser": { - "httpMethod": "POST", - "uri": "/users", - "summary": "Creates a new user", - "responseClass": "CreateUserOutput", - "parameters": { - "name": { - "location": "json", - "type": "string" - }, - "age": { - "location": "json", - "type": "integer" - } - } - }, - "GetUser": { - "httpMethod": "GET", - "uri": "/users/{id}", - "summary": "Retrieves a single user", - "responseClass": "GetUserOutput", - "parameters": { - "id": { - "location": "uri", - "description": "User to retrieve by ID", - "required": true - } - } - }, - "DeleteUser": { - "httpMethod": "DELETE", - "uri": "/users/{id}", - "summary": "Deletes a user", - "responseClass": "DeleteUserOutput", - "parameters": { - "id": { - "location": "uri", - "description": "User to delete by ID", - "required": true - } - } - } - }, - "models": { - "GetUsersOutput": { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "location": "json", - "type": "string" - }, - "age": { - "location": "json", - "type": "integer" - } - } - } - }, - "CreateUserOutput": { - "type": "object", - "properties": { - "id": { - "location": "json", - "type": "string" - }, - "location": { - "location": "header", - "sentAs": "Location", - "type": "string" - } - } - }, - "GetUserOutput": { - "type": "object", - "properties": { - "name": { - "location": "json", - "type": "string" - }, - "age": { - "location": "json", - "type": "integer" - } - } - }, - "DeleteUserOutput": { - "type": "object", - "properties": { - "status": { - "location": "statusCode", - "type": "integer" - } - } - } - } - } - -If you attach this service description to a client, you would completely configure the client to interact with the -Foo web service and provide valuable response models for each operation. - -.. code-block:: php - - use Guzzle\Service\Description\ServiceDescription; - - $description = ServiceDescription::factory('/path/to/client.json'); - $client->setDescription($description); - - $command = $client->getCommand('DeleteUser', array('id' => 123)); - $responseModel = $client->execute($command); - echo $responseModel['status']; - -.. note:: - - You can add the service description to your client's factory method or constructor. diff --git a/bb-vendor/guzzle/guzzle/docs/webservice-client/using-the-service-builder.rst b/bb-vendor/guzzle/guzzle/docs/webservice-client/using-the-service-builder.rst deleted file mode 100644 index b7113d68b..000000000 --- a/bb-vendor/guzzle/guzzle/docs/webservice-client/using-the-service-builder.rst +++ /dev/null @@ -1,316 +0,0 @@ -======================= -Using a service builder -======================= - -The best way to instantiate Guzzle web service clients is to let Guzzle handle building the clients for you using a -ServiceBuilder. A ServiceBuilder is responsible for creating concrete client objects based on configuration settings -and helps to manage credentials for different environments. - -You don't have to use a service builder, but they help to decouple your application from concrete classes and help to -share configuration data across multiple clients. Consider the following example. Here we are creating two clients that -require the same API public key and secret key. The clients are created using their ``factory()`` methods. - -.. code-block:: php - - use MyService\FooClient; - use MyService\BarClient; - - $foo = FooClient::factory(array( - 'key' => 'abc', - 'secret' => '123', - 'custom' => 'and above all' - )); - - $bar = BarClient::factory(array( - 'key' => 'abc', - 'secret' => '123', - 'custom' => 'listen to me' - )); - -The redundant specification of the API keys can be removed using a service builder. - -.. code-block:: php - - use Guzzle\Service\Builder\ServiceBuilder; - - $builder = ServiceBuilder::factory(array( - 'services' => array( - 'abstract_client' => array( - 'params' => array( - 'key' => 'abc', - 'secret' => '123' - ) - ), - 'foo' => array( - 'extends' => 'abstract_client', - 'class' => 'MyService\FooClient', - 'params' => array( - 'custom' => 'and above all' - ) - ), - 'bar' => array( - 'extends' => 'abstract_client', - 'class' => 'MyService\FooClient', - 'params' => array( - 'custom' => 'listen to me' - ) - ) - ) - )); - - $foo = $builder->get('foo'); - $bar = $builder->get('bar'); - -You can make managing your API keys even easier by saving the service builder configuration in a JSON format in a -.json file. - -Creating a service builder --------------------------- - -A ServiceBuilder can source information from an array, an PHP include file that returns an array, or a JSON file. - -.. code-block:: php - - use Guzzle\Service\Builder\ServiceBuilder; - - // Source service definitions from a JSON file - $builder = ServiceBuilder::factory('services.json'); - -Sourcing data from an array -~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Data can be source from a PHP array. The array must contain an associative ``services`` array that maps the name of a -client to the configuration information used by the service builder to create the client. Clients are given names -which are used to identify how a client is retrieved from a service builder. This can be useful for using multiple -accounts for the same service or creating development clients vs. production clients. - -.. code-block:: php - - $services = array( - 'includes' => array( - '/path/to/other/services.json', - '/path/to/other/php_services.php' - ), - 'services' => array( - 'abstract.foo' => array( - 'params' => array( - 'username' => 'foo', - 'password' => 'bar' - ) - ), - 'bar' => array( - 'extends' => 'abstract.foo', - 'class' => 'MyClientClass', - 'params' => array( - 'other' => 'abc' - ) - ) - ) - ); - -A service builder configuration array contains two top-level array keys: - -+------------+---------------------------------------------------------------------------------------------------------+ -| Key | Description | -+============+=========================================================================================================+ -| includes | Array of paths to JSON or PHP include files to include in the configuration. | -+------------+---------------------------------------------------------------------------------------------------------+ -| services | Associative array of defined services that can be created by the service builder. Each service can | -| | contain the following keys: | -| | | -| | +------------+----------------------------------------------------------------------------------------+ | -| | | Key | Description | | -| | +============+========================================================================================+ | -| | | class | The concrete class to instantiate that implements the | | -| | | | ``Guzzle\Common\FromConfigInterface``. | | -| | +------------+----------------------------------------------------------------------------------------+ | -| | | extends | The name of a previously defined service to extend from | | -| | +------------+----------------------------------------------------------------------------------------+ | -| | | params | Associative array of parameters to pass to the factory method of the service it is | | -| | | | instantiated | | -| | +------------+----------------------------------------------------------------------------------------+ | -| | | alias | An alias that can be used in addition to the array key for retrieving a client from | | -| | | | the service builder. | | -| | +------------+----------------------------------------------------------------------------------------+ | -+------------+---------------------------------------------------------------------------------------------------------+ - -The first client defined, ``abstract.foo``, is used as a placeholder of shared configuration values. Any service -extending abstract.foo will inherit its params. As an example, this can be useful when clients share the same username -and password. - -The next client, ``bar``, extends from ``abstract.foo`` using the ``extends`` attribute referencing the client from -which to extend. Additional parameters can be merged into the original service definition when extending a parent -service. - -.. important:: - - Each client that you intend to instantiate must specify a ``class`` attribute that references the full class name - of the client being created. The class referenced in the ``class`` parameter must implement a static ``factory()`` - method that accepts an array or ``Guzzle\Common\Collection`` object and returns an instantiated object. - -Sourcing from a PHP include -~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You can create service builder configurations using a PHP include file. This can be useful if you wish to take -advantage of an opcode cache like APC to speed up the process of loading and processing the configuration. The PHP -include file is the same format as an array, but you simply create a PHP script that returns an array and save the -file with the .php file extension. - -.. code-block:: php - - '...'); - // Saved as config.php - -This configuration file can then be used with a service builder. - -.. code-block:: php - - $builder = ServiceBuilder::factory('/path/to/config.php'); - -Sourcing from a JSON document -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You can use JSON documents to serialize your service descriptions. The JSON format uses the exact same structure as -the PHP array syntax, but it's just serialized using JSON. - -.. code-block:: javascript - - { - "includes": ["/path/to/other/services.json", "/path/to/other/php_services.php"], - "services": { - "abstract.foo": { - "params": { - "username": "foo", - "password": "bar" - } - }, - "bar": { - "extends": "abstract.foo", - "class": "MyClientClass", - "params": { - "other": "abc" - } - } - } - } - -Referencing other clients in parameters -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -If one of your clients depends on another client as one of its parameters, you can reference that client by name by -enclosing the client's reference key in ``{}``. - -.. code-block:: javascript - - { - "services": { - "token": { - "class": "My\Token\TokenFactory", - "params": { - "access_key": "xyz" - } - }, - "client": { - "class": "My\Client", - "params": { - "token_client": "{token}", - "version": "1.0" - } - } - } - } - -When ``client`` is constructed by the service builder, the service builder will first create the ``token`` service -and then inject the token service into ``client``'s factory method in the ``token_client`` parameter. - -Retrieving clients from a service builder ------------------------------------------ - -Clients are referenced using a customizable name you provide in your service definition. The ServiceBuilder is a sort -of multiton object-- it will only instantiate a client once and return that client for subsequent retrievals. Clients -are retrieved by name (the array key used in the configuration) or by the ``alias`` setting of a service. - -Here's an example of retrieving a client from your ServiceBuilder: - -.. code-block:: php - - $client = $builder->get('foo'); - - // You can also use the ServiceBuilder object as an array - $client = $builder['foo']; - -Creating throwaway clients -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You can get a "throwaway" client (a client that is not persisted by the ServiceBuilder) by passing ``true`` in the -second argument of ``ServiceBuilder::get()``. This allows you to create a client that will not be returned by other -parts of your code that use the service builder. Instead of passing ``true``, you can pass an array of configuration -settings that will override the configuration settings specified in the service builder. - -.. code-block:: php - - // Get a throwaway client and overwrite the "custom" setting of the client - $foo = $builder->get('foo', array( - 'custom' => 'in this world there are rules' - )); - -Getting raw configuration settings -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You can get the raw configuration settings provided to the service builder for a specific service using the -``getData($name)`` method of a service builder. This method will null if the service was not found in the service -builder or an array of configuration settings if the service was found. - -.. code-block:: php - - $data = $builder->getData('foo'); - echo $data['key'] . "\n"; - echo $data['secret'] . "\n"; - echo $data['custom'] . "\n"; - -Adding a plugin to all clients ------------------------------- - -You can add a plugin to all clients created by a service builder using the ``addGlobalPlugin($plugin)`` method of a -service builder and passing a ``Symfony\Component\EventDispatcher\EventSubscriberInterface`` object. The service builder -will then attach each global plugin to every client as it is created. This allows you to, for example, add a LogPlugin -to every request created by a service builder for easy debugging. - -.. code-block:: php - - use Guzzle\Plugin\Log\LogPlugin; - - // Add a debug log plugin to every client as it is created - $builder->addGlobalPlugin(LogPlugin::getDebugPlugin()); - - $foo = $builder->get('foo'); - $foo->get('/')->send(); - // Should output all of the data sent over the wire - -.. _service-builder-events: - -Events emitted from a service builder -------------------------------------- - -A ``Guzzle\Service\Builder\ServiceBuilder`` object emits the following events: - -+-------------------------------+--------------------------------------------+-----------------------------------------+ -| Event name | Description | Event data | -+===============================+============================================+=========================================+ -| service_builder.create_client | Called when a client is created | * client: The created client object | -+-------------------------------+--------------------------------------------+-----------------------------------------+ - -.. code-block:: php - - use Guzzle\Common\Event; - use Guzzle\Service\Builder\ServiceBuilder; - - $builder = ServiceBuilder::factory('/path/to/config.json'); - - // Add an event listener to print out each client client as it is created - $builder->getEventDispatcher()->addListener('service_builder.create_client', function (Event $e) { - echo 'Client created: ' . get_class($e['client']) . "\n"; - }); - - $foo = $builder->get('foo'); - // Should output the class used for the "foo" client diff --git a/bb-vendor/guzzle/guzzle/docs/webservice-client/webservice-client.rst b/bb-vendor/guzzle/guzzle/docs/webservice-client/webservice-client.rst deleted file mode 100644 index 7ec771e1c..000000000 --- a/bb-vendor/guzzle/guzzle/docs/webservice-client/webservice-client.rst +++ /dev/null @@ -1,659 +0,0 @@ -====================== -The web service client -====================== - -The ``Guzzle\Service`` namespace contains various abstractions that help to make it easier to interact with a web -service API, including commands, service descriptions, and resource iterators. - -In this chapter, we'll build a simple `Twitter API client `_. - -Creating a client -================= - -A class that extends from ``Guzzle\Service\Client`` or implements ``Guzzle\Service\ClientInterface`` must implement a -``factory()`` method in order to be used with a :doc:`service builder `. - -Factory method --------------- - -You can use the ``factory()`` method of a client directly if you do not need a service builder. - -.. code-block:: php - - use mtdowling\TwitterClient; - - // Create a client and pass an array of configuration data - $twitter = TwitterClient::factory(array( - 'consumer_key' => '****', - 'consumer_secret' => '****', - 'token' => '****', - 'token_secret' => '****' - )); - -.. note:: - - If you'd like to follow along, here's how to get your Twitter API credentials: - - 1. Visit https://dev.twitter.com/apps - 2. Click on an application that you've created - 3. Click on the "OAuth tool" tab - 4. Copy all of the settings under "OAuth Settings" - -Implementing a factory method ------------------------------ - -Creating a client and its factory method is pretty simple. You just need to implement ``Guzzle\Service\ClientInterface`` -or extend from ``Guzzle\Service\Client``. - -.. code-block:: php - - namespace mtdowling; - - use Guzzle\Common\Collection; - use Guzzle\Plugin\Oauth\OauthPlugin; - use Guzzle\Service\Client; - use Guzzle\Service\Description\ServiceDescription; - - /** - * A simple Twitter API client - */ - class TwitterClient extends Client - { - public static function factory($config = array()) - { - // Provide a hash of default client configuration options - $default = array('base_url' => 'https://api.twitter.com/1.1'); - - // The following values are required when creating the client - $required = array( - 'base_url', - 'consumer_key', - 'consumer_secret', - 'token', - 'token_secret' - ); - - // Merge in default settings and validate the config - $config = Collection::fromConfig($config, $default, $required); - - // Create a new Twitter client - $client = new self($config->get('base_url'), $config); - - // Ensure that the OauthPlugin is attached to the client - $client->addSubscriber(new OauthPlugin($config->toArray())); - - return $client; - } - } - -Service Builder ---------------- - -A service builder is used to easily create web service clients, provides a simple configuration driven approach to -creating clients, and allows you to share configuration settings across multiple clients. You can find out more about -Guzzle's service builder in :doc:`using-the-service-builder`. - -.. code-block:: php - - use Guzzle\Service\Builder\ServiceBuilder; - - // Create a service builder and provide client configuration data - $builder = ServiceBuilder::factory('/path/to/client_config.json'); - - // Get the client from the service builder by name - $twitter = $builder->get('twitter'); - -The above example assumes you have JSON data similar to the following stored in "/path/to/client_config.json": - -.. code-block:: json - - { - "services": { - "twitter": { - "class": "mtdowling\\TwitterClient", - "params": { - "consumer_key": "****", - "consumer_secret": "****", - "token": "****", - "token_secret": "****" - } - } - } - } - -.. note:: - - A service builder becomes much more valuable when using multiple web service clients in a single application or - if you need to utilize the same client with varying configuration settings (e.g. multiple accounts). - -Commands -======== - -Commands are a concept in Guzzle that helps to hide the underlying implementation of an API by providing an easy to use -parameter driven object for each action of an API. A command is responsible for accepting an array of configuration -parameters, serializing an HTTP request, and parsing an HTTP response. Following the -`command pattern `_, commands in Guzzle offer a greater level of -flexibility when implementing and utilizing a web service client. - -Executing commands ------------------- - -You must explicitly execute a command after creating a command using the ``getCommand()`` method. A command has an -``execute()`` method that may be called, or you can use the ``execute()`` method of a client object and pass in the -command object. Calling either of these execute methods will return the result value of the command. The result value is -the result of parsing the HTTP response with the ``process()`` method. - -.. code-block:: php - - // Get a command from the client and pass an array of parameters - $command = $twitter->getCommand('getMentions', array( - 'count' => 5 - )); - - // Other parameters can be set on the command after it is created - $command['trim_user'] = false; - - // Execute the command using the command object. - // The result value contains an array of JSON data from the response - $result = $command->execute(); - - // You can retrieve the result of the command later too - $result = $command->getResult(). - -Command object also contains methods that allow you to inspect the HTTP request and response that was utilized with -the command. - -.. code-block:: php - - $request = $command->getRequest(); - $response = $command->getResponse(); - -.. note:: - - The format and notation used to retrieve commands from a client can be customized by injecting a custom command - factory, ``Guzzle\Service\Command\Factory\FactoryInterface``, on the client using ``$client->setCommandFactory()``. - -Executing with magic methods -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -When using method missing magic methods with a command, the command will be executed right away and the result of the -command is returned. - -.. code-block:: php - - $jsonData = $twitter->getMentions(array( - 'count' => 5, - 'trim_user' => true - )); - -Creating commands ------------------ - -Commands are created using either the ``getCommand()`` method of a client or a magic missing method of a client. Using -the ``getCommand()`` method allows you to create a command without executing it, allowing for customization of the -command or the request serialized by the command. - -When a client attempts to create a command, it uses the client's ``Guzzle\Service\Command\Factory\FactoryInterface``. -By default, Guzzle will utilize a command factory that first looks for a concrete class for a particular command -(concrete commands) followed by a command defined by a service description (operation commands). We'll learn more about -concrete commands and operation commands later in this chapter. - -.. code-block:: php - - // Get a command from the twitter client. - $command = $twitter->getCommand('getMentions'); - $result = $command->execute(); - -Unless you've skipped ahead, running the above code will throw an exception. - - PHP Fatal error: Uncaught exception 'Guzzle\Common\Exception\InvalidArgumentException' with message - 'Command was not found matching getMentions' - -This exception was thrown because the "getMentions" command has not yet been implemented. Let's implement one now. - -Concrete commands -~~~~~~~~~~~~~~~~~ - -Commands can be created in one of two ways: create a concrete command class that extends -``Guzzle\Service\Command\AbstractCommand`` or -:doc:`create an OperationCommand based on a service description `. The recommended -approach is to use a service description to define your web service, but you can use concrete commands when custom -logic must be implemented for marshaling or unmarshaling a HTTP message. - -Commands are the method in which you abstract away the underlying format of the requests that need to be sent to take -action on a web service. Commands in Guzzle are meant to be built by executing a series of setter methods on a command -object. Commands are only validated right before they are executed. A ``Guzzle\Service\Client`` object is responsible -for executing commands. Commands created for your web service must implement -``Guzzle\Service\Command\CommandInterface``, but it's easier to extend the ``Guzzle\Service\Command\AbstractCommand`` -class, implement the ``build()`` method, and optionally implement the ``process()`` method. - -Serializing requests -^^^^^^^^^^^^^^^^^^^^ - -The ``build()`` method of a command is responsible for using the arguments of the command to build and serialize a -HTTP request and set the request on the ``$request`` property of the command object. This step is usually taken care of -for you when using a service description driven command that uses the default -``Guzzle\Service\Command\OperationCommand``. You may wish to implement the process method yourself when you aren't -using a service description or need to implement more complex request serialization. - -.. important:::: - - When implementing a custom ``build()`` method, be sure to set the class property of ``$this->request`` to an - instantiated and ready to send request. - -The following example shows how to implement the ``getMentions`` -`Twitter API `_ method using a concrete command. - -.. code-block:: php - - namespace mtdowling\Twitter\Command; - - use Guzzle\Service\Command\AbstractCommand; - - class GetMentions extends AbstractCommand - { - protected function build() - { - // Create the request property of the command - $this->request = $this->client->get('statuses/mentions_timeline.json'); - - // Grab the query object of the request because we will use it for - // serializing command parameters on the request - $query = $this->request->getQuery(); - - if ($this['count']) { - $query->set('count', $this['count']); - } - - if ($this['since_id']) { - $query->set('since_id', $this['since_id']); - } - - if ($this['max_id']) { - $query->set('max_id', $this['max_id']); - } - - if ($this['trim_user'] !== null) { - $query->set('trim_user', $this['trim_user'] ? 'true' : 'false'); - } - - if ($this['contributor_details'] !== null) { - $query->set('contributor_details', $this['contributor_details'] ? 'true' : 'false'); - } - - if ($this['include_entities'] !== null) { - $query->set('include_entities', $this['include_entities'] ? 'true' : 'false'); - } - } - } - -By default, a client will attempt to find concrete command classes under the ``Command`` namespace of a client. First -the client will attempt to find an exact match for the name of the command to the name of the command class. If an -exact match is not found, the client will calculate a class name using inflection. This is calculated based on the -folder hierarchy of a command and converting the CamelCased named commands into snake_case. Here are some examples on -how the command names are calculated: - -#. ``Foo\Command\JarJar`` **->** jar_jar -#. ``Foo\Command\Test`` **->** test -#. ``Foo\Command\People\GetCurrentPerson`` **->** people.get_current_person - -Notice how any sub-namespace beneath ``Command`` is converted from ``\`` to ``.`` (a period). CamelCasing is converted -to lowercased snake_casing (e.g. JarJar == jar_jar). - -Parsing responses -^^^^^^^^^^^^^^^^^ - -The ``process()`` method of a command is responsible for converting an HTTP response into something more useful. For -example, a service description operation that has specified a model object in the ``responseClass`` attribute of the -operation will set a ``Guzzle\Service\Resource\Model`` object as the result of the command. This behavior can be -completely modified as needed-- even if you are using operations and responseClass models. Simply implement a custom -``process()`` method that sets the ``$this->result`` class property to whatever you choose. You can reuse parts of the -default Guzzle response parsing functionality or get inspiration from existing code by using -``Guzzle\Service\Command\OperationResponseParser`` and ``Guzzle\Service\Command\DefaultResponseParser`` classes. - -If you do not implement a custom ``process()`` method and are not using a service description, then Guzzle will attempt -to guess how a response should be processed based on the Content-Type header of the response. Because the Twitter API -sets a ``Content-Type: application/json`` header on this response, we do not need to implement any custom response -parsing. - -Operation commands -~~~~~~~~~~~~~~~~~~ - -Operation commands are commands in which the serialization of an HTTP request and the parsing of an HTTP response are -driven by a Guzzle service description. Because request serialization, validation, and response parsing are -described using a DSL, creating operation commands is a much faster process than writing concrete commands. - -Creating operation commands for our Twitter client can remove a great deal of redundancy from the previous concrete -command, and allows for a deeper runtime introspection of the API. Here's an example service description we can use to -create the Twitter API client: - -.. code-block:: json - - { - "name": "Twitter", - "apiVersion": "1.1", - "baseUrl": "https://api.twitter.com/1.1", - "description": "Twitter REST API client", - "operations": { - "GetMentions": { - "httpMethod": "GET", - "uri": "statuses/mentions_timeline.json", - "summary": "Returns the 20 most recent mentions for the authenticating user.", - "responseClass": "GetMentionsOutput", - "parameters": { - "count": { - "description": "Specifies the number of tweets to try and retrieve", - "type": "integer", - "location": "query" - }, - "since_id": { - "description": "Returns results with an ID greater than the specified ID", - "type": "integer", - "location": "query" - }, - "max_id": { - "description": "Returns results with an ID less than or equal to the specified ID.", - "type": "integer", - "location": "query" - }, - "trim_user": { - "description": "Limits the amount of data returned for each user", - "type": "boolean", - "location": "query" - }, - "contributor_details": { - "description": "Adds more data to contributor elements", - "type": "boolean", - "location": "query" - }, - "include_entities": { - "description": "The entities node will be disincluded when set to false.", - "type": "boolean", - "location": "query" - } - } - } - }, - "models": { - "GetMentionsOutput": { - "type": "object", - "additionalProperties": { - "location": "json" - } - } - } - } - -If you're lazy, you can define the API in a less descriptive manner using ``additionalParameters``. -``additionalParameters`` define the serialization and validation rules of parameters that are not explicitly defined -in a service description. - -.. code-block:: json - - { - "name": "Twitter", - "apiVersion": "1.1", - "baseUrl": "https://api.twitter.com/1.1", - "description": "Twitter REST API client", - "operations": { - "GetMentions": { - "httpMethod": "GET", - "uri": "statuses/mentions_timeline.json", - "summary": "Returns the 20 most recent mentions for the authenticating user.", - "responseClass": "GetMentionsOutput", - "additionalParameters": { - "location": "query" - } - } - }, - "models": { - "GetMentionsOutput": { - "type": "object", - "additionalProperties": { - "location": "json" - } - } - } - } - -You should attach the service description to the client at the end of the client's factory method: - -.. code-block:: php - - // ... - class TwitterClient extends Client - { - public static function factory($config = array()) - { - // ... same code as before ... - - // Set the service description - $client->setDescription(ServiceDescription::factory('path/to/twitter.json')); - - return $client; - } - } - -The client can now use operations defined in the service description instead of requiring you to create concrete -command classes. Feel free to delete the concrete command class we created earlier. - -.. code-block:: php - - $jsonData = $twitter->getMentions(array( - 'count' => 5, - 'trim_user' => true - )); - -Executing commands in parallel ------------------------------- - -Much like HTTP requests, Guzzle allows you to send multiple commands in parallel. You can send commands in parallel by -passing an array of command objects to a client's ``execute()`` method. The client will serialize each request and -send them all in parallel. If an error is encountered during the transfer, then a -``Guzzle\Service\Exception\CommandTransferException`` is thrown, which allows you to retrieve a list of commands that -succeeded and a list of commands that failed. - -.. code-block:: php - - use Guzzle\Service\Exception\CommandTransferException; - - $commands = array(); - $commands[] = $twitter->getCommand('getMentions'); - $commands[] = $twitter->getCommand('otherCommandName'); - // etc... - - try { - $result = $client->execute($commands); - foreach ($result as $command) { - echo $command->getName() . ': ' . $command->getResponse()->getStatusCode() . "\n"; - } - } catch (CommandTransferException $e) { - // Get an array of the commands that succeeded - foreach ($e->getSuccessfulCommands() as $command) { - echo $command->getName() . " succeeded\n"; - } - // Get an array of the commands that failed - foreach ($e->getFailedCommands() as $command) { - echo $command->getName() . " failed\n"; - } - } - -.. note:: - - All commands executed from a client using an array must originate from the same client. - -Special command options ------------------------ - -Guzzle exposes several options that help to control how commands are validated, serialized, and parsed. -Command options can be specified when creating a command or in the ``command.params`` parameter in the -``Guzzle\Service\Client``. - -=========================== ============================================================================================ -command.request_options Option used to add :ref:`Request options ` to the request created by a - command -command.hidden_params An array of the names of parameters ignored by the ``additionalParameters`` parameter schema -command.disable_validation Set to true to disable JSON schema validation of the command's input parameters -command.response_processing Determines how the default response parser will parse the command. One of "raw" no parsing, - "model" (the default method used to parse commands using response models defined in service - descriptions) -command.headers (deprecated) Option used to specify custom headers. Use ``command.request_options`` instead -command.on_complete (deprecated) Option used to add an onComplete method to a command. Use - ``command.after_send`` event instead -command.response_body (deprecated) Option used to change the entity body used to store a response. - Use ``command.request_options`` instead -=========================== ============================================================================================ - -Advanced client configuration -============================= - -Default command parameters --------------------------- - -When creating a client object, you can specify default command parameters to pass into all commands. Any key value pair -present in the ``command.params`` settings of a client will be added as default parameters to any command created -by the client. - -.. code-block:: php - - $client = new Guzzle\Service\Client(array( - 'command.params' => array( - 'default_1' => 'foo', - 'another' => 'bar' - ) - )); - -Magic methods -------------- - -Client objects will, by default, attempt to create and execute commands when a missing method is invoked on a client. -This powerful concept applies to both concrete commands and operation commands powered by a service description. This -makes it appear to the end user that you have defined actual methods on a client object, when in fact, the methods are -invoked using PHP's magic ``__call`` method. - -The ``__call`` method uses the ``getCommand()`` method of a client, which uses the client's internal -``Guzzle\Service\Command\Factory\FactoryInterface`` object. The default command factory allows you to instantiate -operations defined in a client's service description. The method in which a client determines which command to -execute is defined as follows: - -1. The client will first try to find a literal match for an operation in the service description. -2. If the literal match is not found, the client will try to uppercase the first character of the operation and find - the match again. -3. If a match is still not found, the command factory will inflect the method name from CamelCase to snake_case and - attempt to find a matching command. -4. If a command still does not match, an exception is thrown. - -.. code-block:: php - - // Use the magic method - $result = $twitter->getMentions(); - - // This is exactly the same as: - $result = $twitter->getCommand('getMentions')->execute(); - -You can disable magic methods on a client by passing ``false`` to the ``enableMagicMethod()`` method. - -Custom command factory ----------------------- - -A client by default uses the ``Guzzle\Service\Command\Factory\CompositeFactory`` which allows multiple command -factories to attempt to create a command by a certain name. The default CompositeFactory uses a ``ConcreteClassFactory`` -and a ``ServiceDescriptionFactory`` if a service description is specified on a client. You can specify a custom -command factory if your client requires custom command creation logic using the ``setCommandFactory()`` method of -a client. - -Custom resource Iterator factory --------------------------------- - -Resource iterators can be retrieved from a client using the ``getIterator($name)`` method of a client. This method uses -a client's internal ``Guzzle\Service\Resource\ResourceIteratorFactoryInterface`` object. A client by default uses a -``Guzzle\Service\Resource\ResourceIteratorClassFactory`` to attempt to find concrete classes that implement resource -iterators. The default factory will first look for matching iterators in the ``Iterator`` subdirectory of the client -followed by the ``Model`` subdirectory of a client. Use the ``setResourceIteratorFactory()`` method of a client to -specify a custom resource iterator factory. - -Plugins and events -================== - -``Guzzle\Service\Client`` exposes various events that allow you to hook in custom logic. A client object owns a -``Symfony\Component\EventDispatcher\EventDispatcher`` object that can be accessed by calling -``$client->getEventDispatcher()``. You can use the event dispatcher to add listeners (a simple callback function) or -event subscribers (classes that listen to specific events of a dispatcher). - -.. _service-client-events: - -Events emitted from a Service Client ------------------------------------- - -A ``Guzzle\Service\Client`` object emits the following events: - -+------------------------------+--------------------------------------------+------------------------------------------+ -| Event name | Description | Event data | -+==============================+============================================+==========================================+ -| client.command.create | The client created a command object | * client: Client object | -| | | * command: Command object | -+------------------------------+--------------------------------------------+------------------------------------------+ -| command.before_prepare | Before a command is validated and built. | * command: Command being prepared | -| | This is also before a request is created. | | -+------------------------------+--------------------------------------------+------------------------------------------+ -| command.after_prepare | After a command instantiates and | * command: Command that was prepared | -| | configures its request object. | | -+------------------------------+--------------------------------------------+------------------------------------------+ -| command.before_send | The client is about to execute a prepared | * command: Command to execute | -| | command | | -+------------------------------+--------------------------------------------+------------------------------------------+ -| command.after_send | The client successfully completed | * command: The command that was executed | -| | executing a command | | -+------------------------------+--------------------------------------------+------------------------------------------+ -| command.parse_response | Called when ``responseType`` is ``class`` | * command: The command with a response | -| | and the response is about to be parsed. | about to be parsed. | -+------------------------------+--------------------------------------------+------------------------------------------+ - -.. code-block:: php - - use Guzzle\Common\Event; - use Guzzle\Service\Client; - - $client = new Client(); - - // create an event listener that operates on request objects - $client->getEventDispatcher()->addListener('command.after_prepare', function (Event $event) { - $command = $event['command']; - $request = $command->getRequest(); - - // do something with request - }); - -.. code-block:: php - - use Guzzle\Common\Event; - use Guzzle\Common\Client; - use Symfony\Component\EventDispatcher\EventSubscriberInterface; - - class EventSubscriber implements EventSubscriberInterface - { - public static function getSubscribedEvents() - { - return array( - 'client.command.create' => 'onCommandCreate', - 'command.parse_response' => 'onParseResponse' - ); - } - - public function onCommandCreate(Event $event) - { - $client = $event['client']; - $command = $event['command']; - // operate on client and command - } - - public function onParseResponse(Event $event) - { - $command = $event['command']; - // operate on the command - } - } - - $client = new Client(); - - $client->addSubscriber(new EventSubscriber()); diff --git a/bb-vendor/guzzle/guzzle/phar-stub.php b/bb-vendor/guzzle/guzzle/phar-stub.php deleted file mode 100644 index cc2b53f4f..000000000 --- a/bb-vendor/guzzle/guzzle/phar-stub.php +++ /dev/null @@ -1,16 +0,0 @@ -registerNamespaces(array( - 'Guzzle' => 'phar://guzzle.phar/src', - 'Symfony\\Component\\EventDispatcher' => 'phar://guzzle.phar/vendor/symfony/event-dispatcher', - 'Doctrine' => 'phar://guzzle.phar/vendor/doctrine/common/lib', - 'Monolog' => 'phar://guzzle.phar/vendor/monolog/monolog/src' -)); -$classLoader->register(); - -__HALT_COMPILER(); diff --git a/bb-vendor/guzzle/guzzle/phing/build.properties.dist b/bb-vendor/guzzle/guzzle/phing/build.properties.dist deleted file mode 100644 index c60d3d9cf..000000000 --- a/bb-vendor/guzzle/guzzle/phing/build.properties.dist +++ /dev/null @@ -1,16 +0,0 @@ -# you may need to update this if you're working on a fork. -guzzle.remote=git@github.com:guzzle/guzzle.git - -# github credentials -- only used by GitHub API calls to create subtree repos -github.basicauth=username:password -# for the subtree split and testing -github.org=guzzle - -# your git path -cmd.git=git - -# your composer command -cmd.composer=composer - -# test server start -cmd.testserver=node diff --git a/bb-vendor/guzzle/guzzle/phing/imports/dependencies.xml b/bb-vendor/guzzle/guzzle/phing/imports/dependencies.xml deleted file mode 100644 index e40e037c2..000000000 --- a/bb-vendor/guzzle/guzzle/phing/imports/dependencies.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - using git at ${cmd.git} - - - - found git at ${cmd.git} - - - - - - - - - - diff --git a/bb-vendor/guzzle/guzzle/phing/imports/deploy.xml b/bb-vendor/guzzle/guzzle/phing/imports/deploy.xml deleted file mode 100644 index 109e5ec4f..000000000 --- a/bb-vendor/guzzle/guzzle/phing/imports/deploy.xml +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - - - - On branch ${head} - - - - - - - - - - working directory clean - - - ${git.status} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ChangeLog Match: ${version.changelog} - Guzzle\Common\Version Match: ${version.version} - - - - releasing: phing -Dnew.version=3.0.x -Dhead=master release - -- - - - - - - - - - - - - - - - BEGINNING RELEASE FOR ${new.version} - - - - - - - - - - - - - - - - - - - - - - - - Tip: to create a new release, do: phing -Dnew.version=[TAG] -Dhead=[BRANCH] release - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bb-vendor/guzzle/guzzle/phing/tasks/ComposerLintTask.php b/bb-vendor/guzzle/guzzle/phing/tasks/ComposerLintTask.php deleted file mode 100644 index 3b7040982..000000000 --- a/bb-vendor/guzzle/guzzle/phing/tasks/ComposerLintTask.php +++ /dev/null @@ -1,152 +0,0 @@ - - * @license http://claylo.mit-license.org/2012/ MIT License - */ - -require_once 'phing/Task.php'; - -class ComposerLintTask extends Task -{ - protected $dir = null; - protected $file = null; - protected $passthru = false; - protected $composer = null; - - /** - * The setter for the dir - * - * @param string $str Directory to crawl recursively for composer files - */ - public function setDir($str) - { - $this->dir = $str; - } - - /** - * The setter for the file - * - * @param string $str Individual file to validate - */ - public function setFile($str) - { - $this->file = $str; - } - - /** - * Whether to use PHP's passthru() function instead of exec() - * - * @param boolean $passthru If passthru shall be used - */ - public function setPassthru($passthru) - { - $this->passthru = (bool) $passthru; - } - - /** - * Composer to execute. If unset, will attempt composer.phar in project - * basedir, and if that fails, will attempt global composer - * installation. - * - * @param string $str Individual file to validate - */ - public function setComposer($str) - { - $this->file = $str; - } - - /** - * The init method: do init steps - */ - public function init() - { - // nothing needed here - } - - /** - * The main entry point - */ - public function main() - { - if ($this->composer === null) { - $this->findComposer(); - } - - $files = array(); - if (!empty($this->file) && file_exists($this->file)) { - $files[] = $this->file; - } - - if (!empty($this->dir)) { - $found = $this->findFiles(); - foreach ($found as $file) { - $files[] = $this->dir . DIRECTORY_SEPARATOR . $file; - } - } - - foreach ($files as $file) { - - $cmd = $this->composer . ' validate ' . $file; - $cmd = escapeshellcmd($cmd); - - if ($this->passthru) { - $retval = null; - passthru($cmd, $retval); - if ($retval == 1) { - throw new BuildException('invalid composer.json'); - } - } else { - $out = array(); - $retval = null; - exec($cmd, $out, $retval); - if ($retval == 1) { - $err = join("\n", $out); - throw new BuildException($err); - } else { - $this->log($out[0]); - } - } - - } - - } - - /** - * Find the composer.json files using Phing's directory scanner - * - * @return array - */ - protected function findFiles() - { - $ds = new DirectoryScanner(); - $ds->setBasedir($this->dir); - $ds->setIncludes(array('**/composer.json')); - $ds->scan(); - return $ds->getIncludedFiles(); - } - - /** - * Find composer installation - * - */ - protected function findComposer() - { - $basedir = $this->project->getBasedir(); - $php = $this->project->getProperty('php.interpreter'); - - if (file_exists($basedir . '/composer.phar')) { - $this->composer = "$php $basedir/composer.phar"; - } else { - $out = array(); - exec('which composer', $out); - if (empty($out)) { - throw new BuildException( - 'Could not determine composer location.' - ); - } - $this->composer = $out[0]; - } - } -} diff --git a/bb-vendor/guzzle/guzzle/phing/tasks/GuzzlePearPharPackageTask.php b/bb-vendor/guzzle/guzzle/phing/tasks/GuzzlePearPharPackageTask.php deleted file mode 100644 index f72a6b5d0..000000000 --- a/bb-vendor/guzzle/guzzle/phing/tasks/GuzzlePearPharPackageTask.php +++ /dev/null @@ -1,338 +0,0 @@ - - * @license http://claylo.mit-license.org/2012/ MIT License - */ - -require_once 'phing/Task.php'; -require_once 'PEAR/PackageFileManager2.php'; -require_once 'PEAR/PackageFileManager/File.php'; -require_once 'PEAR/Packager.php'; - -class GuzzlePearPharPackageTask extends Task -{ - private $version; - private $deploy = true; - private $makephar = true; - - private $subpackages = array(); - - public function setVersion($str) - { - $this->version = $str; - } - - public function getVersion() - { - return $this->version; - } - - public function setDeploy($deploy) - { - $this->deploy = (bool) $deploy; - } - - public function getDeploy() - { - return $this->deploy; - } - - public function setMakephar($makephar) - { - $this->makephar = (bool) $makephar; - } - - public function getMakephar() - { - return $this->makephar; - } - - private $basedir; - private $guzzleinfo; - private $changelog_release_date; - private $changelog_notes = '-'; - - public function main() - { - $this->basedir = $this->getProject()->getBasedir(); - - if (!is_dir((string) $this->basedir.'/.subsplit')) { - throw new BuildException('PEAR packaging requires .subsplit directory'); - } - - // main composer file - $composer_file = file_get_contents((string) $this->basedir.'/.subsplit/composer.json'); - $this->guzzleinfo = json_decode($composer_file, true); - - // make sure we have a target - $pearwork = (string) $this->basedir . '/build/pearwork'; - if (!is_dir($pearwork)) { - mkdir($pearwork, 0777, true); - } - $pearlogs = (string) $this->basedir . '/build/artifacts/logs'; - if (!is_dir($pearlogs)) { - mkdir($pearlogs, 0777, true); - } - - $version = $this->getVersion(); - $this->grabChangelog(); - if ($version[0] == '2') { - $this->log('building single PEAR package'); - $this->buildSinglePackage(); - } else { - // $this->log("building PEAR subpackages"); - // $this->createSubPackages(); - // $this->log("building PEAR bundle package"); - $this->buildSinglePackage(); - } - - if ($this->getMakephar()) { - $this->log("building PHAR"); - $this->getProject()->executeTarget('package-phar'); - } - - if ($this->getDeploy()) { - $this->doDeployment(); - } - } - - public function doDeployment() - { - $basedir = (string) $this->basedir; - $this->log('beginning PEAR/PHAR deployment'); - - chdir($basedir . '/build/pearwork'); - if (!is_dir('./channel')) { - mkdir('./channel'); - } - - // Pull the PEAR channel down locally - passthru('aws s3 sync s3://pear.guzzlephp.org ./channel'); - - // add PEAR packages - foreach (scandir('./') as $file) { - if (substr($file, -4) == '.tgz') { - passthru('pirum add ./channel ' . $file); - } - } - - // if we have a new phar, add it - if ($this->getMakephar() && file_exists($basedir . '/build/artifacts/guzzle.phar')) { - rename($basedir . '/build/artifacts/guzzle.phar', './channel/guzzle.phar'); - } - - // Sync up with the S3 bucket - chdir($basedir . '/build/pearwork/channel'); - passthru('aws s3 sync . s3://pear.guzzlephp.org'); - } - - public function buildSinglePackage() - { - $v = $this->getVersion(); - $apiversion = $v[0] . '.0.0'; - - $opts = array( - 'packagedirectory' => (string) $this->basedir . '/.subsplit/src/', - 'filelistgenerator' => 'file', - 'ignore' => array('*composer.json'), - 'baseinstalldir' => '/', - 'packagefile' => 'package.xml' - //'outputdirectory' => (string) $this->basedir . '/build/pearwork/' - ); - $pfm = new PEAR_PackageFileManager2(); - $pfm->setOptions($opts); - $pfm->addRole('md', 'doc'); - $pfm->addRole('pem', 'php'); - $pfm->setPackage('Guzzle'); - $pfm->setSummary("Object-oriented PHP HTTP Client for PHP 5.3+"); - $pfm->setDescription($this->guzzleinfo['description']); - $pfm->setPackageType('php'); - $pfm->setChannel('guzzlephp.org/pear'); - $pfm->setAPIVersion($apiversion); - $pfm->setReleaseVersion($this->getVersion()); - $pfm->setAPIStability('stable'); - $pfm->setReleaseStability('stable'); - $pfm->setNotes($this->changelog_notes); - $pfm->setPackageType('php'); - $pfm->setLicense('MIT', 'http://github.com/guzzle/guzzle/blob/master/LICENSE'); - $pfm->addMaintainer('lead', 'mtdowling', 'Michael Dowling', 'mtdowling@gmail.com', 'yes'); - $pfm->setDate($this->changelog_release_date); - $pfm->generateContents(); - - $phpdep = $this->guzzleinfo['require']['php']; - $phpdep = str_replace('>=', '', $phpdep); - $pfm->setPhpDep($phpdep); - $pfm->addExtensionDep('required', 'curl'); - $pfm->setPearinstallerDep('1.4.6'); - $pfm->addPackageDepWithChannel('required', 'EventDispatcher', 'pear.symfony.com', '2.1.0'); - if (!empty($this->subpackages)) { - foreach ($this->subpackages as $package) { - $pkg = dirname($package); - $pkg = str_replace('/', '_', $pkg); - $pfm->addConflictingPackageDepWithChannel($pkg, 'guzzlephp.org/pear', false, $apiversion); - } - } - - ob_start(); - $startdir = getcwd(); - chdir((string) $this->basedir . '/build/pearwork'); - - echo "DEBUGGING GENERATED PACKAGE FILE\n"; - $result = $pfm->debugPackageFile(); - if ($result) { - $out = $pfm->writePackageFile(); - echo "\n\n\nWRITE PACKAGE FILE RESULT:\n"; - var_dump($out); - // load up package file and build package - $packager = new PEAR_Packager(); - echo "\n\n\nBUILDING PACKAGE FROM PACKAGE FILE:\n"; - $dest_package = $packager->package($opts['packagedirectory'].'package.xml'); - var_dump($dest_package); - } else { - echo "\n\n\nDEBUGGING RESULT:\n"; - var_dump($result); - } - echo "removing package.xml"; - unlink($opts['packagedirectory'].'package.xml'); - $log = ob_get_clean(); - file_put_contents((string) $this->basedir . '/build/artifacts/logs/pear_package.log', $log); - chdir($startdir); - } - - public function createSubPackages() - { - $this->findComponents(); - - foreach ($this->subpackages as $package) { - $baseinstalldir = dirname($package); - $dir = (string) $this->basedir.'/.subsplit/src/' . $baseinstalldir; - $composer_file = file_get_contents((string) $this->basedir.'/.subsplit/src/'. $package); - $package_info = json_decode($composer_file, true); - $this->log('building ' . $package_info['target-dir'] . ' subpackage'); - $this->buildSubPackage($dir, $baseinstalldir, $package_info); - } - } - - public function buildSubPackage($dir, $baseinstalldir, $info) - { - $package = str_replace('/', '_', $baseinstalldir); - $opts = array( - 'packagedirectory' => $dir, - 'filelistgenerator' => 'file', - 'ignore' => array('*composer.json', '*package.xml'), - 'baseinstalldir' => '/' . $info['target-dir'], - 'packagefile' => 'package.xml' - ); - $pfm = new PEAR_PackageFileManager2(); - $pfm->setOptions($opts); - $pfm->setPackage($package); - $pfm->setSummary($info['description']); - $pfm->setDescription($info['description']); - $pfm->setPackageType('php'); - $pfm->setChannel('guzzlephp.org/pear'); - $pfm->setAPIVersion('3.0.0'); - $pfm->setReleaseVersion($this->getVersion()); - $pfm->setAPIStability('stable'); - $pfm->setReleaseStability('stable'); - $pfm->setNotes($this->changelog_notes); - $pfm->setPackageType('php'); - $pfm->setLicense('MIT', 'http://github.com/guzzle/guzzle/blob/master/LICENSE'); - $pfm->addMaintainer('lead', 'mtdowling', 'Michael Dowling', 'mtdowling@gmail.com', 'yes'); - $pfm->setDate($this->changelog_release_date); - $pfm->generateContents(); - - $phpdep = $this->guzzleinfo['require']['php']; - $phpdep = str_replace('>=', '', $phpdep); - $pfm->setPhpDep($phpdep); - $pfm->setPearinstallerDep('1.4.6'); - - foreach ($info['require'] as $type => $version) { - if ($type == 'php') { - continue; - } - if ($type == 'symfony/event-dispatcher') { - $pfm->addPackageDepWithChannel('required', 'EventDispatcher', 'pear.symfony.com', '2.1.0'); - } - if ($type == 'ext-curl') { - $pfm->addExtensionDep('required', 'curl'); - } - if (substr($type, 0, 6) == 'guzzle') { - $gdep = str_replace('/', ' ', $type); - $gdep = ucwords($gdep); - $gdep = str_replace(' ', '_', $gdep); - $pfm->addPackageDepWithChannel('required', $gdep, 'guzzlephp.org/pear', $this->getVersion()); - } - } - - // can't have main Guzzle package AND sub-packages - $pfm->addConflictingPackageDepWithChannel('Guzzle', 'guzzlephp.org/pear', false, $apiversion); - - ob_start(); - $startdir = getcwd(); - chdir((string) $this->basedir . '/build/pearwork'); - - echo "DEBUGGING GENERATED PACKAGE FILE\n"; - $result = $pfm->debugPackageFile(); - if ($result) { - $out = $pfm->writePackageFile(); - echo "\n\n\nWRITE PACKAGE FILE RESULT:\n"; - var_dump($out); - // load up package file and build package - $packager = new PEAR_Packager(); - echo "\n\n\nBUILDING PACKAGE FROM PACKAGE FILE:\n"; - $dest_package = $packager->package($opts['packagedirectory'].'/package.xml'); - var_dump($dest_package); - } else { - echo "\n\n\nDEBUGGING RESULT:\n"; - var_dump($result); - } - echo "removing package.xml"; - unlink($opts['packagedirectory'].'/package.xml'); - $log = ob_get_clean(); - file_put_contents((string) $this->basedir . '/build/artifacts/logs/pear_package_'.$package.'.log', $log); - chdir($startdir); - } - - public function findComponents() - { - $ds = new DirectoryScanner(); - $ds->setBasedir((string) $this->basedir.'/.subsplit/src'); - $ds->setIncludes(array('**/composer.json')); - $ds->scan(); - $files = $ds->getIncludedFiles(); - $this->subpackages = $files; - } - - public function grabChangelog() - { - $cl = file((string) $this->basedir.'/.subsplit/CHANGELOG.md'); - $notes = ''; - $in_version = false; - $release_date = null; - - foreach ($cl as $line) { - $line = trim($line); - if (preg_match('/^\* '.$this->getVersion().' \(([0-9\-]+)\)$/', $line, $matches)) { - $release_date = $matches[1]; - $in_version = true; - continue; - } - if ($in_version && empty($line) && empty($notes)) { - continue; - } - if ($in_version && ! empty($line)) { - $notes .= $line."\n"; - } - if ($in_version && empty($line) && !empty($notes)) { - $in_version = false; - } - } - $this->changelog_release_date = $release_date; - - if (! empty($notes)) { - $this->changelog_notes = $notes; - } - } -} diff --git a/bb-vendor/guzzle/guzzle/phing/tasks/GuzzleSubSplitTask.php b/bb-vendor/guzzle/guzzle/phing/tasks/GuzzleSubSplitTask.php deleted file mode 100644 index 5d56a5bd5..000000000 --- a/bb-vendor/guzzle/guzzle/phing/tasks/GuzzleSubSplitTask.php +++ /dev/null @@ -1,385 +0,0 @@ - - * @license http://claylo.mit-license.org/2012/ MIT License - */ - -require_once 'phing/tasks/ext/git/GitBaseTask.php'; - -// base - base of tree to split out -// subIndicatorFile - composer.json, package.xml? -class GuzzleSubSplitTask extends GitBaseTask -{ - /** - * What git repository to pull from and publish to - */ - protected $remote = null; - - /** - * Publish for comma-separated heads instead of all heads - */ - protected $heads = null; - - /** - * Publish for comma-separated tags instead of all tags - */ - protected $tags = null; - - /** - * Base of the tree RELATIVE TO .subsplit working dir - */ - protected $base = null; - - /** - * The presence of this file will indicate that the directory it resides - * in is at the top level of a split. - */ - protected $subIndicatorFile = 'composer.json'; - - /** - * Do everything except actually send the update. - */ - protected $dryRun = null; - - /** - * Do not sync any heads. - */ - protected $noHeads = false; - - /** - * Do not sync any tags. - */ - protected $noTags = false; - - /** - * The splits we found in the heads - */ - protected $splits; - - public function setRemote($str) - { - $this->remote = $str; - } - - public function getRemote() - { - return $this->remote; - } - - public function setHeads($str) - { - $this->heads = explode(',', $str); - } - - public function getHeads() - { - return $this->heads; - } - - public function setTags($str) - { - $this->tags = explode(',', $str); - } - - public function getTags() - { - return $this->tags; - } - - public function setBase($str) - { - $this->base = $str; - } - - public function getBase() - { - return $this->base; - } - - public function setSubIndicatorFile($str) - { - $this->subIndicatorFile = $str; - } - - public function getSubIndicatorFile() - { - return $this->subIndicatorFile; - } - - public function setDryRun($bool) - { - $this->dryRun = (bool) $bool; - } - - public function getDryRun() - { - return $this->dryRun; - } - - public function setNoHeads($bool) - { - $this->noHeads = (bool) $bool; - } - - public function getNoHeads() - { - return $this->noHeads; - } - - public function setNoTags($bool) - { - $this->noTags = (bool) $bool; - } - - public function getNoTags() - { - return $this->noTags; - } - - /** - * GitClient from VersionControl_Git - */ - protected $client = null; - - /** - * The main entry point - */ - public function main() - { - $repo = $this->getRepository(); - if (empty($repo)) { - throw new BuildException('"repository" is a required parameter'); - } - - $remote = $this->getRemote(); - if (empty($remote)) { - throw new BuildException('"remote" is a required parameter'); - } - - chdir($repo); - $this->client = $this->getGitClient(false, $repo); - - // initalized yet? - if (!is_dir('.subsplit')) { - $this->subsplitInit(); - } else { - // update - $this->subsplitUpdate(); - } - - // find all splits based on heads requested - $this->findSplits(); - - // check that GitHub has the repos - $this->verifyRepos(); - - // execute the subsplits - $this->publish(); - } - - public function publish() - { - $this->log('DRY RUN ONLY FOR NOW'); - $base = $this->getBase(); - $base = rtrim($base, '/') . '/'; - $org = $this->getOwningTarget()->getProject()->getProperty('github.org'); - - $splits = array(); - - $heads = $this->getHeads(); - foreach ($heads as $head) { - foreach ($this->splits[$head] as $component => $meta) { - $splits[] = $base . $component . ':git@github.com:'. $org.'/'.$meta['repo']; - } - - $cmd = 'git subsplit publish '; - $cmd .= escapeshellarg(implode(' ', $splits)); - - if ($this->getNoHeads()) { - $cmd .= ' --no-heads'; - } else { - $cmd .= ' --heads='.$head; - } - - if ($this->getNoTags()) { - $cmd .= ' --no-tags'; - } else { - if ($this->getTags()) { - $cmd .= ' --tags=' . escapeshellarg(implode(' ', $this->getTags())); - } - } - - passthru($cmd); - } - } - - /** - * Runs `git subsplit update` - */ - public function subsplitUpdate() - { - $repo = $this->getRepository(); - $this->log('git-subsplit update...'); - $cmd = $this->client->getCommand('subsplit'); - $cmd->addArgument('update'); - try { - $cmd->execute(); - } catch (Exception $e) { - throw new BuildException('git subsplit update failed'. $e); - } - chdir($repo . '/.subsplit'); - passthru('php ../composer.phar update --dev'); - chdir($repo); - } - - /** - * Runs `git subsplit init` based on the remote repository. - */ - public function subsplitInit() - { - $remote = $this->getRemote(); - $cmd = $this->client->getCommand('subsplit'); - $this->log('running git-subsplit init ' . $remote); - - $cmd->setArguments(array( - 'init', - $remote - )); - - try { - $output = $cmd->execute(); - } catch (Exception $e) { - throw new BuildException('git subsplit init failed'. $e); - } - $this->log(trim($output), Project::MSG_INFO); - $repo = $this->getRepository(); - chdir($repo . '/.subsplit'); - passthru('php ../composer.phar install --dev'); - chdir($repo); - } - - /** - * Find the composer.json files using Phing's directory scanner - * - * @return array - */ - protected function findSplits() - { - $this->log("checking heads for subsplits"); - $repo = $this->getRepository(); - $base = $this->getBase(); - - $splits = array(); - $heads = $this->getHeads(); - - if (!empty($base)) { - $base = '/' . ltrim($base, '/'); - } else { - $base = '/'; - } - - chdir($repo . '/.subsplit'); - foreach ($heads as $head) { - $splits[$head] = array(); - - // check each head requested *BEFORE* the actual subtree split command gets it - passthru("git checkout '$head'"); - $ds = new DirectoryScanner(); - $ds->setBasedir($repo . '/.subsplit' . $base); - $ds->setIncludes(array('**/'.$this->subIndicatorFile)); - $ds->scan(); - $files = $ds->getIncludedFiles(); - - // Process the files we found - foreach ($files as $file) { - $pkg = file_get_contents($repo . '/.subsplit' . $base .'/'. $file); - $pkg_json = json_decode($pkg, true); - $name = $pkg_json['name']; - $component = str_replace('/composer.json', '', $file); - // keep this for split cmd - $tmpreponame = explode('/', $name); - $reponame = $tmpreponame[1]; - $splits[$head][$component]['repo'] = $reponame; - $nscomponent = str_replace('/', '\\', $component); - $splits[$head][$component]['desc'] = "[READ ONLY] Subtree split of $nscomponent: " . $pkg_json['description']; - } - } - - // go back to how we found it - passthru("git checkout master"); - chdir($repo); - $this->splits = $splits; - } - - /** - * Based on list of repositories we determined we *should* have, talk - * to GitHub and make sure they're all there. - * - */ - protected function verifyRepos() - { - $this->log('verifying GitHub target repos'); - $github_org = $this->getOwningTarget()->getProject()->getProperty('github.org'); - $github_creds = $this->getOwningTarget()->getProject()->getProperty('github.basicauth'); - - if ($github_creds == 'username:password') { - $this->log('Skipping GitHub repo checks. Update github.basicauth in build.properties to verify repos.', 1); - return; - } - - $ch = curl_init('https://api.github.com/orgs/'.$github_org.'/repos?type=all'); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_USERPWD, $github_creds); - // change this when we know we can use our bundled CA bundle! - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - $result = curl_exec($ch); - curl_close($ch); - $repos = json_decode($result, true); - $existing_repos = array(); - - // parse out the repos we found on GitHub - foreach ($repos as $repo) { - $tmpreponame = explode('/', $repo['full_name']); - $reponame = $tmpreponame[1]; - $existing_repos[$reponame] = $repo['description']; - } - - $heads = $this->getHeads(); - foreach ($heads as $head) { - foreach ($this->splits[$head] as $component => $meta) { - - $reponame = $meta['repo']; - - if (!isset($existing_repos[$reponame])) { - $this->log("Creating missing repo $reponame"); - $payload = array( - 'name' => $reponame, - 'description' => $meta['desc'], - 'homepage' => 'http://www.guzzlephp.org/', - 'private' => true, - 'has_issues' => false, - 'has_wiki' => false, - 'has_downloads' => true, - 'auto_init' => false - ); - $ch = curl_init('https://api.github.com/orgs/'.$github_org.'/repos'); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_USERPWD, $github_creds); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); - curl_setopt($ch, CURLOPT_POST, 1); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload)); - // change this when we know we can use our bundled CA bundle! - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); - $result = curl_exec($ch); - echo "Response code: ".curl_getinfo($ch, CURLINFO_HTTP_CODE)."\n"; - curl_close($ch); - } else { - $this->log("Repo $reponame exists", 2); - } - } - } - } -} diff --git a/bb-vendor/guzzle/guzzle/phpunit.xml.dist b/bb-vendor/guzzle/guzzle/phpunit.xml.dist deleted file mode 100644 index 208fdc08e..000000000 --- a/bb-vendor/guzzle/guzzle/phpunit.xml.dist +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - ./tests/Guzzle/Tests - - - - - - - - - - ./src/Guzzle - - ./src/Guzzle - ./src/Guzzle/Common/Exception/GuzzleException.php - ./src/Guzzle/Http/Exception/HttpException.php - ./src/Guzzle/Http/Exception/ServerErrorResponseException.php - ./src/Guzzle/Http/Exception/ClientErrorResponseException.php - ./src/Guzzle/Http/Exception/TooManyRedirectsException.php - ./src/Guzzle/Http/Exception/CouldNotRewindStreamException.php - ./src/Guzzle/Common/Exception/BadMethodCallException.php - ./src/Guzzle/Common/Exception/InvalidArgumentException.php - ./src/Guzzle/Common/Exception/RuntimeException.php - ./src/Guzzle/Common/Exception/UnexpectedValueException.php - ./src/Guzzle/Service/Exception/ClientNotFoundException.php - ./src/Guzzle/Service/Exception/CommandException.php - ./src/Guzzle/Service/Exception/DescriptionBuilderException.php - ./src/Guzzle/Service/Exception/ServiceBuilderException.php - ./src/Guzzle/Service/Exception/ServiceNotFoundException.php - ./src/Guzzle/Service/Exception/ValidationException.php - ./src/Guzzle/Service/Exception/JsonException.php - - - - - diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/AbstractBatchDecorator.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/AbstractBatchDecorator.php deleted file mode 100644 index 0625d71c3..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/AbstractBatchDecorator.php +++ /dev/null @@ -1,66 +0,0 @@ -decoratedBatch = $decoratedBatch; - } - - /** - * Allow decorators to implement custom methods - * - * @param string $method Missing method name - * @param array $args Method arguments - * - * @return mixed - * @codeCoverageIgnore - */ - public function __call($method, array $args) - { - return call_user_func_array(array($this->decoratedBatch, $method), $args); - } - - public function add($item) - { - $this->decoratedBatch->add($item); - - return $this; - } - - public function flush() - { - return $this->decoratedBatch->flush(); - } - - public function isEmpty() - { - return $this->decoratedBatch->isEmpty(); - } - - /** - * Trace the decorators associated with the batch - * - * @return array - */ - public function getDecorators() - { - $found = array($this); - if (method_exists($this->decoratedBatch, 'getDecorators')) { - $found = array_merge($found, $this->decoratedBatch->getDecorators()); - } - - return $found; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/Batch.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/Batch.php deleted file mode 100644 index 4d41c54f8..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/Batch.php +++ /dev/null @@ -1,92 +0,0 @@ -transferStrategy = $transferStrategy; - $this->divisionStrategy = $divisionStrategy; - $this->queue = new \SplQueue(); - $this->queue->setIteratorMode(\SplQueue::IT_MODE_DELETE); - $this->dividedBatches = array(); - } - - public function add($item) - { - $this->queue->enqueue($item); - - return $this; - } - - public function flush() - { - $this->createBatches(); - - $items = array(); - foreach ($this->dividedBatches as $batchIndex => $dividedBatch) { - while ($dividedBatch->valid()) { - $batch = $dividedBatch->current(); - $dividedBatch->next(); - try { - $this->transferStrategy->transfer($batch); - $items = array_merge($items, $batch); - } catch (\Exception $e) { - throw new BatchTransferException($batch, $items, $e, $this->transferStrategy, $this->divisionStrategy); - } - } - // Keep the divided batch down to a minimum in case of a later exception - unset($this->dividedBatches[$batchIndex]); - } - - return $items; - } - - public function isEmpty() - { - return count($this->queue) == 0 && count($this->dividedBatches) == 0; - } - - /** - * Create batches for any queued items - */ - protected function createBatches() - { - if (count($this->queue)) { - if ($batches = $this->divisionStrategy->createBatches($this->queue)) { - // Convert arrays into iterators - if (is_array($batches)) { - $batches = new \ArrayIterator($batches); - } - $this->dividedBatches[] = $batches; - } - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchBuilder.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchBuilder.php deleted file mode 100644 index ea99b4dd0..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchBuilder.php +++ /dev/null @@ -1,199 +0,0 @@ - 'Guzzle\Batch\BatchRequestTransfer', - 'command' => 'Guzzle\Batch\BatchCommandTransfer' - ); - - /** - * Create a new instance of the BatchBuilder - * - * @return BatchBuilder - */ - public static function factory() - { - return new self(); - } - - /** - * Automatically flush the batch when the size of the queue reaches a certain threshold. Adds {@see FlushingBatch}. - * - * @param $threshold Number of items to allow in the queue before a flush - * - * @return BatchBuilder - */ - public function autoFlushAt($threshold) - { - $this->autoFlush = $threshold; - - return $this; - } - - /** - * Maintain a history of all items that have been transferred using the batch. Adds {@see HistoryBatch}. - * - * @return BatchBuilder - */ - public function keepHistory() - { - $this->history = true; - - return $this; - } - - /** - * Buffer exceptions thrown during transfer so that you can transfer as much as possible, and after a transfer - * completes, inspect each exception that was thrown. Enables the {@see ExceptionBufferingBatch} decorator. - * - * @return BatchBuilder - */ - public function bufferExceptions() - { - $this->exceptionBuffering = true; - - return $this; - } - - /** - * Notify a callable each time a batch flush completes. Enables the {@see NotifyingBatch} decorator. - * - * @param mixed $callable Callable function to notify - * - * @return BatchBuilder - * @throws InvalidArgumentException if the argument is not callable - */ - public function notify($callable) - { - $this->afterFlush = $callable; - - return $this; - } - - /** - * Configures the batch to transfer batches of requests. Associates a {@see \Guzzle\Http\BatchRequestTransfer} - * object as both the transfer and divisor strategy. - * - * @param int $batchSize Batch size for each batch of requests - * - * @return BatchBuilder - */ - public function transferRequests($batchSize = 50) - { - $className = self::$mapping['request']; - $this->transferStrategy = new $className($batchSize); - $this->divisorStrategy = $this->transferStrategy; - - return $this; - } - - /** - * Configures the batch to transfer batches commands. Associates as - * {@see \Guzzle\Service\Command\BatchCommandTransfer} as both the transfer and divisor strategy. - * - * @param int $batchSize Batch size for each batch of commands - * - * @return BatchBuilder - */ - public function transferCommands($batchSize = 50) - { - $className = self::$mapping['command']; - $this->transferStrategy = new $className($batchSize); - $this->divisorStrategy = $this->transferStrategy; - - return $this; - } - - /** - * Specify the strategy used to divide the queue into an array of batches - * - * @param BatchDivisorInterface $divisorStrategy Strategy used to divide a batch queue into batches - * - * @return BatchBuilder - */ - public function createBatchesWith(BatchDivisorInterface $divisorStrategy) - { - $this->divisorStrategy = $divisorStrategy; - - return $this; - } - - /** - * Specify the strategy used to transport the items when flush is called - * - * @param BatchTransferInterface $transferStrategy How items are transferred - * - * @return BatchBuilder - */ - public function transferWith(BatchTransferInterface $transferStrategy) - { - $this->transferStrategy = $transferStrategy; - - return $this; - } - - /** - * Create and return the instantiated batch - * - * @return BatchInterface - * @throws RuntimeException if no transfer strategy has been specified - */ - public function build() - { - if (!$this->transferStrategy) { - throw new RuntimeException('No transfer strategy has been specified'); - } - - if (!$this->divisorStrategy) { - throw new RuntimeException('No divisor strategy has been specified'); - } - - $batch = new Batch($this->transferStrategy, $this->divisorStrategy); - - if ($this->exceptionBuffering) { - $batch = new ExceptionBufferingBatch($batch); - } - - if ($this->afterFlush) { - $batch = new NotifyingBatch($batch, $this->afterFlush); - } - - if ($this->autoFlush) { - $batch = new FlushingBatch($batch, $this->autoFlush); - } - - if ($this->history) { - $batch = new HistoryBatch($batch); - } - - return $batch; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchClosureDivisor.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchClosureDivisor.php deleted file mode 100644 index e0a2d9568..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchClosureDivisor.php +++ /dev/null @@ -1,39 +0,0 @@ -callable = $callable; - $this->context = $context; - } - - public function createBatches(\SplQueue $queue) - { - return call_user_func($this->callable, $queue, $this->context); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchClosureTransfer.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchClosureTransfer.php deleted file mode 100644 index 9cbf1aba4..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchClosureTransfer.php +++ /dev/null @@ -1,40 +0,0 @@ -callable = $callable; - $this->context = $context; - } - - public function transfer(array $batch) - { - return empty($batch) ? null : call_user_func($this->callable, $batch, $this->context); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchCommandTransfer.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchCommandTransfer.php deleted file mode 100644 index d55ac7d1f..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchCommandTransfer.php +++ /dev/null @@ -1,75 +0,0 @@ -batchSize = $batchSize; - } - - /** - * Creates batches by grouping commands by their associated client - * {@inheritdoc} - */ - public function createBatches(\SplQueue $queue) - { - $groups = new \SplObjectStorage(); - foreach ($queue as $item) { - if (!$item instanceof CommandInterface) { - throw new InvalidArgumentException('All items must implement Guzzle\Service\Command\CommandInterface'); - } - $client = $item->getClient(); - if (!$groups->contains($client)) { - $groups->attach($client, new \ArrayObject(array($item))); - } else { - $groups[$client]->append($item); - } - } - - $batches = array(); - foreach ($groups as $batch) { - $batches = array_merge($batches, array_chunk($groups[$batch]->getArrayCopy(), $this->batchSize)); - } - - return $batches; - } - - public function transfer(array $batch) - { - if (empty($batch)) { - return; - } - - // Get the client of the first found command - $client = reset($batch)->getClient(); - - // Keep a list of all commands with invalid clients - $invalid = array_filter($batch, function ($command) use ($client) { - return $command->getClient() !== $client; - }); - - if (!empty($invalid)) { - throw new InconsistentClientTransferException($invalid); - } - - $client->execute($batch); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchDivisorInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchDivisorInterface.php deleted file mode 100644 index 0214f05f4..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchDivisorInterface.php +++ /dev/null @@ -1,18 +0,0 @@ -batchSize = $batchSize; - } - - /** - * Creates batches of requests by grouping requests by their associated curl multi object. - * {@inheritdoc} - */ - public function createBatches(\SplQueue $queue) - { - // Create batches by client objects - $groups = new \SplObjectStorage(); - foreach ($queue as $item) { - if (!$item instanceof RequestInterface) { - throw new InvalidArgumentException('All items must implement Guzzle\Http\Message\RequestInterface'); - } - $client = $item->getClient(); - if (!$groups->contains($client)) { - $groups->attach($client, array($item)); - } else { - $current = $groups[$client]; - $current[] = $item; - $groups[$client] = $current; - } - } - - $batches = array(); - foreach ($groups as $batch) { - $batches = array_merge($batches, array_chunk($groups[$batch], $this->batchSize)); - } - - return $batches; - } - - public function transfer(array $batch) - { - if ($batch) { - reset($batch)->getClient()->send($batch); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchSizeDivisor.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchSizeDivisor.php deleted file mode 100644 index 67f90a581..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchSizeDivisor.php +++ /dev/null @@ -1,47 +0,0 @@ -size = $size; - } - - /** - * Set the size of each batch - * - * @param int $size Size of each batch - * - * @return BatchSizeDivisor - */ - public function setSize($size) - { - $this->size = $size; - - return $this; - } - - /** - * Get the size of each batch - * - * @return int - */ - public function getSize() - { - return $this->size; - } - - public function createBatches(\SplQueue $queue) - { - return array_chunk(iterator_to_array($queue, false), $this->size); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchTransferInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchTransferInterface.php deleted file mode 100644 index 2e0b60dad..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/BatchTransferInterface.php +++ /dev/null @@ -1,16 +0,0 @@ -batch = $batch; - $this->transferredItems = $transferredItems; - $this->transferStrategy = $transferStrategy; - $this->divisorStrategy = $divisorStrategy; - parent::__construct( - 'Exception encountered while transferring batch: ' . $exception->getMessage(), - $exception->getCode(), - $exception - ); - } - - /** - * Get the batch that we being sent when the exception occurred - * - * @return array - */ - public function getBatch() - { - return $this->batch; - } - - /** - * Get the items transferred at the point in which the exception was encountered - * - * @return array - */ - public function getTransferredItems() - { - return $this->transferredItems; - } - - /** - * Get the transfer strategy - * - * @return TransferStrategy - */ - public function getTransferStrategy() - { - return $this->transferStrategy; - } - - /** - * Get the divisor strategy - * - * @return DivisorStrategy - */ - public function getDivisorStrategy() - { - return $this->divisorStrategy; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/ExceptionBufferingBatch.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/ExceptionBufferingBatch.php deleted file mode 100644 index d7a892885..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/ExceptionBufferingBatch.php +++ /dev/null @@ -1,50 +0,0 @@ -decoratedBatch->isEmpty()) { - try { - $transferredItems = $this->decoratedBatch->flush(); - } catch (BatchTransferException $e) { - $this->exceptions[] = $e; - $transferredItems = $e->getTransferredItems(); - } - $items = array_merge($items, $transferredItems); - } - - return $items; - } - - /** - * Get the buffered exceptions - * - * @return array Array of BatchTransferException objects - */ - public function getExceptions() - { - return $this->exceptions; - } - - /** - * Clear the buffered exceptions - */ - public function clearExceptions() - { - $this->exceptions = array(); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/FlushingBatch.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/FlushingBatch.php deleted file mode 100644 index 367b68427..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/FlushingBatch.php +++ /dev/null @@ -1,60 +0,0 @@ -threshold = $threshold; - parent::__construct($decoratedBatch); - } - - /** - * Set the auto-flush threshold - * - * @param int $threshold The auto-flush threshold - * - * @return FlushingBatch - */ - public function setThreshold($threshold) - { - $this->threshold = $threshold; - - return $this; - } - - /** - * Get the auto-flush threshold - * - * @return int - */ - public function getThreshold() - { - return $this->threshold; - } - - public function add($item) - { - $this->decoratedBatch->add($item); - if (++$this->currentTotal >= $this->threshold) { - $this->currentTotal = 0; - $this->decoratedBatch->flush(); - } - - return $this; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/HistoryBatch.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/HistoryBatch.php deleted file mode 100644 index e345fdc34..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/HistoryBatch.php +++ /dev/null @@ -1,39 +0,0 @@ -history[] = $item; - $this->decoratedBatch->add($item); - - return $this; - } - - /** - * Get the batch history - * - * @return array - */ - public function getHistory() - { - return $this->history; - } - - /** - * Clear the batch history - */ - public function clearHistory() - { - $this->history = array(); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/NotifyingBatch.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/NotifyingBatch.php deleted file mode 100644 index 96d04daa8..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/NotifyingBatch.php +++ /dev/null @@ -1,38 +0,0 @@ -callable = $callable; - parent::__construct($decoratedBatch); - } - - public function flush() - { - $items = $this->decoratedBatch->flush(); - call_user_func($this->callable, $items); - - return $items; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/composer.json b/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/composer.json deleted file mode 100644 index 12404d381..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Batch/composer.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "guzzle/batch", - "description": "Guzzle batch component for batching requests, commands, or custom transfers", - "homepage": "http://guzzlephp.org/", - "keywords": ["batch", "HTTP", "REST", "guzzle"], - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "require": { - "php": ">=5.3.2", - "guzzle/common": "self.version" - }, - "autoload": { - "psr-0": { "Guzzle\\Batch": "" } - }, - "suggest": { - "guzzle/http": "self.version", - "guzzle/service": "self.version" - }, - "target-dir": "Guzzle/Batch", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/AbstractCacheAdapter.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/AbstractCacheAdapter.php deleted file mode 100644 index a5c527167..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/AbstractCacheAdapter.php +++ /dev/null @@ -1,21 +0,0 @@ -cache; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/CacheAdapterFactory.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/CacheAdapterFactory.php deleted file mode 100644 index 94e623463..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/CacheAdapterFactory.php +++ /dev/null @@ -1,117 +0,0 @@ -newInstanceArgs($args); - } - } catch (\Exception $e) { - throw new RuntimeException($e->getMessage(), $e->getCode(), $e); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/CacheAdapterInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/CacheAdapterInterface.php deleted file mode 100644 index 970c9e228..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/CacheAdapterInterface.php +++ /dev/null @@ -1,55 +0,0 @@ -callables = $callables; - } - - public function contains($id, array $options = null) - { - return call_user_func($this->callables['contains'], $id, $options); - } - - public function delete($id, array $options = null) - { - return call_user_func($this->callables['delete'], $id, $options); - } - - public function fetch($id, array $options = null) - { - return call_user_func($this->callables['fetch'], $id, $options); - } - - public function save($id, $data, $lifeTime = false, array $options = null) - { - return call_user_func($this->callables['save'], $id, $data, $lifeTime, $options); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/DoctrineCacheAdapter.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/DoctrineCacheAdapter.php deleted file mode 100644 index e1aaf9f81..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/DoctrineCacheAdapter.php +++ /dev/null @@ -1,41 +0,0 @@ -cache = $cache; - } - - public function contains($id, array $options = null) - { - return $this->cache->contains($id); - } - - public function delete($id, array $options = null) - { - return $this->cache->delete($id); - } - - public function fetch($id, array $options = null) - { - return $this->cache->fetch($id); - } - - public function save($id, $data, $lifeTime = false, array $options = null) - { - return $this->cache->save($id, $data, $lifeTime !== false ? $lifeTime : 0); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/NullCacheAdapter.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/NullCacheAdapter.php deleted file mode 100644 index 68bd4af97..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/NullCacheAdapter.php +++ /dev/null @@ -1,31 +0,0 @@ -cache = $cache; - } - - public function contains($id, array $options = null) - { - return $this->cache->test($id); - } - - public function delete($id, array $options = null) - { - return $this->cache->remove($id); - } - - public function fetch($id, array $options = null) - { - return $this->cache->load($id); - } - - public function save($id, $data, $lifeTime = false, array $options = null) - { - return $this->cache->save($data, $id, array(), $lifeTime); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/Zf2CacheAdapter.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/Zf2CacheAdapter.php deleted file mode 100644 index 1fc18a555..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/Zf2CacheAdapter.php +++ /dev/null @@ -1,41 +0,0 @@ -cache = $cache; - } - - public function contains($id, array $options = null) - { - return $this->cache->hasItem($id); - } - - public function delete($id, array $options = null) - { - return $this->cache->removeItem($id); - } - - public function fetch($id, array $options = null) - { - return $this->cache->getItem($id); - } - - public function save($id, $data, $lifeTime = false, array $options = null) - { - return $this->cache->setItem($id, $data); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/composer.json b/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/composer.json deleted file mode 100644 index a5d999bd6..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Cache/composer.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "guzzle/cache", - "description": "Guzzle cache adapter component", - "homepage": "http://guzzlephp.org/", - "keywords": ["cache", "adapter", "zf", "doctrine", "guzzle"], - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "require": { - "php": ">=5.3.2", - "guzzle/common": "self.version" - }, - "autoload": { - "psr-0": { "Guzzle\\Cache": "" } - }, - "target-dir": "Guzzle/Cache", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Common/AbstractHasDispatcher.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Common/AbstractHasDispatcher.php deleted file mode 100644 index d1e842b1c..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Common/AbstractHasDispatcher.php +++ /dev/null @@ -1,49 +0,0 @@ -eventDispatcher = $eventDispatcher; - - return $this; - } - - public function getEventDispatcher() - { - if (!$this->eventDispatcher) { - $this->eventDispatcher = new EventDispatcher(); - } - - return $this->eventDispatcher; - } - - public function dispatch($eventName, array $context = array()) - { - return $this->getEventDispatcher()->dispatch($eventName, new Event($context)); - } - - public function addSubscriber(EventSubscriberInterface $subscriber) - { - $this->getEventDispatcher()->addSubscriber($subscriber); - - return $this; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Common/Collection.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Common/Collection.php deleted file mode 100644 index 5cb1535d0..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Common/Collection.php +++ /dev/null @@ -1,403 +0,0 @@ -data = $data; - } - - /** - * Create a new collection from an array, validate the keys, and add default values where missing - * - * @param array $config Configuration values to apply. - * @param array $defaults Default parameters - * @param array $required Required parameter names - * - * @return self - * @throws InvalidArgumentException if a parameter is missing - */ - public static function fromConfig(array $config = array(), array $defaults = array(), array $required = array()) - { - $data = $config + $defaults; - - if ($missing = array_diff($required, array_keys($data))) { - throw new InvalidArgumentException('Config is missing the following keys: ' . implode(', ', $missing)); - } - - return new self($data); - } - - public function count() - { - return count($this->data); - } - - public function getIterator() - { - return new \ArrayIterator($this->data); - } - - public function toArray() - { - return $this->data; - } - - /** - * Removes all key value pairs - * - * @return Collection - */ - public function clear() - { - $this->data = array(); - - return $this; - } - - /** - * Get all or a subset of matching key value pairs - * - * @param array $keys Pass an array of keys to retrieve only a subset of key value pairs - * - * @return array Returns an array of all matching key value pairs - */ - public function getAll(array $keys = null) - { - return $keys ? array_intersect_key($this->data, array_flip($keys)) : $this->data; - } - - /** - * Get a specific key value. - * - * @param string $key Key to retrieve. - * - * @return mixed|null Value of the key or NULL - */ - public function get($key) - { - return isset($this->data[$key]) ? $this->data[$key] : null; - } - - /** - * Set a key value pair - * - * @param string $key Key to set - * @param mixed $value Value to set - * - * @return Collection Returns a reference to the object - */ - public function set($key, $value) - { - $this->data[$key] = $value; - - return $this; - } - - /** - * Add a value to a key. If a key of the same name has already been added, the key value will be converted into an - * array and the new value will be pushed to the end of the array. - * - * @param string $key Key to add - * @param mixed $value Value to add to the key - * - * @return Collection Returns a reference to the object. - */ - public function add($key, $value) - { - if (!array_key_exists($key, $this->data)) { - $this->data[$key] = $value; - } elseif (is_array($this->data[$key])) { - $this->data[$key][] = $value; - } else { - $this->data[$key] = array($this->data[$key], $value); - } - - return $this; - } - - /** - * Remove a specific key value pair - * - * @param string $key A key to remove - * - * @return Collection - */ - public function remove($key) - { - unset($this->data[$key]); - - return $this; - } - - /** - * Get all keys in the collection - * - * @return array - */ - public function getKeys() - { - return array_keys($this->data); - } - - /** - * Returns whether or not the specified key is present. - * - * @param string $key The key for which to check the existence. - * - * @return bool - */ - public function hasKey($key) - { - return array_key_exists($key, $this->data); - } - - /** - * Case insensitive search the keys in the collection - * - * @param string $key Key to search for - * - * @return bool|string Returns false if not found, otherwise returns the key - */ - public function keySearch($key) - { - foreach (array_keys($this->data) as $k) { - if (!strcasecmp($k, $key)) { - return $k; - } - } - - return false; - } - - /** - * Checks if any keys contains a certain value - * - * @param string $value Value to search for - * - * @return mixed Returns the key if the value was found FALSE if the value was not found. - */ - public function hasValue($value) - { - return array_search($value, $this->data); - } - - /** - * Replace the data of the object with the value of an array - * - * @param array $data Associative array of data - * - * @return Collection Returns a reference to the object - */ - public function replace(array $data) - { - $this->data = $data; - - return $this; - } - - /** - * Add and merge in a Collection or array of key value pair data. - * - * @param Collection|array $data Associative array of key value pair data - * - * @return Collection Returns a reference to the object. - */ - public function merge($data) - { - foreach ($data as $key => $value) { - $this->add($key, $value); - } - - return $this; - } - - /** - * Over write key value pairs in this collection with all of the data from an array or collection. - * - * @param array|\Traversable $data Values to override over this config - * - * @return self - */ - public function overwriteWith($data) - { - if (is_array($data)) { - $this->data = $data + $this->data; - } elseif ($data instanceof Collection) { - $this->data = $data->toArray() + $this->data; - } else { - foreach ($data as $key => $value) { - $this->data[$key] = $value; - } - } - - return $this; - } - - /** - * Returns a Collection containing all the elements of the collection after applying the callback function to each - * one. The Closure should accept three parameters: (string) $key, (string) $value, (array) $context and return a - * modified value - * - * @param \Closure $closure Closure to apply - * @param array $context Context to pass to the closure - * @param bool $static Set to TRUE to use the same class as the return rather than returning a Collection - * - * @return Collection - */ - public function map(\Closure $closure, array $context = array(), $static = true) - { - $collection = $static ? new static() : new self(); - foreach ($this as $key => $value) { - $collection->add($key, $closure($key, $value, $context)); - } - - return $collection; - } - - /** - * Iterates over each key value pair in the collection passing them to the Closure. If the Closure function returns - * true, the current value from input is returned into the result Collection. The Closure must accept three - * parameters: (string) $key, (string) $value and return Boolean TRUE or FALSE for each value. - * - * @param \Closure $closure Closure evaluation function - * @param bool $static Set to TRUE to use the same class as the return rather than returning a Collection - * - * @return Collection - */ - public function filter(\Closure $closure, $static = true) - { - $collection = ($static) ? new static() : new self(); - foreach ($this->data as $key => $value) { - if ($closure($key, $value)) { - $collection->add($key, $value); - } - } - - return $collection; - } - - public function offsetExists($offset) - { - return isset($this->data[$offset]); - } - - public function offsetGet($offset) - { - return isset($this->data[$offset]) ? $this->data[$offset] : null; - } - - public function offsetSet($offset, $value) - { - $this->data[$offset] = $value; - } - - public function offsetUnset($offset) - { - unset($this->data[$offset]); - } - - /** - * Set a value into a nested array key. Keys will be created as needed to set the value. - * - * @param string $path Path to set - * @param mixed $value Value to set at the key - * - * @return self - * @throws RuntimeException when trying to setPath using a nested path that travels through a scalar value - */ - public function setPath($path, $value) - { - $current =& $this->data; - $queue = explode('/', $path); - while (null !== ($key = array_shift($queue))) { - if (!is_array($current)) { - throw new RuntimeException("Trying to setPath {$path}, but {$key} is set and is not an array"); - } elseif (!$queue) { - $current[$key] = $value; - } elseif (isset($current[$key])) { - $current =& $current[$key]; - } else { - $current[$key] = array(); - $current =& $current[$key]; - } - } - - return $this; - } - - /** - * Gets a value from the collection using an array path (e.g. foo/baz/bar would retrieve bar from two nested arrays) - * Allows for wildcard searches which recursively combine matches up to the level at which the wildcard occurs. This - * can be useful for accepting any key of a sub-array and combining matching keys from each diverging path. - * - * @param string $path Path to traverse and retrieve a value from - * @param string $separator Character used to add depth to the search - * @param mixed $data Optional data to descend into (used when wildcards are encountered) - * - * @return mixed|null - */ - public function getPath($path, $separator = '/', $data = null) - { - if ($data === null) { - $data =& $this->data; - } - - $path = is_array($path) ? $path : explode($separator, $path); - while (null !== ($part = array_shift($path))) { - if (!is_array($data)) { - return null; - } elseif (isset($data[$part])) { - $data =& $data[$part]; - } elseif ($part != '*') { - return null; - } else { - // Perform a wildcard search by diverging and merging paths - $result = array(); - foreach ($data as $value) { - if (!$path) { - $result = array_merge_recursive($result, (array) $value); - } elseif (null !== ($test = $this->getPath($path, $separator, $value))) { - $result = array_merge_recursive($result, (array) $test); - } - } - return $result; - } - } - - return $data; - } - - /** - * Inject configuration settings into an input string - * - * @param string $input Input to inject - * - * @return string - * @deprecated - */ - public function inject($input) - { - Version::warn(__METHOD__ . ' is deprecated'); - $replace = array(); - foreach ($this->data as $key => $val) { - $replace['{' . $key . '}'] = $val; - } - - return strtr($input, $replace); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Common/Event.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Common/Event.php deleted file mode 100644 index fad76a9b8..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Common/Event.php +++ /dev/null @@ -1,52 +0,0 @@ -context = $context; - } - - public function getIterator() - { - return new \ArrayIterator($this->context); - } - - public function offsetGet($offset) - { - return isset($this->context[$offset]) ? $this->context[$offset] : null; - } - - public function offsetSet($offset, $value) - { - $this->context[$offset] = $value; - } - - public function offsetExists($offset) - { - return isset($this->context[$offset]); - } - - public function offsetUnset($offset) - { - unset($this->context[$offset]); - } - - public function toArray() - { - return $this->context; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Common/Exception/BadMethodCallException.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Common/Exception/BadMethodCallException.php deleted file mode 100644 index 08d1c7256..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Common/Exception/BadMethodCallException.php +++ /dev/null @@ -1,5 +0,0 @@ -shortMessage = $message; - } - - /** - * Set all of the exceptions - * - * @param array $exceptions Array of exceptions - * - * @return self - */ - public function setExceptions(array $exceptions) - { - $this->exceptions = array(); - foreach ($exceptions as $exception) { - $this->add($exception); - } - - return $this; - } - - /** - * Add exceptions to the collection - * - * @param ExceptionCollection|\Exception $e Exception to add - * - * @return ExceptionCollection; - */ - public function add($e) - { - $this->exceptions[] = $e; - if ($this->message) { - $this->message .= "\n"; - } - - $this->message .= $this->getExceptionMessage($e, 0); - - return $this; - } - - /** - * Get the total number of request exceptions - * - * @return int - */ - public function count() - { - return count($this->exceptions); - } - - /** - * Allows array-like iteration over the request exceptions - * - * @return \ArrayIterator - */ - public function getIterator() - { - return new \ArrayIterator($this->exceptions); - } - - /** - * Get the first exception in the collection - * - * @return \Exception - */ - public function getFirst() - { - return $this->exceptions ? $this->exceptions[0] : null; - } - - private function getExceptionMessage(\Exception $e, $depth = 0) - { - static $sp = ' '; - $prefix = $depth ? str_repeat($sp, $depth) : ''; - $message = "{$prefix}(" . get_class($e) . ') ' . $e->getFile() . ' line ' . $e->getLine() . "\n"; - - if ($e instanceof self) { - if ($e->shortMessage) { - $message .= "\n{$prefix}{$sp}" . str_replace("\n", "\n{$prefix}{$sp}", $e->shortMessage) . "\n"; - } - foreach ($e as $ee) { - $message .= "\n" . $this->getExceptionMessage($ee, $depth + 1); - } - } else { - $message .= "\n{$prefix}{$sp}" . str_replace("\n", "\n{$prefix}{$sp}", $e->getMessage()) . "\n"; - $message .= "\n{$prefix}{$sp}" . str_replace("\n", "\n{$prefix}{$sp}", $e->getTraceAsString()) . "\n"; - } - - return str_replace(getcwd(), '.', $message); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Common/Exception/GuzzleException.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Common/Exception/GuzzleException.php deleted file mode 100644 index 458e6f2ea..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Common/Exception/GuzzleException.php +++ /dev/null @@ -1,8 +0,0 @@ -=5.3.2", - "symfony/event-dispatcher": ">=2.1" - }, - "autoload": { - "psr-0": { "Guzzle\\Common": "" } - }, - "target-dir": "Guzzle/Common", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/AbstractEntityBodyDecorator.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/AbstractEntityBodyDecorator.php deleted file mode 100644 index 5005a887c..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/AbstractEntityBodyDecorator.php +++ /dev/null @@ -1,221 +0,0 @@ -body = $body; - } - - public function __toString() - { - return (string) $this->body; - } - - /** - * Allow decorators to implement custom methods - * - * @param string $method Missing method name - * @param array $args Method arguments - * - * @return mixed - */ - public function __call($method, array $args) - { - return call_user_func_array(array($this->body, $method), $args); - } - - public function close() - { - return $this->body->close(); - } - - public function setRewindFunction($callable) - { - $this->body->setRewindFunction($callable); - - return $this; - } - - public function rewind() - { - return $this->body->rewind(); - } - - public function compress($filter = 'zlib.deflate') - { - return $this->body->compress($filter); - } - - public function uncompress($filter = 'zlib.inflate') - { - return $this->body->uncompress($filter); - } - - public function getContentLength() - { - return $this->getSize(); - } - - public function getContentType() - { - return $this->body->getContentType(); - } - - public function getContentMd5($rawOutput = false, $base64Encode = false) - { - $hash = Stream::getHash($this, 'md5', $rawOutput); - - return $hash && $base64Encode ? base64_encode($hash) : $hash; - } - - public function getContentEncoding() - { - return $this->body->getContentEncoding(); - } - - public function getMetaData($key = null) - { - return $this->body->getMetaData($key); - } - - public function getStream() - { - return $this->body->getStream(); - } - - public function setStream($stream, $size = 0) - { - $this->body->setStream($stream, $size); - - return $this; - } - - public function detachStream() - { - $this->body->detachStream(); - - return $this; - } - - public function getWrapper() - { - return $this->body->getWrapper(); - } - - public function getWrapperData() - { - return $this->body->getWrapperData(); - } - - public function getStreamType() - { - return $this->body->getStreamType(); - } - - public function getUri() - { - return $this->body->getUri(); - } - - public function getSize() - { - return $this->body->getSize(); - } - - public function isReadable() - { - return $this->body->isReadable(); - } - - public function isRepeatable() - { - return $this->isSeekable() && $this->isReadable(); - } - - public function isWritable() - { - return $this->body->isWritable(); - } - - public function isConsumed() - { - return $this->body->isConsumed(); - } - - /** - * Alias of isConsumed() - * {@inheritdoc} - */ - public function feof() - { - return $this->isConsumed(); - } - - public function isLocal() - { - return $this->body->isLocal(); - } - - public function isSeekable() - { - return $this->body->isSeekable(); - } - - public function setSize($size) - { - $this->body->setSize($size); - - return $this; - } - - public function seek($offset, $whence = SEEK_SET) - { - return $this->body->seek($offset, $whence); - } - - public function read($length) - { - return $this->body->read($length); - } - - public function write($string) - { - return $this->body->write($string); - } - - public function readLine($maxLength = null) - { - return $this->body->readLine($maxLength); - } - - public function ftell() - { - return $this->body->ftell(); - } - - public function getCustomData($key) - { - return $this->body->getCustomData($key); - } - - public function setCustomData($key, $value) - { - $this->body->setCustomData($key, $value); - - return $this; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/CachingEntityBody.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/CachingEntityBody.php deleted file mode 100644 index c65c13650..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/CachingEntityBody.php +++ /dev/null @@ -1,229 +0,0 @@ -remoteStream = $body; - $this->body = new EntityBody(fopen('php://temp', 'r+')); - } - - /** - * Will give the contents of the buffer followed by the exhausted remote stream. - * - * Warning: Loads the entire stream into memory - * - * @return string - */ - public function __toString() - { - $pos = $this->ftell(); - $this->rewind(); - - $str = ''; - while (!$this->isConsumed()) { - $str .= $this->read(16384); - } - - $this->seek($pos); - - return $str; - } - - public function getSize() - { - return max($this->body->getSize(), $this->remoteStream->getSize()); - } - - /** - * {@inheritdoc} - * @throws RuntimeException When seeking with SEEK_END or when seeking past the total size of the buffer stream - */ - public function seek($offset, $whence = SEEK_SET) - { - if ($whence == SEEK_SET) { - $byte = $offset; - } elseif ($whence == SEEK_CUR) { - $byte = $offset + $this->ftell(); - } else { - throw new RuntimeException(__CLASS__ . ' supports only SEEK_SET and SEEK_CUR seek operations'); - } - - // You cannot skip ahead past where you've read from the remote stream - if ($byte > $this->body->getSize()) { - throw new RuntimeException( - "Cannot seek to byte {$byte} when the buffered stream only contains {$this->body->getSize()} bytes" - ); - } - - return $this->body->seek($byte); - } - - public function rewind() - { - return $this->seek(0); - } - - /** - * Does not support custom rewind functions - * - * @throws RuntimeException - */ - public function setRewindFunction($callable) - { - throw new RuntimeException(__CLASS__ . ' does not support custom stream rewind functions'); - } - - public function read($length) - { - // Perform a regular read on any previously read data from the buffer - $data = $this->body->read($length); - $remaining = $length - strlen($data); - - // More data was requested so read from the remote stream - if ($remaining) { - // If data was written to the buffer in a position that would have been filled from the remote stream, - // then we must skip bytes on the remote stream to emulate overwriting bytes from that position. This - // mimics the behavior of other PHP stream wrappers. - $remoteData = $this->remoteStream->read($remaining + $this->skipReadBytes); - - if ($this->skipReadBytes) { - $len = strlen($remoteData); - $remoteData = substr($remoteData, $this->skipReadBytes); - $this->skipReadBytes = max(0, $this->skipReadBytes - $len); - } - - $data .= $remoteData; - $this->body->write($remoteData); - } - - return $data; - } - - public function write($string) - { - // When appending to the end of the currently read stream, you'll want to skip bytes from being read from - // the remote stream to emulate other stream wrappers. Basically replacing bytes of data of a fixed length. - $overflow = (strlen($string) + $this->ftell()) - $this->remoteStream->ftell(); - if ($overflow > 0) { - $this->skipReadBytes += $overflow; - } - - return $this->body->write($string); - } - - /** - * {@inheritdoc} - * @link http://php.net/manual/en/function.fgets.php - */ - public function readLine($maxLength = null) - { - $buffer = ''; - $size = 0; - while (!$this->isConsumed()) { - $byte = $this->read(1); - $buffer .= $byte; - // Break when a new line is found or the max length - 1 is reached - if ($byte == PHP_EOL || ++$size == $maxLength - 1) { - break; - } - } - - return $buffer; - } - - public function isConsumed() - { - return $this->body->isConsumed() && $this->remoteStream->isConsumed(); - } - - /** - * Close both the remote stream and buffer stream - */ - public function close() - { - return $this->remoteStream->close() && $this->body->close(); - } - - public function setStream($stream, $size = 0) - { - $this->remoteStream->setStream($stream, $size); - } - - public function getContentType() - { - return $this->remoteStream->getContentType(); - } - - public function getContentEncoding() - { - return $this->remoteStream->getContentEncoding(); - } - - public function getMetaData($key = null) - { - return $this->remoteStream->getMetaData($key); - } - - public function getStream() - { - return $this->remoteStream->getStream(); - } - - public function getWrapper() - { - return $this->remoteStream->getWrapper(); - } - - public function getWrapperData() - { - return $this->remoteStream->getWrapperData(); - } - - public function getStreamType() - { - return $this->remoteStream->getStreamType(); - } - - public function getUri() - { - return $this->remoteStream->getUri(); - } - - /** - * Always retrieve custom data from the remote stream - * {@inheritdoc} - */ - public function getCustomData($key) - { - return $this->remoteStream->getCustomData($key); - } - - /** - * Always set custom data on the remote stream - * {@inheritdoc} - */ - public function setCustomData($key, $value) - { - $this->remoteStream->setCustomData($key, $value); - - return $this; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Client.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Client.php deleted file mode 100644 index 3d7298dcd..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Client.php +++ /dev/null @@ -1,524 +0,0 @@ -setConfig($config ?: new Collection()); - $this->initSsl(); - $this->setBaseUrl($baseUrl); - $this->defaultHeaders = new Collection(); - $this->setRequestFactory(RequestFactory::getInstance()); - $this->userAgent = $this->getDefaultUserAgent(); - if (!$this->config[self::DISABLE_REDIRECTS]) { - $this->addSubscriber(new RedirectPlugin()); - } - } - - final public function setConfig($config) - { - if ($config instanceof Collection) { - $this->config = $config; - } elseif (is_array($config)) { - $this->config = new Collection($config); - } else { - throw new InvalidArgumentException('Config must be an array or Collection'); - } - - return $this; - } - - final public function getConfig($key = false) - { - return $key ? $this->config[$key] : $this->config; - } - - /** - * Set a default request option on the client that will be used as a default for each request - * - * @param string $keyOrPath request.options key (e.g. allow_redirects) or path to a nested key (e.g. headers/foo) - * @param mixed $value Value to set - * - * @return $this - */ - public function setDefaultOption($keyOrPath, $value) - { - $keyOrPath = self::REQUEST_OPTIONS . '/' . $keyOrPath; - $this->config->setPath($keyOrPath, $value); - - return $this; - } - - /** - * Retrieve a default request option from the client - * - * @param string $keyOrPath request.options key (e.g. allow_redirects) or path to a nested key (e.g. headers/foo) - * - * @return mixed|null - */ - public function getDefaultOption($keyOrPath) - { - $keyOrPath = self::REQUEST_OPTIONS . '/' . $keyOrPath; - - return $this->config->getPath($keyOrPath); - } - - final public function setSslVerification($certificateAuthority = true, $verifyPeer = true, $verifyHost = 2) - { - $opts = $this->config[self::CURL_OPTIONS] ?: array(); - - if ($certificateAuthority === true) { - // use bundled CA bundle, set secure defaults - $opts[CURLOPT_CAINFO] = __DIR__ . '/Resources/cacert.pem'; - $opts[CURLOPT_SSL_VERIFYPEER] = true; - $opts[CURLOPT_SSL_VERIFYHOST] = 2; - } elseif ($certificateAuthority === false) { - unset($opts[CURLOPT_CAINFO]); - $opts[CURLOPT_SSL_VERIFYPEER] = false; - $opts[CURLOPT_SSL_VERIFYHOST] = 0; - } elseif ($verifyPeer !== true && $verifyPeer !== false && $verifyPeer !== 1 && $verifyPeer !== 0) { - throw new InvalidArgumentException('verifyPeer must be 1, 0 or boolean'); - } elseif ($verifyHost !== 0 && $verifyHost !== 1 && $verifyHost !== 2) { - throw new InvalidArgumentException('verifyHost must be 0, 1 or 2'); - } else { - $opts[CURLOPT_SSL_VERIFYPEER] = $verifyPeer; - $opts[CURLOPT_SSL_VERIFYHOST] = $verifyHost; - if (is_file($certificateAuthority)) { - unset($opts[CURLOPT_CAPATH]); - $opts[CURLOPT_CAINFO] = $certificateAuthority; - } elseif (is_dir($certificateAuthority)) { - unset($opts[CURLOPT_CAINFO]); - $opts[CURLOPT_CAPATH] = $certificateAuthority; - } else { - throw new RuntimeException( - 'Invalid option passed to ' . self::SSL_CERT_AUTHORITY . ': ' . $certificateAuthority - ); - } - } - - $this->config->set(self::CURL_OPTIONS, $opts); - - return $this; - } - - public function createRequest($method = 'GET', $uri = null, $headers = null, $body = null, array $options = array()) - { - if (!$uri) { - $url = $this->getBaseUrl(); - } else { - if (!is_array($uri)) { - $templateVars = null; - } else { - list($uri, $templateVars) = $uri; - } - if (strpos($uri, '://')) { - // Use absolute URLs as-is - $url = $this->expandTemplate($uri, $templateVars); - } else { - $url = Url::factory($this->getBaseUrl())->combine($this->expandTemplate($uri, $templateVars)); - } - } - - // If default headers are provided, then merge them under any explicitly provided headers for the request - if (count($this->defaultHeaders)) { - if (!$headers) { - $headers = $this->defaultHeaders->toArray(); - } elseif (is_array($headers)) { - $headers += $this->defaultHeaders->toArray(); - } elseif ($headers instanceof Collection) { - $headers = $headers->toArray() + $this->defaultHeaders->toArray(); - } - } - - return $this->prepareRequest($this->requestFactory->create($method, (string) $url, $headers, $body), $options); - } - - public function getBaseUrl($expand = true) - { - return $expand ? $this->expandTemplate($this->baseUrl) : $this->baseUrl; - } - - public function setBaseUrl($url) - { - $this->baseUrl = $url; - - return $this; - } - - public function setUserAgent($userAgent, $includeDefault = false) - { - if ($includeDefault) { - $userAgent .= ' ' . $this->getDefaultUserAgent(); - } - $this->userAgent = $userAgent; - - return $this; - } - - /** - * Get the default User-Agent string to use with Guzzle - * - * @return string - */ - public function getDefaultUserAgent() - { - return 'Guzzle/' . Version::VERSION - . ' curl/' . CurlVersion::getInstance()->get('version') - . ' PHP/' . PHP_VERSION; - } - - public function get($uri = null, $headers = null, $options = array()) - { - // BC compat: $options can be a string, resource, etc to specify where the response body is downloaded - return is_array($options) - ? $this->createRequest('GET', $uri, $headers, null, $options) - : $this->createRequest('GET', $uri, $headers, $options); - } - - public function head($uri = null, $headers = null, array $options = array()) - { - return $this->createRequest('HEAD', $uri, $headers, null, $options); - } - - public function delete($uri = null, $headers = null, $body = null, array $options = array()) - { - return $this->createRequest('DELETE', $uri, $headers, $body, $options); - } - - public function put($uri = null, $headers = null, $body = null, array $options = array()) - { - return $this->createRequest('PUT', $uri, $headers, $body, $options); - } - - public function patch($uri = null, $headers = null, $body = null, array $options = array()) - { - return $this->createRequest('PATCH', $uri, $headers, $body, $options); - } - - public function post($uri = null, $headers = null, $postBody = null, array $options = array()) - { - return $this->createRequest('POST', $uri, $headers, $postBody, $options); - } - - public function options($uri = null, array $options = array()) - { - return $this->createRequest('OPTIONS', $uri, $options); - } - - public function send($requests) - { - if (!($requests instanceof RequestInterface)) { - return $this->sendMultiple($requests); - } - - try { - /** @var $requests RequestInterface */ - $this->getCurlMulti()->add($requests)->send(); - return $requests->getResponse(); - } catch (ExceptionCollection $e) { - throw $e->getFirst(); - } - } - - /** - * Set a curl multi object to be used internally by the client for transferring requests. - * - * @param CurlMultiInterface $curlMulti Multi object - * - * @return self - */ - public function setCurlMulti(CurlMultiInterface $curlMulti) - { - $this->curlMulti = $curlMulti; - - return $this; - } - - /** - * @return CurlMultiInterface|CurlMultiProxy - */ - public function getCurlMulti() - { - if (!$this->curlMulti) { - $this->curlMulti = new CurlMultiProxy( - self::MAX_HANDLES, - $this->getConfig('select_timeout') ?: self::DEFAULT_SELECT_TIMEOUT - ); - } - - return $this->curlMulti; - } - - public function setRequestFactory(RequestFactoryInterface $factory) - { - $this->requestFactory = $factory; - - return $this; - } - - /** - * Set the URI template expander to use with the client - * - * @param UriTemplateInterface $uriTemplate URI template expander - * - * @return self - */ - public function setUriTemplate(UriTemplateInterface $uriTemplate) - { - $this->uriTemplate = $uriTemplate; - - return $this; - } - - /** - * Expand a URI template while merging client config settings into the template variables - * - * @param string $template Template to expand - * @param array $variables Variables to inject - * - * @return string - */ - protected function expandTemplate($template, array $variables = null) - { - $expansionVars = $this->getConfig()->toArray(); - if ($variables) { - $expansionVars = $variables + $expansionVars; - } - - return $this->getUriTemplate()->expand($template, $expansionVars); - } - - /** - * Get the URI template expander used by the client - * - * @return UriTemplateInterface - */ - protected function getUriTemplate() - { - if (!$this->uriTemplate) { - $this->uriTemplate = ParserRegistry::getInstance()->getParser('uri_template'); - } - - return $this->uriTemplate; - } - - /** - * Send multiple requests in parallel - * - * @param array $requests Array of RequestInterface objects - * - * @return array Returns an array of Response objects - */ - protected function sendMultiple(array $requests) - { - $curlMulti = $this->getCurlMulti(); - foreach ($requests as $request) { - $curlMulti->add($request); - } - $curlMulti->send(); - - /** @var $request RequestInterface */ - $result = array(); - foreach ($requests as $request) { - $result[] = $request->getResponse(); - } - - return $result; - } - - /** - * Prepare a request to be sent from the Client by adding client specific behaviors and properties to the request. - * - * @param RequestInterface $request Request to prepare for the client - * @param array $options Options to apply to the request - * - * @return RequestInterface - */ - protected function prepareRequest(RequestInterface $request, array $options = array()) - { - $request->setClient($this)->setEventDispatcher(clone $this->getEventDispatcher()); - - if ($curl = $this->config[self::CURL_OPTIONS]) { - $request->getCurlOptions()->overwriteWith(CurlHandle::parseCurlConfig($curl)); - } - - if ($params = $this->config[self::REQUEST_PARAMS]) { - Version::warn('request.params is deprecated. Use request.options to add default request options.'); - $request->getParams()->overwriteWith($params); - } - - if ($this->userAgent && !$request->hasHeader('User-Agent')) { - $request->setHeader('User-Agent', $this->userAgent); - } - - if ($defaults = $this->config[self::REQUEST_OPTIONS]) { - $this->requestFactory->applyOptions($request, $defaults, RequestFactoryInterface::OPTIONS_AS_DEFAULTS); - } - - if ($options) { - $this->requestFactory->applyOptions($request, $options); - } - - $this->dispatch('client.create_request', array('client' => $this, 'request' => $request)); - - return $request; - } - - /** - * Initializes SSL settings - */ - protected function initSsl() - { - $authority = $this->config[self::SSL_CERT_AUTHORITY]; - - if ($authority === 'system') { - return; - } - - if ($authority === null) { - $authority = true; - } - - if ($authority === true && substr(__FILE__, 0, 7) == 'phar://') { - $authority = self::extractPharCacert(__DIR__ . '/Resources/cacert.pem'); - } - - $this->setSslVerification($authority); - } - - /** - * @deprecated - */ - public function getDefaultHeaders() - { - Version::warn(__METHOD__ . ' is deprecated. Use the request.options array to retrieve default request options'); - return $this->defaultHeaders; - } - - /** - * @deprecated - */ - public function setDefaultHeaders($headers) - { - Version::warn(__METHOD__ . ' is deprecated. Use the request.options array to specify default request options'); - if ($headers instanceof Collection) { - $this->defaultHeaders = $headers; - } elseif (is_array($headers)) { - $this->defaultHeaders = new Collection($headers); - } else { - throw new InvalidArgumentException('Headers must be an array or Collection'); - } - - return $this; - } - - /** - * @deprecated - */ - public function preparePharCacert($md5Check = true) - { - return sys_get_temp_dir() . '/guzzle-cacert.pem'; - } - - /** - * Copies the phar cacert from a phar into the temp directory. - * - * @param string $pharCacertPath Path to the phar cacert. For example: - * 'phar://aws.phar/Guzzle/Http/Resources/cacert.pem' - * - * @return string Returns the path to the extracted cacert file. - * @throws \RuntimeException Throws if the phar cacert cannot be found or - * the file cannot be copied to the temp dir. - */ - public static function extractPharCacert($pharCacertPath) - { - // Copy the cacert.pem file from the phar if it is not in the temp - // folder. - $certFile = sys_get_temp_dir() . '/guzzle-cacert.pem'; - - if (!file_exists($pharCacertPath)) { - throw new \RuntimeException("Could not find $pharCacertPath"); - } - - if (!file_exists($certFile) || - filesize($certFile) != filesize($pharCacertPath) - ) { - if (!copy($pharCacertPath, $certFile)) { - throw new \RuntimeException( - "Could not copy {$pharCacertPath} to {$certFile}: " - . var_export(error_get_last(), true) - ); - } - } - - return $certFile; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/ClientInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/ClientInterface.php deleted file mode 100644 index 10e4de2ab..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/ClientInterface.php +++ /dev/null @@ -1,223 +0,0 @@ -getCurlOptions(); - $mediator = new RequestMediator($request, $requestCurlOptions->get('emit_io')); - $tempContentLength = null; - $method = $request->getMethod(); - $bodyAsString = $requestCurlOptions->get(self::BODY_AS_STRING); - - // Prepare url - $url = (string)$request->getUrl(); - if(($pos = strpos($url, '#')) !== false ){ - // strip fragment from url - $url = substr($url, 0, $pos); - } - - // Array of default cURL options. - $curlOptions = array( - CURLOPT_URL => $url, - CURLOPT_CONNECTTIMEOUT => 150, - CURLOPT_RETURNTRANSFER => false, - CURLOPT_HEADER => false, - CURLOPT_PORT => $request->getPort(), - CURLOPT_HTTPHEADER => array(), - CURLOPT_WRITEFUNCTION => array($mediator, 'writeResponseBody'), - CURLOPT_HEADERFUNCTION => array($mediator, 'receiveResponseHeader'), - CURLOPT_HTTP_VERSION => $request->getProtocolVersion() === '1.0' - ? CURL_HTTP_VERSION_1_0 : CURL_HTTP_VERSION_1_1, - // Verifies the authenticity of the peer's certificate - CURLOPT_SSL_VERIFYPEER => 1, - // Certificate must indicate that the server is the server to which you meant to connect - CURLOPT_SSL_VERIFYHOST => 2 - ); - - if (defined('CURLOPT_PROTOCOLS')) { - // Allow only HTTP and HTTPS protocols - $curlOptions[CURLOPT_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS; - } - - // Add CURLOPT_ENCODING if Accept-Encoding header is provided - if ($acceptEncodingHeader = $request->getHeader('Accept-Encoding')) { - $curlOptions[CURLOPT_ENCODING] = (string) $acceptEncodingHeader; - // Let cURL set the Accept-Encoding header, prevents duplicate values - $request->removeHeader('Accept-Encoding'); - } - - // Enable curl debug information if the 'debug' param was set - if ($requestCurlOptions->get('debug')) { - $curlOptions[CURLOPT_STDERR] = fopen('php://temp', 'r+'); - // @codeCoverageIgnoreStart - if (false === $curlOptions[CURLOPT_STDERR]) { - throw new RuntimeException('Unable to create a stream for CURLOPT_STDERR'); - } - // @codeCoverageIgnoreEnd - $curlOptions[CURLOPT_VERBOSE] = true; - } - - // Specify settings according to the HTTP method - if ($method == 'GET') { - $curlOptions[CURLOPT_HTTPGET] = true; - } elseif ($method == 'HEAD') { - $curlOptions[CURLOPT_NOBODY] = true; - // HEAD requests do not use a write function - unset($curlOptions[CURLOPT_WRITEFUNCTION]); - } elseif (!($request instanceof EntityEnclosingRequest)) { - $curlOptions[CURLOPT_CUSTOMREQUEST] = $method; - } else { - - $curlOptions[CURLOPT_CUSTOMREQUEST] = $method; - - // Handle sending raw bodies in a request - if ($request->getBody()) { - // You can send the body as a string using curl's CURLOPT_POSTFIELDS - if ($bodyAsString) { - $curlOptions[CURLOPT_POSTFIELDS] = (string) $request->getBody(); - // Allow curl to add the Content-Length for us to account for the times when - // POST redirects are followed by GET requests - if ($tempContentLength = $request->getHeader('Content-Length')) { - $tempContentLength = (int) (string) $tempContentLength; - } - // Remove the curl generated Content-Type header if none was set manually - if (!$request->hasHeader('Content-Type')) { - $curlOptions[CURLOPT_HTTPHEADER][] = 'Content-Type:'; - } - } else { - $curlOptions[CURLOPT_UPLOAD] = true; - // Let cURL handle setting the Content-Length header - if ($tempContentLength = $request->getHeader('Content-Length')) { - $tempContentLength = (int) (string) $tempContentLength; - $curlOptions[CURLOPT_INFILESIZE] = $tempContentLength; - } - // Add a callback for curl to read data to send with the request only if a body was specified - $curlOptions[CURLOPT_READFUNCTION] = array($mediator, 'readRequestBody'); - // Attempt to seek to the start of the stream - $request->getBody()->seek(0); - } - - } else { - - // Special handling for POST specific fields and files - $postFields = false; - if (count($request->getPostFiles())) { - $postFields = $request->getPostFields()->useUrlEncoding(false)->urlEncode(); - foreach ($request->getPostFiles() as $key => $data) { - $prefixKeys = count($data) > 1; - foreach ($data as $index => $file) { - // Allow multiple files in the same key - $fieldKey = $prefixKeys ? "{$key}[{$index}]" : $key; - $postFields[$fieldKey] = $file->getCurlValue(); - } - } - } elseif (count($request->getPostFields())) { - $postFields = (string) $request->getPostFields()->useUrlEncoding(true); - } - - if ($postFields !== false) { - if ($method == 'POST') { - unset($curlOptions[CURLOPT_CUSTOMREQUEST]); - $curlOptions[CURLOPT_POST] = true; - } - $curlOptions[CURLOPT_POSTFIELDS] = $postFields; - $request->removeHeader('Content-Length'); - } - } - - // If the Expect header is not present, prevent curl from adding it - if (!$request->hasHeader('Expect')) { - $curlOptions[CURLOPT_HTTPHEADER][] = 'Expect:'; - } - } - - // If a Content-Length header was specified but we want to allow curl to set one for us - if (null !== $tempContentLength) { - $request->removeHeader('Content-Length'); - } - - // Set custom cURL options - foreach ($requestCurlOptions->toArray() as $key => $value) { - if (is_numeric($key)) { - $curlOptions[$key] = $value; - } - } - - // Do not set an Accept header by default - if (!isset($curlOptions[CURLOPT_ENCODING])) { - $curlOptions[CURLOPT_HTTPHEADER][] = 'Accept:'; - } - - // Add any custom headers to the request. Empty headers will cause curl to not send the header at all. - foreach ($request->getHeaderLines() as $line) { - $curlOptions[CURLOPT_HTTPHEADER][] = $line; - } - - // Add the content-length header back if it was temporarily removed - if (null !== $tempContentLength) { - $request->setHeader('Content-Length', $tempContentLength); - } - - // Apply the options to a new cURL handle. - $handle = curl_init(); - - // Enable the progress function if the 'progress' param was set - if ($requestCurlOptions->get('progress')) { - // Wrap the function in a function that provides the curl handle to the mediator's progress function - // Using this rather than injecting the handle into the mediator prevents a circular reference - $curlOptions[CURLOPT_PROGRESSFUNCTION] = function () use ($mediator, $handle) { - $args = func_get_args(); - $args[] = $handle; - - // PHP 5.5 pushed the handle onto the start of the args - if (is_resource($args[0])) { - array_shift($args); - } - - call_user_func_array(array($mediator, 'progress'), $args); - }; - $curlOptions[CURLOPT_NOPROGRESS] = false; - } - - curl_setopt_array($handle, $curlOptions); - - return new static($handle, $curlOptions); - } - - /** - * Construct a new CurlHandle object that wraps a cURL handle - * - * @param resource $handle Configured cURL handle resource - * @param Collection|array $options Curl options to use with the handle - * - * @throws InvalidArgumentException - */ - public function __construct($handle, $options) - { - if (!is_resource($handle)) { - throw new InvalidArgumentException('Invalid handle provided'); - } - if (is_array($options)) { - $this->options = new Collection($options); - } elseif ($options instanceof Collection) { - $this->options = $options; - } else { - throw new InvalidArgumentException('Expected array or Collection'); - } - $this->handle = $handle; - } - - /** - * Destructor - */ - public function __destruct() - { - $this->close(); - } - - /** - * Close the curl handle - */ - public function close() - { - if (is_resource($this->handle)) { - curl_close($this->handle); - } - $this->handle = null; - } - - /** - * Check if the handle is available and still OK - * - * @return bool - */ - public function isAvailable() - { - return is_resource($this->handle); - } - - /** - * Get the last error that occurred on the cURL handle - * - * @return string - */ - public function getError() - { - return $this->isAvailable() ? curl_error($this->handle) : ''; - } - - /** - * Get the last error number that occurred on the cURL handle - * - * @return int - */ - public function getErrorNo() - { - if ($this->errorNo) { - return $this->errorNo; - } - - return $this->isAvailable() ? curl_errno($this->handle) : CURLE_OK; - } - - /** - * Set the curl error number - * - * @param int $error Error number to set - * - * @return CurlHandle - */ - public function setErrorNo($error) - { - $this->errorNo = $error; - - return $this; - } - - /** - * Get cURL curl_getinfo data - * - * @param int $option Option to retrieve. Pass null to retrieve all data as an array. - * - * @return array|mixed - */ - public function getInfo($option = null) - { - if (!is_resource($this->handle)) { - return null; - } - - if (null !== $option) { - return curl_getinfo($this->handle, $option) ?: null; - } - - return curl_getinfo($this->handle) ?: array(); - } - - /** - * Get the stderr output - * - * @param bool $asResource Set to TRUE to get an fopen resource - * - * @return string|resource|null - */ - public function getStderr($asResource = false) - { - $stderr = $this->getOptions()->get(CURLOPT_STDERR); - if (!$stderr) { - return null; - } - - if ($asResource) { - return $stderr; - } - - fseek($stderr, 0); - $e = stream_get_contents($stderr); - fseek($stderr, 0, SEEK_END); - - return $e; - } - - /** - * Get the URL that this handle is connecting to - * - * @return Url - */ - public function getUrl() - { - return Url::factory($this->options->get(CURLOPT_URL)); - } - - /** - * Get the wrapped curl handle - * - * @return resource|null Returns the cURL handle or null if it was closed - */ - public function getHandle() - { - return $this->isAvailable() ? $this->handle : null; - } - - /** - * Get the cURL setopt options of the handle. Changing values in the return object will have no effect on the curl - * handle after it is created. - * - * @return Collection - */ - public function getOptions() - { - return $this->options; - } - - /** - * Update a request based on the log messages of the CurlHandle - * - * @param RequestInterface $request Request to update - */ - public function updateRequestFromTransfer(RequestInterface $request) - { - if (!$request->getResponse()) { - return; - } - - // Update the transfer stats of the response - $request->getResponse()->setInfo($this->getInfo()); - - if (!$log = $this->getStderr(true)) { - return; - } - - // Parse the cURL stderr output for outgoing requests - $headers = ''; - fseek($log, 0); - while (($line = fgets($log)) !== false) { - if ($line && $line[0] == '>') { - $headers = substr(trim($line), 2) . "\r\n"; - while (($line = fgets($log)) !== false) { - if ($line[0] == '*' || $line[0] == '<') { - break; - } else { - $headers .= trim($line) . "\r\n"; - } - } - } - } - - // Add request headers to the request exactly as they were sent - if ($headers) { - $parsed = ParserRegistry::getInstance()->getParser('message')->parseRequest($headers); - if (!empty($parsed['headers'])) { - $request->setHeaders(array()); - foreach ($parsed['headers'] as $name => $value) { - $request->setHeader($name, $value); - } - } - if (!empty($parsed['version'])) { - $request->setProtocolVersion($parsed['version']); - } - } - } - - /** - * Parse the config and replace curl.* configurators into the constant based values so it can be used elsewhere - * - * @param array|Collection $config The configuration we want to parse - * - * @return array - */ - public static function parseCurlConfig($config) - { - $curlOptions = array(); - foreach ($config as $key => $value) { - if (is_string($key) && defined($key)) { - // Convert constants represented as string to constant int values - $key = constant($key); - } - if (is_string($value) && defined($value)) { - $value = constant($value); - } - $curlOptions[$key] = $value; - } - - return $curlOptions; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php deleted file mode 100644 index 9e4e63722..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMulti.php +++ /dev/null @@ -1,423 +0,0 @@ - array('CURLM_BAD_HANDLE', 'The passed-in handle is not a valid CURLM handle.'), - CURLM_BAD_EASY_HANDLE => array('CURLM_BAD_EASY_HANDLE', "An easy handle was not good/valid. It could mean that it isn't an easy handle at all, or possibly that the handle already is in used by this or another multi handle."), - CURLM_OUT_OF_MEMORY => array('CURLM_OUT_OF_MEMORY', 'You are doomed.'), - CURLM_INTERNAL_ERROR => array('CURLM_INTERNAL_ERROR', 'This can only be returned if libcurl bugs. Please report it to us!') - ); - - /** @var float */ - protected $selectTimeout; - - public function __construct($selectTimeout = 1.0) - { - $this->selectTimeout = $selectTimeout; - $this->multiHandle = curl_multi_init(); - // @codeCoverageIgnoreStart - if ($this->multiHandle === false) { - throw new CurlException('Unable to create multi handle'); - } - // @codeCoverageIgnoreEnd - $this->reset(); - } - - public function __destruct() - { - if (is_resource($this->multiHandle)) { - curl_multi_close($this->multiHandle); - } - } - - public function add(RequestInterface $request) - { - $this->requests[] = $request; - // If requests are currently transferring and this is async, then the - // request must be prepared now as the send() method is not called. - $this->beforeSend($request); - $this->dispatch(self::ADD_REQUEST, array('request' => $request)); - - return $this; - } - - public function all() - { - return $this->requests; - } - - public function remove(RequestInterface $request) - { - $this->removeHandle($request); - if (($index = array_search($request, $this->requests, true)) !== false) { - $request = $this->requests[$index]; - unset($this->requests[$index]); - $this->requests = array_values($this->requests); - $this->dispatch(self::REMOVE_REQUEST, array('request' => $request)); - return true; - } - - return false; - } - - public function reset($hard = false) - { - // Remove each request - if ($this->requests) { - foreach ($this->requests as $request) { - $this->remove($request); - } - } - - $this->handles = new \SplObjectStorage(); - $this->requests = $this->resourceHash = $this->exceptions = $this->successful = array(); - } - - public function send() - { - $this->perform(); - $exceptions = $this->exceptions; - $successful = $this->successful; - $this->reset(); - - if ($exceptions) { - $this->throwMultiException($exceptions, $successful); - } - } - - public function count() - { - return count($this->requests); - } - - /** - * Build and throw a MultiTransferException - * - * @param array $exceptions Exceptions encountered - * @param array $successful Successful requests - * @throws MultiTransferException - */ - protected function throwMultiException(array $exceptions, array $successful) - { - $multiException = new MultiTransferException('Errors during multi transfer'); - - while ($e = array_shift($exceptions)) { - $multiException->addFailedRequestWithException($e['request'], $e['exception']); - } - - // Add successful requests - foreach ($successful as $request) { - if (!$multiException->containsRequest($request)) { - $multiException->addSuccessfulRequest($request); - } - } - - throw $multiException; - } - - /** - * Prepare for sending - * - * @param RequestInterface $request Request to prepare - * @throws \Exception on error preparing the request - */ - protected function beforeSend(RequestInterface $request) - { - try { - $state = $request->setState(RequestInterface::STATE_TRANSFER); - if ($state == RequestInterface::STATE_TRANSFER) { - $this->addHandle($request); - } else { - // Requests might decide they don't need to be sent just before - // transfer (e.g. CachePlugin) - $this->remove($request); - if ($state == RequestInterface::STATE_COMPLETE) { - $this->successful[] = $request; - } - } - } catch (\Exception $e) { - // Queue the exception to be thrown when sent - $this->removeErroredRequest($request, $e); - } - } - - private function addHandle(RequestInterface $request) - { - $handle = $this->createCurlHandle($request)->getHandle(); - $this->checkCurlResult( - curl_multi_add_handle($this->multiHandle, $handle) - ); - } - - /** - * Create a curl handle for a request - * - * @param RequestInterface $request Request - * - * @return CurlHandle - */ - protected function createCurlHandle(RequestInterface $request) - { - $wrapper = CurlHandle::factory($request); - $this->handles[$request] = $wrapper; - $this->resourceHash[(int) $wrapper->getHandle()] = $request; - - return $wrapper; - } - - /** - * Get the data from the multi handle - */ - protected function perform() - { - $event = new Event(array('curl_multi' => $this)); - - while ($this->requests) { - // Notify each request as polling - $blocking = $total = 0; - foreach ($this->requests as $request) { - ++$total; - $event['request'] = $request; - $request->getEventDispatcher()->dispatch(self::POLLING_REQUEST, $event); - // The blocking variable just has to be non-falsey to block the loop - if ($request->getParams()->hasKey(self::BLOCKING)) { - ++$blocking; - } - } - if ($blocking == $total) { - // Sleep to prevent eating CPU because no requests are actually pending a select call - usleep(500); - } else { - $this->executeHandles(); - } - } - } - - /** - * Execute and select curl handles - */ - private function executeHandles() - { - // The first curl_multi_select often times out no matter what, but is usually required for fast transfers - $selectTimeout = 0.001; - $active = false; - do { - while (($mrc = curl_multi_exec($this->multiHandle, $active)) == CURLM_CALL_MULTI_PERFORM); - $this->checkCurlResult($mrc); - $this->processMessages(); - if ($active && curl_multi_select($this->multiHandle, $selectTimeout) === -1) { - // Perform a usleep if a select returns -1: https://bugs.php.net/bug.php?id=61141 - usleep(150); - } - $selectTimeout = $this->selectTimeout; - } while ($active); - } - - /** - * Process any received curl multi messages - */ - private function processMessages() - { - while ($done = curl_multi_info_read($this->multiHandle)) { - $request = $this->resourceHash[(int) $done['handle']]; - try { - $this->processResponse($request, $this->handles[$request], $done); - $this->successful[] = $request; - } catch (\Exception $e) { - $this->removeErroredRequest($request, $e); - } - } - } - - /** - * Remove a request that encountered an exception - * - * @param RequestInterface $request Request to remove - * @param \Exception $e Exception encountered - */ - protected function removeErroredRequest(RequestInterface $request, \Exception $e = null) - { - $this->exceptions[] = array('request' => $request, 'exception' => $e); - $this->remove($request); - $this->dispatch(self::MULTI_EXCEPTION, array('exception' => $e, 'all_exceptions' => $this->exceptions)); - } - - /** - * Check for errors and fix headers of a request based on a curl response - * - * @param RequestInterface $request Request to process - * @param CurlHandle $handle Curl handle object - * @param array $curl Array returned from curl_multi_info_read - * - * @throws CurlException on Curl error - */ - protected function processResponse(RequestInterface $request, CurlHandle $handle, array $curl) - { - // Set the transfer stats on the response - $handle->updateRequestFromTransfer($request); - // Check if a cURL exception occurred, and if so, notify things - $curlException = $this->isCurlException($request, $handle, $curl); - - // Always remove completed curl handles. They can be added back again - // via events if needed (e.g. ExponentialBackoffPlugin) - $this->removeHandle($request); - - if (!$curlException) { - if ($this->validateResponseWasSet($request)) { - $state = $request->setState( - RequestInterface::STATE_COMPLETE, - array('handle' => $handle) - ); - // Only remove the request if it wasn't resent as a result of - // the state change - if ($state != RequestInterface::STATE_TRANSFER) { - $this->remove($request); - } - } - return; - } - - // Set the state of the request to an error - $state = $request->setState(RequestInterface::STATE_ERROR, array('exception' => $curlException)); - // Allow things to ignore the error if possible - if ($state != RequestInterface::STATE_TRANSFER) { - $this->remove($request); - } - - // The error was not handled, so fail - if ($state == RequestInterface::STATE_ERROR) { - /** @var CurlException $curlException */ - throw $curlException; - } - } - - /** - * Remove a curl handle from the curl multi object - * - * @param RequestInterface $request Request that owns the handle - */ - protected function removeHandle(RequestInterface $request) - { - if (isset($this->handles[$request])) { - $handle = $this->handles[$request]; - curl_multi_remove_handle($this->multiHandle, $handle->getHandle()); - unset($this->handles[$request]); - unset($this->resourceHash[(int) $handle->getHandle()]); - $handle->close(); - } - } - - /** - * Check if a cURL transfer resulted in what should be an exception - * - * @param RequestInterface $request Request to check - * @param CurlHandle $handle Curl handle object - * @param array $curl Array returned from curl_multi_info_read - * - * @return CurlException|bool - */ - private function isCurlException(RequestInterface $request, CurlHandle $handle, array $curl) - { - if (CURLM_OK == $curl['result'] || CURLM_CALL_MULTI_PERFORM == $curl['result']) { - return false; - } - - $handle->setErrorNo($curl['result']); - $e = new CurlException(sprintf('[curl] %s: %s [url] %s', - $handle->getErrorNo(), $handle->getError(), $handle->getUrl())); - $e->setCurlHandle($handle) - ->setRequest($request) - ->setCurlInfo($handle->getInfo()) - ->setError($handle->getError(), $handle->getErrorNo()); - - return $e; - } - - /** - * Throw an exception for a cURL multi response if needed - * - * @param int $code Curl response code - * @throws CurlException - */ - private function checkCurlResult($code) - { - if ($code != CURLM_OK && $code != CURLM_CALL_MULTI_PERFORM) { - throw new CurlException(isset($this->multiErrors[$code]) - ? "cURL error: {$code} ({$this->multiErrors[$code][0]}): cURL message: {$this->multiErrors[$code][1]}" - : 'Unexpected cURL error: ' . $code - ); - } - } - - /** - * @link https://github.com/guzzle/guzzle/issues/710 - */ - private function validateResponseWasSet(RequestInterface $request) - { - if ($request->getResponse()) { - return true; - } - - $body = $request instanceof EntityEnclosingRequestInterface - ? $request->getBody() - : null; - - if (!$body) { - $rex = new RequestException( - 'No response was received for a request with no body. This' - . ' could mean that you are saturating your network.' - ); - $rex->setRequest($request); - $this->removeErroredRequest($request, $rex); - } elseif (!$body->isSeekable() || !$body->seek(0)) { - // Nothing we can do with this. Sorry! - $rex = new RequestException( - 'The connection was unexpectedly closed. The request would' - . ' have been retried, but attempting to rewind the' - . ' request body failed.' - ); - $rex->setRequest($request); - $this->removeErroredRequest($request, $rex); - } else { - $this->remove($request); - // Add the request back to the batch to retry automatically. - $this->requests[] = $request; - $this->addHandle($request); - } - - return false; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMultiInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMultiInterface.php deleted file mode 100644 index 0ead75735..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlMultiInterface.php +++ /dev/null @@ -1,58 +0,0 @@ -maxHandles = $maxHandles; - $this->selectTimeout = $selectTimeout; - // You can get some weird "Too many open files" errors when sending a large amount of requests in parallel. - // These two statements autoload classes before a system runs out of file descriptors so that you can get back - // valuable error messages if you run out. - class_exists('Guzzle\Http\Message\Response'); - class_exists('Guzzle\Http\Exception\CurlException'); - } - - public function add(RequestInterface $request) - { - $this->queued[] = $request; - - return $this; - } - - public function all() - { - $requests = $this->queued; - foreach ($this->handles as $handle) { - $requests = array_merge($requests, $handle->all()); - } - - return $requests; - } - - public function remove(RequestInterface $request) - { - foreach ($this->queued as $i => $r) { - if ($request === $r) { - unset($this->queued[$i]); - return true; - } - } - - foreach ($this->handles as $handle) { - if ($handle->remove($request)) { - return true; - } - } - - return false; - } - - public function reset($hard = false) - { - $this->queued = array(); - $this->groups = array(); - foreach ($this->handles as $handle) { - $handle->reset(); - } - if ($hard) { - $this->handles = array(); - } - - return $this; - } - - public function send() - { - if ($this->queued) { - $group = $this->getAvailableHandle(); - // Add this handle to a list of handles than is claimed - $this->groups[] = $group; - while ($request = array_shift($this->queued)) { - $group->add($request); - } - try { - $group->send(); - array_pop($this->groups); - $this->cleanupHandles(); - } catch (\Exception $e) { - // Remove the group and cleanup if an exception was encountered and no more requests in group - if (!$group->count()) { - array_pop($this->groups); - $this->cleanupHandles(); - } - throw $e; - } - } - } - - public function count() - { - return count($this->all()); - } - - /** - * Get an existing available CurlMulti handle or create a new one - * - * @return CurlMulti - */ - protected function getAvailableHandle() - { - // Grab a handle that is not claimed - foreach ($this->handles as $h) { - if (!in_array($h, $this->groups, true)) { - return $h; - } - } - - // All are claimed, so create one - $handle = new CurlMulti($this->selectTimeout); - $handle->setEventDispatcher($this->getEventDispatcher()); - $this->handles[] = $handle; - - return $handle; - } - - /** - * Trims down unused CurlMulti handles to limit the number of open connections - */ - protected function cleanupHandles() - { - if ($diff = max(0, count($this->handles) - $this->maxHandles)) { - for ($i = count($this->handles) - 1; $i > 0 && $diff > 0; $i--) { - if (!count($this->handles[$i])) { - unset($this->handles[$i]); - $diff--; - } - } - $this->handles = array_values($this->handles); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlVersion.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlVersion.php deleted file mode 100644 index c3f99dd25..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Curl/CurlVersion.php +++ /dev/null @@ -1,66 +0,0 @@ -version) { - $this->version = curl_version(); - } - - return $this->version; - } - - /** - * Get a specific type of curl information - * - * @param string $type Version information to retrieve. This value is one of: - * - version_number: cURL 24 bit version number - * - version: cURL version number, as a string - * - ssl_version_number: OpenSSL 24 bit version number - * - ssl_version: OpenSSL version number, as a string - * - libz_version: zlib version number, as a string - * - host: Information about the host where cURL was built - * - features: A bitmask of the CURL_VERSION_XXX constants - * - protocols: An array of protocols names supported by cURL - * - * @return string|float|bool if the $type is found, and false if not found - */ - public function get($type) - { - $version = $this->getAll(); - - return isset($version[$type]) ? $version[$type] : false; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Curl/RequestMediator.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Curl/RequestMediator.php deleted file mode 100644 index 5d1a0cd87..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Curl/RequestMediator.php +++ /dev/null @@ -1,147 +0,0 @@ -request = $request; - $this->emitIo = $emitIo; - } - - /** - * Receive a response header from curl - * - * @param resource $curl Curl handle - * @param string $header Received header - * - * @return int - */ - public function receiveResponseHeader($curl, $header) - { - static $normalize = array("\r", "\n"); - $length = strlen($header); - $header = str_replace($normalize, '', $header); - - if (strpos($header, 'HTTP/') === 0) { - - $startLine = explode(' ', $header, 3); - $code = $startLine[1]; - $status = isset($startLine[2]) ? $startLine[2] : ''; - - // Only download the body of the response to the specified response - // body when a successful response is received. - if ($code >= 200 && $code < 300) { - $body = $this->request->getResponseBody(); - } else { - $body = EntityBody::factory(); - } - - $response = new Response($code, null, $body); - $response->setStatus($code, $status); - $this->request->startResponse($response); - - $this->request->dispatch('request.receive.status_line', array( - 'request' => $this, - 'line' => $header, - 'status_code' => $code, - 'reason_phrase' => $status - )); - - } elseif ($pos = strpos($header, ':')) { - $this->request->getResponse()->addHeader( - trim(substr($header, 0, $pos)), - trim(substr($header, $pos + 1)) - ); - } - - return $length; - } - - /** - * Received a progress notification - * - * @param int $downloadSize Total download size - * @param int $downloaded Amount of bytes downloaded - * @param int $uploadSize Total upload size - * @param int $uploaded Amount of bytes uploaded - * @param resource $handle CurlHandle object - */ - public function progress($downloadSize, $downloaded, $uploadSize, $uploaded, $handle = null) - { - $this->request->dispatch('curl.callback.progress', array( - 'request' => $this->request, - 'handle' => $handle, - 'download_size' => $downloadSize, - 'downloaded' => $downloaded, - 'upload_size' => $uploadSize, - 'uploaded' => $uploaded - )); - } - - /** - * Write data to the response body of a request - * - * @param resource $curl Curl handle - * @param string $write Data that was received - * - * @return int - */ - public function writeResponseBody($curl, $write) - { - if ($this->emitIo) { - $this->request->dispatch('curl.callback.write', array( - 'request' => $this->request, - 'write' => $write - )); - } - - if ($response = $this->request->getResponse()) { - return $response->getBody()->write($write); - } else { - // Unexpected data received before response headers - abort transfer - return 0; - } - } - - /** - * Read data from the request body and send it to curl - * - * @param resource $ch Curl handle - * @param resource $fd File descriptor - * @param int $length Amount of data to read - * - * @return string - */ - public function readRequestBody($ch, $fd, $length) - { - if (!($body = $this->request->getBody())) { - return ''; - } - - $read = (string) $body->read($length); - if ($this->emitIo) { - $this->request->dispatch('curl.callback.read', array('request' => $this->request, 'read' => $read)); - } - - return $read; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/EntityBody.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/EntityBody.php deleted file mode 100644 index b60d170f0..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/EntityBody.php +++ /dev/null @@ -1,201 +0,0 @@ -rewindFunction = $callable; - - return $this; - } - - public function rewind() - { - return $this->rewindFunction ? call_user_func($this->rewindFunction, $this) : parent::rewind(); - } - - /** - * Create a new EntityBody from a string - * - * @param string $string String of data - * - * @return EntityBody - */ - public static function fromString($string) - { - $stream = fopen('php://temp', 'r+'); - if ($string !== '') { - fwrite($stream, $string); - rewind($stream); - } - - return new static($stream); - } - - public function compress($filter = 'zlib.deflate') - { - $result = $this->handleCompression($filter); - $this->contentEncoding = $result ? $filter : false; - - return $result; - } - - public function uncompress($filter = 'zlib.inflate') - { - $offsetStart = 0; - - // When inflating gzipped data, the first 10 bytes must be stripped - // if a gzip header is present - if ($filter == 'zlib.inflate') { - // @codeCoverageIgnoreStart - if (!$this->isReadable() || ($this->isConsumed() && !$this->isSeekable())) { - return false; - } - // @codeCoverageIgnoreEnd - if (stream_get_contents($this->stream, 3, 0) === "\x1f\x8b\x08") { - $offsetStart = 10; - } - } - - $this->contentEncoding = false; - - return $this->handleCompression($filter, $offsetStart); - } - - public function getContentLength() - { - return $this->getSize(); - } - - public function getContentType() - { - return $this->getUri() ? Mimetypes::getInstance()->fromFilename($this->getUri()) : null; - } - - public function getContentMd5($rawOutput = false, $base64Encode = false) - { - if ($hash = self::getHash($this, 'md5', $rawOutput)) { - return $hash && $base64Encode ? base64_encode($hash) : $hash; - } else { - return false; - } - } - - /** - * Calculate the MD5 hash of an entity body - * - * @param EntityBodyInterface $body Entity body to calculate the hash for - * @param bool $rawOutput Whether or not to use raw output - * @param bool $base64Encode Whether or not to base64 encode raw output (only if raw output is true) - * - * @return bool|string Returns an MD5 string on success or FALSE on failure - * @deprecated This will be deprecated soon - * @codeCoverageIgnore - */ - public static function calculateMd5(EntityBodyInterface $body, $rawOutput = false, $base64Encode = false) - { - Version::warn(__CLASS__ . ' is deprecated. Use getContentMd5()'); - return $body->getContentMd5($rawOutput, $base64Encode); - } - - public function setStreamFilterContentEncoding($streamFilterContentEncoding) - { - $this->contentEncoding = $streamFilterContentEncoding; - - return $this; - } - - public function getContentEncoding() - { - return strtr($this->contentEncoding, array( - 'zlib.deflate' => 'gzip', - 'bzip2.compress' => 'compress' - )) ?: false; - } - - protected function handleCompression($filter, $offsetStart = 0) - { - // @codeCoverageIgnoreStart - if (!$this->isReadable() || ($this->isConsumed() && !$this->isSeekable())) { - return false; - } - // @codeCoverageIgnoreEnd - - $handle = fopen('php://temp', 'r+'); - $filter = @stream_filter_append($handle, $filter, STREAM_FILTER_WRITE); - if (!$filter) { - return false; - } - - // Seek to the offset start if possible - $this->seek($offsetStart); - while ($data = fread($this->stream, 8096)) { - fwrite($handle, $data); - } - - fclose($this->stream); - $this->stream = $handle; - stream_filter_remove($filter); - $stat = fstat($this->stream); - $this->size = $stat['size']; - $this->rebuildCache(); - $this->seek(0); - - // Remove any existing rewind function as the underlying stream has been replaced - $this->rewindFunction = null; - - return true; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/EntityBodyInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/EntityBodyInterface.php deleted file mode 100644 index e640f5785..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/EntityBodyInterface.php +++ /dev/null @@ -1,73 +0,0 @@ -isClientError()) { - $label = 'Client error response'; - $class = __NAMESPACE__ . '\\ClientErrorResponseException'; - } elseif ($response->isServerError()) { - $label = 'Server error response'; - $class = __NAMESPACE__ . '\\ServerErrorResponseException'; - } else { - $label = 'Unsuccessful response'; - $class = __CLASS__; - } - - $message = $label . PHP_EOL . implode(PHP_EOL, array( - '[status code] ' . $response->getStatusCode(), - '[reason phrase] ' . $response->getReasonPhrase(), - '[url] ' . $request->getUrl(), - )); - - $e = new $class($message); - $e->setResponse($response); - $e->setRequest($request); - - return $e; - } - - /** - * Set the response that caused the exception - * - * @param Response $response Response to set - */ - public function setResponse(Response $response) - { - $this->response = $response; - } - - /** - * Get the response that caused the exception - * - * @return Response - */ - public function getResponse() - { - return $this->response; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Exception/ClientErrorResponseException.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Exception/ClientErrorResponseException.php deleted file mode 100644 index 04d7ddc05..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Exception/ClientErrorResponseException.php +++ /dev/null @@ -1,8 +0,0 @@ -curlError = $error; - $this->curlErrorNo = $number; - - return $this; - } - - /** - * Set the associated curl handle - * - * @param CurlHandle $handle Curl handle - * - * @return self - */ - public function setCurlHandle(CurlHandle $handle) - { - $this->handle = $handle; - - return $this; - } - - /** - * Get the associated cURL handle - * - * @return CurlHandle|null - */ - public function getCurlHandle() - { - return $this->handle; - } - - /** - * Get the associated cURL error message - * - * @return string|null - */ - public function getError() - { - return $this->curlError; - } - - /** - * Get the associated cURL error number - * - * @return int|null - */ - public function getErrorNo() - { - return $this->curlErrorNo; - } - - /** - * Returns curl information about the transfer - * - * @return array - */ - public function getCurlInfo() - { - return $this->curlInfo; - } - - /** - * Set curl transfer information - * - * @param array $info Array of curl transfer information - * - * @return self - * @link http://php.net/manual/en/function.curl-getinfo.php - */ - public function setCurlInfo(array $info) - { - $this->curlInfo = $info; - - return $this; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Exception/HttpException.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Exception/HttpException.php deleted file mode 100644 index ee87295d3..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Exception/HttpException.php +++ /dev/null @@ -1,10 +0,0 @@ -successfulRequests, $this->failedRequests); - } - - /** - * Add to the array of successful requests - * - * @param RequestInterface $request Successful request - * - * @return self - */ - public function addSuccessfulRequest(RequestInterface $request) - { - $this->successfulRequests[] = $request; - - return $this; - } - - /** - * Add to the array of failed requests - * - * @param RequestInterface $request Failed request - * - * @return self - */ - public function addFailedRequest(RequestInterface $request) - { - $this->failedRequests[] = $request; - - return $this; - } - - /** - * Add to the array of failed requests and associate with exceptions - * - * @param RequestInterface $request Failed request - * @param \Exception $exception Exception to add and associate with - * - * @return self - */ - public function addFailedRequestWithException(RequestInterface $request, \Exception $exception) - { - $this->add($exception) - ->addFailedRequest($request) - ->exceptionForRequest[spl_object_hash($request)] = $exception; - - return $this; - } - - /** - * Get the Exception that caused the given $request to fail - * - * @param RequestInterface $request Failed command - * - * @return \Exception|null - */ - public function getExceptionForFailedRequest(RequestInterface $request) - { - $oid = spl_object_hash($request); - - return isset($this->exceptionForRequest[$oid]) ? $this->exceptionForRequest[$oid] : null; - } - - /** - * Set all of the successful requests - * - * @param array Array of requests - * - * @return self - */ - public function setSuccessfulRequests(array $requests) - { - $this->successfulRequests = $requests; - - return $this; - } - - /** - * Set all of the failed requests - * - * @param array Array of requests - * - * @return self - */ - public function setFailedRequests(array $requests) - { - $this->failedRequests = $requests; - - return $this; - } - - /** - * Get an array of successful requests sent in the multi transfer - * - * @return array - */ - public function getSuccessfulRequests() - { - return $this->successfulRequests; - } - - /** - * Get an array of failed requests sent in the multi transfer - * - * @return array - */ - public function getFailedRequests() - { - return $this->failedRequests; - } - - /** - * Check if the exception object contains a request - * - * @param RequestInterface $request Request to check - * - * @return bool - */ - public function containsRequest(RequestInterface $request) - { - return in_array($request, $this->failedRequests, true) || in_array($request, $this->successfulRequests, true); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Exception/RequestException.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Exception/RequestException.php deleted file mode 100644 index 274df2cb1..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Exception/RequestException.php +++ /dev/null @@ -1,39 +0,0 @@ -request = $request; - - return $this; - } - - /** - * Get the request that caused the exception - * - * @return RequestInterface - */ - public function getRequest() - { - return $this->request; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Exception/ServerErrorResponseException.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Exception/ServerErrorResponseException.php deleted file mode 100644 index f0f7cfe48..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Exception/ServerErrorResponseException.php +++ /dev/null @@ -1,8 +0,0 @@ -eventDispatcher = $eventDispatcher; - - return $this; - } - - public function getEventDispatcher() - { - if (!$this->eventDispatcher) { - $this->eventDispatcher = new EventDispatcher(); - } - - return $this->eventDispatcher; - } - - public function dispatch($eventName, array $context = array()) - { - return $this->getEventDispatcher()->dispatch($eventName, new Event($context)); - } - - /** - * {@inheritdoc} - * @codeCoverageIgnore - */ - public function addSubscriber(EventSubscriberInterface $subscriber) - { - $this->getEventDispatcher()->addSubscriber($subscriber); - - return $this; - } - - public function read($length) - { - $event = array( - 'body' => $this, - 'length' => $length, - 'read' => $this->body->read($length) - ); - $this->dispatch('body.read', $event); - - return $event['read']; - } - - public function write($string) - { - $event = array( - 'body' => $this, - 'write' => $string, - 'result' => $this->body->write($string) - ); - $this->dispatch('body.write', $event); - - return $event['result']; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/AbstractMessage.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/AbstractMessage.php deleted file mode 100644 index 0d066ffce..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/AbstractMessage.php +++ /dev/null @@ -1,220 +0,0 @@ -params = new Collection(); - $this->headerFactory = new HeaderFactory(); - $this->headers = new HeaderCollection(); - } - - /** - * Set the header factory to use to create headers - * - * @param HeaderFactoryInterface $factory - * - * @return self - */ - public function setHeaderFactory(HeaderFactoryInterface $factory) - { - $this->headerFactory = $factory; - - return $this; - } - - public function getParams() - { - return $this->params; - } - - public function addHeader($header, $value) - { - if (isset($this->headers[$header])) { - $this->headers[$header]->add($value); - } elseif ($value instanceof HeaderInterface) { - $this->headers[$header] = $value; - } else { - $this->headers[$header] = $this->headerFactory->createHeader($header, $value); - } - - return $this; - } - - public function addHeaders(array $headers) - { - foreach ($headers as $key => $value) { - $this->addHeader($key, $value); - } - - return $this; - } - - public function getHeader($header) - { - return $this->headers[$header]; - } - - public function getHeaders() - { - return $this->headers; - } - - public function getHeaderLines() - { - $headers = array(); - foreach ($this->headers as $value) { - $headers[] = $value->getName() . ': ' . $value; - } - - return $headers; - } - - public function setHeader($header, $value) - { - unset($this->headers[$header]); - $this->addHeader($header, $value); - - return $this; - } - - public function setHeaders(array $headers) - { - $this->headers->clear(); - foreach ($headers as $key => $value) { - $this->addHeader($key, $value); - } - - return $this; - } - - public function hasHeader($header) - { - return isset($this->headers[$header]); - } - - public function removeHeader($header) - { - unset($this->headers[$header]); - - return $this; - } - - /** - * @deprecated Use $message->getHeader()->parseParams() - * @codeCoverageIgnore - */ - public function getTokenizedHeader($header, $token = ';') - { - Version::warn(__METHOD__ . ' is deprecated. Use $message->getHeader()->parseParams()'); - if ($this->hasHeader($header)) { - $data = new Collection(); - foreach ($this->getHeader($header)->parseParams() as $values) { - foreach ($values as $key => $value) { - if ($value === '') { - $data->set($data->count(), $key); - } else { - $data->add($key, $value); - } - } - } - return $data; - } - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function setTokenizedHeader($header, $data, $token = ';') - { - Version::warn(__METHOD__ . ' is deprecated.'); - return $this; - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function getCacheControlDirective($directive) - { - Version::warn(__METHOD__ . ' is deprecated. Use $message->getHeader(\'Cache-Control\')->getDirective()'); - if (!($header = $this->getHeader('Cache-Control'))) { - return null; - } - - return $header->getDirective($directive); - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function hasCacheControlDirective($directive) - { - Version::warn(__METHOD__ . ' is deprecated. Use $message->getHeader(\'Cache-Control\')->hasDirective()'); - if ($header = $this->getHeader('Cache-Control')) { - return $header->hasDirective($directive); - } else { - return false; - } - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function addCacheControlDirective($directive, $value = true) - { - Version::warn(__METHOD__ . ' is deprecated. Use $message->getHeader(\'Cache-Control\')->addDirective()'); - if (!($header = $this->getHeader('Cache-Control'))) { - $this->addHeader('Cache-Control', ''); - $header = $this->getHeader('Cache-Control'); - } - - $header->addDirective($directive, $value); - - return $this; - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function removeCacheControlDirective($directive) - { - Version::warn(__METHOD__ . ' is deprecated. Use $message->getHeader(\'Cache-Control\')->removeDirective()'); - if ($header = $this->getHeader('Cache-Control')) { - $header->removeDirective($directive); - } - - return $this; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/EntityEnclosingRequest.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/EntityEnclosingRequest.php deleted file mode 100644 index 212850a25..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/EntityEnclosingRequest.php +++ /dev/null @@ -1,247 +0,0 @@ -postFields = new QueryString(); - parent::__construct($method, $url, $headers); - } - - /** - * @return string - */ - public function __toString() - { - // Only attempt to include the POST data if it's only fields - if (count($this->postFields) && empty($this->postFiles)) { - return parent::__toString() . (string) $this->postFields; - } - - return parent::__toString() . $this->body; - } - - public function setState($state, array $context = array()) - { - parent::setState($state, $context); - if ($state == self::STATE_TRANSFER && !$this->body && !count($this->postFields) && !count($this->postFiles)) { - $this->setHeader('Content-Length', 0)->removeHeader('Transfer-Encoding'); - } - - return $this->state; - } - - public function setBody($body, $contentType = null) - { - $this->body = EntityBody::factory($body); - - // Auto detect the Content-Type from the path of the request if possible - if ($contentType === null && !$this->hasHeader('Content-Type')) { - $contentType = $this->body->getContentType(); - } - - if ($contentType) { - $this->setHeader('Content-Type', $contentType); - } - - // Always add the Expect 100-Continue header if the body cannot be rewound. This helps with redirects. - if (!$this->body->isSeekable() && $this->expectCutoff !== false) { - $this->setHeader('Expect', '100-Continue'); - } - - // Set the Content-Length header if it can be determined - $size = $this->body->getContentLength(); - if ($size !== null && $size !== false) { - $this->setHeader('Content-Length', $size); - if ($size > $this->expectCutoff) { - $this->setHeader('Expect', '100-Continue'); - } - } elseif (!$this->hasHeader('Content-Length')) { - if ('1.1' == $this->protocolVersion) { - $this->setHeader('Transfer-Encoding', 'chunked'); - } else { - throw new RequestException( - 'Cannot determine Content-Length and cannot use chunked Transfer-Encoding when using HTTP/1.0' - ); - } - } - - return $this; - } - - public function getBody() - { - return $this->body; - } - - /** - * Set the size that the entity body of the request must exceed before adding the Expect: 100-Continue header. - * - * @param int|bool $size Cutoff in bytes. Set to false to never send the expect header (even with non-seekable data) - * - * @return self - */ - public function setExpectHeaderCutoff($size) - { - $this->expectCutoff = $size; - if ($size === false || !$this->body) { - $this->removeHeader('Expect'); - } elseif ($this->body && $this->body->getSize() && $this->body->getSize() > $size) { - $this->setHeader('Expect', '100-Continue'); - } - - return $this; - } - - public function configureRedirects($strict = false, $maxRedirects = 5) - { - $this->getParams()->set(RedirectPlugin::STRICT_REDIRECTS, $strict); - if ($maxRedirects == 0) { - $this->getParams()->set(RedirectPlugin::DISABLE, true); - } else { - $this->getParams()->set(RedirectPlugin::MAX_REDIRECTS, $maxRedirects); - } - - return $this; - } - - public function getPostField($field) - { - return $this->postFields->get($field); - } - - public function getPostFields() - { - return $this->postFields; - } - - public function setPostField($key, $value) - { - $this->postFields->set($key, $value); - $this->processPostFields(); - - return $this; - } - - public function addPostFields($fields) - { - $this->postFields->merge($fields); - $this->processPostFields(); - - return $this; - } - - public function removePostField($field) - { - $this->postFields->remove($field); - $this->processPostFields(); - - return $this; - } - - public function getPostFiles() - { - return $this->postFiles; - } - - public function getPostFile($fieldName) - { - return isset($this->postFiles[$fieldName]) ? $this->postFiles[$fieldName] : null; - } - - public function removePostFile($fieldName) - { - unset($this->postFiles[$fieldName]); - $this->processPostFields(); - - return $this; - } - - public function addPostFile($field, $filename = null, $contentType = null, $postname = null) - { - $data = null; - - if ($field instanceof PostFileInterface) { - $data = $field; - } elseif (is_array($filename)) { - // Allow multiple values to be set in a single key - foreach ($filename as $file) { - $this->addPostFile($field, $file, $contentType); - } - return $this; - } elseif (!is_string($filename)) { - throw new RequestException('The path to a file must be a string'); - } elseif (!empty($filename)) { - // Adding an empty file will cause cURL to error out - $data = new PostFile($field, $filename, $contentType, $postname); - } - - if ($data) { - if (!isset($this->postFiles[$data->getFieldName()])) { - $this->postFiles[$data->getFieldName()] = array($data); - } else { - $this->postFiles[$data->getFieldName()][] = $data; - } - $this->processPostFields(); - } - - return $this; - } - - public function addPostFiles(array $files) - { - foreach ($files as $key => $file) { - if ($file instanceof PostFileInterface) { - $this->addPostFile($file, null, null, false); - } elseif (is_string($file)) { - // Convert non-associative array keys into 'file' - if (is_numeric($key)) { - $key = 'file'; - } - $this->addPostFile($key, $file, null, false); - } else { - throw new RequestException('File must be a string or instance of PostFileInterface'); - } - } - - return $this; - } - - /** - * Determine what type of request should be sent based on post fields - */ - protected function processPostFields() - { - if (!$this->postFiles) { - $this->removeHeader('Expect')->setHeader('Content-Type', self::URL_ENCODED); - } else { - $this->setHeader('Content-Type', self::MULTIPART); - if ($this->expectCutoff !== false) { - $this->setHeader('Expect', '100-Continue'); - } - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/EntityEnclosingRequestInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/EntityEnclosingRequestInterface.php deleted file mode 100644 index 49ad4595d..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/EntityEnclosingRequestInterface.php +++ /dev/null @@ -1,137 +0,0 @@ - filenames where filename can be a string or PostFileInterface - * - * @return self - */ - public function addPostFiles(array $files); - - /** - * Configure how redirects are handled for the request - * - * @param bool $strict Set to true to follow strict RFC compliance when redirecting POST requests. Most - * browsers with follow a 301-302 redirect for a POST request with a GET request. This is - * the default behavior of Guzzle. Enable strict redirects to redirect these responses - * with a POST rather than a GET request. - * @param int $maxRedirects Specify the maximum number of allowed redirects. Set to 0 to disable redirects. - * - * @return self - */ - public function configureRedirects($strict = false, $maxRedirects = 5); -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/Header.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/Header.php deleted file mode 100644 index 50597b2a6..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/Header.php +++ /dev/null @@ -1,182 +0,0 @@ -header = trim($header); - $this->glue = $glue; - - foreach ((array) $values as $value) { - foreach ((array) $value as $v) { - $this->values[] = $v; - } - } - } - - public function __toString() - { - return implode($this->glue . ' ', $this->toArray()); - } - - public function add($value) - { - $this->values[] = $value; - - return $this; - } - - public function getName() - { - return $this->header; - } - - public function setName($name) - { - $this->header = $name; - - return $this; - } - - public function setGlue($glue) - { - $this->glue = $glue; - - return $this; - } - - public function getGlue() - { - return $this->glue; - } - - /** - * Normalize the header to be a single header with an array of values. - * - * If any values of the header contains the glue string value (e.g. ","), then the value will be exploded into - * multiple entries in the header. - * - * @return self - */ - public function normalize() - { - $values = $this->toArray(); - - for ($i = 0, $total = count($values); $i < $total; $i++) { - if (strpos($values[$i], $this->glue) !== false) { - // Explode on glue when the glue is not inside of a comma - foreach (preg_split('/' . preg_quote($this->glue) . '(?=([^"]*"[^"]*")*[^"]*$)/', $values[$i]) as $v) { - $values[] = trim($v); - } - unset($values[$i]); - } - } - - $this->values = array_values($values); - - return $this; - } - - public function hasValue($searchValue) - { - return in_array($searchValue, $this->toArray()); - } - - public function removeValue($searchValue) - { - $this->values = array_values(array_filter($this->values, function ($value) use ($searchValue) { - return $value != $searchValue; - })); - - return $this; - } - - public function toArray() - { - return $this->values; - } - - public function count() - { - return count($this->toArray()); - } - - public function getIterator() - { - return new \ArrayIterator($this->toArray()); - } - - public function parseParams() - { - $params = $matches = array(); - $callback = array($this, 'trimHeader'); - - // Normalize the header into a single array and iterate over all values - foreach ($this->normalize()->toArray() as $val) { - $part = array(); - foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) as $kvp) { - if (!preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) { - continue; - } - $pieces = array_map($callback, $matches[0]); - $part[$pieces[0]] = isset($pieces[1]) ? $pieces[1] : ''; - } - if ($part) { - $params[] = $part; - } - } - - return $params; - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function hasExactHeader($header) - { - Version::warn(__METHOD__ . ' is deprecated'); - return $this->header == $header; - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function raw() - { - Version::warn(__METHOD__ . ' is deprecated. Use toArray()'); - return $this->toArray(); - } - - /** - * Trim a header by removing excess spaces and wrapping quotes - * - * @param $str - * - * @return string - */ - protected function trimHeader($str) - { - static $trimmed = "\"' \n\t"; - - return trim($str, $trimmed); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/Header/CacheControl.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/Header/CacheControl.php deleted file mode 100644 index 77789e51f..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/Header/CacheControl.php +++ /dev/null @@ -1,121 +0,0 @@ -directives = null; - } - - public function removeValue($searchValue) - { - parent::removeValue($searchValue); - $this->directives = null; - } - - /** - * Check if a specific cache control directive exists - * - * @param string $param Directive to retrieve - * - * @return bool - */ - public function hasDirective($param) - { - $directives = $this->getDirectives(); - - return isset($directives[$param]); - } - - /** - * Get a specific cache control directive - * - * @param string $param Directive to retrieve - * - * @return string|bool|null - */ - public function getDirective($param) - { - $directives = $this->getDirectives(); - - return isset($directives[$param]) ? $directives[$param] : null; - } - - /** - * Add a cache control directive - * - * @param string $param Directive to add - * @param string $value Value to set - * - * @return self - */ - public function addDirective($param, $value) - { - $directives = $this->getDirectives(); - $directives[$param] = $value; - $this->updateFromDirectives($directives); - - return $this; - } - - /** - * Remove a cache control directive by name - * - * @param string $param Directive to remove - * - * @return self - */ - public function removeDirective($param) - { - $directives = $this->getDirectives(); - unset($directives[$param]); - $this->updateFromDirectives($directives); - - return $this; - } - - /** - * Get an associative array of cache control directives - * - * @return array - */ - public function getDirectives() - { - if ($this->directives === null) { - $this->directives = array(); - foreach ($this->parseParams() as $collection) { - foreach ($collection as $key => $value) { - $this->directives[$key] = $value === '' ? true : $value; - } - } - } - - return $this->directives; - } - - /** - * Updates the header value based on the parsed directives - * - * @param array $directives Array of cache control directives - */ - protected function updateFromDirectives(array $directives) - { - $this->directives = $directives; - $this->values = array(); - - foreach ($directives as $key => $value) { - $this->values[] = $value === true ? $key : "{$key}={$value}"; - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/Header/HeaderCollection.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/Header/HeaderCollection.php deleted file mode 100644 index 8c7f6aefb..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/Header/HeaderCollection.php +++ /dev/null @@ -1,108 +0,0 @@ -headers = $headers; - } - - public function __clone() - { - foreach ($this->headers as &$header) { - $header = clone $header; - } - } - - /** - * Clears the header collection - */ - public function clear() - { - $this->headers = array(); - } - - /** - * Set a header on the collection - * - * @param HeaderInterface $header Header to add - * - * @return self - */ - public function add(HeaderInterface $header) - { - $this->headers[strtolower($header->getName())] = $header; - - return $this; - } - - /** - * Get an array of header objects - * - * @return array - */ - public function getAll() - { - return $this->headers; - } - - /** - * Alias of offsetGet - */ - public function get($key) - { - return $this->offsetGet($key); - } - - public function count() - { - return count($this->headers); - } - - public function offsetExists($offset) - { - return isset($this->headers[strtolower($offset)]); - } - - public function offsetGet($offset) - { - $l = strtolower($offset); - - return isset($this->headers[$l]) ? $this->headers[$l] : null; - } - - public function offsetSet($offset, $value) - { - $this->add($value); - } - - public function offsetUnset($offset) - { - unset($this->headers[strtolower($offset)]); - } - - public function getIterator() - { - return new \ArrayIterator($this->headers); - } - - public function toArray() - { - $result = array(); - foreach ($this->headers as $header) { - $result[$header->getName()] = $header->toArray(); - } - - return $result; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/Header/HeaderFactory.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/Header/HeaderFactory.php deleted file mode 100644 index 0273be52f..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/Header/HeaderFactory.php +++ /dev/null @@ -1,26 +0,0 @@ - 'Guzzle\Http\Message\Header\CacheControl', - 'link' => 'Guzzle\Http\Message\Header\Link', - ); - - public function createHeader($header, $value = null) - { - $lowercase = strtolower($header); - - return isset($this->mapping[$lowercase]) - ? new $this->mapping[$lowercase]($header, $value) - : new Header($header, $value); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/Header/HeaderFactoryInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/Header/HeaderFactoryInterface.php deleted file mode 100644 index 9457cf64a..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/Header/HeaderFactoryInterface.php +++ /dev/null @@ -1,19 +0,0 @@ -", "rel=\"{$rel}\""); - - foreach ($params as $k => $v) { - $values[] = "{$k}=\"{$v}\""; - } - - return $this->add(implode('; ', $values)); - } - - /** - * Check if a specific link exists for a given rel attribute - * - * @param string $rel rel value - * - * @return bool - */ - public function hasLink($rel) - { - return $this->getLink($rel) !== null; - } - - /** - * Get a specific link for a given rel attribute - * - * @param string $rel Rel value - * - * @return array|null - */ - public function getLink($rel) - { - foreach ($this->getLinks() as $link) { - if (isset($link['rel']) && $link['rel'] == $rel) { - return $link; - } - } - - return null; - } - - /** - * Get an associative array of links - * - * For example: - * Link: ; rel=front; type="image/jpeg", ; rel=back; type="image/jpeg" - * - * - * var_export($response->getLinks()); - * array( - * array( - * 'url' => 'http:/.../front.jpeg', - * 'rel' => 'back', - * 'type' => 'image/jpeg', - * ) - * ) - * - * - * @return array - */ - public function getLinks() - { - $links = $this->parseParams(); - - foreach ($links as &$link) { - $key = key($link); - unset($link[$key]); - $link['url'] = trim($key, '<> '); - } - - return $links; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/MessageInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/MessageInterface.php deleted file mode 100644 index 62bcd4391..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/MessageInterface.php +++ /dev/null @@ -1,102 +0,0 @@ -fieldName = $fieldName; - $this->setFilename($filename); - $this->postname = $postname ? $postname : basename($filename); - $this->contentType = $contentType ?: $this->guessContentType(); - } - - public function setFieldName($name) - { - $this->fieldName = $name; - - return $this; - } - - public function getFieldName() - { - return $this->fieldName; - } - - public function setFilename($filename) - { - // Remove leading @ symbol - if (strpos($filename, '@') === 0) { - $filename = substr($filename, 1); - } - - if (!is_readable($filename)) { - throw new InvalidArgumentException("Unable to open {$filename} for reading"); - } - - $this->filename = $filename; - - return $this; - } - - public function setPostname($postname) - { - $this->postname = $postname; - - return $this; - } - - public function getFilename() - { - return $this->filename; - } - - public function getPostname() - { - return $this->postname; - } - - public function setContentType($type) - { - $this->contentType = $type; - - return $this; - } - - public function getContentType() - { - return $this->contentType; - } - - public function getCurlValue() - { - // PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax - // See: https://wiki.php.net/rfc/curl-file-upload - if (function_exists('curl_file_create')) { - return curl_file_create($this->filename, $this->contentType, $this->postname); - } - - // Use the old style if using an older version of PHP - $value = "@{$this->filename};filename=" . $this->postname; - if ($this->contentType) { - $value .= ';type=' . $this->contentType; - } - - return $value; - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function getCurlString() - { - Version::warn(__METHOD__ . ' is deprecated. Use getCurlValue()'); - return $this->getCurlValue(); - } - - /** - * Determine the Content-Type of the file - */ - protected function guessContentType() - { - return Mimetypes::getInstance()->fromFilename($this->filename) ?: 'application/octet-stream'; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/PostFileInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/PostFileInterface.php deleted file mode 100644 index 7f0779d1e..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/PostFileInterface.php +++ /dev/null @@ -1,83 +0,0 @@ -method = strtoupper($method); - $this->curlOptions = new Collection(); - $this->setUrl($url); - - if ($headers) { - // Special handling for multi-value headers - foreach ($headers as $key => $value) { - // Deal with collisions with Host and Authorization - if ($key == 'host' || $key == 'Host') { - $this->setHeader($key, $value); - } elseif ($value instanceof HeaderInterface) { - $this->addHeader($key, $value); - } else { - foreach ((array) $value as $v) { - $this->addHeader($key, $v); - } - } - } - } - - $this->setState(self::STATE_NEW); - } - - public function __clone() - { - if ($this->eventDispatcher) { - $this->eventDispatcher = clone $this->eventDispatcher; - } - $this->curlOptions = clone $this->curlOptions; - $this->params = clone $this->params; - $this->url = clone $this->url; - $this->response = $this->responseBody = null; - $this->headers = clone $this->headers; - - $this->setState(RequestInterface::STATE_NEW); - $this->dispatch('request.clone', array('request' => $this)); - } - - /** - * Get the HTTP request as a string - * - * @return string - */ - public function __toString() - { - return $this->getRawHeaders() . "\r\n\r\n"; - } - - /** - * Default method that will throw exceptions if an unsuccessful response is received. - * - * @param Event $event Received - * @throws BadResponseException if the response is not successful - */ - public static function onRequestError(Event $event) - { - $e = BadResponseException::factory($event['request'], $event['response']); - $event['request']->setState(self::STATE_ERROR, array('exception' => $e) + $event->toArray()); - throw $e; - } - - public function setClient(ClientInterface $client) - { - $this->client = $client; - - return $this; - } - - public function getClient() - { - return $this->client; - } - - public function getRawHeaders() - { - $protocolVersion = $this->protocolVersion ?: '1.1'; - - return trim($this->method . ' ' . $this->getResource()) . ' ' - . strtoupper(str_replace('https', 'http', $this->url->getScheme())) - . '/' . $protocolVersion . "\r\n" . implode("\r\n", $this->getHeaderLines()); - } - - public function setUrl($url) - { - if ($url instanceof Url) { - $this->url = $url; - } else { - $this->url = Url::factory($url); - } - - // Update the port and host header - $this->setPort($this->url->getPort()); - - if ($this->url->getUsername() || $this->url->getPassword()) { - $this->setAuth($this->url->getUsername(), $this->url->getPassword()); - // Remove the auth info from the URL - $this->url->setUsername(null); - $this->url->setPassword(null); - } - - return $this; - } - - public function send() - { - if (!$this->client) { - throw new RuntimeException('A client must be set on the request'); - } - - return $this->client->send($this); - } - - public function getResponse() - { - return $this->response; - } - - public function getQuery($asString = false) - { - return $asString - ? (string) $this->url->getQuery() - : $this->url->getQuery(); - } - - public function getMethod() - { - return $this->method; - } - - public function getScheme() - { - return $this->url->getScheme(); - } - - public function setScheme($scheme) - { - $this->url->setScheme($scheme); - - return $this; - } - - public function getHost() - { - return $this->url->getHost(); - } - - public function setHost($host) - { - $this->url->setHost($host); - $this->setPort($this->url->getPort()); - - return $this; - } - - public function getProtocolVersion() - { - return $this->protocolVersion; - } - - public function setProtocolVersion($protocol) - { - $this->protocolVersion = $protocol; - - return $this; - } - - public function getPath() - { - return '/' . ltrim($this->url->getPath(), '/'); - } - - public function setPath($path) - { - $this->url->setPath($path); - - return $this; - } - - public function getPort() - { - return $this->url->getPort(); - } - - public function setPort($port) - { - $this->url->setPort($port); - - // Include the port in the Host header if it is not the default port for the scheme of the URL - $scheme = $this->url->getScheme(); - if ($port && (($scheme == 'http' && $port != 80) || ($scheme == 'https' && $port != 443))) { - $this->headers['host'] = $this->headerFactory->createHeader('Host', $this->url->getHost() . ':' . $port); - } else { - $this->headers['host'] = $this->headerFactory->createHeader('Host', $this->url->getHost()); - } - - return $this; - } - - public function getUsername() - { - return $this->username; - } - - public function getPassword() - { - return $this->password; - } - - public function setAuth($user, $password = '', $scheme = CURLAUTH_BASIC) - { - static $authMap = array( - 'basic' => CURLAUTH_BASIC, - 'digest' => CURLAUTH_DIGEST, - 'ntlm' => CURLAUTH_NTLM, - 'any' => CURLAUTH_ANY - ); - - // If we got false or null, disable authentication - if (!$user) { - $this->password = $this->username = null; - $this->removeHeader('Authorization'); - $this->getCurlOptions()->remove(CURLOPT_HTTPAUTH); - return $this; - } - - if (!is_numeric($scheme)) { - $scheme = strtolower($scheme); - if (!isset($authMap[$scheme])) { - throw new InvalidArgumentException($scheme . ' is not a valid authentication type'); - } - $scheme = $authMap[$scheme]; - } - - $this->username = $user; - $this->password = $password; - - // Bypass CURL when using basic auth to promote connection reuse - if ($scheme == CURLAUTH_BASIC) { - $this->getCurlOptions()->remove(CURLOPT_HTTPAUTH); - $this->setHeader('Authorization', 'Basic ' . base64_encode($this->username . ':' . $this->password)); - } else { - $this->getCurlOptions() - ->set(CURLOPT_HTTPAUTH, $scheme) - ->set(CURLOPT_USERPWD, $this->username . ':' . $this->password); - } - - return $this; - } - - public function getResource() - { - $resource = $this->getPath(); - if ($query = (string) $this->url->getQuery()) { - $resource .= '?' . $query; - } - - return $resource; - } - - public function getUrl($asObject = false) - { - return $asObject ? clone $this->url : (string) $this->url; - } - - public function getState() - { - return $this->state; - } - - public function setState($state, array $context = array()) - { - $oldState = $this->state; - $this->state = $state; - - switch ($state) { - case self::STATE_NEW: - $this->response = null; - break; - case self::STATE_TRANSFER: - if ($oldState !== $state) { - // Fix Content-Length and Transfer-Encoding collisions - if ($this->hasHeader('Transfer-Encoding') && $this->hasHeader('Content-Length')) { - $this->removeHeader('Transfer-Encoding'); - } - $this->dispatch('request.before_send', array('request' => $this)); - } - break; - case self::STATE_COMPLETE: - if ($oldState !== $state) { - $this->processResponse($context); - $this->responseBody = null; - } - break; - case self::STATE_ERROR: - if (isset($context['exception'])) { - $this->dispatch('request.exception', array( - 'request' => $this, - 'response' => isset($context['response']) ? $context['response'] : $this->response, - 'exception' => isset($context['exception']) ? $context['exception'] : null - )); - } - } - - return $this->state; - } - - public function getCurlOptions() - { - return $this->curlOptions; - } - - public function startResponse(Response $response) - { - $this->state = self::STATE_TRANSFER; - $response->setEffectiveUrl((string) $this->getUrl()); - $this->response = $response; - - return $this; - } - - public function setResponse(Response $response, $queued = false) - { - $response->setEffectiveUrl((string) $this->url); - - if ($queued) { - $ed = $this->getEventDispatcher(); - $ed->addListener('request.before_send', $f = function ($e) use ($response, &$f, $ed) { - $e['request']->setResponse($response); - $ed->removeListener('request.before_send', $f); - }, -9999); - } else { - $this->response = $response; - // If a specific response body is specified, then use it instead of the response's body - if ($this->responseBody && !$this->responseBody->getCustomData('default') && !$response->isRedirect()) { - $this->getResponseBody()->write((string) $this->response->getBody()); - } else { - $this->responseBody = $this->response->getBody(); - } - $this->setState(self::STATE_COMPLETE); - } - - return $this; - } - - public function setResponseBody($body) - { - // Attempt to open a file for writing if a string was passed - if (is_string($body)) { - // @codeCoverageIgnoreStart - if (!($body = fopen($body, 'w+'))) { - throw new InvalidArgumentException('Could not open ' . $body . ' for writing'); - } - // @codeCoverageIgnoreEnd - } - - $this->responseBody = EntityBody::factory($body); - - return $this; - } - - public function getResponseBody() - { - if ($this->responseBody === null) { - $this->responseBody = EntityBody::factory()->setCustomData('default', true); - } - - return $this->responseBody; - } - - /** - * Determine if the response body is repeatable (readable + seekable) - * - * @return bool - * @deprecated Use getResponseBody()->isSeekable() - * @codeCoverageIgnore - */ - public function isResponseBodyRepeatable() - { - Version::warn(__METHOD__ . ' is deprecated. Use $request->getResponseBody()->isRepeatable()'); - return !$this->responseBody ? true : $this->responseBody->isRepeatable(); - } - - public function getCookies() - { - if ($cookie = $this->getHeader('Cookie')) { - $data = ParserRegistry::getInstance()->getParser('cookie')->parseCookie($cookie); - return $data['cookies']; - } - - return array(); - } - - public function getCookie($name) - { - $cookies = $this->getCookies(); - - return isset($cookies[$name]) ? $cookies[$name] : null; - } - - public function addCookie($name, $value) - { - if (!$this->hasHeader('Cookie')) { - $this->setHeader('Cookie', "{$name}={$value}"); - } else { - $this->getHeader('Cookie')->add("{$name}={$value}"); - } - - // Always use semicolons to separate multiple cookie headers - $this->getHeader('Cookie')->setGlue(';'); - - return $this; - } - - public function removeCookie($name) - { - if ($cookie = $this->getHeader('Cookie')) { - foreach ($cookie as $cookieValue) { - if (strpos($cookieValue, $name . '=') === 0) { - $cookie->removeValue($cookieValue); - } - } - } - - return $this; - } - - public function setEventDispatcher(EventDispatcherInterface $eventDispatcher) - { - $this->eventDispatcher = $eventDispatcher; - $this->eventDispatcher->addListener('request.error', array(__CLASS__, 'onRequestError'), -255); - - return $this; - } - - public function getEventDispatcher() - { - if (!$this->eventDispatcher) { - $this->setEventDispatcher(new EventDispatcher()); - } - - return $this->eventDispatcher; - } - - public function dispatch($eventName, array $context = array()) - { - $context['request'] = $this; - - return $this->getEventDispatcher()->dispatch($eventName, new Event($context)); - } - - public function addSubscriber(EventSubscriberInterface $subscriber) - { - $this->getEventDispatcher()->addSubscriber($subscriber); - - return $this; - } - - /** - * Get an array containing the request and response for event notifications - * - * @return array - */ - protected function getEventArray() - { - return array( - 'request' => $this, - 'response' => $this->response - ); - } - - /** - * Process a received response - * - * @param array $context Contextual information - * @throws RequestException|BadResponseException on unsuccessful responses - */ - protected function processResponse(array $context = array()) - { - if (!$this->response) { - // If no response, then processResponse shouldn't have been called - $e = new RequestException('Error completing request'); - $e->setRequest($this); - throw $e; - } - - $this->state = self::STATE_COMPLETE; - - // A request was sent, but we don't know if we'll send more or if the final response will be successful - $this->dispatch('request.sent', $this->getEventArray() + $context); - - // Some response processors will remove the response or reset the state (example: ExponentialBackoffPlugin) - if ($this->state == RequestInterface::STATE_COMPLETE) { - - // The request completed, so the HTTP transaction is complete - $this->dispatch('request.complete', $this->getEventArray()); - - // If the response is bad, allow listeners to modify it or throw exceptions. You can change the response by - // modifying the Event object in your listeners or calling setResponse() on the request - if ($this->response->isError()) { - $event = new Event($this->getEventArray()); - $this->getEventDispatcher()->dispatch('request.error', $event); - // Allow events of request.error to quietly change the response - if ($event['response'] !== $this->response) { - $this->response = $event['response']; - } - } - - // If a successful response was received, dispatch an event - if ($this->response->isSuccessful()) { - $this->dispatch('request.success', $this->getEventArray()); - } - } - } - - /** - * @deprecated Use Guzzle\Plugin\Cache\DefaultCanCacheStrategy - * @codeCoverageIgnore - */ - public function canCache() - { - Version::warn(__METHOD__ . ' is deprecated. Use Guzzle\Plugin\Cache\DefaultCanCacheStrategy.'); - if (class_exists('Guzzle\Plugin\Cache\DefaultCanCacheStrategy')) { - $canCache = new \Guzzle\Plugin\Cache\DefaultCanCacheStrategy(); - return $canCache->canCacheRequest($this); - } else { - return false; - } - } - - /** - * @deprecated Use the history plugin (not emitting a warning as this is built-into the RedirectPlugin for now) - * @codeCoverageIgnore - */ - public function setIsRedirect($isRedirect) - { - $this->isRedirect = $isRedirect; - - return $this; - } - - /** - * @deprecated Use the history plugin - * @codeCoverageIgnore - */ - public function isRedirect() - { - Version::warn(__METHOD__ . ' is deprecated. Use the HistoryPlugin to track this.'); - return $this->isRedirect; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/RequestFactory.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/RequestFactory.php deleted file mode 100644 index ba00a7676..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/RequestFactory.php +++ /dev/null @@ -1,359 +0,0 @@ -methods = array_flip(get_class_methods(__CLASS__)); - } - - public function fromMessage($message) - { - $parsed = ParserRegistry::getInstance()->getParser('message')->parseRequest($message); - - if (!$parsed) { - return false; - } - - $request = $this->fromParts($parsed['method'], $parsed['request_url'], - $parsed['headers'], $parsed['body'], $parsed['protocol'], - $parsed['version']); - - // EntityEnclosingRequest adds an "Expect: 100-Continue" header when using a raw request body for PUT or POST - // requests. This factory method should accurately reflect the message, so here we are removing the Expect - // header if one was not supplied in the message. - if (!isset($parsed['headers']['Expect']) && !isset($parsed['headers']['expect'])) { - $request->removeHeader('Expect'); - } - - return $request; - } - - public function fromParts( - $method, - array $urlParts, - $headers = null, - $body = null, - $protocol = 'HTTP', - $protocolVersion = '1.1' - ) { - return $this->create($method, Url::buildUrl($urlParts), $headers, $body) - ->setProtocolVersion($protocolVersion); - } - - public function create($method, $url, $headers = null, $body = null, array $options = array()) - { - $method = strtoupper($method); - - if ($method == 'GET' || $method == 'HEAD' || $method == 'TRACE') { - // Handle non-entity-enclosing request methods - $request = new $this->requestClass($method, $url, $headers); - if ($body) { - // The body is where the response body will be stored - $type = gettype($body); - if ($type == 'string' || $type == 'resource' || $type == 'object') { - $request->setResponseBody($body); - } - } - } else { - // Create an entity enclosing request by default - $request = new $this->entityEnclosingRequestClass($method, $url, $headers); - if ($body || $body === '0') { - // Add POST fields and files to an entity enclosing request if an array is used - if (is_array($body) || $body instanceof Collection) { - // Normalize PHP style cURL uploads with a leading '@' symbol - foreach ($body as $key => $value) { - if (is_string($value) && substr($value, 0, 1) == '@') { - $request->addPostFile($key, $value); - unset($body[$key]); - } - } - // Add the fields if they are still present and not all files - $request->addPostFields($body); - } else { - // Add a raw entity body body to the request - $request->setBody($body, (string) $request->getHeader('Content-Type')); - if ((string) $request->getHeader('Transfer-Encoding') == 'chunked') { - $request->removeHeader('Content-Length'); - } - } - } - } - - if ($options) { - $this->applyOptions($request, $options); - } - - return $request; - } - - /** - * Clone a request while changing the method. Emulates the behavior of - * {@see Guzzle\Http\Message\Request::clone}, but can change the HTTP method. - * - * @param RequestInterface $request Request to clone - * @param string $method Method to set - * - * @return RequestInterface - */ - public function cloneRequestWithMethod(RequestInterface $request, $method) - { - // Create the request with the same client if possible - if ($request->getClient()) { - $cloned = $request->getClient()->createRequest($method, $request->getUrl(), $request->getHeaders()); - } else { - $cloned = $this->create($method, $request->getUrl(), $request->getHeaders()); - } - - $cloned->getCurlOptions()->replace($request->getCurlOptions()->toArray()); - $cloned->setEventDispatcher(clone $request->getEventDispatcher()); - // Ensure that that the Content-Length header is not copied if changing to GET or HEAD - if (!($cloned instanceof EntityEnclosingRequestInterface)) { - $cloned->removeHeader('Content-Length'); - } elseif ($request instanceof EntityEnclosingRequestInterface) { - $cloned->setBody($request->getBody()); - } - $cloned->getParams()->replace($request->getParams()->toArray()); - $cloned->dispatch('request.clone', array('request' => $cloned)); - - return $cloned; - } - - public function applyOptions(RequestInterface $request, array $options = array(), $flags = self::OPTIONS_NONE) - { - // Iterate over each key value pair and attempt to apply a config using function visitors - foreach ($options as $key => $value) { - $method = "visit_{$key}"; - if (isset($this->methods[$method])) { - $this->{$method}($request, $value, $flags); - } - } - } - - protected function visit_headers(RequestInterface $request, $value, $flags) - { - if (!is_array($value)) { - throw new InvalidArgumentException('headers value must be an array'); - } - - if ($flags & self::OPTIONS_AS_DEFAULTS) { - // Merge headers in but do not overwrite existing values - foreach ($value as $key => $header) { - if (!$request->hasHeader($key)) { - $request->setHeader($key, $header); - } - } - } else { - $request->addHeaders($value); - } - } - - protected function visit_body(RequestInterface $request, $value, $flags) - { - if ($request instanceof EntityEnclosingRequestInterface) { - $request->setBody($value); - } else { - throw new InvalidArgumentException('Attempting to set a body on a non-entity-enclosing request'); - } - } - - protected function visit_allow_redirects(RequestInterface $request, $value, $flags) - { - if ($value === false) { - $request->getParams()->set(RedirectPlugin::DISABLE, true); - } - } - - protected function visit_auth(RequestInterface $request, $value, $flags) - { - if (!is_array($value)) { - throw new InvalidArgumentException('auth value must be an array'); - } - - $request->setAuth($value[0], isset($value[1]) ? $value[1] : null, isset($value[2]) ? $value[2] : 'basic'); - } - - protected function visit_query(RequestInterface $request, $value, $flags) - { - if (!is_array($value)) { - throw new InvalidArgumentException('query value must be an array'); - } - - if ($flags & self::OPTIONS_AS_DEFAULTS) { - // Merge query string values in but do not overwrite existing values - $query = $request->getQuery(); - $query->overwriteWith(array_diff_key($value, $query->toArray())); - } else { - $request->getQuery()->overwriteWith($value); - } - } - - protected function visit_cookies(RequestInterface $request, $value, $flags) - { - if (!is_array($value)) { - throw new InvalidArgumentException('cookies value must be an array'); - } - - foreach ($value as $name => $v) { - $request->addCookie($name, $v); - } - } - - protected function visit_events(RequestInterface $request, $value, $flags) - { - if (!is_array($value)) { - throw new InvalidArgumentException('events value must be an array'); - } - - foreach ($value as $name => $method) { - if (is_array($method)) { - $request->getEventDispatcher()->addListener($name, $method[0], $method[1]); - } else { - $request->getEventDispatcher()->addListener($name, $method); - } - } - } - - protected function visit_plugins(RequestInterface $request, $value, $flags) - { - if (!is_array($value)) { - throw new InvalidArgumentException('plugins value must be an array'); - } - - foreach ($value as $plugin) { - $request->addSubscriber($plugin); - } - } - - protected function visit_exceptions(RequestInterface $request, $value, $flags) - { - if ($value === false || $value === 0) { - $dispatcher = $request->getEventDispatcher(); - foreach ($dispatcher->getListeners('request.error') as $listener) { - if (is_array($listener) && $listener[0] == 'Guzzle\Http\Message\Request' && $listener[1] = 'onRequestError') { - $dispatcher->removeListener('request.error', $listener); - break; - } - } - } - } - - protected function visit_save_to(RequestInterface $request, $value, $flags) - { - $request->setResponseBody($value); - } - - protected function visit_params(RequestInterface $request, $value, $flags) - { - if (!is_array($value)) { - throw new InvalidArgumentException('params value must be an array'); - } - - $request->getParams()->overwriteWith($value); - } - - protected function visit_timeout(RequestInterface $request, $value, $flags) - { - if (defined('CURLOPT_TIMEOUT_MS')) { - $request->getCurlOptions()->set(CURLOPT_TIMEOUT_MS, $value * 1000); - } else { - $request->getCurlOptions()->set(CURLOPT_TIMEOUT, $value); - } - } - - protected function visit_connect_timeout(RequestInterface $request, $value, $flags) - { - if (defined('CURLOPT_CONNECTTIMEOUT_MS')) { - $request->getCurlOptions()->set(CURLOPT_CONNECTTIMEOUT_MS, $value * 1000); - } else { - $request->getCurlOptions()->set(CURLOPT_CONNECTTIMEOUT, $value); - } - } - - protected function visit_debug(RequestInterface $request, $value, $flags) - { - if ($value) { - $request->getCurlOptions()->set(CURLOPT_VERBOSE, true); - } - } - - protected function visit_verify(RequestInterface $request, $value, $flags) - { - $curl = $request->getCurlOptions(); - if ($value === true || is_string($value)) { - $curl[CURLOPT_SSL_VERIFYHOST] = 2; - $curl[CURLOPT_SSL_VERIFYPEER] = true; - if ($value !== true) { - $curl[CURLOPT_CAINFO] = $value; - } - } elseif ($value === false) { - unset($curl[CURLOPT_CAINFO]); - $curl[CURLOPT_SSL_VERIFYHOST] = 0; - $curl[CURLOPT_SSL_VERIFYPEER] = false; - } - } - - protected function visit_proxy(RequestInterface $request, $value, $flags) - { - $request->getCurlOptions()->set(CURLOPT_PROXY, $value, $flags); - } - - protected function visit_cert(RequestInterface $request, $value, $flags) - { - if (is_array($value)) { - $request->getCurlOptions()->set(CURLOPT_SSLCERT, $value[0]); - $request->getCurlOptions()->set(CURLOPT_SSLCERTPASSWD, $value[1]); - } else { - $request->getCurlOptions()->set(CURLOPT_SSLCERT, $value); - } - } - - protected function visit_ssl_key(RequestInterface $request, $value, $flags) - { - if (is_array($value)) { - $request->getCurlOptions()->set(CURLOPT_SSLKEY, $value[0]); - $request->getCurlOptions()->set(CURLOPT_SSLKEYPASSWD, $value[1]); - } else { - $request->getCurlOptions()->set(CURLOPT_SSLKEY, $value); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/RequestFactoryInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/RequestFactoryInterface.php deleted file mode 100644 index 6088f10e9..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Message/RequestFactoryInterface.php +++ /dev/null @@ -1,105 +0,0 @@ - 'Continue', - 101 => 'Switching Protocols', - 102 => 'Processing', - 200 => 'OK', - 201 => 'Created', - 202 => 'Accepted', - 203 => 'Non-Authoritative Information', - 204 => 'No Content', - 205 => 'Reset Content', - 206 => 'Partial Content', - 207 => 'Multi-Status', - 208 => 'Already Reported', - 226 => 'IM Used', - 300 => 'Multiple Choices', - 301 => 'Moved Permanently', - 302 => 'Found', - 303 => 'See Other', - 304 => 'Not Modified', - 305 => 'Use Proxy', - 307 => 'Temporary Redirect', - 308 => 'Permanent Redirect', - 400 => 'Bad Request', - 401 => 'Unauthorized', - 402 => 'Payment Required', - 403 => 'Forbidden', - 404 => 'Not Found', - 405 => 'Method Not Allowed', - 406 => 'Not Acceptable', - 407 => 'Proxy Authentication Required', - 408 => 'Request Timeout', - 409 => 'Conflict', - 410 => 'Gone', - 411 => 'Length Required', - 412 => 'Precondition Failed', - 413 => 'Request Entity Too Large', - 414 => 'Request-URI Too Long', - 415 => 'Unsupported Media Type', - 416 => 'Requested Range Not Satisfiable', - 417 => 'Expectation Failed', - 422 => 'Unprocessable Entity', - 423 => 'Locked', - 424 => 'Failed Dependency', - 425 => 'Reserved for WebDAV advanced collections expired proposal', - 426 => 'Upgrade required', - 428 => 'Precondition Required', - 429 => 'Too Many Requests', - 431 => 'Request Header Fields Too Large', - 500 => 'Internal Server Error', - 501 => 'Not Implemented', - 502 => 'Bad Gateway', - 503 => 'Service Unavailable', - 504 => 'Gateway Timeout', - 505 => 'HTTP Version Not Supported', - 506 => 'Variant Also Negotiates (Experimental)', - 507 => 'Insufficient Storage', - 508 => 'Loop Detected', - 510 => 'Not Extended', - 511 => 'Network Authentication Required', - ); - - /** @var EntityBodyInterface The response body */ - protected $body; - - /** @var string The reason phrase of the response (human readable code) */ - protected $reasonPhrase; - - /** @var string The status code of the response */ - protected $statusCode; - - /** @var array Information about the request */ - protected $info = array(); - - /** @var string The effective URL that returned this response */ - protected $effectiveUrl; - - /** @var array Cacheable response codes (see RFC 2616:13.4) */ - protected static $cacheResponseCodes = array(200, 203, 206, 300, 301, 410); - - /** - * Create a new Response based on a raw response message - * - * @param string $message Response message - * - * @return self|bool Returns false on error - */ - public static function fromMessage($message) - { - $data = ParserRegistry::getInstance()->getParser('message')->parseResponse($message); - if (!$data) { - return false; - } - - $response = new static($data['code'], $data['headers'], $data['body']); - $response->setProtocol($data['protocol'], $data['version']) - ->setStatus($data['code'], $data['reason_phrase']); - - // Set the appropriate Content-Length if the one set is inaccurate (e.g. setting to X) - $contentLength = (string) $response->getHeader('Content-Length'); - $actualLength = strlen($data['body']); - if (strlen($data['body']) > 0 && $contentLength != $actualLength) { - $response->setHeader('Content-Length', $actualLength); - } - - return $response; - } - - /** - * Construct the response - * - * @param string $statusCode The response status code (e.g. 200, 404, etc) - * @param ToArrayInterface|array $headers The response headers - * @param string|resource|EntityBodyInterface $body The body of the response - * - * @throws BadResponseException if an invalid response code is given - */ - public function __construct($statusCode, $headers = null, $body = null) - { - parent::__construct(); - $this->setStatus($statusCode); - $this->body = EntityBody::factory($body !== null ? $body : ''); - - if ($headers) { - if (is_array($headers)) { - $this->setHeaders($headers); - } elseif ($headers instanceof ToArrayInterface) { - $this->setHeaders($headers->toArray()); - } else { - throw new BadResponseException('Invalid headers argument received'); - } - } - } - - /** - * @return string - */ - public function __toString() - { - return $this->getMessage(); - } - - public function serialize() - { - return json_encode(array( - 'status' => $this->statusCode, - 'body' => (string) $this->body, - 'headers' => $this->headers->toArray() - )); - } - - public function unserialize($serialize) - { - $data = json_decode($serialize, true); - $this->__construct($data['status'], $data['headers'], $data['body']); - } - - /** - * Get the response entity body - * - * @param bool $asString Set to TRUE to return a string of the body rather than a full body object - * - * @return EntityBodyInterface|string - */ - public function getBody($asString = false) - { - return $asString ? (string) $this->body : $this->body; - } - - /** - * Set the response entity body - * - * @param EntityBodyInterface|string $body Body to set - * - * @return self - */ - public function setBody($body) - { - $this->body = EntityBody::factory($body); - - return $this; - } - - /** - * Set the protocol and protocol version of the response - * - * @param string $protocol Response protocol - * @param string $version Protocol version - * - * @return self - */ - public function setProtocol($protocol, $version) - { - $this->protocol = $protocol; - $this->protocolVersion = $version; - - return $this; - } - - /** - * Get the protocol used for the response (e.g. HTTP) - * - * @return string - */ - public function getProtocol() - { - return $this->protocol; - } - - /** - * Get the HTTP protocol version - * - * @return string - */ - public function getProtocolVersion() - { - return $this->protocolVersion; - } - - /** - * Get a cURL transfer information - * - * @param string $key A single statistic to check - * - * @return array|string|null Returns all stats if no key is set, a single stat if a key is set, or null if a key - * is set and not found - * @link http://www.php.net/manual/en/function.curl-getinfo.php - */ - public function getInfo($key = null) - { - if ($key === null) { - return $this->info; - } elseif (array_key_exists($key, $this->info)) { - return $this->info[$key]; - } else { - return null; - } - } - - /** - * Set the transfer information - * - * @param array $info Array of cURL transfer stats - * - * @return self - */ - public function setInfo(array $info) - { - $this->info = $info; - - return $this; - } - - /** - * Set the response status - * - * @param int $statusCode Response status code to set - * @param string $reasonPhrase Response reason phrase - * - * @return self - * @throws BadResponseException when an invalid response code is received - */ - public function setStatus($statusCode, $reasonPhrase = '') - { - $this->statusCode = (int) $statusCode; - - if (!$reasonPhrase && isset(self::$statusTexts[$this->statusCode])) { - $this->reasonPhrase = self::$statusTexts[$this->statusCode]; - } else { - $this->reasonPhrase = $reasonPhrase; - } - - return $this; - } - - /** - * Get the response status code - * - * @return integer - */ - public function getStatusCode() - { - return $this->statusCode; - } - - /** - * Get the entire response as a string - * - * @return string - */ - public function getMessage() - { - $message = $this->getRawHeaders(); - - // Only include the body in the message if the size is < 2MB - $size = $this->body->getSize(); - if ($size < 2097152) { - $message .= (string) $this->body; - } - - return $message; - } - - /** - * Get the the raw message headers as a string - * - * @return string - */ - public function getRawHeaders() - { - $headers = 'HTTP/1.1 ' . $this->statusCode . ' ' . $this->reasonPhrase . "\r\n"; - $lines = $this->getHeaderLines(); - if (!empty($lines)) { - $headers .= implode("\r\n", $lines) . "\r\n"; - } - - return $headers . "\r\n"; - } - - /** - * Get the response reason phrase- a human readable version of the numeric - * status code - * - * @return string - */ - public function getReasonPhrase() - { - return $this->reasonPhrase; - } - - /** - * Get the Accept-Ranges HTTP header - * - * @return string Returns what partial content range types this server supports. - */ - public function getAcceptRanges() - { - return (string) $this->getHeader('Accept-Ranges'); - } - - /** - * Calculate the age of the response - * - * @return integer - */ - public function calculateAge() - { - $age = $this->getHeader('Age'); - - if ($age === null && $this->getDate()) { - $age = time() - strtotime($this->getDate()); - } - - return $age === null ? null : (int) (string) $age; - } - - /** - * Get the Age HTTP header - * - * @return integer|null Returns the age the object has been in a proxy cache in seconds. - */ - public function getAge() - { - return (string) $this->getHeader('Age'); - } - - /** - * Get the Allow HTTP header - * - * @return string|null Returns valid actions for a specified resource. To be used for a 405 Method not allowed. - */ - public function getAllow() - { - return (string) $this->getHeader('Allow'); - } - - /** - * Check if an HTTP method is allowed by checking the Allow response header - * - * @param string $method Method to check - * - * @return bool - */ - public function isMethodAllowed($method) - { - $allow = $this->getHeader('Allow'); - if ($allow) { - foreach (explode(',', $allow) as $allowable) { - if (!strcasecmp(trim($allowable), $method)) { - return true; - } - } - } - - return false; - } - - /** - * Get the Cache-Control HTTP header - * - * @return string - */ - public function getCacheControl() - { - return (string) $this->getHeader('Cache-Control'); - } - - /** - * Get the Connection HTTP header - * - * @return string - */ - public function getConnection() - { - return (string) $this->getHeader('Connection'); - } - - /** - * Get the Content-Encoding HTTP header - * - * @return string|null - */ - public function getContentEncoding() - { - return (string) $this->getHeader('Content-Encoding'); - } - - /** - * Get the Content-Language HTTP header - * - * @return string|null Returns the language the content is in. - */ - public function getContentLanguage() - { - return (string) $this->getHeader('Content-Language'); - } - - /** - * Get the Content-Length HTTP header - * - * @return integer Returns the length of the response body in bytes - */ - public function getContentLength() - { - return (int) (string) $this->getHeader('Content-Length'); - } - - /** - * Get the Content-Location HTTP header - * - * @return string|null Returns an alternate location for the returned data (e.g /index.htm) - */ - public function getContentLocation() - { - return (string) $this->getHeader('Content-Location'); - } - - /** - * Get the Content-Disposition HTTP header - * - * @return string|null Returns the Content-Disposition header - */ - public function getContentDisposition() - { - return (string) $this->getHeader('Content-Disposition'); - } - - /** - * Get the Content-MD5 HTTP header - * - * @return string|null Returns a Base64-encoded binary MD5 sum of the content of the response. - */ - public function getContentMd5() - { - return (string) $this->getHeader('Content-MD5'); - } - - /** - * Get the Content-Range HTTP header - * - * @return string Returns where in a full body message this partial message belongs (e.g. bytes 21010-47021/47022). - */ - public function getContentRange() - { - return (string) $this->getHeader('Content-Range'); - } - - /** - * Get the Content-Type HTTP header - * - * @return string Returns the mime type of this content. - */ - public function getContentType() - { - return (string) $this->getHeader('Content-Type'); - } - - /** - * Checks if the Content-Type is of a certain type. This is useful if the - * Content-Type header contains charset information and you need to know if - * the Content-Type matches a particular type. - * - * @param string $type Content type to check against - * - * @return bool - */ - public function isContentType($type) - { - return stripos($this->getHeader('Content-Type'), $type) !== false; - } - - /** - * Get the Date HTTP header - * - * @return string|null Returns the date and time that the message was sent. - */ - public function getDate() - { - return (string) $this->getHeader('Date'); - } - - /** - * Get the ETag HTTP header - * - * @return string|null Returns an identifier for a specific version of a resource, often a Message digest. - */ - public function getEtag() - { - return (string) $this->getHeader('ETag'); - } - - /** - * Get the Expires HTTP header - * - * @return string|null Returns the date/time after which the response is considered stale. - */ - public function getExpires() - { - return (string) $this->getHeader('Expires'); - } - - /** - * Get the Last-Modified HTTP header - * - * @return string|null Returns the last modified date for the requested object, in RFC 2822 format - * (e.g. Tue, 15 Nov 1994 12:45:26 GMT) - */ - public function getLastModified() - { - return (string) $this->getHeader('Last-Modified'); - } - - /** - * Get the Location HTTP header - * - * @return string|null Used in redirection, or when a new resource has been created. - */ - public function getLocation() - { - return (string) $this->getHeader('Location'); - } - - /** - * Get the Pragma HTTP header - * - * @return Header|null Returns the implementation-specific headers that may have various effects anywhere along - * the request-response chain. - */ - public function getPragma() - { - return (string) $this->getHeader('Pragma'); - } - - /** - * Get the Proxy-Authenticate HTTP header - * - * @return string|null Authentication to access the proxy (e.g. Basic) - */ - public function getProxyAuthenticate() - { - return (string) $this->getHeader('Proxy-Authenticate'); - } - - /** - * Get the Retry-After HTTP header - * - * @return int|null If an entity is temporarily unavailable, this instructs the client to try again after a - * specified period of time. - */ - public function getRetryAfter() - { - return (string) $this->getHeader('Retry-After'); - } - - /** - * Get the Server HTTP header - * - * @return string|null A name for the server - */ - public function getServer() - { - return (string) $this->getHeader('Server'); - } - - /** - * Get the Set-Cookie HTTP header - * - * @return string|null An HTTP cookie. - */ - public function getSetCookie() - { - return (string) $this->getHeader('Set-Cookie'); - } - - /** - * Get the Trailer HTTP header - * - * @return string|null The Trailer general field value indicates that the given set of header fields is present in - * the trailer of a message encoded with chunked transfer-coding. - */ - public function getTrailer() - { - return (string) $this->getHeader('Trailer'); - } - - /** - * Get the Transfer-Encoding HTTP header - * - * @return string|null The form of encoding used to safely transfer the entity to the user - */ - public function getTransferEncoding() - { - return (string) $this->getHeader('Transfer-Encoding'); - } - - /** - * Get the Vary HTTP header - * - * @return string|null Tells downstream proxies how to match future request headers to decide whether the cached - * response can be used rather than requesting a fresh one from the origin server. - */ - public function getVary() - { - return (string) $this->getHeader('Vary'); - } - - /** - * Get the Via HTTP header - * - * @return string|null Informs the client of proxies through which the response was sent. - */ - public function getVia() - { - return (string) $this->getHeader('Via'); - } - - /** - * Get the Warning HTTP header - * - * @return string|null A general warning about possible problems with the entity body - */ - public function getWarning() - { - return (string) $this->getHeader('Warning'); - } - - /** - * Get the WWW-Authenticate HTTP header - * - * @return string|null Indicates the authentication scheme that should be used to access the requested entity - */ - public function getWwwAuthenticate() - { - return (string) $this->getHeader('WWW-Authenticate'); - } - - /** - * Checks if HTTP Status code is a Client Error (4xx) - * - * @return bool - */ - public function isClientError() - { - return $this->statusCode >= 400 && $this->statusCode < 500; - } - - /** - * Checks if HTTP Status code is Server OR Client Error (4xx or 5xx) - * - * @return boolean - */ - public function isError() - { - return $this->isClientError() || $this->isServerError(); - } - - /** - * Checks if HTTP Status code is Information (1xx) - * - * @return bool - */ - public function isInformational() - { - return $this->statusCode < 200; - } - - /** - * Checks if HTTP Status code is a Redirect (3xx) - * - * @return bool - */ - public function isRedirect() - { - return $this->statusCode >= 300 && $this->statusCode < 400; - } - - /** - * Checks if HTTP Status code is Server Error (5xx) - * - * @return bool - */ - public function isServerError() - { - return $this->statusCode >= 500 && $this->statusCode < 600; - } - - /** - * Checks if HTTP Status code is Successful (2xx | 304) - * - * @return bool - */ - public function isSuccessful() - { - return ($this->statusCode >= 200 && $this->statusCode < 300) || $this->statusCode == 304; - } - - /** - * Check if the response can be cached based on the response headers - * - * @return bool Returns TRUE if the response can be cached or false if not - */ - public function canCache() - { - // Check if the response is cacheable based on the code - if (!in_array((int) $this->getStatusCode(), self::$cacheResponseCodes)) { - return false; - } - - // Make sure a valid body was returned and can be cached - if ((!$this->getBody()->isReadable() || !$this->getBody()->isSeekable()) - && ($this->getContentLength() > 0 || $this->getTransferEncoding() == 'chunked')) { - return false; - } - - // Never cache no-store resources (this is a private cache, so private - // can be cached) - if ($this->getHeader('Cache-Control') && $this->getHeader('Cache-Control')->hasDirective('no-store')) { - return false; - } - - return $this->isFresh() || $this->getFreshness() === null || $this->canValidate(); - } - - /** - * Gets the number of seconds from the current time in which this response is still considered fresh - * - * @return int|null Returns the number of seconds - */ - public function getMaxAge() - { - if ($header = $this->getHeader('Cache-Control')) { - // s-max-age, then max-age, then Expires - if ($age = $header->getDirective('s-maxage')) { - return $age; - } - if ($age = $header->getDirective('max-age')) { - return $age; - } - } - - if ($this->getHeader('Expires')) { - return strtotime($this->getExpires()) - time(); - } - - return null; - } - - /** - * Check if the response is considered fresh. - * - * A response is considered fresh when its age is less than or equal to the freshness lifetime (maximum age) of the - * response. - * - * @return bool|null - */ - public function isFresh() - { - $fresh = $this->getFreshness(); - - return $fresh === null ? null : $fresh >= 0; - } - - /** - * Check if the response can be validated against the origin server using a conditional GET request. - * - * @return bool - */ - public function canValidate() - { - return $this->getEtag() || $this->getLastModified(); - } - - /** - * Get the freshness of the response by returning the difference of the maximum lifetime of the response and the - * age of the response (max-age - age). - * - * Freshness values less than 0 mean that the response is no longer fresh and is ABS(freshness) seconds expired. - * Freshness values of greater than zero is the number of seconds until the response is no longer fresh. A NULL - * result means that no freshness information is available. - * - * @return int - */ - public function getFreshness() - { - $maxAge = $this->getMaxAge(); - $age = $this->calculateAge(); - - return $maxAge && $age ? ($maxAge - $age) : null; - } - - /** - * Parse the JSON response body and return an array - * - * @return array|string|int|bool|float - * @throws RuntimeException if the response body is not in JSON format - */ - public function json() - { - $data = json_decode((string) $this->body, true); - if (JSON_ERROR_NONE !== json_last_error()) { - throw new RuntimeException('Unable to parse response body into JSON: ' . json_last_error()); - } - - return $data === null ? array() : $data; - } - - /** - * Parse the XML response body and return a \SimpleXMLElement. - * - * In order to prevent XXE attacks, this method disables loading external - * entities. If you rely on external entities, then you must parse the - * XML response manually by accessing the response body directly. - * - * @return \SimpleXMLElement - * @throws RuntimeException if the response body is not in XML format - * @link http://websec.io/2012/08/27/Preventing-XXE-in-PHP.html - */ - public function xml() - { - $errorMessage = null; - $internalErrors = libxml_use_internal_errors(true); - $disableEntities = libxml_disable_entity_loader(true); - libxml_clear_errors(); - - try { - $xml = new \SimpleXMLElement((string) $this->body ?: '', LIBXML_NONET); - if ($error = libxml_get_last_error()) { - $errorMessage = $error->message; - } - } catch (\Exception $e) { - $errorMessage = $e->getMessage(); - } - - libxml_clear_errors(); - libxml_use_internal_errors($internalErrors); - libxml_disable_entity_loader($disableEntities); - - if ($errorMessage) { - throw new RuntimeException('Unable to parse response body into XML: ' . $errorMessage); - } - - return $xml; - } - - /** - * Get the redirect count of this response - * - * @return int - */ - public function getRedirectCount() - { - return (int) $this->params->get(RedirectPlugin::REDIRECT_COUNT); - } - - /** - * Set the effective URL that resulted in this response (e.g. the last redirect URL) - * - * @param string $url The effective URL - * - * @return self - */ - public function setEffectiveUrl($url) - { - $this->effectiveUrl = $url; - - return $this; - } - - /** - * Get the effective URL that resulted in this response (e.g. the last redirect URL) - * - * @return string - */ - public function getEffectiveUrl() - { - return $this->effectiveUrl; - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function getPreviousResponse() - { - Version::warn(__METHOD__ . ' is deprecated. Use the HistoryPlugin.'); - return null; - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function setRequest($request) - { - Version::warn(__METHOD__ . ' is deprecated'); - return $this; - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function getRequest() - { - Version::warn(__METHOD__ . ' is deprecated'); - return null; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Mimetypes.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Mimetypes.php deleted file mode 100644 index d71586a05..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Mimetypes.php +++ /dev/null @@ -1,962 +0,0 @@ - 'text/vnd.in3d.3dml', - '3g2' => 'video/3gpp2', - '3gp' => 'video/3gpp', - '7z' => 'application/x-7z-compressed', - 'aab' => 'application/x-authorware-bin', - 'aac' => 'audio/x-aac', - 'aam' => 'application/x-authorware-map', - 'aas' => 'application/x-authorware-seg', - 'abw' => 'application/x-abiword', - 'ac' => 'application/pkix-attr-cert', - 'acc' => 'application/vnd.americandynamics.acc', - 'ace' => 'application/x-ace-compressed', - 'acu' => 'application/vnd.acucobol', - 'acutc' => 'application/vnd.acucorp', - 'adp' => 'audio/adpcm', - 'aep' => 'application/vnd.audiograph', - 'afm' => 'application/x-font-type1', - 'afp' => 'application/vnd.ibm.modcap', - 'ahead' => 'application/vnd.ahead.space', - 'ai' => 'application/postscript', - 'aif' => 'audio/x-aiff', - 'aifc' => 'audio/x-aiff', - 'aiff' => 'audio/x-aiff', - 'air' => 'application/vnd.adobe.air-application-installer-package+zip', - 'ait' => 'application/vnd.dvb.ait', - 'ami' => 'application/vnd.amiga.ami', - 'apk' => 'application/vnd.android.package-archive', - 'application' => 'application/x-ms-application', - 'apr' => 'application/vnd.lotus-approach', - 'asa' => 'text/plain', - 'asax' => 'application/octet-stream', - 'asc' => 'application/pgp-signature', - 'ascx' => 'text/plain', - 'asf' => 'video/x-ms-asf', - 'ashx' => 'text/plain', - 'asm' => 'text/x-asm', - 'asmx' => 'text/plain', - 'aso' => 'application/vnd.accpac.simply.aso', - 'asp' => 'text/plain', - 'aspx' => 'text/plain', - 'asx' => 'video/x-ms-asf', - 'atc' => 'application/vnd.acucorp', - 'atom' => 'application/atom+xml', - 'atomcat' => 'application/atomcat+xml', - 'atomsvc' => 'application/atomsvc+xml', - 'atx' => 'application/vnd.antix.game-component', - 'au' => 'audio/basic', - 'avi' => 'video/x-msvideo', - 'aw' => 'application/applixware', - 'axd' => 'text/plain', - 'azf' => 'application/vnd.airzip.filesecure.azf', - 'azs' => 'application/vnd.airzip.filesecure.azs', - 'azw' => 'application/vnd.amazon.ebook', - 'bat' => 'application/x-msdownload', - 'bcpio' => 'application/x-bcpio', - 'bdf' => 'application/x-font-bdf', - 'bdm' => 'application/vnd.syncml.dm+wbxml', - 'bed' => 'application/vnd.realvnc.bed', - 'bh2' => 'application/vnd.fujitsu.oasysprs', - 'bin' => 'application/octet-stream', - 'bmi' => 'application/vnd.bmi', - 'bmp' => 'image/bmp', - 'book' => 'application/vnd.framemaker', - 'box' => 'application/vnd.previewsystems.box', - 'boz' => 'application/x-bzip2', - 'bpk' => 'application/octet-stream', - 'btif' => 'image/prs.btif', - 'bz' => 'application/x-bzip', - 'bz2' => 'application/x-bzip2', - 'c' => 'text/x-c', - 'c11amc' => 'application/vnd.cluetrust.cartomobile-config', - 'c11amz' => 'application/vnd.cluetrust.cartomobile-config-pkg', - 'c4d' => 'application/vnd.clonk.c4group', - 'c4f' => 'application/vnd.clonk.c4group', - 'c4g' => 'application/vnd.clonk.c4group', - 'c4p' => 'application/vnd.clonk.c4group', - 'c4u' => 'application/vnd.clonk.c4group', - 'cab' => 'application/vnd.ms-cab-compressed', - 'car' => 'application/vnd.curl.car', - 'cat' => 'application/vnd.ms-pki.seccat', - 'cc' => 'text/x-c', - 'cct' => 'application/x-director', - 'ccxml' => 'application/ccxml+xml', - 'cdbcmsg' => 'application/vnd.contact.cmsg', - 'cdf' => 'application/x-netcdf', - 'cdkey' => 'application/vnd.mediastation.cdkey', - 'cdmia' => 'application/cdmi-capability', - 'cdmic' => 'application/cdmi-container', - 'cdmid' => 'application/cdmi-domain', - 'cdmio' => 'application/cdmi-object', - 'cdmiq' => 'application/cdmi-queue', - 'cdx' => 'chemical/x-cdx', - 'cdxml' => 'application/vnd.chemdraw+xml', - 'cdy' => 'application/vnd.cinderella', - 'cer' => 'application/pkix-cert', - 'cfc' => 'application/x-coldfusion', - 'cfm' => 'application/x-coldfusion', - 'cgm' => 'image/cgm', - 'chat' => 'application/x-chat', - 'chm' => 'application/vnd.ms-htmlhelp', - 'chrt' => 'application/vnd.kde.kchart', - 'cif' => 'chemical/x-cif', - 'cii' => 'application/vnd.anser-web-certificate-issue-initiation', - 'cil' => 'application/vnd.ms-artgalry', - 'cla' => 'application/vnd.claymore', - 'class' => 'application/java-vm', - 'clkk' => 'application/vnd.crick.clicker.keyboard', - 'clkp' => 'application/vnd.crick.clicker.palette', - 'clkt' => 'application/vnd.crick.clicker.template', - 'clkw' => 'application/vnd.crick.clicker.wordbank', - 'clkx' => 'application/vnd.crick.clicker', - 'clp' => 'application/x-msclip', - 'cmc' => 'application/vnd.cosmocaller', - 'cmdf' => 'chemical/x-cmdf', - 'cml' => 'chemical/x-cml', - 'cmp' => 'application/vnd.yellowriver-custom-menu', - 'cmx' => 'image/x-cmx', - 'cod' => 'application/vnd.rim.cod', - 'com' => 'application/x-msdownload', - 'conf' => 'text/plain', - 'cpio' => 'application/x-cpio', - 'cpp' => 'text/x-c', - 'cpt' => 'application/mac-compactpro', - 'crd' => 'application/x-mscardfile', - 'crl' => 'application/pkix-crl', - 'crt' => 'application/x-x509-ca-cert', - 'cryptonote' => 'application/vnd.rig.cryptonote', - 'cs' => 'text/plain', - 'csh' => 'application/x-csh', - 'csml' => 'chemical/x-csml', - 'csp' => 'application/vnd.commonspace', - 'css' => 'text/css', - 'cst' => 'application/x-director', - 'csv' => 'text/csv', - 'cu' => 'application/cu-seeme', - 'curl' => 'text/vnd.curl', - 'cww' => 'application/prs.cww', - 'cxt' => 'application/x-director', - 'cxx' => 'text/x-c', - 'dae' => 'model/vnd.collada+xml', - 'daf' => 'application/vnd.mobius.daf', - 'dataless' => 'application/vnd.fdsn.seed', - 'davmount' => 'application/davmount+xml', - 'dcr' => 'application/x-director', - 'dcurl' => 'text/vnd.curl.dcurl', - 'dd2' => 'application/vnd.oma.dd2+xml', - 'ddd' => 'application/vnd.fujixerox.ddd', - 'deb' => 'application/x-debian-package', - 'def' => 'text/plain', - 'deploy' => 'application/octet-stream', - 'der' => 'application/x-x509-ca-cert', - 'dfac' => 'application/vnd.dreamfactory', - 'dic' => 'text/x-c', - 'dir' => 'application/x-director', - 'dis' => 'application/vnd.mobius.dis', - 'dist' => 'application/octet-stream', - 'distz' => 'application/octet-stream', - 'djv' => 'image/vnd.djvu', - 'djvu' => 'image/vnd.djvu', - 'dll' => 'application/x-msdownload', - 'dmg' => 'application/octet-stream', - 'dms' => 'application/octet-stream', - 'dna' => 'application/vnd.dna', - 'doc' => 'application/msword', - 'docm' => 'application/vnd.ms-word.document.macroenabled.12', - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'dot' => 'application/msword', - 'dotm' => 'application/vnd.ms-word.template.macroenabled.12', - 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', - 'dp' => 'application/vnd.osgi.dp', - 'dpg' => 'application/vnd.dpgraph', - 'dra' => 'audio/vnd.dra', - 'dsc' => 'text/prs.lines.tag', - 'dssc' => 'application/dssc+der', - 'dtb' => 'application/x-dtbook+xml', - 'dtd' => 'application/xml-dtd', - 'dts' => 'audio/vnd.dts', - 'dtshd' => 'audio/vnd.dts.hd', - 'dump' => 'application/octet-stream', - 'dvi' => 'application/x-dvi', - 'dwf' => 'model/vnd.dwf', - 'dwg' => 'image/vnd.dwg', - 'dxf' => 'image/vnd.dxf', - 'dxp' => 'application/vnd.spotfire.dxp', - 'dxr' => 'application/x-director', - 'ecelp4800' => 'audio/vnd.nuera.ecelp4800', - 'ecelp7470' => 'audio/vnd.nuera.ecelp7470', - 'ecelp9600' => 'audio/vnd.nuera.ecelp9600', - 'ecma' => 'application/ecmascript', - 'edm' => 'application/vnd.novadigm.edm', - 'edx' => 'application/vnd.novadigm.edx', - 'efif' => 'application/vnd.picsel', - 'ei6' => 'application/vnd.pg.osasli', - 'elc' => 'application/octet-stream', - 'eml' => 'message/rfc822', - 'emma' => 'application/emma+xml', - 'eol' => 'audio/vnd.digital-winds', - 'eot' => 'application/vnd.ms-fontobject', - 'eps' => 'application/postscript', - 'epub' => 'application/epub+zip', - 'es3' => 'application/vnd.eszigno3+xml', - 'esf' => 'application/vnd.epson.esf', - 'et3' => 'application/vnd.eszigno3+xml', - 'etx' => 'text/x-setext', - 'exe' => 'application/x-msdownload', - 'exi' => 'application/exi', - 'ext' => 'application/vnd.novadigm.ext', - 'ez' => 'application/andrew-inset', - 'ez2' => 'application/vnd.ezpix-album', - 'ez3' => 'application/vnd.ezpix-package', - 'f' => 'text/x-fortran', - 'f4v' => 'video/x-f4v', - 'f77' => 'text/x-fortran', - 'f90' => 'text/x-fortran', - 'fbs' => 'image/vnd.fastbidsheet', - 'fcs' => 'application/vnd.isac.fcs', - 'fdf' => 'application/vnd.fdf', - 'fe_launch' => 'application/vnd.denovo.fcselayout-link', - 'fg5' => 'application/vnd.fujitsu.oasysgp', - 'fgd' => 'application/x-director', - 'fh' => 'image/x-freehand', - 'fh4' => 'image/x-freehand', - 'fh5' => 'image/x-freehand', - 'fh7' => 'image/x-freehand', - 'fhc' => 'image/x-freehand', - 'fig' => 'application/x-xfig', - 'fli' => 'video/x-fli', - 'flo' => 'application/vnd.micrografx.flo', - 'flv' => 'video/x-flv', - 'flw' => 'application/vnd.kde.kivio', - 'flx' => 'text/vnd.fmi.flexstor', - 'fly' => 'text/vnd.fly', - 'fm' => 'application/vnd.framemaker', - 'fnc' => 'application/vnd.frogans.fnc', - 'for' => 'text/x-fortran', - 'fpx' => 'image/vnd.fpx', - 'frame' => 'application/vnd.framemaker', - 'fsc' => 'application/vnd.fsc.weblaunch', - 'fst' => 'image/vnd.fst', - 'ftc' => 'application/vnd.fluxtime.clip', - 'fti' => 'application/vnd.anser-web-funds-transfer-initiation', - 'fvt' => 'video/vnd.fvt', - 'fxp' => 'application/vnd.adobe.fxp', - 'fxpl' => 'application/vnd.adobe.fxp', - 'fzs' => 'application/vnd.fuzzysheet', - 'g2w' => 'application/vnd.geoplan', - 'g3' => 'image/g3fax', - 'g3w' => 'application/vnd.geospace', - 'gac' => 'application/vnd.groove-account', - 'gdl' => 'model/vnd.gdl', - 'geo' => 'application/vnd.dynageo', - 'gex' => 'application/vnd.geometry-explorer', - 'ggb' => 'application/vnd.geogebra.file', - 'ggt' => 'application/vnd.geogebra.tool', - 'ghf' => 'application/vnd.groove-help', - 'gif' => 'image/gif', - 'gim' => 'application/vnd.groove-identity-message', - 'gmx' => 'application/vnd.gmx', - 'gnumeric' => 'application/x-gnumeric', - 'gph' => 'application/vnd.flographit', - 'gqf' => 'application/vnd.grafeq', - 'gqs' => 'application/vnd.grafeq', - 'gram' => 'application/srgs', - 'gre' => 'application/vnd.geometry-explorer', - 'grv' => 'application/vnd.groove-injector', - 'grxml' => 'application/srgs+xml', - 'gsf' => 'application/x-font-ghostscript', - 'gtar' => 'application/x-gtar', - 'gtm' => 'application/vnd.groove-tool-message', - 'gtw' => 'model/vnd.gtw', - 'gv' => 'text/vnd.graphviz', - 'gxt' => 'application/vnd.geonext', - 'h' => 'text/x-c', - 'h261' => 'video/h261', - 'h263' => 'video/h263', - 'h264' => 'video/h264', - 'hal' => 'application/vnd.hal+xml', - 'hbci' => 'application/vnd.hbci', - 'hdf' => 'application/x-hdf', - 'hh' => 'text/x-c', - 'hlp' => 'application/winhlp', - 'hpgl' => 'application/vnd.hp-hpgl', - 'hpid' => 'application/vnd.hp-hpid', - 'hps' => 'application/vnd.hp-hps', - 'hqx' => 'application/mac-binhex40', - 'hta' => 'application/octet-stream', - 'htc' => 'text/html', - 'htke' => 'application/vnd.kenameaapp', - 'htm' => 'text/html', - 'html' => 'text/html', - 'hvd' => 'application/vnd.yamaha.hv-dic', - 'hvp' => 'application/vnd.yamaha.hv-voice', - 'hvs' => 'application/vnd.yamaha.hv-script', - 'i2g' => 'application/vnd.intergeo', - 'icc' => 'application/vnd.iccprofile', - 'ice' => 'x-conference/x-cooltalk', - 'icm' => 'application/vnd.iccprofile', - 'ico' => 'image/x-icon', - 'ics' => 'text/calendar', - 'ief' => 'image/ief', - 'ifb' => 'text/calendar', - 'ifm' => 'application/vnd.shana.informed.formdata', - 'iges' => 'model/iges', - 'igl' => 'application/vnd.igloader', - 'igm' => 'application/vnd.insors.igm', - 'igs' => 'model/iges', - 'igx' => 'application/vnd.micrografx.igx', - 'iif' => 'application/vnd.shana.informed.interchange', - 'imp' => 'application/vnd.accpac.simply.imp', - 'ims' => 'application/vnd.ms-ims', - 'in' => 'text/plain', - 'ini' => 'text/plain', - 'ipfix' => 'application/ipfix', - 'ipk' => 'application/vnd.shana.informed.package', - 'irm' => 'application/vnd.ibm.rights-management', - 'irp' => 'application/vnd.irepository.package+xml', - 'iso' => 'application/octet-stream', - 'itp' => 'application/vnd.shana.informed.formtemplate', - 'ivp' => 'application/vnd.immervision-ivp', - 'ivu' => 'application/vnd.immervision-ivu', - 'jad' => 'text/vnd.sun.j2me.app-descriptor', - 'jam' => 'application/vnd.jam', - 'jar' => 'application/java-archive', - 'java' => 'text/x-java-source', - 'jisp' => 'application/vnd.jisp', - 'jlt' => 'application/vnd.hp-jlyt', - 'jnlp' => 'application/x-java-jnlp-file', - 'joda' => 'application/vnd.joost.joda-archive', - 'jpe' => 'image/jpeg', - 'jpeg' => 'image/jpeg', - 'jpg' => 'image/jpeg', - 'jpgm' => 'video/jpm', - 'jpgv' => 'video/jpeg', - 'jpm' => 'video/jpm', - 'js' => 'text/javascript', - 'json' => 'application/json', - 'kar' => 'audio/midi', - 'karbon' => 'application/vnd.kde.karbon', - 'kfo' => 'application/vnd.kde.kformula', - 'kia' => 'application/vnd.kidspiration', - 'kml' => 'application/vnd.google-earth.kml+xml', - 'kmz' => 'application/vnd.google-earth.kmz', - 'kne' => 'application/vnd.kinar', - 'knp' => 'application/vnd.kinar', - 'kon' => 'application/vnd.kde.kontour', - 'kpr' => 'application/vnd.kde.kpresenter', - 'kpt' => 'application/vnd.kde.kpresenter', - 'ksp' => 'application/vnd.kde.kspread', - 'ktr' => 'application/vnd.kahootz', - 'ktx' => 'image/ktx', - 'ktz' => 'application/vnd.kahootz', - 'kwd' => 'application/vnd.kde.kword', - 'kwt' => 'application/vnd.kde.kword', - 'lasxml' => 'application/vnd.las.las+xml', - 'latex' => 'application/x-latex', - 'lbd' => 'application/vnd.llamagraphics.life-balance.desktop', - 'lbe' => 'application/vnd.llamagraphics.life-balance.exchange+xml', - 'les' => 'application/vnd.hhe.lesson-player', - 'lha' => 'application/octet-stream', - 'link66' => 'application/vnd.route66.link66+xml', - 'list' => 'text/plain', - 'list3820' => 'application/vnd.ibm.modcap', - 'listafp' => 'application/vnd.ibm.modcap', - 'log' => 'text/plain', - 'lostxml' => 'application/lost+xml', - 'lrf' => 'application/octet-stream', - 'lrm' => 'application/vnd.ms-lrm', - 'ltf' => 'application/vnd.frogans.ltf', - 'lvp' => 'audio/vnd.lucent.voice', - 'lwp' => 'application/vnd.lotus-wordpro', - 'lzh' => 'application/octet-stream', - 'm13' => 'application/x-msmediaview', - 'm14' => 'application/x-msmediaview', - 'm1v' => 'video/mpeg', - 'm21' => 'application/mp21', - 'm2a' => 'audio/mpeg', - 'm2v' => 'video/mpeg', - 'm3a' => 'audio/mpeg', - 'm3u' => 'audio/x-mpegurl', - 'm3u8' => 'application/vnd.apple.mpegurl', - 'm4a' => 'audio/mp4', - 'm4u' => 'video/vnd.mpegurl', - 'm4v' => 'video/mp4', - 'ma' => 'application/mathematica', - 'mads' => 'application/mads+xml', - 'mag' => 'application/vnd.ecowin.chart', - 'maker' => 'application/vnd.framemaker', - 'man' => 'text/troff', - 'mathml' => 'application/mathml+xml', - 'mb' => 'application/mathematica', - 'mbk' => 'application/vnd.mobius.mbk', - 'mbox' => 'application/mbox', - 'mc1' => 'application/vnd.medcalcdata', - 'mcd' => 'application/vnd.mcd', - 'mcurl' => 'text/vnd.curl.mcurl', - 'mdb' => 'application/x-msaccess', - 'mdi' => 'image/vnd.ms-modi', - 'me' => 'text/troff', - 'mesh' => 'model/mesh', - 'meta4' => 'application/metalink4+xml', - 'mets' => 'application/mets+xml', - 'mfm' => 'application/vnd.mfmp', - 'mgp' => 'application/vnd.osgeo.mapguide.package', - 'mgz' => 'application/vnd.proteus.magazine', - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mif' => 'application/vnd.mif', - 'mime' => 'message/rfc822', - 'mj2' => 'video/mj2', - 'mjp2' => 'video/mj2', - 'mlp' => 'application/vnd.dolby.mlp', - 'mmd' => 'application/vnd.chipnuts.karaoke-mmd', - 'mmf' => 'application/vnd.smaf', - 'mmr' => 'image/vnd.fujixerox.edmics-mmr', - 'mny' => 'application/x-msmoney', - 'mobi' => 'application/x-mobipocket-ebook', - 'mods' => 'application/mods+xml', - 'mov' => 'video/quicktime', - 'movie' => 'video/x-sgi-movie', - 'mp2' => 'audio/mpeg', - 'mp21' => 'application/mp21', - 'mp2a' => 'audio/mpeg', - 'mp3' => 'audio/mpeg', - 'mp4' => 'video/mp4', - 'mp4a' => 'audio/mp4', - 'mp4s' => 'application/mp4', - 'mp4v' => 'video/mp4', - 'mpc' => 'application/vnd.mophun.certificate', - 'mpe' => 'video/mpeg', - 'mpeg' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mpg4' => 'video/mp4', - 'mpga' => 'audio/mpeg', - 'mpkg' => 'application/vnd.apple.installer+xml', - 'mpm' => 'application/vnd.blueice.multipass', - 'mpn' => 'application/vnd.mophun.application', - 'mpp' => 'application/vnd.ms-project', - 'mpt' => 'application/vnd.ms-project', - 'mpy' => 'application/vnd.ibm.minipay', - 'mqy' => 'application/vnd.mobius.mqy', - 'mrc' => 'application/marc', - 'mrcx' => 'application/marcxml+xml', - 'ms' => 'text/troff', - 'mscml' => 'application/mediaservercontrol+xml', - 'mseed' => 'application/vnd.fdsn.mseed', - 'mseq' => 'application/vnd.mseq', - 'msf' => 'application/vnd.epson.msf', - 'msh' => 'model/mesh', - 'msi' => 'application/x-msdownload', - 'msl' => 'application/vnd.mobius.msl', - 'msty' => 'application/vnd.muvee.style', - 'mts' => 'model/vnd.mts', - 'mus' => 'application/vnd.musician', - 'musicxml' => 'application/vnd.recordare.musicxml+xml', - 'mvb' => 'application/x-msmediaview', - 'mwf' => 'application/vnd.mfer', - 'mxf' => 'application/mxf', - 'mxl' => 'application/vnd.recordare.musicxml', - 'mxml' => 'application/xv+xml', - 'mxs' => 'application/vnd.triscape.mxs', - 'mxu' => 'video/vnd.mpegurl', - 'n-gage' => 'application/vnd.nokia.n-gage.symbian.install', - 'n3' => 'text/n3', - 'nb' => 'application/mathematica', - 'nbp' => 'application/vnd.wolfram.player', - 'nc' => 'application/x-netcdf', - 'ncx' => 'application/x-dtbncx+xml', - 'ngdat' => 'application/vnd.nokia.n-gage.data', - 'nlu' => 'application/vnd.neurolanguage.nlu', - 'nml' => 'application/vnd.enliven', - 'nnd' => 'application/vnd.noblenet-directory', - 'nns' => 'application/vnd.noblenet-sealer', - 'nnw' => 'application/vnd.noblenet-web', - 'npx' => 'image/vnd.net-fpx', - 'nsf' => 'application/vnd.lotus-notes', - 'oa2' => 'application/vnd.fujitsu.oasys2', - 'oa3' => 'application/vnd.fujitsu.oasys3', - 'oas' => 'application/vnd.fujitsu.oasys', - 'obd' => 'application/x-msbinder', - 'oda' => 'application/oda', - 'odb' => 'application/vnd.oasis.opendocument.database', - 'odc' => 'application/vnd.oasis.opendocument.chart', - 'odf' => 'application/vnd.oasis.opendocument.formula', - 'odft' => 'application/vnd.oasis.opendocument.formula-template', - 'odg' => 'application/vnd.oasis.opendocument.graphics', - 'odi' => 'application/vnd.oasis.opendocument.image', - 'odm' => 'application/vnd.oasis.opendocument.text-master', - 'odp' => 'application/vnd.oasis.opendocument.presentation', - 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', - 'odt' => 'application/vnd.oasis.opendocument.text', - 'oga' => 'audio/ogg', - 'ogg' => 'audio/ogg', - 'ogv' => 'video/ogg', - 'ogx' => 'application/ogg', - 'onepkg' => 'application/onenote', - 'onetmp' => 'application/onenote', - 'onetoc' => 'application/onenote', - 'onetoc2' => 'application/onenote', - 'opf' => 'application/oebps-package+xml', - 'oprc' => 'application/vnd.palm', - 'org' => 'application/vnd.lotus-organizer', - 'osf' => 'application/vnd.yamaha.openscoreformat', - 'osfpvg' => 'application/vnd.yamaha.openscoreformat.osfpvg+xml', - 'otc' => 'application/vnd.oasis.opendocument.chart-template', - 'otf' => 'application/x-font-otf', - 'otg' => 'application/vnd.oasis.opendocument.graphics-template', - 'oth' => 'application/vnd.oasis.opendocument.text-web', - 'oti' => 'application/vnd.oasis.opendocument.image-template', - 'otp' => 'application/vnd.oasis.opendocument.presentation-template', - 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', - 'ott' => 'application/vnd.oasis.opendocument.text-template', - 'oxt' => 'application/vnd.openofficeorg.extension', - 'p' => 'text/x-pascal', - 'p10' => 'application/pkcs10', - 'p12' => 'application/x-pkcs12', - 'p7b' => 'application/x-pkcs7-certificates', - 'p7c' => 'application/pkcs7-mime', - 'p7m' => 'application/pkcs7-mime', - 'p7r' => 'application/x-pkcs7-certreqresp', - 'p7s' => 'application/pkcs7-signature', - 'p8' => 'application/pkcs8', - 'pas' => 'text/x-pascal', - 'paw' => 'application/vnd.pawaafile', - 'pbd' => 'application/vnd.powerbuilder6', - 'pbm' => 'image/x-portable-bitmap', - 'pcf' => 'application/x-font-pcf', - 'pcl' => 'application/vnd.hp-pcl', - 'pclxl' => 'application/vnd.hp-pclxl', - 'pct' => 'image/x-pict', - 'pcurl' => 'application/vnd.curl.pcurl', - 'pcx' => 'image/x-pcx', - 'pdb' => 'application/vnd.palm', - 'pdf' => 'application/pdf', - 'pfa' => 'application/x-font-type1', - 'pfb' => 'application/x-font-type1', - 'pfm' => 'application/x-font-type1', - 'pfr' => 'application/font-tdpfr', - 'pfx' => 'application/x-pkcs12', - 'pgm' => 'image/x-portable-graymap', - 'pgn' => 'application/x-chess-pgn', - 'pgp' => 'application/pgp-encrypted', - 'php' => 'text/x-php', - 'phps' => 'application/x-httpd-phps', - 'pic' => 'image/x-pict', - 'pkg' => 'application/octet-stream', - 'pki' => 'application/pkixcmp', - 'pkipath' => 'application/pkix-pkipath', - 'plb' => 'application/vnd.3gpp.pic-bw-large', - 'plc' => 'application/vnd.mobius.plc', - 'plf' => 'application/vnd.pocketlearn', - 'pls' => 'application/pls+xml', - 'pml' => 'application/vnd.ctc-posml', - 'png' => 'image/png', - 'pnm' => 'image/x-portable-anymap', - 'portpkg' => 'application/vnd.macports.portpkg', - 'pot' => 'application/vnd.ms-powerpoint', - 'potm' => 'application/vnd.ms-powerpoint.template.macroenabled.12', - 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', - 'ppam' => 'application/vnd.ms-powerpoint.addin.macroenabled.12', - 'ppd' => 'application/vnd.cups-ppd', - 'ppm' => 'image/x-portable-pixmap', - 'pps' => 'application/vnd.ms-powerpoint', - 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroenabled.12', - 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', - 'ppt' => 'application/vnd.ms-powerpoint', - 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroenabled.12', - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'pqa' => 'application/vnd.palm', - 'prc' => 'application/x-mobipocket-ebook', - 'pre' => 'application/vnd.lotus-freelance', - 'prf' => 'application/pics-rules', - 'ps' => 'application/postscript', - 'psb' => 'application/vnd.3gpp.pic-bw-small', - 'psd' => 'image/vnd.adobe.photoshop', - 'psf' => 'application/x-font-linux-psf', - 'pskcxml' => 'application/pskc+xml', - 'ptid' => 'application/vnd.pvi.ptid1', - 'pub' => 'application/x-mspublisher', - 'pvb' => 'application/vnd.3gpp.pic-bw-var', - 'pwn' => 'application/vnd.3m.post-it-notes', - 'pya' => 'audio/vnd.ms-playready.media.pya', - 'pyv' => 'video/vnd.ms-playready.media.pyv', - 'qam' => 'application/vnd.epson.quickanime', - 'qbo' => 'application/vnd.intu.qbo', - 'qfx' => 'application/vnd.intu.qfx', - 'qps' => 'application/vnd.publishare-delta-tree', - 'qt' => 'video/quicktime', - 'qwd' => 'application/vnd.quark.quarkxpress', - 'qwt' => 'application/vnd.quark.quarkxpress', - 'qxb' => 'application/vnd.quark.quarkxpress', - 'qxd' => 'application/vnd.quark.quarkxpress', - 'qxl' => 'application/vnd.quark.quarkxpress', - 'qxt' => 'application/vnd.quark.quarkxpress', - 'ra' => 'audio/x-pn-realaudio', - 'ram' => 'audio/x-pn-realaudio', - 'rar' => 'application/x-rar-compressed', - 'ras' => 'image/x-cmu-raster', - 'rb' => 'text/plain', - 'rcprofile' => 'application/vnd.ipunplugged.rcprofile', - 'rdf' => 'application/rdf+xml', - 'rdz' => 'application/vnd.data-vision.rdz', - 'rep' => 'application/vnd.businessobjects', - 'res' => 'application/x-dtbresource+xml', - 'resx' => 'text/xml', - 'rgb' => 'image/x-rgb', - 'rif' => 'application/reginfo+xml', - 'rip' => 'audio/vnd.rip', - 'rl' => 'application/resource-lists+xml', - 'rlc' => 'image/vnd.fujixerox.edmics-rlc', - 'rld' => 'application/resource-lists-diff+xml', - 'rm' => 'application/vnd.rn-realmedia', - 'rmi' => 'audio/midi', - 'rmp' => 'audio/x-pn-realaudio-plugin', - 'rms' => 'application/vnd.jcp.javame.midlet-rms', - 'rnc' => 'application/relax-ng-compact-syntax', - 'roff' => 'text/troff', - 'rp9' => 'application/vnd.cloanto.rp9', - 'rpss' => 'application/vnd.nokia.radio-presets', - 'rpst' => 'application/vnd.nokia.radio-preset', - 'rq' => 'application/sparql-query', - 'rs' => 'application/rls-services+xml', - 'rsd' => 'application/rsd+xml', - 'rss' => 'application/rss+xml', - 'rtf' => 'application/rtf', - 'rtx' => 'text/richtext', - 's' => 'text/x-asm', - 'saf' => 'application/vnd.yamaha.smaf-audio', - 'sbml' => 'application/sbml+xml', - 'sc' => 'application/vnd.ibm.secure-container', - 'scd' => 'application/x-msschedule', - 'scm' => 'application/vnd.lotus-screencam', - 'scq' => 'application/scvp-cv-request', - 'scs' => 'application/scvp-cv-response', - 'scurl' => 'text/vnd.curl.scurl', - 'sda' => 'application/vnd.stardivision.draw', - 'sdc' => 'application/vnd.stardivision.calc', - 'sdd' => 'application/vnd.stardivision.impress', - 'sdkd' => 'application/vnd.solent.sdkm+xml', - 'sdkm' => 'application/vnd.solent.sdkm+xml', - 'sdp' => 'application/sdp', - 'sdw' => 'application/vnd.stardivision.writer', - 'see' => 'application/vnd.seemail', - 'seed' => 'application/vnd.fdsn.seed', - 'sema' => 'application/vnd.sema', - 'semd' => 'application/vnd.semd', - 'semf' => 'application/vnd.semf', - 'ser' => 'application/java-serialized-object', - 'setpay' => 'application/set-payment-initiation', - 'setreg' => 'application/set-registration-initiation', - 'sfd-hdstx' => 'application/vnd.hydrostatix.sof-data', - 'sfs' => 'application/vnd.spotfire.sfs', - 'sgl' => 'application/vnd.stardivision.writer-global', - 'sgm' => 'text/sgml', - 'sgml' => 'text/sgml', - 'sh' => 'application/x-sh', - 'shar' => 'application/x-shar', - 'shf' => 'application/shf+xml', - 'sig' => 'application/pgp-signature', - 'silo' => 'model/mesh', - 'sis' => 'application/vnd.symbian.install', - 'sisx' => 'application/vnd.symbian.install', - 'sit' => 'application/x-stuffit', - 'sitx' => 'application/x-stuffitx', - 'skd' => 'application/vnd.koan', - 'skm' => 'application/vnd.koan', - 'skp' => 'application/vnd.koan', - 'skt' => 'application/vnd.koan', - 'sldm' => 'application/vnd.ms-powerpoint.slide.macroenabled.12', - 'sldx' => 'application/vnd.openxmlformats-officedocument.presentationml.slide', - 'slt' => 'application/vnd.epson.salt', - 'sm' => 'application/vnd.stepmania.stepchart', - 'smf' => 'application/vnd.stardivision.math', - 'smi' => 'application/smil+xml', - 'smil' => 'application/smil+xml', - 'snd' => 'audio/basic', - 'snf' => 'application/x-font-snf', - 'so' => 'application/octet-stream', - 'spc' => 'application/x-pkcs7-certificates', - 'spf' => 'application/vnd.yamaha.smaf-phrase', - 'spl' => 'application/x-futuresplash', - 'spot' => 'text/vnd.in3d.spot', - 'spp' => 'application/scvp-vp-response', - 'spq' => 'application/scvp-vp-request', - 'spx' => 'audio/ogg', - 'src' => 'application/x-wais-source', - 'sru' => 'application/sru+xml', - 'srx' => 'application/sparql-results+xml', - 'sse' => 'application/vnd.kodak-descriptor', - 'ssf' => 'application/vnd.epson.ssf', - 'ssml' => 'application/ssml+xml', - 'st' => 'application/vnd.sailingtracker.track', - 'stc' => 'application/vnd.sun.xml.calc.template', - 'std' => 'application/vnd.sun.xml.draw.template', - 'stf' => 'application/vnd.wt.stf', - 'sti' => 'application/vnd.sun.xml.impress.template', - 'stk' => 'application/hyperstudio', - 'stl' => 'application/vnd.ms-pki.stl', - 'str' => 'application/vnd.pg.format', - 'stw' => 'application/vnd.sun.xml.writer.template', - 'sub' => 'image/vnd.dvb.subtitle', - 'sus' => 'application/vnd.sus-calendar', - 'susp' => 'application/vnd.sus-calendar', - 'sv4cpio' => 'application/x-sv4cpio', - 'sv4crc' => 'application/x-sv4crc', - 'svc' => 'application/vnd.dvb.service', - 'svd' => 'application/vnd.svd', - 'svg' => 'image/svg+xml', - 'svgz' => 'image/svg+xml', - 'swa' => 'application/x-director', - 'swf' => 'application/x-shockwave-flash', - 'swi' => 'application/vnd.aristanetworks.swi', - 'sxc' => 'application/vnd.sun.xml.calc', - 'sxd' => 'application/vnd.sun.xml.draw', - 'sxg' => 'application/vnd.sun.xml.writer.global', - 'sxi' => 'application/vnd.sun.xml.impress', - 'sxm' => 'application/vnd.sun.xml.math', - 'sxw' => 'application/vnd.sun.xml.writer', - 't' => 'text/troff', - 'tao' => 'application/vnd.tao.intent-module-archive', - 'tar' => 'application/x-tar', - 'tcap' => 'application/vnd.3gpp2.tcap', - 'tcl' => 'application/x-tcl', - 'teacher' => 'application/vnd.smart.teacher', - 'tei' => 'application/tei+xml', - 'teicorpus' => 'application/tei+xml', - 'tex' => 'application/x-tex', - 'texi' => 'application/x-texinfo', - 'texinfo' => 'application/x-texinfo', - 'text' => 'text/plain', - 'tfi' => 'application/thraud+xml', - 'tfm' => 'application/x-tex-tfm', - 'thmx' => 'application/vnd.ms-officetheme', - 'tif' => 'image/tiff', - 'tiff' => 'image/tiff', - 'tmo' => 'application/vnd.tmobile-livetv', - 'torrent' => 'application/x-bittorrent', - 'tpl' => 'application/vnd.groove-tool-template', - 'tpt' => 'application/vnd.trid.tpt', - 'tr' => 'text/troff', - 'tra' => 'application/vnd.trueapp', - 'trm' => 'application/x-msterminal', - 'tsd' => 'application/timestamped-data', - 'tsv' => 'text/tab-separated-values', - 'ttc' => 'application/x-font-ttf', - 'ttf' => 'application/x-font-ttf', - 'ttl' => 'text/turtle', - 'twd' => 'application/vnd.simtech-mindmapper', - 'twds' => 'application/vnd.simtech-mindmapper', - 'txd' => 'application/vnd.genomatix.tuxedo', - 'txf' => 'application/vnd.mobius.txf', - 'txt' => 'text/plain', - 'u32' => 'application/x-authorware-bin', - 'udeb' => 'application/x-debian-package', - 'ufd' => 'application/vnd.ufdl', - 'ufdl' => 'application/vnd.ufdl', - 'umj' => 'application/vnd.umajin', - 'unityweb' => 'application/vnd.unity', - 'uoml' => 'application/vnd.uoml+xml', - 'uri' => 'text/uri-list', - 'uris' => 'text/uri-list', - 'urls' => 'text/uri-list', - 'ustar' => 'application/x-ustar', - 'utz' => 'application/vnd.uiq.theme', - 'uu' => 'text/x-uuencode', - 'uva' => 'audio/vnd.dece.audio', - 'uvd' => 'application/vnd.dece.data', - 'uvf' => 'application/vnd.dece.data', - 'uvg' => 'image/vnd.dece.graphic', - 'uvh' => 'video/vnd.dece.hd', - 'uvi' => 'image/vnd.dece.graphic', - 'uvm' => 'video/vnd.dece.mobile', - 'uvp' => 'video/vnd.dece.pd', - 'uvs' => 'video/vnd.dece.sd', - 'uvt' => 'application/vnd.dece.ttml+xml', - 'uvu' => 'video/vnd.uvvu.mp4', - 'uvv' => 'video/vnd.dece.video', - 'uvva' => 'audio/vnd.dece.audio', - 'uvvd' => 'application/vnd.dece.data', - 'uvvf' => 'application/vnd.dece.data', - 'uvvg' => 'image/vnd.dece.graphic', - 'uvvh' => 'video/vnd.dece.hd', - 'uvvi' => 'image/vnd.dece.graphic', - 'uvvm' => 'video/vnd.dece.mobile', - 'uvvp' => 'video/vnd.dece.pd', - 'uvvs' => 'video/vnd.dece.sd', - 'uvvt' => 'application/vnd.dece.ttml+xml', - 'uvvu' => 'video/vnd.uvvu.mp4', - 'uvvv' => 'video/vnd.dece.video', - 'uvvx' => 'application/vnd.dece.unspecified', - 'uvx' => 'application/vnd.dece.unspecified', - 'vcd' => 'application/x-cdlink', - 'vcf' => 'text/x-vcard', - 'vcg' => 'application/vnd.groove-vcard', - 'vcs' => 'text/x-vcalendar', - 'vcx' => 'application/vnd.vcx', - 'vis' => 'application/vnd.visionary', - 'viv' => 'video/vnd.vivo', - 'vor' => 'application/vnd.stardivision.writer', - 'vox' => 'application/x-authorware-bin', - 'vrml' => 'model/vrml', - 'vsd' => 'application/vnd.visio', - 'vsf' => 'application/vnd.vsf', - 'vss' => 'application/vnd.visio', - 'vst' => 'application/vnd.visio', - 'vsw' => 'application/vnd.visio', - 'vtu' => 'model/vnd.vtu', - 'vxml' => 'application/voicexml+xml', - 'w3d' => 'application/x-director', - 'wad' => 'application/x-doom', - 'wav' => 'audio/x-wav', - 'wax' => 'audio/x-ms-wax', - 'wbmp' => 'image/vnd.wap.wbmp', - 'wbs' => 'application/vnd.criticaltools.wbs+xml', - 'wbxml' => 'application/vnd.wap.wbxml', - 'wcm' => 'application/vnd.ms-works', - 'wdb' => 'application/vnd.ms-works', - 'weba' => 'audio/webm', - 'webm' => 'video/webm', - 'webp' => 'image/webp', - 'wg' => 'application/vnd.pmi.widget', - 'wgt' => 'application/widget', - 'wks' => 'application/vnd.ms-works', - 'wm' => 'video/x-ms-wm', - 'wma' => 'audio/x-ms-wma', - 'wmd' => 'application/x-ms-wmd', - 'wmf' => 'application/x-msmetafile', - 'wml' => 'text/vnd.wap.wml', - 'wmlc' => 'application/vnd.wap.wmlc', - 'wmls' => 'text/vnd.wap.wmlscript', - 'wmlsc' => 'application/vnd.wap.wmlscriptc', - 'wmv' => 'video/x-ms-wmv', - 'wmx' => 'video/x-ms-wmx', - 'wmz' => 'application/x-ms-wmz', - 'woff' => 'application/x-font-woff', - 'wpd' => 'application/vnd.wordperfect', - 'wpl' => 'application/vnd.ms-wpl', - 'wps' => 'application/vnd.ms-works', - 'wqd' => 'application/vnd.wqd', - 'wri' => 'application/x-mswrite', - 'wrl' => 'model/vrml', - 'wsdl' => 'application/wsdl+xml', - 'wspolicy' => 'application/wspolicy+xml', - 'wtb' => 'application/vnd.webturbo', - 'wvx' => 'video/x-ms-wvx', - 'x32' => 'application/x-authorware-bin', - 'x3d' => 'application/vnd.hzn-3d-crossword', - 'xap' => 'application/x-silverlight-app', - 'xar' => 'application/vnd.xara', - 'xbap' => 'application/x-ms-xbap', - 'xbd' => 'application/vnd.fujixerox.docuworks.binder', - 'xbm' => 'image/x-xbitmap', - 'xdf' => 'application/xcap-diff+xml', - 'xdm' => 'application/vnd.syncml.dm+xml', - 'xdp' => 'application/vnd.adobe.xdp+xml', - 'xdssc' => 'application/dssc+xml', - 'xdw' => 'application/vnd.fujixerox.docuworks', - 'xenc' => 'application/xenc+xml', - 'xer' => 'application/patch-ops-error+xml', - 'xfdf' => 'application/vnd.adobe.xfdf', - 'xfdl' => 'application/vnd.xfdl', - 'xht' => 'application/xhtml+xml', - 'xhtml' => 'application/xhtml+xml', - 'xhvml' => 'application/xv+xml', - 'xif' => 'image/vnd.xiff', - 'xla' => 'application/vnd.ms-excel', - 'xlam' => 'application/vnd.ms-excel.addin.macroenabled.12', - 'xlc' => 'application/vnd.ms-excel', - 'xlm' => 'application/vnd.ms-excel', - 'xls' => 'application/vnd.ms-excel', - 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroenabled.12', - 'xlsm' => 'application/vnd.ms-excel.sheet.macroenabled.12', - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'xlt' => 'application/vnd.ms-excel', - 'xltm' => 'application/vnd.ms-excel.template.macroenabled.12', - 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', - 'xlw' => 'application/vnd.ms-excel', - 'xml' => 'application/xml', - 'xo' => 'application/vnd.olpc-sugar', - 'xop' => 'application/xop+xml', - 'xpi' => 'application/x-xpinstall', - 'xpm' => 'image/x-xpixmap', - 'xpr' => 'application/vnd.is-xpr', - 'xps' => 'application/vnd.ms-xpsdocument', - 'xpw' => 'application/vnd.intercon.formnet', - 'xpx' => 'application/vnd.intercon.formnet', - 'xsl' => 'application/xml', - 'xslt' => 'application/xslt+xml', - 'xsm' => 'application/vnd.syncml+xml', - 'xspf' => 'application/xspf+xml', - 'xul' => 'application/vnd.mozilla.xul+xml', - 'xvm' => 'application/xv+xml', - 'xvml' => 'application/xv+xml', - 'xwd' => 'image/x-xwindowdump', - 'xyz' => 'chemical/x-xyz', - 'yaml' => 'text/yaml', - 'yang' => 'application/yang', - 'yin' => 'application/yin+xml', - 'yml' => 'text/yaml', - 'zaz' => 'application/vnd.zzazz.deck+xml', - 'zip' => 'application/zip', - 'zir' => 'application/vnd.zul', - 'zirz' => 'application/vnd.zul', - 'zmm' => 'application/vnd.handheld-entertainment+xml' - ); - - /** - * Get a singleton instance of the class - * - * @return self - * @codeCoverageIgnore - */ - public static function getInstance() - { - if (!self::$instance) { - self::$instance = new self(); - } - - return self::$instance; - } - - /** - * Get a mimetype value from a file extension - * - * @param string $extension File extension - * - * @return string|null - * - */ - public function fromExtension($extension) - { - $extension = strtolower($extension); - - return isset($this->mimetypes[$extension]) ? $this->mimetypes[$extension] : null; - } - - /** - * Get a mimetype from a filename - * - * @param string $filename Filename to generate a mimetype from - * - * @return string|null - */ - public function fromFilename($filename) - { - return $this->fromExtension(pathinfo($filename, PATHINFO_EXTENSION)); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/QueryAggregator/CommaAggregator.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/QueryAggregator/CommaAggregator.php deleted file mode 100644 index 4b4e49d05..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/QueryAggregator/CommaAggregator.php +++ /dev/null @@ -1,20 +0,0 @@ -isUrlEncoding()) { - return array($query->encodeValue($key) => implode(',', array_map(array($query, 'encodeValue'), $value))); - } else { - return array($key => implode(',', $value)); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/QueryAggregator/DuplicateAggregator.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/QueryAggregator/DuplicateAggregator.php deleted file mode 100644 index 1bf1730e4..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/QueryAggregator/DuplicateAggregator.php +++ /dev/null @@ -1,22 +0,0 @@ -isUrlEncoding()) { - return array($query->encodeValue($key) => array_map(array($query, 'encodeValue'), $value)); - } else { - return array($key => $value); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/QueryAggregator/PhpAggregator.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/QueryAggregator/PhpAggregator.php deleted file mode 100644 index 133ea2bd9..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/QueryAggregator/PhpAggregator.php +++ /dev/null @@ -1,27 +0,0 @@ - $v) { - $k = "{$key}[{$k}]"; - if (is_array($v)) { - $ret = array_merge($ret, self::aggregate($k, $v, $query)); - } else { - $ret[$query->encodeValue($k)] = $query->encodeValue($v); - } - } - - return $ret; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/QueryAggregator/QueryAggregatorInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/QueryAggregator/QueryAggregatorInterface.php deleted file mode 100644 index 72bee620c..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/QueryAggregator/QueryAggregatorInterface.php +++ /dev/null @@ -1,22 +0,0 @@ -add($key, $value); - $foundDuplicates = true; - } elseif ($paramIsPhpStyleArray) { - $q[$key] = array($value); - } else { - $q[$key] = $value; - } - } else { - // Uses false by default to represent keys with no trailing "=" sign. - $q->add($key, false); - } - } - - // Use the duplicate aggregator if duplicates were found and not using PHP style arrays - if ($foundDuplicates && !$foundPhpStyle) { - $q->setAggregator(new DuplicateAggregator()); - } - - return $q; - } - - /** - * Convert the query string parameters to a query string string - * - * @return string - * @throws RuntimeException - */ - public function __toString() - { - if (!$this->data) { - return ''; - } - - $queryList = array(); - foreach ($this->prepareData($this->data) as $name => $value) { - $queryList[] = $this->convertKvp($name, $value); - } - - return implode($this->fieldSeparator, $queryList); - } - - /** - * Get the query string field separator - * - * @return string - */ - public function getFieldSeparator() - { - return $this->fieldSeparator; - } - - /** - * Get the query string value separator - * - * @return string - */ - public function getValueSeparator() - { - return $this->valueSeparator; - } - - /** - * Returns the type of URL encoding used by the query string - * - * One of: false, "RFC 3986", or "application/x-www-form-urlencoded" - * - * @return bool|string - */ - public function getUrlEncoding() - { - return $this->urlEncode; - } - - /** - * Returns true or false if using URL encoding - * - * @return bool - */ - public function isUrlEncoding() - { - return $this->urlEncode !== false; - } - - /** - * Provide a function for combining multi-valued query string parameters into a single or multiple fields - * - * @param null|QueryAggregatorInterface $aggregator Pass in a QueryAggregatorInterface object to handle converting - * deeply nested query string variables into a flattened array. - * Pass null to use the default PHP style aggregator. For legacy - * reasons, this function accepts a callable that must accepts a - * $key, $value, and query object. - * @return self - * @see \Guzzle\Http\QueryString::aggregateUsingComma() - */ - public function setAggregator(QueryAggregatorInterface $aggregator = null) - { - // Use the default aggregator if none was set - if (!$aggregator) { - if (!self::$defaultAggregator) { - self::$defaultAggregator = new PhpAggregator(); - } - $aggregator = self::$defaultAggregator; - } - - $this->aggregator = $aggregator; - - return $this; - } - - /** - * Set whether or not field names and values should be rawurlencoded - * - * @param bool|string $encode Set to TRUE to use RFC 3986 encoding (rawurlencode), false to disable encoding, or - * form_urlencoding to use application/x-www-form-urlencoded encoding (urlencode) - * @return self - */ - public function useUrlEncoding($encode) - { - $this->urlEncode = ($encode === true) ? self::RFC_3986 : $encode; - - return $this; - } - - /** - * Set the query string separator - * - * @param string $separator The query string separator that will separate fields - * - * @return self - */ - public function setFieldSeparator($separator) - { - $this->fieldSeparator = $separator; - - return $this; - } - - /** - * Set the query string value separator - * - * @param string $separator The query string separator that will separate values from fields - * - * @return self - */ - public function setValueSeparator($separator) - { - $this->valueSeparator = $separator; - - return $this; - } - - /** - * Returns an array of url encoded field names and values - * - * @return array - */ - public function urlEncode() - { - return $this->prepareData($this->data); - } - - /** - * URL encodes a value based on the url encoding type of the query string object - * - * @param string $value Value to encode - * - * @return string - */ - public function encodeValue($value) - { - if ($this->urlEncode == self::RFC_3986) { - return rawurlencode($value); - } elseif ($this->urlEncode == self::FORM_URLENCODED) { - return urlencode($value); - } else { - return (string) $value; - } - } - - /** - * Url encode parameter data and convert nested query strings into a flattened hash. - * - * @param array $data The data to encode - * - * @return array Returns an array of encoded values and keys - */ - protected function prepareData(array $data) - { - // If no aggregator is present then set the default - if (!$this->aggregator) { - $this->setAggregator(null); - } - - $temp = array(); - foreach ($data as $key => $value) { - if ($value === false || $value === null) { - // False and null will not include the "=". Use an empty string to include the "=". - $temp[$this->encodeValue($key)] = $value; - } elseif (is_array($value)) { - $temp = array_merge($temp, $this->aggregator->aggregate($key, $value, $this)); - } else { - $temp[$this->encodeValue($key)] = $this->encodeValue($value); - } - } - - return $temp; - } - - /** - * Converts a key value pair that can contain strings, nulls, false, or arrays - * into a single string. - * - * @param string $name Name of the field - * @param mixed $value Value of the field - * @return string - */ - private function convertKvp($name, $value) - { - if ($value === self::BLANK || $value === null || $value === false) { - return $name; - } elseif (!is_array($value)) { - return $name . $this->valueSeparator . $value; - } - - $result = ''; - foreach ($value as $v) { - $result .= $this->convertKvp($name, $v) . $this->fieldSeparator; - } - - return rtrim($result, $this->fieldSeparator); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/ReadLimitEntityBody.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/ReadLimitEntityBody.php deleted file mode 100644 index ef282733b..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/ReadLimitEntityBody.php +++ /dev/null @@ -1,122 +0,0 @@ -setLimit($limit)->setOffset($offset); - } - - /** - * Returns only a subset of the decorated entity body when cast as a string - * {@inheritdoc} - */ - public function __toString() - { - if (!$this->body->isReadable() || - (!$this->body->isSeekable() && $this->body->isConsumed()) - ) { - return ''; - } - - $originalPos = $this->body->ftell(); - $this->body->seek($this->offset); - $data = ''; - while (!$this->feof()) { - $data .= $this->read(1048576); - } - $this->body->seek($originalPos); - - return (string) $data ?: ''; - } - - public function isConsumed() - { - return $this->body->isConsumed() || - ($this->body->ftell() >= $this->offset + $this->limit); - } - - /** - * Returns the Content-Length of the limited subset of data - * {@inheritdoc} - */ - public function getContentLength() - { - $length = $this->body->getContentLength(); - - return $length === false - ? $this->limit - : min($this->limit, min($length, $this->offset + $this->limit) - $this->offset); - } - - /** - * Allow for a bounded seek on the read limited entity body - * {@inheritdoc} - */ - public function seek($offset, $whence = SEEK_SET) - { - return $whence === SEEK_SET - ? $this->body->seek(max($this->offset, min($this->offset + $this->limit, $offset))) - : false; - } - - /** - * Set the offset to start limiting from - * - * @param int $offset Offset to seek to and begin byte limiting from - * - * @return self - */ - public function setOffset($offset) - { - $this->body->seek($offset); - $this->offset = $offset; - - return $this; - } - - /** - * Set the limit of bytes that the decorator allows to be read from the stream - * - * @param int $limit Total number of bytes to allow to be read from the stream - * - * @return self - */ - public function setLimit($limit) - { - $this->limit = $limit; - - return $this; - } - - public function read($length) - { - // Check if the current position is less than the total allowed bytes + original offset - $remaining = ($this->offset + $this->limit) - $this->body->ftell(); - if ($remaining > 0) { - // Only return the amount of requested data, ensuring that the byte limit is not exceeded - return $this->body->read(min($remaining, $length)); - } else { - return false; - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/RedirectPlugin.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/RedirectPlugin.php deleted file mode 100644 index 1a824b8b7..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/RedirectPlugin.php +++ /dev/null @@ -1,250 +0,0 @@ - array('onRequestSent', 100), - 'request.clone' => 'cleanupRequest', - 'request.before_send' => 'cleanupRequest' - ); - } - - /** - * Clean up the parameters of a request when it is cloned - * - * @param Event $event Event emitted - */ - public function cleanupRequest(Event $event) - { - $params = $event['request']->getParams(); - unset($params[self::REDIRECT_COUNT]); - unset($params[self::PARENT_REQUEST]); - } - - /** - * Called when a request receives a redirect response - * - * @param Event $event Event emitted - */ - public function onRequestSent(Event $event) - { - $response = $event['response']; - $request = $event['request']; - - // Only act on redirect requests with Location headers - if (!$response || $request->getParams()->get(self::DISABLE)) { - return; - } - - // Trace the original request based on parameter history - $original = $this->getOriginalRequest($request); - - // Terminating condition to set the effective response on the original request - if (!$response->isRedirect() || !$response->hasHeader('Location')) { - if ($request !== $original) { - // This is a terminating redirect response, so set it on the original request - $response->getParams()->set(self::REDIRECT_COUNT, $original->getParams()->get(self::REDIRECT_COUNT)); - $original->setResponse($response); - $response->setEffectiveUrl($request->getUrl()); - } - return; - } - - $this->sendRedirectRequest($original, $request, $response); - } - - /** - * Get the original request that initiated a series of redirects - * - * @param RequestInterface $request Request to get the original request from - * - * @return RequestInterface - */ - protected function getOriginalRequest(RequestInterface $request) - { - $original = $request; - // The number of redirects is held on the original request, so determine which request that is - while ($parent = $original->getParams()->get(self::PARENT_REQUEST)) { - $original = $parent; - } - - return $original; - } - - /** - * Create a redirect request for a specific request object - * - * Takes into account strict RFC compliant redirection (e.g. redirect POST with POST) vs doing what most clients do - * (e.g. redirect POST with GET). - * - * @param RequestInterface $request Request being redirected - * @param RequestInterface $original Original request - * @param int $statusCode Status code of the redirect - * @param string $location Location header of the redirect - * - * @return RequestInterface Returns a new redirect request - * @throws CouldNotRewindStreamException If the body needs to be rewound but cannot - */ - protected function createRedirectRequest( - RequestInterface $request, - $statusCode, - $location, - RequestInterface $original - ) { - $redirectRequest = null; - $strict = $original->getParams()->get(self::STRICT_REDIRECTS); - - // Switch method to GET for 303 redirects. 301 and 302 redirects also switch to GET unless we are forcing RFC - // compliance to emulate what most browsers do. NOTE: IE only switches methods on 301/302 when coming from a POST. - if ($request instanceof EntityEnclosingRequestInterface && ($statusCode == 303 || (!$strict && $statusCode <= 302))) { - $redirectRequest = RequestFactory::getInstance()->cloneRequestWithMethod($request, 'GET'); - } else { - $redirectRequest = clone $request; - } - - $redirectRequest->setIsRedirect(true); - // Always use the same response body when redirecting - $redirectRequest->setResponseBody($request->getResponseBody()); - - $location = Url::factory($location); - // If the location is not absolute, then combine it with the original URL - if (!$location->isAbsolute()) { - $originalUrl = $redirectRequest->getUrl(true); - // Remove query string parameters and just take what is present on the redirect Location header - $originalUrl->getQuery()->clear(); - $location = $originalUrl->combine((string) $location, true); - } - - $redirectRequest->setUrl($location); - - // Add the parent request to the request before it sends (make sure it's before the onRequestClone event too) - $redirectRequest->getEventDispatcher()->addListener( - 'request.before_send', - $func = function ($e) use (&$func, $request, $redirectRequest) { - $redirectRequest->getEventDispatcher()->removeListener('request.before_send', $func); - $e['request']->getParams()->set(RedirectPlugin::PARENT_REQUEST, $request); - } - ); - - // Rewind the entity body of the request if needed - if ($redirectRequest instanceof EntityEnclosingRequestInterface && $redirectRequest->getBody()) { - $body = $redirectRequest->getBody(); - // Only rewind the body if some of it has been read already, and throw an exception if the rewind fails - if ($body->ftell() && !$body->rewind()) { - throw new CouldNotRewindStreamException( - 'Unable to rewind the non-seekable entity body of the request after redirecting. cURL probably ' - . 'sent part of body before the redirect occurred. Try adding acustom rewind function using on the ' - . 'entity body of the request using setRewindFunction().' - ); - } - } - - return $redirectRequest; - } - - /** - * Prepare the request for redirection and enforce the maximum number of allowed redirects per client - * - * @param RequestInterface $original Original request - * @param RequestInterface $request Request to prepare and validate - * @param Response $response The current response - * - * @return RequestInterface - */ - protected function prepareRedirection(RequestInterface $original, RequestInterface $request, Response $response) - { - $params = $original->getParams(); - // This is a new redirect, so increment the redirect counter - $current = $params[self::REDIRECT_COUNT] + 1; - $params[self::REDIRECT_COUNT] = $current; - // Use a provided maximum value or default to a max redirect count of 5 - $max = isset($params[self::MAX_REDIRECTS]) ? $params[self::MAX_REDIRECTS] : $this->defaultMaxRedirects; - - // Throw an exception if the redirect count is exceeded - if ($current > $max) { - $this->throwTooManyRedirectsException($original, $max); - return false; - } else { - // Create a redirect request based on the redirect rules set on the request - return $this->createRedirectRequest( - $request, - $response->getStatusCode(), - trim($response->getLocation()), - $original - ); - } - } - - /** - * Send a redirect request and handle any errors - * - * @param RequestInterface $original The originating request - * @param RequestInterface $request The current request being redirected - * @param Response $response The response of the current request - * - * @throws BadResponseException|\Exception - */ - protected function sendRedirectRequest(RequestInterface $original, RequestInterface $request, Response $response) - { - // Validate and create a redirect request based on the original request and current response - if ($redirectRequest = $this->prepareRedirection($original, $request, $response)) { - try { - $redirectRequest->send(); - } catch (BadResponseException $e) { - $e->getResponse(); - if (!$e->getResponse()) { - throw $e; - } - } - } - } - - /** - * Throw a too many redirects exception for a request - * - * @param RequestInterface $original Request - * @param int $max Max allowed redirects - * - * @throws TooManyRedirectsException when too many redirects have been issued - */ - protected function throwTooManyRedirectsException(RequestInterface $original, $max) - { - $original->getEventDispatcher()->addListener( - 'request.complete', - $func = function ($e) use (&$func, $original, $max) { - $original->getEventDispatcher()->removeListener('request.complete', $func); - $str = "{$max} redirects were issued for this request:\n" . $e['request']->getRawHeaders(); - throw new TooManyRedirectsException($str); - } - ); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/StaticClient.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/StaticClient.php deleted file mode 100644 index dbd4c1841..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/StaticClient.php +++ /dev/null @@ -1,157 +0,0 @@ -createRequest($method, $url, null, null, $options); - - if (isset($options['stream'])) { - if ($options['stream'] instanceof StreamRequestFactoryInterface) { - return $options['stream']->fromRequest($request); - } elseif ($options['stream'] == true) { - $streamFactory = new PhpStreamRequestFactory(); - return $streamFactory->fromRequest($request); - } - } - - return $request->send(); - } - - /** - * Send a GET request - * - * @param string $url URL of the request - * @param array $options Array of request options - * - * @return \Guzzle\Http\Message\Response - * @see Guzzle::request for a list of available options - */ - public static function get($url, $options = array()) - { - return self::request('GET', $url, $options); - } - - /** - * Send a HEAD request - * - * @param string $url URL of the request - * @param array $options Array of request options - * - * @return \Guzzle\Http\Message\Response - * @see Guzzle::request for a list of available options - */ - public static function head($url, $options = array()) - { - return self::request('HEAD', $url, $options); - } - - /** - * Send a DELETE request - * - * @param string $url URL of the request - * @param array $options Array of request options - * - * @return \Guzzle\Http\Message\Response - * @see Guzzle::request for a list of available options - */ - public static function delete($url, $options = array()) - { - return self::request('DELETE', $url, $options); - } - - /** - * Send a POST request - * - * @param string $url URL of the request - * @param array $options Array of request options - * - * @return \Guzzle\Http\Message\Response - * @see Guzzle::request for a list of available options - */ - public static function post($url, $options = array()) - { - return self::request('POST', $url, $options); - } - - /** - * Send a PUT request - * - * @param string $url URL of the request - * @param array $options Array of request options - * - * @return \Guzzle\Http\Message\Response - * @see Guzzle::request for a list of available options - */ - public static function put($url, $options = array()) - { - return self::request('PUT', $url, $options); - } - - /** - * Send a PATCH request - * - * @param string $url URL of the request - * @param array $options Array of request options - * - * @return \Guzzle\Http\Message\Response - * @see Guzzle::request for a list of available options - */ - public static function patch($url, $options = array()) - { - return self::request('PATCH', $url, $options); - } - - /** - * Send an OPTIONS request - * - * @param string $url URL of the request - * @param array $options Array of request options - * - * @return \Guzzle\Http\Message\Response - * @see Guzzle::request for a list of available options - */ - public static function options($url, $options = array()) - { - return self::request('OPTIONS', $url, $options); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Url.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Url.php deleted file mode 100644 index 6a4e77245..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/Url.php +++ /dev/null @@ -1,554 +0,0 @@ - null, 'host' => null, 'path' => null, 'port' => null, 'query' => null, - 'user' => null, 'pass' => null, 'fragment' => null); - - if (false === ($parts = parse_url($url))) { - throw new InvalidArgumentException('Was unable to parse malformed url: ' . $url); - } - - $parts += $defaults; - - // Convert the query string into a QueryString object - if ($parts['query'] || 0 !== strlen($parts['query'])) { - $parts['query'] = QueryString::fromString($parts['query']); - } - - return new static($parts['scheme'], $parts['host'], $parts['user'], - $parts['pass'], $parts['port'], $parts['path'], $parts['query'], - $parts['fragment']); - } - - /** - * Build a URL from parse_url parts. The generated URL will be a relative URL if a scheme or host are not provided. - * - * @param array $parts Array of parse_url parts - * - * @return string - */ - public static function buildUrl(array $parts) - { - $url = $scheme = ''; - - if (isset($parts['scheme'])) { - $scheme = $parts['scheme']; - $url .= $scheme . ':'; - } - - if (isset($parts['host'])) { - $url .= '//'; - if (isset($parts['user'])) { - $url .= $parts['user']; - if (isset($parts['pass'])) { - $url .= ':' . $parts['pass']; - } - $url .= '@'; - } - - $url .= $parts['host']; - - // Only include the port if it is not the default port of the scheme - if (isset($parts['port']) - && !(($scheme == 'http' && $parts['port'] == 80) || ($scheme == 'https' && $parts['port'] == 443)) - ) { - $url .= ':' . $parts['port']; - } - } - - // Add the path component if present - if (isset($parts['path']) && 0 !== strlen($parts['path'])) { - // Always ensure that the path begins with '/' if set and something is before the path - if ($url && $parts['path'][0] != '/' && substr($url, -1) != '/') { - $url .= '/'; - } - $url .= $parts['path']; - } - - // Add the query string if present - if (isset($parts['query'])) { - $url .= '?' . $parts['query']; - } - - // Ensure that # is only added to the url if fragment contains anything. - if (isset($parts['fragment'])) { - $url .= '#' . $parts['fragment']; - } - - return $url; - } - - /** - * Create a new URL from URL parts - * - * @param string $scheme Scheme of the URL - * @param string $host Host of the URL - * @param string $username Username of the URL - * @param string $password Password of the URL - * @param int $port Port of the URL - * @param string $path Path of the URL - * @param QueryString|array|string $query Query string of the URL - * @param string $fragment Fragment of the URL - */ - public function __construct($scheme, $host, $username = null, $password = null, $port = null, $path = null, QueryString $query = null, $fragment = null) - { - $this->scheme = $scheme; - $this->host = $host; - $this->port = $port; - $this->username = $username; - $this->password = $password; - $this->fragment = $fragment; - if (!$query) { - $this->query = new QueryString(); - } else { - $this->setQuery($query); - } - $this->setPath($path); - } - - /** - * Clone the URL - */ - public function __clone() - { - $this->query = clone $this->query; - } - - /** - * Returns the URL as a URL string - * - * @return string - */ - public function __toString() - { - return self::buildUrl($this->getParts()); - } - - /** - * Get the parts of the URL as an array - * - * @return array - */ - public function getParts() - { - $query = (string) $this->query; - - return array( - 'scheme' => $this->scheme, - 'user' => $this->username, - 'pass' => $this->password, - 'host' => $this->host, - 'port' => $this->port, - 'path' => $this->getPath(), - 'query' => $query !== '' ? $query : null, - 'fragment' => $this->fragment, - ); - } - - /** - * Set the host of the request. - * - * @param string $host Host to set (e.g. www.yahoo.com, yahoo.com) - * - * @return Url - */ - public function setHost($host) - { - if (strpos($host, ':') === false) { - $this->host = $host; - } else { - list($host, $port) = explode(':', $host); - $this->host = $host; - $this->setPort($port); - } - - return $this; - } - - /** - * Get the host part of the URL - * - * @return string - */ - public function getHost() - { - return $this->host; - } - - /** - * Set the scheme part of the URL (http, https, ftp, etc) - * - * @param string $scheme Scheme to set - * - * @return Url - */ - public function setScheme($scheme) - { - if ($this->scheme == 'http' && $this->port == 80) { - $this->port = null; - } elseif ($this->scheme == 'https' && $this->port == 443) { - $this->port = null; - } - - $this->scheme = $scheme; - - return $this; - } - - /** - * Get the scheme part of the URL - * - * @return string - */ - public function getScheme() - { - return $this->scheme; - } - - /** - * Set the port part of the URL - * - * @param int $port Port to set - * - * @return Url - */ - public function setPort($port) - { - $this->port = $port; - - return $this; - } - - /** - * Get the port part of the URl. Will return the default port for a given scheme if no port has been set. - * - * @return int|null - */ - public function getPort() - { - if ($this->port) { - return $this->port; - } elseif ($this->scheme == 'http') { - return 80; - } elseif ($this->scheme == 'https') { - return 443; - } - - return null; - } - - /** - * Set the path part of the URL - * - * @param array|string $path Path string or array of path segments - * - * @return Url - */ - public function setPath($path) - { - static $pathReplace = array(' ' => '%20', '?' => '%3F'); - if (is_array($path)) { - $path = '/' . implode('/', $path); - } - - $this->path = strtr($path, $pathReplace); - - return $this; - } - - /** - * Normalize the URL so that double slashes and relative paths are removed - * - * @return Url - */ - public function normalizePath() - { - if (!$this->path || $this->path == '/' || $this->path == '*') { - return $this; - } - - $results = array(); - $segments = $this->getPathSegments(); - foreach ($segments as $segment) { - if ($segment == '..') { - array_pop($results); - } elseif ($segment != '.' && $segment != '') { - $results[] = $segment; - } - } - - // Combine the normalized parts and add the leading slash if needed - $this->path = ($this->path[0] == '/' ? '/' : '') . implode('/', $results); - - // Add the trailing slash if necessary - if ($this->path != '/' && end($segments) == '') { - $this->path .= '/'; - } - - return $this; - } - - /** - * Add a relative path to the currently set path. - * - * @param string $relativePath Relative path to add - * - * @return Url - */ - public function addPath($relativePath) - { - if ($relativePath != '/' && is_string($relativePath) && strlen($relativePath) > 0) { - // Add a leading slash if needed - if ($relativePath[0] != '/') { - $relativePath = '/' . $relativePath; - } - $this->setPath(str_replace('//', '/', $this->path . $relativePath)); - } - - return $this; - } - - /** - * Get the path part of the URL - * - * @return string - */ - public function getPath() - { - return $this->path; - } - - /** - * Get the path segments of the URL as an array - * - * @return array - */ - public function getPathSegments() - { - return array_slice(explode('/', $this->getPath()), 1); - } - - /** - * Set the password part of the URL - * - * @param string $password Password to set - * - * @return Url - */ - public function setPassword($password) - { - $this->password = $password; - - return $this; - } - - /** - * Get the password part of the URL - * - * @return null|string - */ - public function getPassword() - { - return $this->password; - } - - /** - * Set the username part of the URL - * - * @param string $username Username to set - * - * @return Url - */ - public function setUsername($username) - { - $this->username = $username; - - return $this; - } - - /** - * Get the username part of the URl - * - * @return null|string - */ - public function getUsername() - { - return $this->username; - } - - /** - * Get the query part of the URL as a QueryString object - * - * @return QueryString - */ - public function getQuery() - { - return $this->query; - } - - /** - * Set the query part of the URL - * - * @param QueryString|string|array $query Query to set - * - * @return Url - */ - public function setQuery($query) - { - if (is_string($query)) { - $output = null; - parse_str($query, $output); - $this->query = new QueryString($output); - } elseif (is_array($query)) { - $this->query = new QueryString($query); - } elseif ($query instanceof QueryString) { - $this->query = $query; - } - - return $this; - } - - /** - * Get the fragment part of the URL - * - * @return null|string - */ - public function getFragment() - { - return $this->fragment; - } - - /** - * Set the fragment part of the URL - * - * @param string $fragment Fragment to set - * - * @return Url - */ - public function setFragment($fragment) - { - $this->fragment = $fragment; - - return $this; - } - - /** - * Check if this is an absolute URL - * - * @return bool - */ - public function isAbsolute() - { - return $this->scheme && $this->host; - } - - /** - * Combine the URL with another URL. Follows the rules specific in RFC 3986 section 5.4. - * - * @param string $url Relative URL to combine with - * @param bool $strictRfc3986 Set to true to use strict RFC 3986 compliance when merging paths. When first - * released, Guzzle used an incorrect algorithm for combining relative URL paths. In - * order to not break users, we introduced this flag to allow the merging of URLs based - * on strict RFC 3986 section 5.4.1. This means that "http://a.com/foo/baz" merged with - * "bar" would become "http://a.com/foo/bar". When this value is set to false, it would - * become "http://a.com/foo/baz/bar". - * @return Url - * @throws InvalidArgumentException - * @link http://tools.ietf.org/html/rfc3986#section-5.4 - */ - public function combine($url, $strictRfc3986 = false) - { - $url = self::factory($url); - - // Use the more absolute URL as the base URL - if (!$this->isAbsolute() && $url->isAbsolute()) { - $url = $url->combine($this); - } - - // Passing a URL with a scheme overrides everything - if ($buffer = $url->getScheme()) { - $this->scheme = $buffer; - $this->host = $url->getHost(); - $this->port = $url->getPort(); - $this->username = $url->getUsername(); - $this->password = $url->getPassword(); - $this->path = $url->getPath(); - $this->query = $url->getQuery(); - $this->fragment = $url->getFragment(); - return $this; - } - - // Setting a host overrides the entire rest of the URL - if ($buffer = $url->getHost()) { - $this->host = $buffer; - $this->port = $url->getPort(); - $this->username = $url->getUsername(); - $this->password = $url->getPassword(); - $this->path = $url->getPath(); - $this->query = $url->getQuery(); - $this->fragment = $url->getFragment(); - return $this; - } - - $path = $url->getPath(); - $query = $url->getQuery(); - - if (!$path) { - if (count($query)) { - $this->addQuery($query, $strictRfc3986); - } - } else { - if ($path[0] == '/') { - $this->path = $path; - } elseif ($strictRfc3986) { - $this->path .= '/../' . $path; - } else { - $this->path .= '/' . $path; - } - $this->normalizePath(); - $this->addQuery($query, $strictRfc3986); - } - - $this->fragment = $url->getFragment(); - - return $this; - } - - private function addQuery(QueryString $new, $strictRfc386) - { - if (!$strictRfc386) { - $new->merge($this->query); - } - - $this->query = $new; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/composer.json b/bb-vendor/guzzle/guzzle/src/Guzzle/Http/composer.json deleted file mode 100644 index 9384a5bf9..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Http/composer.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "guzzle/http", - "description": "HTTP libraries used by Guzzle", - "homepage": "http://guzzlephp.org/", - "keywords": ["http client", "http", "client", "Guzzle", "curl"], - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "require": { - "php": ">=5.3.2", - "guzzle/common": "self.version", - "guzzle/parser": "self.version", - "guzzle/stream": "self.version" - }, - "suggest": { - "ext-curl": "*" - }, - "autoload": { - "psr-0": { "Guzzle\\Http": "" } - }, - "target-dir": "Guzzle/Http", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Inflection/Inflector.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Inflection/Inflector.php deleted file mode 100644 index c6997734c..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Inflection/Inflector.php +++ /dev/null @@ -1,38 +0,0 @@ - array(), - 'camel' => array() - ); - - /** @var int Max entries per cache */ - protected $maxCacheSize; - - /** @var InflectorInterface Decorated inflector */ - protected $decoratedInflector; - - /** - * @param InflectorInterface $inflector Inflector being decorated - * @param int $maxCacheSize Maximum number of cached items to hold per cache - */ - public function __construct(InflectorInterface $inflector, $maxCacheSize = 500) - { - $this->decoratedInflector = $inflector; - $this->maxCacheSize = $maxCacheSize; - } - - public function snake($word) - { - if (!isset($this->cache['snake'][$word])) { - $this->pruneCache('snake'); - $this->cache['snake'][$word] = $this->decoratedInflector->snake($word); - } - - return $this->cache['snake'][$word]; - } - - /** - * Converts strings from snake_case to upper CamelCase - * - * @param string $word Value to convert into upper CamelCase - * - * @return string - */ - public function camel($word) - { - if (!isset($this->cache['camel'][$word])) { - $this->pruneCache('camel'); - $this->cache['camel'][$word] = $this->decoratedInflector->camel($word); - } - - return $this->cache['camel'][$word]; - } - - /** - * Prune one of the named caches by removing 20% of the cache if it is full - * - * @param string $cache Type of cache to prune - */ - protected function pruneCache($cache) - { - if (count($this->cache[$cache]) == $this->maxCacheSize) { - $this->cache[$cache] = array_slice($this->cache[$cache], $this->maxCacheSize * 0.2); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Inflection/PreComputedInflector.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Inflection/PreComputedInflector.php deleted file mode 100644 index db37e4fe4..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Inflection/PreComputedInflector.php +++ /dev/null @@ -1,59 +0,0 @@ - array(), - 'camel' => array() - ); - - /** @var InflectorInterface Decorated inflector */ - protected $decoratedInflector; - - /** - * @param InflectorInterface $inflector Inflector being decorated - * @param array $snake Hash of pre-computed camel to snake - * @param array $camel Hash of pre-computed snake to camel - * @param bool $mirror Mirror snake and camel reflections - */ - public function __construct(InflectorInterface $inflector, array $snake = array(), array $camel = array(), $mirror = false) - { - if ($mirror) { - $camel = array_merge(array_flip($snake), $camel); - $snake = array_merge(array_flip($camel), $snake); - } - - $this->decoratedInflector = $inflector; - $this->mapping = array( - 'snake' => $snake, - 'camel' => $camel - ); - } - - public function snake($word) - { - return isset($this->mapping['snake'][$word]) - ? $this->mapping['snake'][$word] - : $this->decoratedInflector->snake($word); - } - - /** - * Converts strings from snake_case to upper CamelCase - * - * @param string $word Value to convert into upper CamelCase - * - * @return string - */ - public function camel($word) - { - return isset($this->mapping['camel'][$word]) - ? $this->mapping['camel'][$word] - : $this->decoratedInflector->camel($word); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Inflection/composer.json b/bb-vendor/guzzle/guzzle/src/Guzzle/Inflection/composer.json deleted file mode 100644 index 93f9e7b72..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Inflection/composer.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "guzzle/inflection", - "description": "Guzzle inflection component", - "homepage": "http://guzzlephp.org/", - "keywords": ["inflection", "guzzle"], - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "require": { - "php": ">=5.3.2" - }, - "autoload": { - "psr-0": { "Guzzle\\Inflection": "" } - }, - "target-dir": "Guzzle/Inflection", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/AppendIterator.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/AppendIterator.php deleted file mode 100644 index 1b6bd7e53..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/AppendIterator.php +++ /dev/null @@ -1,19 +0,0 @@ -getArrayIterator()->append($iterator); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/ChunkedIterator.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/ChunkedIterator.php deleted file mode 100644 index d76cdd439..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/ChunkedIterator.php +++ /dev/null @@ -1,56 +0,0 @@ -chunkSize = $chunkSize; - } - - public function rewind() - { - parent::rewind(); - $this->next(); - } - - public function next() - { - $this->chunk = array(); - for ($i = 0; $i < $this->chunkSize && parent::valid(); $i++) { - $this->chunk[] = parent::current(); - parent::next(); - } - } - - public function current() - { - return $this->chunk; - } - - public function valid() - { - return (bool) $this->chunk; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/FilterIterator.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/FilterIterator.php deleted file mode 100644 index b103367b6..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/FilterIterator.php +++ /dev/null @@ -1,36 +0,0 @@ -callback = $callback; - } - - public function accept() - { - return call_user_func($this->callback, $this->current()); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/MapIterator.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/MapIterator.php deleted file mode 100644 index 7e586bda6..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/MapIterator.php +++ /dev/null @@ -1,34 +0,0 @@ -callback = $callback; - } - - public function current() - { - return call_user_func($this->callback, parent::current()); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/MethodProxyIterator.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/MethodProxyIterator.php deleted file mode 100644 index de4ab0360..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/MethodProxyIterator.php +++ /dev/null @@ -1,27 +0,0 @@ -getInnerIterator(); - while ($i instanceof \OuterIterator) { - $i = $i->getInnerIterator(); - } - - return call_user_func_array(array($i, $name), $args); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/README.md b/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/README.md deleted file mode 100644 index 8bb7e08e2..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/README.md +++ /dev/null @@ -1,25 +0,0 @@ -Guzzle Iterator -=============== - -Provides useful Iterators and Iterator decorators - -- ChunkedIterator: Pulls out chunks from an inner iterator and yields the chunks as arrays -- FilterIterator: Used when PHP 5.4's CallbackFilterIterator is not available -- MapIterator: Maps values before yielding -- MethodProxyIterator: Proxies missing method calls to the innermost iterator - -### Installing via Composer - -```bash -# Install Composer -curl -sS https://getcomposer.org/installer | php - -# Add Guzzle as a dependency -php composer.phar require guzzle/iterator:~3.0 -``` - -After installing, you need to require Composer's autoloader: - -```php -require 'vendor/autoload.php'; -``` diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/composer.json b/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/composer.json deleted file mode 100644 index ee1737987..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Iterator/composer.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "guzzle/iterator", - "description": "Provides helpful iterators and iterator decorators", - "keywords": ["iterator", "guzzle"], - "homepage": "http://guzzlephp.org/", - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "require": { - "php": ">=5.3.2", - "guzzle/common": ">=2.8.0" - }, - "autoload": { - "psr-0": { "Guzzle\\Iterator": "/" } - }, - "target-dir": "Guzzle/Iterator", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Log/AbstractLogAdapter.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Log/AbstractLogAdapter.php deleted file mode 100644 index 7f6271bcb..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Log/AbstractLogAdapter.php +++ /dev/null @@ -1,16 +0,0 @@ -log; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Log/ArrayLogAdapter.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Log/ArrayLogAdapter.php deleted file mode 100644 index a70fc8d42..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Log/ArrayLogAdapter.php +++ /dev/null @@ -1,34 +0,0 @@ -logs[] = array('message' => $message, 'priority' => $priority, 'extras' => $extras); - } - - /** - * Get logged entries - * - * @return array - */ - public function getLogs() - { - return $this->logs; - } - - /** - * Clears logged entries - */ - public function clearLogs() - { - $this->logs = array(); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Log/ClosureLogAdapter.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Log/ClosureLogAdapter.php deleted file mode 100644 index d4bb73f21..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Log/ClosureLogAdapter.php +++ /dev/null @@ -1,23 +0,0 @@ -log = $logObject; - } - - public function log($message, $priority = LOG_INFO, $extras = array()) - { - call_user_func($this->log, $message, $priority, $extras); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Log/LogAdapterInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Log/LogAdapterInterface.php deleted file mode 100644 index d7ac4ea7c..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Log/LogAdapterInterface.php +++ /dev/null @@ -1,18 +0,0 @@ ->>>>>>>\n{request}\n<<<<<<<<\n{response}\n--------\n{curl_stderr}"; - const SHORT_FORMAT = '[{ts}] "{method} {resource} {protocol}/{version}" {code}'; - - /** - * @var string Template used to format log messages - */ - protected $template; - - /** - * @param string $template Log message template - */ - public function __construct($template = self::DEFAULT_FORMAT) - { - $this->template = $template ?: self::DEFAULT_FORMAT; - } - - /** - * Set the template to use for logging - * - * @param string $template Log message template - * - * @return self - */ - public function setTemplate($template) - { - $this->template = $template; - - return $this; - } - - /** - * Returns a formatted message - * - * @param RequestInterface $request Request that was sent - * @param Response $response Response that was received - * @param CurlHandle $handle Curl handle associated with the message - * @param array $customData Associative array of custom template data - * - * @return string - */ - public function format( - RequestInterface $request, - Response $response = null, - CurlHandle $handle = null, - array $customData = array() - ) { - $cache = $customData; - - return preg_replace_callback( - '/{\s*([A-Za-z_\-\.0-9]+)\s*}/', - function (array $matches) use ($request, $response, $handle, &$cache) { - - if (array_key_exists($matches[1], $cache)) { - return $cache[$matches[1]]; - } - - $result = ''; - switch ($matches[1]) { - case 'request': - $result = (string) $request; - break; - case 'response': - $result = (string) $response; - break; - case 'req_body': - $result = $request instanceof EntityEnclosingRequestInterface - ? (string) $request->getBody() : ''; - break; - case 'res_body': - $result = $response ? $response->getBody(true) : ''; - break; - case 'ts': - $result = gmdate('c'); - break; - case 'method': - $result = $request->getMethod(); - break; - case 'url': - $result = (string) $request->getUrl(); - break; - case 'resource': - $result = $request->getResource(); - break; - case 'protocol': - $result = 'HTTP'; - break; - case 'version': - $result = $request->getProtocolVersion(); - break; - case 'host': - $result = $request->getHost(); - break; - case 'hostname': - $result = gethostname(); - break; - case 'port': - $result = $request->getPort(); - break; - case 'code': - $result = $response ? $response->getStatusCode() : ''; - break; - case 'phrase': - $result = $response ? $response->getReasonPhrase() : ''; - break; - case 'connect_time': - $result = $handle && $handle->getInfo(CURLINFO_CONNECT_TIME) - ? $handle->getInfo(CURLINFO_CONNECT_TIME) - : ($response ? $response->getInfo('connect_time') : ''); - break; - case 'total_time': - $result = $handle && $handle->getInfo(CURLINFO_TOTAL_TIME) - ? $handle->getInfo(CURLINFO_TOTAL_TIME) - : ($response ? $response->getInfo('total_time') : ''); - break; - case 'curl_error': - $result = $handle ? $handle->getError() : ''; - break; - case 'curl_code': - $result = $handle ? $handle->getErrorNo() : ''; - break; - case 'curl_stderr': - $result = $handle ? $handle->getStderr() : ''; - break; - default: - if (strpos($matches[1], 'req_header_') === 0) { - $result = $request->getHeader(substr($matches[1], 11)); - } elseif ($response && strpos($matches[1], 'res_header_') === 0) { - $result = $response->getHeader(substr($matches[1], 11)); - } - } - - $cache[$matches[1]] = $result; - return $result; - }, - $this->template - ); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Log/MonologLogAdapter.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Log/MonologLogAdapter.php deleted file mode 100644 index 6afe7b62a..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Log/MonologLogAdapter.php +++ /dev/null @@ -1,34 +0,0 @@ - Logger::DEBUG, - LOG_INFO => Logger::INFO, - LOG_WARNING => Logger::WARNING, - LOG_ERR => Logger::ERROR, - LOG_CRIT => Logger::CRITICAL, - LOG_ALERT => Logger::ALERT - ); - - public function __construct(Logger $logObject) - { - $this->log = $logObject; - } - - public function log($message, $priority = LOG_INFO, $extras = array()) - { - $this->log->addRecord(self::$mapping[$priority], $message, $extras); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Log/PsrLogAdapter.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Log/PsrLogAdapter.php deleted file mode 100644 index 38a2b600d..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Log/PsrLogAdapter.php +++ /dev/null @@ -1,36 +0,0 @@ - LogLevel::DEBUG, - LOG_INFO => LogLevel::INFO, - LOG_WARNING => LogLevel::WARNING, - LOG_ERR => LogLevel::ERROR, - LOG_CRIT => LogLevel::CRITICAL, - LOG_ALERT => LogLevel::ALERT - ); - - public function __construct(LoggerInterface $logObject) - { - $this->log = $logObject; - } - - public function log($message, $priority = LOG_INFO, $extras = array()) - { - $this->log->log(self::$mapping[$priority], $message, $extras); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Log/Zf1LogAdapter.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Log/Zf1LogAdapter.php deleted file mode 100644 index 0ea8e3b1d..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Log/Zf1LogAdapter.php +++ /dev/null @@ -1,24 +0,0 @@ -log = $logObject; - Version::warn(__CLASS__ . ' is deprecated'); - } - - public function log($message, $priority = LOG_INFO, $extras = array()) - { - $this->log->log($message, $priority, $extras); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Log/Zf2LogAdapter.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Log/Zf2LogAdapter.php deleted file mode 100644 index 863f6a1c4..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Log/Zf2LogAdapter.php +++ /dev/null @@ -1,21 +0,0 @@ -log = $logObject; - } - - public function log($message, $priority = LOG_INFO, $extras = array()) - { - $this->log->log($priority, $message, $extras); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Log/composer.json b/bb-vendor/guzzle/guzzle/src/Guzzle/Log/composer.json deleted file mode 100644 index a8213e8b4..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Log/composer.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "guzzle/log", - "description": "Guzzle log adapter component", - "homepage": "http://guzzlephp.org/", - "keywords": ["log", "adapter", "guzzle"], - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "require": { - "php": ">=5.3.2" - }, - "autoload": { - "psr-0": { "Guzzle\\Log": "" } - }, - "suggest": { - "guzzle/http": "self.version" - }, - "target-dir": "Guzzle/Log", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/Cookie/CookieParser.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/Cookie/CookieParser.php deleted file mode 100644 index 4349eeb38..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/Cookie/CookieParser.php +++ /dev/null @@ -1,131 +0,0 @@ - 'Domain', - 'path' => 'Path', - 'max_age' => 'Max-Age', - 'expires' => 'Expires', - 'version' => 'Version', - 'secure' => 'Secure', - 'port' => 'Port', - 'discard' => 'Discard', - 'comment' => 'Comment', - 'comment_url' => 'Comment-Url', - 'http_only' => 'HttpOnly' - ); - - public function parseCookie($cookie, $host = null, $path = null, $decode = false) - { - // Explode the cookie string using a series of semicolons - $pieces = array_filter(array_map('trim', explode(';', $cookie))); - - // The name of the cookie (first kvp) must include an equal sign. - if (empty($pieces) || !strpos($pieces[0], '=')) { - return false; - } - - // Create the default return array - $data = array_merge(array_fill_keys(array_keys(self::$cookieParts), null), array( - 'cookies' => array(), - 'data' => array(), - 'path' => null, - 'http_only' => false, - 'discard' => false, - 'domain' => $host - )); - $foundNonCookies = 0; - - // Add the cookie pieces into the parsed data array - foreach ($pieces as $part) { - - $cookieParts = explode('=', $part, 2); - $key = trim($cookieParts[0]); - - if (count($cookieParts) == 1) { - // Can be a single value (e.g. secure, httpOnly) - $value = true; - } else { - // Be sure to strip wrapping quotes - $value = trim($cookieParts[1], " \n\r\t\0\x0B\""); - if ($decode) { - $value = urldecode($value); - } - } - - // Only check for non-cookies when cookies have been found - if (!empty($data['cookies'])) { - foreach (self::$cookieParts as $mapValue => $search) { - if (!strcasecmp($search, $key)) { - $data[$mapValue] = $mapValue == 'port' ? array_map('trim', explode(',', $value)) : $value; - $foundNonCookies++; - continue 2; - } - } - } - - // If cookies have not yet been retrieved, or this value was not found in the pieces array, treat it as a - // cookie. IF non-cookies have been parsed, then this isn't a cookie, it's cookie data. Cookies then data. - $data[$foundNonCookies ? 'data' : 'cookies'][$key] = $value; - } - - // Calculate the expires date - if (!$data['expires'] && $data['max_age']) { - $data['expires'] = time() + (int) $data['max_age']; - } - - // Check path attribute according RFC6265 http://tools.ietf.org/search/rfc6265#section-5.2.4 - // "If the attribute-value is empty or if the first character of the - // attribute-value is not %x2F ("/"): - // Let cookie-path be the default-path. - // Otherwise: - // Let cookie-path be the attribute-value." - if (!$data['path'] || substr($data['path'], 0, 1) !== '/') { - $data['path'] = $this->getDefaultPath($path); - } - - return $data; - } - - /** - * Get default cookie path according to RFC 6265 - * http://tools.ietf.org/search/rfc6265#section-5.1.4 Paths and Path-Match - * - * @param string $path Request uri-path - * - * @return string - */ - protected function getDefaultPath($path) { - // "The user agent MUST use an algorithm equivalent to the following algorithm - // to compute the default-path of a cookie:" - - // "2. If the uri-path is empty or if the first character of the uri-path is not - // a %x2F ("/") character, output %x2F ("/") and skip the remaining steps. - if (empty($path) || substr($path, 0, 1) !== '/') { - return '/'; - } - - // "3. If the uri-path contains no more than one %x2F ("/") character, output - // %x2F ("/") and skip the remaining step." - if ($path === "/") { - return $path; - } - - $rightSlashPos = strrpos($path, '/'); - if ($rightSlashPos === 0) { - return "/"; - } - - // "4. Output the characters of the uri-path from the first character up to, - // but not including, the right-most %x2F ("/")." - return substr($path, 0, $rightSlashPos); - - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/Cookie/CookieParserInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/Cookie/CookieParserInterface.php deleted file mode 100644 index d21ffe21c..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/Cookie/CookieParserInterface.php +++ /dev/null @@ -1,33 +0,0 @@ - $requestUrl, - 'scheme' => 'http' - ); - - // Check for the Host header - if (isset($parts['headers']['Host'])) { - $urlParts['host'] = $parts['headers']['Host']; - } elseif (isset($parts['headers']['host'])) { - $urlParts['host'] = $parts['headers']['host']; - } else { - $urlParts['host'] = null; - } - - if (false === strpos($urlParts['host'], ':')) { - $urlParts['port'] = ''; - } else { - $hostParts = explode(':', $urlParts['host']); - $urlParts['host'] = trim($hostParts[0]); - $urlParts['port'] = (int) trim($hostParts[1]); - if ($urlParts['port'] == 443) { - $urlParts['scheme'] = 'https'; - } - } - - // Check if a query is present - $path = $urlParts['path']; - $qpos = strpos($path, '?'); - if ($qpos) { - $urlParts['query'] = substr($path, $qpos + 1); - $urlParts['path'] = substr($path, 0, $qpos); - } else { - $urlParts['query'] = ''; - } - - return $urlParts; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/Message/MessageParser.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/Message/MessageParser.php deleted file mode 100644 index efc1aa322..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/Message/MessageParser.php +++ /dev/null @@ -1,110 +0,0 @@ -parseMessage($message); - - // Parse the protocol and protocol version - if (isset($parts['start_line'][2])) { - $startParts = explode('/', $parts['start_line'][2]); - $protocol = strtoupper($startParts[0]); - $version = isset($startParts[1]) ? $startParts[1] : '1.1'; - } else { - $protocol = 'HTTP'; - $version = '1.1'; - } - - $parsed = array( - 'method' => strtoupper($parts['start_line'][0]), - 'protocol' => $protocol, - 'version' => $version, - 'headers' => $parts['headers'], - 'body' => $parts['body'] - ); - - $parsed['request_url'] = $this->getUrlPartsFromMessage(isset($parts['start_line'][1]) ? $parts['start_line'][1] : '' , $parsed); - - return $parsed; - } - - public function parseResponse($message) - { - if (!$message) { - return false; - } - - $parts = $this->parseMessage($message); - list($protocol, $version) = explode('/', trim($parts['start_line'][0])); - - return array( - 'protocol' => $protocol, - 'version' => $version, - 'code' => $parts['start_line'][1], - 'reason_phrase' => isset($parts['start_line'][2]) ? $parts['start_line'][2] : '', - 'headers' => $parts['headers'], - 'body' => $parts['body'] - ); - } - - /** - * Parse a message into parts - * - * @param string $message Message to parse - * - * @return array - */ - protected function parseMessage($message) - { - $startLine = null; - $headers = array(); - $body = ''; - - // Iterate over each line in the message, accounting for line endings - $lines = preg_split('/(\\r?\\n)/', $message, -1, PREG_SPLIT_DELIM_CAPTURE); - for ($i = 0, $totalLines = count($lines); $i < $totalLines; $i += 2) { - - $line = $lines[$i]; - - // If two line breaks were encountered, then this is the end of body - if (empty($line)) { - if ($i < $totalLines - 1) { - $body = implode('', array_slice($lines, $i + 2)); - } - break; - } - - // Parse message headers - if (!$startLine) { - $startLine = explode(' ', $line, 3); - } elseif (strpos($line, ':')) { - $parts = explode(':', $line, 2); - $key = trim($parts[0]); - $value = isset($parts[1]) ? trim($parts[1]) : ''; - if (!isset($headers[$key])) { - $headers[$key] = $value; - } elseif (!is_array($headers[$key])) { - $headers[$key] = array($headers[$key], $value); - } else { - $headers[$key][] = $value; - } - } - } - - return array( - 'start_line' => $startLine, - 'headers' => $headers, - 'body' => $body - ); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/Message/MessageParserInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/Message/MessageParserInterface.php deleted file mode 100644 index cc448088d..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/Message/MessageParserInterface.php +++ /dev/null @@ -1,27 +0,0 @@ - $parts->requestMethod, - 'protocol' => 'HTTP', - 'version' => number_format($parts->httpVersion, 1), - 'headers' => $parts->headers, - 'body' => $parts->body - ); - - $parsed['request_url'] = $this->getUrlPartsFromMessage($parts->requestUrl, $parsed); - - return $parsed; - } - - public function parseResponse($message) - { - if (!$message) { - return false; - } - - $parts = http_parse_message($message); - - return array( - 'protocol' => 'HTTP', - 'version' => number_format($parts->httpVersion, 1), - 'code' => $parts->responseCode, - 'reason_phrase' => $parts->responseStatus, - 'headers' => $parts->headers, - 'body' => $parts->body - ); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/ParserRegistry.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/ParserRegistry.php deleted file mode 100644 index f8386831c..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/ParserRegistry.php +++ /dev/null @@ -1,75 +0,0 @@ - 'Guzzle\\Parser\\Message\\MessageParser', - 'cookie' => 'Guzzle\\Parser\\Cookie\\CookieParser', - 'url' => 'Guzzle\\Parser\\Url\\UrlParser', - 'uri_template' => 'Guzzle\\Parser\\UriTemplate\\UriTemplate', - ); - - /** - * @return self - * @codeCoverageIgnore - */ - public static function getInstance() - { - if (!self::$instance) { - self::$instance = new static; - } - - return self::$instance; - } - - public function __construct() - { - // Use the PECL URI template parser if available - if (extension_loaded('uri_template')) { - $this->mapping['uri_template'] = 'Guzzle\\Parser\\UriTemplate\\PeclUriTemplate'; - } - } - - /** - * Get a parser by name from an instance - * - * @param string $name Name of the parser to retrieve - * - * @return mixed|null - */ - public function getParser($name) - { - if (!isset($this->instances[$name])) { - if (!isset($this->mapping[$name])) { - return null; - } - $class = $this->mapping[$name]; - $this->instances[$name] = new $class(); - } - - return $this->instances[$name]; - } - - /** - * Register a custom parser by name with the register - * - * @param string $name Name or handle of the parser to register - * @param mixed $parser Instantiated parser to register - */ - public function registerParser($name, $parser) - { - $this->instances[$name] = $parser; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/UriTemplate/PeclUriTemplate.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/UriTemplate/PeclUriTemplate.php deleted file mode 100644 index b0764e837..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/UriTemplate/PeclUriTemplate.php +++ /dev/null @@ -1,26 +0,0 @@ - true, '#' => true, '.' => true, '/' => true, ';' => true, '?' => true, '&' => true - ); - - /** @var array Delimiters */ - private static $delims = array( - ':', '/', '?', '#', '[', ']', '@', '!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=' - ); - - /** @var array Percent encoded delimiters */ - private static $delimsPct = array( - '%3A', '%2F', '%3F', '%23', '%5B', '%5D', '%40', '%21', '%24', '%26', '%27', '%28', '%29', '%2A', '%2B', '%2C', - '%3B', '%3D' - ); - - public function expand($template, array $variables) - { - if ($this->regex == self::DEFAULT_PATTERN && false === strpos($template, '{')) { - return $template; - } - - $this->template = $template; - $this->variables = $variables; - - return preg_replace_callback($this->regex, array($this, 'expandMatch'), $this->template); - } - - /** - * Set the regex patten used to expand URI templates - * - * @param string $regexPattern - */ - public function setRegex($regexPattern) - { - $this->regex = $regexPattern; - } - - /** - * Parse an expression into parts - * - * @param string $expression Expression to parse - * - * @return array Returns an associative array of parts - */ - private function parseExpression($expression) - { - // Check for URI operators - $operator = ''; - - if (isset(self::$operatorHash[$expression[0]])) { - $operator = $expression[0]; - $expression = substr($expression, 1); - } - - $values = explode(',', $expression); - foreach ($values as &$value) { - $value = trim($value); - $varspec = array(); - $substrPos = strpos($value, ':'); - if ($substrPos) { - $varspec['value'] = substr($value, 0, $substrPos); - $varspec['modifier'] = ':'; - $varspec['position'] = (int) substr($value, $substrPos + 1); - } elseif (substr($value, -1) == '*') { - $varspec['modifier'] = '*'; - $varspec['value'] = substr($value, 0, -1); - } else { - $varspec['value'] = (string) $value; - $varspec['modifier'] = ''; - } - $value = $varspec; - } - - return array( - 'operator' => $operator, - 'values' => $values - ); - } - - /** - * Process an expansion - * - * @param array $matches Matches met in the preg_replace_callback - * - * @return string Returns the replacement string - */ - private function expandMatch(array $matches) - { - static $rfc1738to3986 = array( - '+' => '%20', - '%7e' => '~' - ); - - $parsed = self::parseExpression($matches[1]); - $replacements = array(); - - $prefix = $parsed['operator']; - $joiner = $parsed['operator']; - $useQueryString = false; - if ($parsed['operator'] == '?') { - $joiner = '&'; - $useQueryString = true; - } elseif ($parsed['operator'] == '&') { - $useQueryString = true; - } elseif ($parsed['operator'] == '#') { - $joiner = ','; - } elseif ($parsed['operator'] == ';') { - $useQueryString = true; - } elseif ($parsed['operator'] == '' || $parsed['operator'] == '+') { - $joiner = ','; - $prefix = ''; - } - - foreach ($parsed['values'] as $value) { - - if (!array_key_exists($value['value'], $this->variables) || $this->variables[$value['value']] === null) { - continue; - } - - $variable = $this->variables[$value['value']]; - $actuallyUseQueryString = $useQueryString; - $expanded = ''; - - if (is_array($variable)) { - - $isAssoc = $this->isAssoc($variable); - $kvp = array(); - foreach ($variable as $key => $var) { - - if ($isAssoc) { - $key = rawurlencode($key); - $isNestedArray = is_array($var); - } else { - $isNestedArray = false; - } - - if (!$isNestedArray) { - $var = rawurlencode($var); - if ($parsed['operator'] == '+' || $parsed['operator'] == '#') { - $var = $this->decodeReserved($var); - } - } - - if ($value['modifier'] == '*') { - if ($isAssoc) { - if ($isNestedArray) { - // Nested arrays must allow for deeply nested structures - $var = strtr(http_build_query(array($key => $var)), $rfc1738to3986); - } else { - $var = $key . '=' . $var; - } - } elseif ($key > 0 && $actuallyUseQueryString) { - $var = $value['value'] . '=' . $var; - } - } - - $kvp[$key] = $var; - } - - if (empty($variable)) { - $actuallyUseQueryString = false; - } elseif ($value['modifier'] == '*') { - $expanded = implode($joiner, $kvp); - if ($isAssoc) { - // Don't prepend the value name when using the explode modifier with an associative array - $actuallyUseQueryString = false; - } - } else { - if ($isAssoc) { - // When an associative array is encountered and the explode modifier is not set, then the - // result must be a comma separated list of keys followed by their respective values. - foreach ($kvp as $k => &$v) { - $v = $k . ',' . $v; - } - } - $expanded = implode(',', $kvp); - } - - } else { - if ($value['modifier'] == ':') { - $variable = substr($variable, 0, $value['position']); - } - $expanded = rawurlencode($variable); - if ($parsed['operator'] == '+' || $parsed['operator'] == '#') { - $expanded = $this->decodeReserved($expanded); - } - } - - if ($actuallyUseQueryString) { - if (!$expanded && $joiner != '&') { - $expanded = $value['value']; - } else { - $expanded = $value['value'] . '=' . $expanded; - } - } - - $replacements[] = $expanded; - } - - $ret = implode($joiner, $replacements); - if ($ret && $prefix) { - return $prefix . $ret; - } - - return $ret; - } - - /** - * Determines if an array is associative - * - * @param array $array Array to check - * - * @return bool - */ - private function isAssoc(array $array) - { - return (bool) count(array_filter(array_keys($array), 'is_string')); - } - - /** - * Removes percent encoding on reserved characters (used with + and # modifiers) - * - * @param string $string String to fix - * - * @return string - */ - private function decodeReserved($string) - { - return str_replace(self::$delimsPct, self::$delims, $string); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/UriTemplate/UriTemplateInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/UriTemplate/UriTemplateInterface.php deleted file mode 100644 index c81d51548..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/UriTemplate/UriTemplateInterface.php +++ /dev/null @@ -1,21 +0,0 @@ -utf8 = $utf8; - } - - public function parseUrl($url) - { - Version::warn(__CLASS__ . ' is deprecated. Just use parse_url()'); - - static $defaults = array('scheme' => null, 'host' => null, 'path' => null, 'port' => null, 'query' => null, - 'user' => null, 'pass' => null, 'fragment' => null); - - $parts = parse_url($url); - - // Need to handle query parsing specially for UTF-8 requirements - if ($this->utf8 && isset($parts['query'])) { - $queryPos = strpos($url, '?'); - if (isset($parts['fragment'])) { - $parts['query'] = substr($url, $queryPos + 1, strpos($url, '#') - $queryPos - 1); - } else { - $parts['query'] = substr($url, $queryPos + 1); - } - } - - return $parts + $defaults; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/Url/UrlParserInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/Url/UrlParserInterface.php deleted file mode 100644 index 89ac4b307..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Parser/Url/UrlParserInterface.php +++ /dev/null @@ -1,19 +0,0 @@ -=5.3.2" - }, - "autoload": { - "psr-0": { "Guzzle\\Parser": "" } - }, - "target-dir": "Guzzle/Parser", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Async/AsyncPlugin.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Async/AsyncPlugin.php deleted file mode 100644 index ae5941873..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Async/AsyncPlugin.php +++ /dev/null @@ -1,84 +0,0 @@ - 'onBeforeSend', - 'request.exception' => 'onRequestTimeout', - 'request.sent' => 'onRequestSent', - 'curl.callback.progress' => 'onCurlProgress' - ); - } - - /** - * Event used to ensure that progress callback are emitted from the curl handle's request mediator. - * - * @param Event $event - */ - public function onBeforeSend(Event $event) - { - // Ensure that progress callbacks are dispatched - $event['request']->getCurlOptions()->set('progress', true); - } - - /** - * Event emitted when a curl progress function is called. When the amount of data uploaded == the amount of data to - * upload OR any bytes have been downloaded, then time the request out after 1ms because we're done with - * transmitting the request, and tell curl not download a body. - * - * @param Event $event - */ - public function onCurlProgress(Event $event) - { - if ($event['handle'] && - ($event['downloaded'] || (isset($event['uploaded']) && $event['upload_size'] === $event['uploaded'])) - ) { - // Timeout after 1ms - curl_setopt($event['handle'], CURLOPT_TIMEOUT_MS, 1); - // Even if the response is quick, tell curl not to download the body. - // - Note that we can only perform this shortcut if the request transmitted a body so as to ensure that the - // request method is not converted to a HEAD request before the request was sent via curl. - if ($event['uploaded']) { - curl_setopt($event['handle'], CURLOPT_NOBODY, true); - } - } - } - - /** - * Event emitted when a curl exception occurs. Ignore the exception and set a mock response. - * - * @param Event $event - */ - public function onRequestTimeout(Event $event) - { - if ($event['exception'] instanceof CurlException) { - $event['request']->setResponse(new Response(200, array( - 'X-Guzzle-Async' => 'Did not wait for the response' - ))); - } - } - - /** - * Event emitted when a request completes because it took less than 1ms. Add an X-Guzzle-Async header to notify the - * caller that there is no body in the message. - * - * @param Event $event - */ - public function onRequestSent(Event $event) - { - // Let the caller know this was meant to be async - $event['request']->getResponse()->setHeader('X-Guzzle-Async', 'Did not wait for the response'); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Async/composer.json b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Async/composer.json deleted file mode 100644 index dc3fc5bf8..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Async/composer.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "guzzle/plugin-async", - "description": "Guzzle async request plugin", - "homepage": "http://guzzlephp.org/", - "keywords": ["plugin", "guzzle"], - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "require": { - "php": ">=5.3.2", - "guzzle/http": "self.version" - }, - "autoload": { - "psr-0": { "Guzzle\\Plugin\\Async": "" } - }, - "target-dir": "Guzzle/Plugin/Async", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/AbstractBackoffStrategy.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/AbstractBackoffStrategy.php deleted file mode 100644 index 0a8598345..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/AbstractBackoffStrategy.php +++ /dev/null @@ -1,91 +0,0 @@ -next = $next; - } - - /** - * Get the next backoff strategy in the chain - * - * @return AbstractBackoffStrategy|null - */ - public function getNext() - { - return $this->next; - } - - public function getBackoffPeriod( - $retries, - RequestInterface $request, - Response $response = null, - HttpException $e = null - ) { - $delay = $this->getDelay($retries, $request, $response, $e); - if ($delay === false) { - // The strategy knows that this must not be retried - return false; - } elseif ($delay === null) { - // If the strategy is deferring a decision and the next strategy will not make a decision then return false - return !$this->next || !$this->next->makesDecision() - ? false - : $this->next->getBackoffPeriod($retries, $request, $response, $e); - } elseif ($delay === true) { - // if the strategy knows that it must retry but is deferring to the next to determine the delay - if (!$this->next) { - return 0; - } else { - $next = $this->next; - while ($next->makesDecision() && $next->getNext()) { - $next = $next->getNext(); - } - return !$next->makesDecision() ? $next->getBackoffPeriod($retries, $request, $response, $e) : 0; - } - } else { - return $delay; - } - } - - /** - * Check if the strategy does filtering and makes decisions on whether or not to retry. - * - * Strategies that return false will never retry if all of the previous strategies in a chain defer on a backoff - * decision. - * - * @return bool - */ - abstract public function makesDecision(); - - /** - * Implement the concrete strategy - * - * @param int $retries Number of retries of the request - * @param RequestInterface $request Request that was sent - * @param Response $response Response that was received. Note that there may not be a response - * @param HttpException $e Exception that was encountered if any - * - * @return bool|int|null Returns false to not retry or the number of seconds to delay between retries. Return true - * or null to defer to the next strategy if available, and if not, return 0. - */ - abstract protected function getDelay( - $retries, - RequestInterface $request, - Response $response = null, - HttpException $e = null - ); -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/AbstractErrorCodeBackoffStrategy.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/AbstractErrorCodeBackoffStrategy.php deleted file mode 100644 index 6ebee6c1a..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/AbstractErrorCodeBackoffStrategy.php +++ /dev/null @@ -1,40 +0,0 @@ -errorCodes = array_fill_keys($codes ?: static::$defaultErrorCodes, 1); - $this->next = $next; - } - - /** - * Get the default failure codes to retry - * - * @return array - */ - public static function getDefaultFailureCodes() - { - return static::$defaultErrorCodes; - } - - public function makesDecision() - { - return true; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/BackoffLogger.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/BackoffLogger.php deleted file mode 100644 index ec54c289e..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/BackoffLogger.php +++ /dev/null @@ -1,76 +0,0 @@ -logger = $logger; - $this->formatter = $formatter ?: new MessageFormatter(self::DEFAULT_FORMAT); - } - - public static function getSubscribedEvents() - { - return array(BackoffPlugin::RETRY_EVENT => 'onRequestRetry'); - } - - /** - * Set the template to use for logging - * - * @param string $template Log message template - * - * @return self - */ - public function setTemplate($template) - { - $this->formatter->setTemplate($template); - - return $this; - } - - /** - * Called when a request is being retried - * - * @param Event $event Event emitted - */ - public function onRequestRetry(Event $event) - { - $this->logger->log($this->formatter->format( - $event['request'], - $event['response'], - $event['handle'], - array( - 'retries' => $event['retries'], - 'delay' => $event['delay'] - ) - )); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/BackoffPlugin.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/BackoffPlugin.php deleted file mode 100644 index 99ace0538..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/BackoffPlugin.php +++ /dev/null @@ -1,126 +0,0 @@ -strategy = $strategy; - } - - /** - * Retrieve a basic truncated exponential backoff plugin that will retry HTTP errors and cURL errors - * - * @param int $maxRetries Maximum number of retries - * @param array $httpCodes HTTP response codes to retry - * @param array $curlCodes cURL error codes to retry - * - * @return self - */ - public static function getExponentialBackoff( - $maxRetries = 3, - array $httpCodes = null, - array $curlCodes = null - ) { - return new self(new TruncatedBackoffStrategy($maxRetries, - new HttpBackoffStrategy($httpCodes, - new CurlBackoffStrategy($curlCodes, - new ExponentialBackoffStrategy() - ) - ) - )); - } - - public static function getAllEvents() - { - return array(self::RETRY_EVENT); - } - - public static function getSubscribedEvents() - { - return array( - 'request.sent' => 'onRequestSent', - 'request.exception' => 'onRequestSent', - CurlMultiInterface::POLLING_REQUEST => 'onRequestPoll' - ); - } - - /** - * Called when a request has been sent and isn't finished processing - * - * @param Event $event - */ - public function onRequestSent(Event $event) - { - $request = $event['request']; - $response = $event['response']; - $exception = $event['exception']; - - $params = $request->getParams(); - $retries = (int) $params->get(self::RETRY_PARAM); - $delay = $this->strategy->getBackoffPeriod($retries, $request, $response, $exception); - - if ($delay !== false) { - // Calculate how long to wait until the request should be retried - $params->set(self::RETRY_PARAM, ++$retries) - ->set(self::DELAY_PARAM, microtime(true) + $delay); - // Send the request again - $request->setState(RequestInterface::STATE_TRANSFER); - $this->dispatch(self::RETRY_EVENT, array( - 'request' => $request, - 'response' => $response, - 'handle' => ($exception && $exception instanceof CurlException) ? $exception->getCurlHandle() : null, - 'retries' => $retries, - 'delay' => $delay - )); - } - } - - /** - * Called when a request is polling in the curl multi object - * - * @param Event $event - */ - public function onRequestPoll(Event $event) - { - $request = $event['request']; - $delay = $request->getParams()->get(self::DELAY_PARAM); - - // If the duration of the delay has passed, retry the request using the pool - if (null !== $delay && microtime(true) >= $delay) { - // Remove the request from the pool and then add it back again. This is required for cURL to know that we - // want to retry sending the easy handle. - $request->getParams()->remove(self::DELAY_PARAM); - // Rewind the request body if possible - if ($request instanceof EntityEnclosingRequestInterface && $request->getBody()) { - $request->getBody()->seek(0); - } - $multi = $event['curl_multi']; - $multi->remove($request); - $multi->add($request); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/BackoffStrategyInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/BackoffStrategyInterface.php deleted file mode 100644 index 4e590dbe0..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/BackoffStrategyInterface.php +++ /dev/null @@ -1,30 +0,0 @@ -callback = $callback; - $this->decision = (bool) $decision; - $this->next = $next; - } - - public function makesDecision() - { - return $this->decision; - } - - protected function getDelay($retries, RequestInterface $request, Response $response = null, HttpException $e = null) - { - return call_user_func($this->callback, $retries, $request, $response, $e); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/ConstantBackoffStrategy.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/ConstantBackoffStrategy.php deleted file mode 100644 index 061d2a407..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/ConstantBackoffStrategy.php +++ /dev/null @@ -1,34 +0,0 @@ -delay = $delay; - } - - public function makesDecision() - { - return false; - } - - protected function getDelay($retries, RequestInterface $request, Response $response = null, HttpException $e = null) - { - return $this->delay; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/CurlBackoffStrategy.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/CurlBackoffStrategy.php deleted file mode 100644 index a584ed4a2..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/CurlBackoffStrategy.php +++ /dev/null @@ -1,28 +0,0 @@ -errorCodes[$e->getErrorNo()]) ? true : null; - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/ExponentialBackoffStrategy.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/ExponentialBackoffStrategy.php deleted file mode 100644 index fb2912d50..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/ExponentialBackoffStrategy.php +++ /dev/null @@ -1,25 +0,0 @@ -isSuccessful()) { - return false; - } else { - return isset($this->errorCodes[$response->getStatusCode()]) ? true : null; - } - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/LinearBackoffStrategy.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/LinearBackoffStrategy.php deleted file mode 100644 index b35e8a490..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/LinearBackoffStrategy.php +++ /dev/null @@ -1,36 +0,0 @@ -step = $step; - } - - public function makesDecision() - { - return false; - } - - protected function getDelay($retries, RequestInterface $request, Response $response = null, HttpException $e = null) - { - return $retries * $this->step; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/ReasonPhraseBackoffStrategy.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/ReasonPhraseBackoffStrategy.php deleted file mode 100644 index 4fd73fedf..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/ReasonPhraseBackoffStrategy.php +++ /dev/null @@ -1,25 +0,0 @@ -errorCodes[$response->getReasonPhrase()]) ? true : null; - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/TruncatedBackoffStrategy.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/TruncatedBackoffStrategy.php deleted file mode 100644 index 3608f3584..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/TruncatedBackoffStrategy.php +++ /dev/null @@ -1,36 +0,0 @@ -max = $maxRetries; - $this->next = $next; - } - - public function makesDecision() - { - return true; - } - - protected function getDelay($retries, RequestInterface $request, Response $response = null, HttpException $e = null) - { - return $retries < $this->max ? null : false; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/composer.json b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/composer.json deleted file mode 100644 index 91c122cb4..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Backoff/composer.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "guzzle/plugin-backoff", - "description": "Guzzle backoff retry plugins", - "homepage": "http://guzzlephp.org/", - "keywords": ["plugin", "guzzle"], - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "require": { - "php": ">=5.3.2", - "guzzle/http": "self.version", - "guzzle/log": "self.version" - }, - "autoload": { - "psr-0": { "Guzzle\\Plugin\\Backoff": "" } - }, - "target-dir": "Guzzle/Plugin/Backoff", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/CacheKeyProviderInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/CacheKeyProviderInterface.php deleted file mode 100644 index 7790f8844..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/CacheKeyProviderInterface.php +++ /dev/null @@ -1,11 +0,0 @@ - new DefaultCacheStorage($options)); - } elseif ($options instanceof CacheStorageInterface) { - $options = array('storage' => $options); - } elseif ($options) { - $options = array('storage' => new DefaultCacheStorage(CacheAdapterFactory::fromCache($options))); - } elseif (!class_exists('Doctrine\Common\Cache\ArrayCache')) { - // @codeCoverageIgnoreStart - throw new InvalidArgumentException('No cache was provided and Doctrine is not installed'); - // @codeCoverageIgnoreEnd - } - } - - $this->autoPurge = isset($options['auto_purge']) ? $options['auto_purge'] : false; - - // Add a cache storage if a cache adapter was provided - $this->storage = isset($options['storage']) - ? $options['storage'] - : new DefaultCacheStorage(new DoctrineCacheAdapter(new ArrayCache())); - - if (!isset($options['can_cache'])) { - $this->canCache = new DefaultCanCacheStrategy(); - } else { - $this->canCache = is_callable($options['can_cache']) - ? new CallbackCanCacheStrategy($options['can_cache']) - : $options['can_cache']; - } - - // Use the provided revalidation strategy or the default - $this->revalidation = isset($options['revalidation']) - ? $options['revalidation'] - : new DefaultRevalidation($this->storage, $this->canCache); - } - - public static function getSubscribedEvents() - { - return array( - 'request.before_send' => array('onRequestBeforeSend', -255), - 'request.sent' => array('onRequestSent', 255), - 'request.error' => array('onRequestError', 0), - 'request.exception' => array('onRequestException', 0), - ); - } - - /** - * Check if a response in cache will satisfy the request before sending - * - * @param Event $event - */ - public function onRequestBeforeSend(Event $event) - { - $request = $event['request']; - $request->addHeader('Via', sprintf('%s GuzzleCache/%s', $request->getProtocolVersion(), Version::VERSION)); - - if (!$this->canCache->canCacheRequest($request)) { - switch ($request->getMethod()) { - case 'PURGE': - $this->purge($request); - $request->setResponse(new Response(200, array(), 'purged')); - break; - case 'PUT': - case 'POST': - case 'DELETE': - case 'PATCH': - if ($this->autoPurge) { - $this->purge($request); - } - } - return; - } - - if ($response = $this->storage->fetch($request)) { - $params = $request->getParams(); - $params['cache.lookup'] = true; - $response->setHeader( - 'Age', - time() - strtotime($response->getDate() ? : $response->getLastModified() ?: 'now') - ); - // Validate that the response satisfies the request - if ($this->canResponseSatisfyRequest($request, $response)) { - if (!isset($params['cache.hit'])) { - $params['cache.hit'] = true; - } - $request->setResponse($response); - } - } - } - - /** - * If possible, store a response in cache after sending - * - * @param Event $event - */ - public function onRequestSent(Event $event) - { - $request = $event['request']; - $response = $event['response']; - - if ($request->getParams()->get('cache.hit') === null && - $this->canCache->canCacheRequest($request) && - $this->canCache->canCacheResponse($response) - ) { - $this->storage->cache($request, $response); - } - - $this->addResponseHeaders($request, $response); - } - - /** - * If possible, return a cache response on an error - * - * @param Event $event - */ - public function onRequestError(Event $event) - { - $request = $event['request']; - - if (!$this->canCache->canCacheRequest($request)) { - return; - } - - if ($response = $this->storage->fetch($request)) { - $response->setHeader( - 'Age', - time() - strtotime($response->getLastModified() ? : $response->getDate() ?: 'now') - ); - - if ($this->canResponseSatisfyFailedRequest($request, $response)) { - $request->getParams()->set('cache.hit', 'error'); - $this->addResponseHeaders($request, $response); - $event['response'] = $response; - $event->stopPropagation(); - } - } - } - - /** - * If possible, set a cache response on a cURL exception - * - * @param Event $event - * - * @return null - */ - public function onRequestException(Event $event) - { - if (!$event['exception'] instanceof CurlException) { - return; - } - - $request = $event['request']; - if (!$this->canCache->canCacheRequest($request)) { - return; - } - - if ($response = $this->storage->fetch($request)) { - $response->setHeader('Age', time() - strtotime($response->getDate() ? : 'now')); - if (!$this->canResponseSatisfyFailedRequest($request, $response)) { - return; - } - $request->getParams()->set('cache.hit', 'error'); - $request->setResponse($response); - $this->addResponseHeaders($request, $response); - $event->stopPropagation(); - } - } - - /** - * Check if a cache response satisfies a request's caching constraints - * - * @param RequestInterface $request Request to validate - * @param Response $response Response to validate - * - * @return bool - */ - public function canResponseSatisfyRequest(RequestInterface $request, Response $response) - { - $responseAge = $response->calculateAge(); - $reqc = $request->getHeader('Cache-Control'); - $resc = $response->getHeader('Cache-Control'); - - // Check the request's max-age header against the age of the response - if ($reqc && $reqc->hasDirective('max-age') && - $responseAge > $reqc->getDirective('max-age')) { - return false; - } - - // Check the response's max-age header - if ($response->isFresh() === false) { - $maxStale = $reqc ? $reqc->getDirective('max-stale') : null; - if (null !== $maxStale) { - if ($maxStale !== true && $response->getFreshness() < (-1 * $maxStale)) { - return false; - } - } elseif ($resc && $resc->hasDirective('max-age') - && $responseAge > $resc->getDirective('max-age') - ) { - return false; - } - } - - if ($this->revalidation->shouldRevalidate($request, $response)) { - try { - return $this->revalidation->revalidate($request, $response); - } catch (CurlException $e) { - $request->getParams()->set('cache.hit', 'error'); - return $this->canResponseSatisfyFailedRequest($request, $response); - } - } - - return true; - } - - /** - * Check if a cache response satisfies a failed request's caching constraints - * - * @param RequestInterface $request Request to validate - * @param Response $response Response to validate - * - * @return bool - */ - public function canResponseSatisfyFailedRequest(RequestInterface $request, Response $response) - { - $reqc = $request->getHeader('Cache-Control'); - $resc = $response->getHeader('Cache-Control'); - $requestStaleIfError = $reqc ? $reqc->getDirective('stale-if-error') : null; - $responseStaleIfError = $resc ? $resc->getDirective('stale-if-error') : null; - - if (!$requestStaleIfError && !$responseStaleIfError) { - return false; - } - - if (is_numeric($requestStaleIfError) && $response->getAge() - $response->getMaxAge() > $requestStaleIfError) { - return false; - } - - if (is_numeric($responseStaleIfError) && $response->getAge() - $response->getMaxAge() > $responseStaleIfError) { - return false; - } - - return true; - } - - /** - * Purge all cache entries for a given URL - * - * @param string $url URL to purge - */ - public function purge($url) - { - // BC compatibility with previous version that accepted a Request object - $url = $url instanceof RequestInterface ? $url->getUrl() : $url; - $this->storage->purge($url); - } - - /** - * Add the plugin's headers to a response - * - * @param RequestInterface $request Request - * @param Response $response Response to add headers to - */ - protected function addResponseHeaders(RequestInterface $request, Response $response) - { - $params = $request->getParams(); - $response->setHeader('Via', sprintf('%s GuzzleCache/%s', $request->getProtocolVersion(), Version::VERSION)); - - $lookup = ($params['cache.lookup'] === true ? 'HIT' : 'MISS') . ' from GuzzleCache'; - if ($header = $response->getHeader('X-Cache-Lookup')) { - // Don't add duplicates - $values = $header->toArray(); - $values[] = $lookup; - $response->setHeader('X-Cache-Lookup', array_unique($values)); - } else { - $response->setHeader('X-Cache-Lookup', $lookup); - } - - if ($params['cache.hit'] === true) { - $xcache = 'HIT from GuzzleCache'; - } elseif ($params['cache.hit'] == 'error') { - $xcache = 'HIT_ERROR from GuzzleCache'; - } else { - $xcache = 'MISS from GuzzleCache'; - } - - if ($header = $response->getHeader('X-Cache')) { - // Don't add duplicates - $values = $header->toArray(); - $values[] = $xcache; - $response->setHeader('X-Cache', array_unique($values)); - } else { - $response->setHeader('X-Cache', $xcache); - } - - if ($response->isFresh() === false) { - $response->addHeader('Warning', sprintf('110 GuzzleCache/%s "Response is stale"', Version::VERSION)); - if ($params['cache.hit'] === 'error') { - $response->addHeader('Warning', sprintf('111 GuzzleCache/%s "Revalidation failed"', Version::VERSION)); - } - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/CacheStorageInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/CacheStorageInterface.php deleted file mode 100644 index f3d915458..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/CacheStorageInterface.php +++ /dev/null @@ -1,43 +0,0 @@ -requestCallback = $requestCallback; - $this->responseCallback = $responseCallback; - } - - public function canCacheRequest(RequestInterface $request) - { - return $this->requestCallback - ? call_user_func($this->requestCallback, $request) - : parent::canCacheRequest($request); - } - - public function canCacheResponse(Response $response) - { - return $this->responseCallback - ? call_user_func($this->responseCallback, $response) - : parent::canCacheResponse($response); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/CanCacheStrategyInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/CanCacheStrategyInterface.php deleted file mode 100644 index 6e01a8e74..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/CanCacheStrategyInterface.php +++ /dev/null @@ -1,30 +0,0 @@ -getParams()->get(self::CACHE_KEY); - - if (!$key) { - - $cloned = clone $request; - $cloned->removeHeader('Cache-Control'); - - // Check to see how and if the key should be filtered - foreach (explode(';', $request->getParams()->get(self::CACHE_KEY_FILTER)) as $part) { - $pieces = array_map('trim', explode('=', $part)); - if (isset($pieces[1])) { - foreach (array_map('trim', explode(',', $pieces[1])) as $remove) { - if ($pieces[0] == 'header') { - $cloned->removeHeader($remove); - } elseif ($pieces[0] == 'query') { - $cloned->getQuery()->remove($remove); - } - } - } - } - - $raw = (string) $cloned; - $key = 'GZ' . md5($raw); - $request->getParams()->set(self::CACHE_KEY, $key)->set(self::CACHE_KEY_RAW, $raw); - } - - return $key; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/DefaultCacheStorage.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/DefaultCacheStorage.php deleted file mode 100644 index 26d7a8b27..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/DefaultCacheStorage.php +++ /dev/null @@ -1,266 +0,0 @@ -cache = CacheAdapterFactory::fromCache($cache); - $this->defaultTtl = $defaultTtl; - $this->keyPrefix = $keyPrefix; - } - - public function cache(RequestInterface $request, Response $response) - { - $currentTime = time(); - - $overrideTtl = $request->getParams()->get('cache.override_ttl'); - if ($overrideTtl) { - $ttl = $overrideTtl; - } else { - $maxAge = $response->getMaxAge(); - if ($maxAge !== null) { - $ttl = $maxAge; - } else { - $ttl = $this->defaultTtl; - } - } - - if ($cacheControl = $response->getHeader('Cache-Control')) { - $stale = $cacheControl->getDirective('stale-if-error'); - if ($stale === true) { - $ttl += $ttl; - } else if (is_numeric($stale)) { - $ttl += $stale; - } - } - - // Determine which manifest key should be used - $key = $this->getCacheKey($request); - $persistedRequest = $this->persistHeaders($request); - $entries = array(); - - if ($manifest = $this->cache->fetch($key)) { - // Determine which cache entries should still be in the cache - $vary = $response->getVary(); - foreach (unserialize($manifest) as $entry) { - // Check if the entry is expired - if ($entry[4] < $currentTime) { - continue; - } - $entry[1]['vary'] = isset($entry[1]['vary']) ? $entry[1]['vary'] : ''; - if ($vary != $entry[1]['vary'] || !$this->requestsMatch($vary, $entry[0], $persistedRequest)) { - $entries[] = $entry; - } - } - } - - // Persist the response body if needed - $bodyDigest = null; - if ($response->getBody() && $response->getBody()->getContentLength() > 0) { - $bodyDigest = $this->getBodyKey($request->getUrl(), $response->getBody()); - $this->cache->save($bodyDigest, (string) $response->getBody(), $ttl); - } - - array_unshift($entries, array( - $persistedRequest, - $this->persistHeaders($response), - $response->getStatusCode(), - $bodyDigest, - $currentTime + $ttl - )); - - $this->cache->save($key, serialize($entries)); - } - - public function delete(RequestInterface $request) - { - $key = $this->getCacheKey($request); - if ($entries = $this->cache->fetch($key)) { - // Delete each cached body - foreach (unserialize($entries) as $entry) { - if ($entry[3]) { - $this->cache->delete($entry[3]); - } - } - $this->cache->delete($key); - } - } - - public function purge($url) - { - foreach (array('GET', 'HEAD', 'POST', 'PUT', 'DELETE') as $method) { - $this->delete(new Request($method, $url)); - } - } - - public function fetch(RequestInterface $request) - { - $key = $this->getCacheKey($request); - if (!($entries = $this->cache->fetch($key))) { - return null; - } - - $match = null; - $headers = $this->persistHeaders($request); - $entries = unserialize($entries); - foreach ($entries as $index => $entry) { - if ($this->requestsMatch(isset($entry[1]['vary']) ? $entry[1]['vary'] : '', $headers, $entry[0])) { - $match = $entry; - break; - } - } - - if (!$match) { - return null; - } - - // Ensure that the response is not expired - $response = null; - if ($match[4] < time()) { - $response = -1; - } else { - $response = new Response($match[2], $match[1]); - if ($match[3]) { - if ($body = $this->cache->fetch($match[3])) { - $response->setBody($body); - } else { - // The response is not valid because the body was somehow deleted - $response = -1; - } - } - } - - if ($response === -1) { - // Remove the entry from the metadata and update the cache - unset($entries[$index]); - if ($entries) { - $this->cache->save($key, serialize($entries)); - } else { - $this->cache->delete($key); - } - return null; - } - - return $response; - } - - /** - * Hash a request URL into a string that returns cache metadata - * - * @param RequestInterface $request - * - * @return string - */ - protected function getCacheKey(RequestInterface $request) - { - // Allow cache.key_filter to trim down the URL cache key by removing generate query string values (e.g. auth) - if ($filter = $request->getParams()->get('cache.key_filter')) { - $url = $request->getUrl(true); - foreach (explode(',', $filter) as $remove) { - $url->getQuery()->remove(trim($remove)); - } - } else { - $url = $request->getUrl(); - } - - return $this->keyPrefix . md5($request->getMethod() . ' ' . $url); - } - - /** - * Create a cache key for a response's body - * - * @param string $url URL of the entry - * @param EntityBodyInterface $body Response body - * - * @return string - */ - protected function getBodyKey($url, EntityBodyInterface $body) - { - return $this->keyPrefix . md5($url) . $body->getContentMd5(); - } - - /** - * Determines whether two Request HTTP header sets are non-varying - * - * @param string $vary Response vary header - * @param array $r1 HTTP header array - * @param array $r2 HTTP header array - * - * @return bool - */ - private function requestsMatch($vary, $r1, $r2) - { - if ($vary) { - foreach (explode(',', $vary) as $header) { - $key = trim(strtolower($header)); - $v1 = isset($r1[$key]) ? $r1[$key] : null; - $v2 = isset($r2[$key]) ? $r2[$key] : null; - if ($v1 !== $v2) { - return false; - } - } - } - - return true; - } - - /** - * Creates an array of cacheable and normalized message headers - * - * @param MessageInterface $message - * - * @return array - */ - private function persistHeaders(MessageInterface $message) - { - // Headers are excluded from the caching (see RFC 2616:13.5.1) - static $noCache = array( - 'age' => true, - 'connection' => true, - 'keep-alive' => true, - 'proxy-authenticate' => true, - 'proxy-authorization' => true, - 'te' => true, - 'trailers' => true, - 'transfer-encoding' => true, - 'upgrade' => true, - 'set-cookie' => true, - 'set-cookie2' => true - ); - - // Clone the response to not destroy any necessary headers when caching - $headers = $message->getHeaders()->getAll(); - $headers = array_diff_key($headers, $noCache); - // Cast the headers to a string - $headers = array_map(function ($h) { return (string) $h; }, $headers); - - return $headers; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/DefaultCanCacheStrategy.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/DefaultCanCacheStrategy.php deleted file mode 100644 index 3ca1fbf19..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/DefaultCanCacheStrategy.php +++ /dev/null @@ -1,32 +0,0 @@ -getMethod() != RequestInterface::GET && $request->getMethod() != RequestInterface::HEAD) { - return false; - } - - // Never cache requests when using no-store - if ($request->hasHeader('Cache-Control') && $request->getHeader('Cache-Control')->hasDirective('no-store')) { - return false; - } - - return true; - } - - public function canCacheResponse(Response $response) - { - return $response->isSuccessful() && $response->canCache(); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/DefaultRevalidation.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/DefaultRevalidation.php deleted file mode 100644 index af33234ee..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/DefaultRevalidation.php +++ /dev/null @@ -1,174 +0,0 @@ -storage = $cache; - $this->canCache = $canCache ?: new DefaultCanCacheStrategy(); - } - - public function revalidate(RequestInterface $request, Response $response) - { - try { - $revalidate = $this->createRevalidationRequest($request, $response); - $validateResponse = $revalidate->send(); - if ($validateResponse->getStatusCode() == 200) { - return $this->handle200Response($request, $validateResponse); - } elseif ($validateResponse->getStatusCode() == 304) { - return $this->handle304Response($request, $validateResponse, $response); - } - } catch (BadResponseException $e) { - $this->handleBadResponse($e); - } - - // Other exceptions encountered in the revalidation request are ignored - // in hopes that sending a request to the origin server will fix it - return false; - } - - public function shouldRevalidate(RequestInterface $request, Response $response) - { - if ($request->getMethod() != RequestInterface::GET) { - return false; - } - - $reqCache = $request->getHeader('Cache-Control'); - $resCache = $response->getHeader('Cache-Control'); - - $revalidate = $request->getHeader('Pragma') == 'no-cache' || - ($reqCache && ($reqCache->hasDirective('no-cache') || $reqCache->hasDirective('must-revalidate'))) || - ($resCache && ($resCache->hasDirective('no-cache') || $resCache->hasDirective('must-revalidate'))); - - // Use the strong ETag validator if available and the response contains no Cache-Control directive - if (!$revalidate && !$resCache && $response->hasHeader('ETag')) { - $revalidate = true; - } - - return $revalidate; - } - - /** - * Handles a bad response when attempting to revalidate - * - * @param BadResponseException $e Exception encountered - * - * @throws BadResponseException - */ - protected function handleBadResponse(BadResponseException $e) - { - // 404 errors mean the resource no longer exists, so remove from - // cache, and prevent an additional request by throwing the exception - if ($e->getResponse()->getStatusCode() == 404) { - $this->storage->delete($e->getRequest()); - throw $e; - } - } - - /** - * Creates a request to use for revalidation - * - * @param RequestInterface $request Request - * @param Response $response Response to revalidate - * - * @return RequestInterface returns a revalidation request - */ - protected function createRevalidationRequest(RequestInterface $request, Response $response) - { - $revalidate = clone $request; - $revalidate->removeHeader('Pragma')->removeHeader('Cache-Control'); - - if ($response->getLastModified()) { - $revalidate->setHeader('If-Modified-Since', $response->getLastModified()); - } - - if ($response->getEtag()) { - $revalidate->setHeader('If-None-Match', $response->getEtag()); - } - - // Remove any cache plugins that might be on the request to prevent infinite recursive revalidations - $dispatcher = $revalidate->getEventDispatcher(); - foreach ($dispatcher->getListeners() as $eventName => $listeners) { - foreach ($listeners as $listener) { - if (is_array($listener) && $listener[0] instanceof CachePlugin) { - $dispatcher->removeListener($eventName, $listener); - } - } - } - - return $revalidate; - } - - /** - * Handles a 200 response response from revalidating. The server does not support validation, so use this response. - * - * @param RequestInterface $request Request that was sent - * @param Response $validateResponse Response received - * - * @return bool Returns true if valid, false if invalid - */ - protected function handle200Response(RequestInterface $request, Response $validateResponse) - { - $request->setResponse($validateResponse); - if ($this->canCache->canCacheResponse($validateResponse)) { - $this->storage->cache($request, $validateResponse); - } - - return false; - } - - /** - * Handle a 304 response and ensure that it is still valid - * - * @param RequestInterface $request Request that was sent - * @param Response $validateResponse Response received - * @param Response $response Original cached response - * - * @return bool Returns true if valid, false if invalid - */ - protected function handle304Response(RequestInterface $request, Response $validateResponse, Response $response) - { - static $replaceHeaders = array('Date', 'Expires', 'Cache-Control', 'ETag', 'Last-Modified'); - - // Make sure that this response has the same ETag - if ($validateResponse->getEtag() != $response->getEtag()) { - return false; - } - - // Replace cached headers with any of these headers from the - // origin server that might be more up to date - $modified = false; - foreach ($replaceHeaders as $name) { - if ($validateResponse->hasHeader($name)) { - $modified = true; - $response->setHeader($name, $validateResponse->getHeader($name)); - } - } - - // Store the updated response in cache - if ($modified && $this->canCache->canCacheResponse($response)) { - $this->storage->cache($request, $response); - } - - return true; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/DenyRevalidation.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/DenyRevalidation.php deleted file mode 100644 index 88b86f3ca..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cache/DenyRevalidation.php +++ /dev/null @@ -1,19 +0,0 @@ -=5.3.2", - "guzzle/http": "self.version", - "guzzle/cache": "self.version" - }, - "autoload": { - "psr-0": { "Guzzle\\Plugin\\Cache": "" } - }, - "target-dir": "Guzzle/Plugin/Cache", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cookie/Cookie.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cookie/Cookie.php deleted file mode 100644 index 5218e5f0e..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cookie/Cookie.php +++ /dev/null @@ -1,538 +0,0 @@ - '', - 'value' => '', - 'domain' => '', - 'path' => '/', - 'expires' => null, - 'max_age' => 0, - 'comment' => null, - 'comment_url' => null, - 'port' => array(), - 'version' => null, - 'secure' => false, - 'discard' => false, - 'http_only' => false - ); - - $this->data = array_merge($defaults, $data); - // Extract the expires value and turn it into a UNIX timestamp if needed - if (!$this->getExpires() && $this->getMaxAge()) { - // Calculate the expires date - $this->setExpires(time() + (int) $this->getMaxAge()); - } elseif ($this->getExpires() && !is_numeric($this->getExpires())) { - $this->setExpires(strtotime($this->getExpires())); - } - } - - /** - * Get the cookie as an array - * - * @return array - */ - public function toArray() - { - return $this->data; - } - - /** - * Get the cookie name - * - * @return string - */ - public function getName() - { - return $this->data['name']; - } - - /** - * Set the cookie name - * - * @param string $name Cookie name - * - * @return Cookie - */ - public function setName($name) - { - return $this->setData('name', $name); - } - - /** - * Get the cookie value - * - * @return string - */ - public function getValue() - { - return $this->data['value']; - } - - /** - * Set the cookie value - * - * @param string $value Cookie value - * - * @return Cookie - */ - public function setValue($value) - { - return $this->setData('value', $value); - } - - /** - * Get the domain - * - * @return string|null - */ - public function getDomain() - { - return $this->data['domain']; - } - - /** - * Set the domain of the cookie - * - * @param string $domain - * - * @return Cookie - */ - public function setDomain($domain) - { - return $this->setData('domain', $domain); - } - - /** - * Get the path - * - * @return string - */ - public function getPath() - { - return $this->data['path']; - } - - /** - * Set the path of the cookie - * - * @param string $path Path of the cookie - * - * @return Cookie - */ - public function setPath($path) - { - return $this->setData('path', $path); - } - - /** - * Maximum lifetime of the cookie in seconds - * - * @return int|null - */ - public function getMaxAge() - { - return $this->data['max_age']; - } - - /** - * Set the max-age of the cookie - * - * @param int $maxAge Max age of the cookie in seconds - * - * @return Cookie - */ - public function setMaxAge($maxAge) - { - return $this->setData('max_age', $maxAge); - } - - /** - * The UNIX timestamp when the cookie expires - * - * @return mixed - */ - public function getExpires() - { - return $this->data['expires']; - } - - /** - * Set the unix timestamp for which the cookie will expire - * - * @param int $timestamp Unix timestamp - * - * @return Cookie - */ - public function setExpires($timestamp) - { - return $this->setData('expires', $timestamp); - } - - /** - * Version of the cookie specification. RFC 2965 is 1 - * - * @return mixed - */ - public function getVersion() - { - return $this->data['version']; - } - - /** - * Set the cookie version - * - * @param string|int $version Version to set - * - * @return Cookie - */ - public function setVersion($version) - { - return $this->setData('version', $version); - } - - /** - * Get whether or not this is a secure cookie - * - * @return null|bool - */ - public function getSecure() - { - return $this->data['secure']; - } - - /** - * Set whether or not the cookie is secure - * - * @param bool $secure Set to true or false if secure - * - * @return Cookie - */ - public function setSecure($secure) - { - return $this->setData('secure', (bool) $secure); - } - - /** - * Get whether or not this is a session cookie - * - * @return null|bool - */ - public function getDiscard() - { - return $this->data['discard']; - } - - /** - * Set whether or not this is a session cookie - * - * @param bool $discard Set to true or false if this is a session cookie - * - * @return Cookie - */ - public function setDiscard($discard) - { - return $this->setData('discard', $discard); - } - - /** - * Get the comment - * - * @return string|null - */ - public function getComment() - { - return $this->data['comment']; - } - - /** - * Set the comment of the cookie - * - * @param string $comment Cookie comment - * - * @return Cookie - */ - public function setComment($comment) - { - return $this->setData('comment', $comment); - } - - /** - * Get the comment URL of the cookie - * - * @return string|null - */ - public function getCommentUrl() - { - return $this->data['comment_url']; - } - - /** - * Set the comment URL of the cookie - * - * @param string $commentUrl Cookie comment URL for more information - * - * @return Cookie - */ - public function setCommentUrl($commentUrl) - { - return $this->setData('comment_url', $commentUrl); - } - - /** - * Get an array of acceptable ports this cookie can be used with - * - * @return array - */ - public function getPorts() - { - return $this->data['port']; - } - - /** - * Set a list of acceptable ports this cookie can be used with - * - * @param array $ports Array of acceptable ports - * - * @return Cookie - */ - public function setPorts(array $ports) - { - return $this->setData('port', $ports); - } - - /** - * Get whether or not this is an HTTP only cookie - * - * @return bool - */ - public function getHttpOnly() - { - return $this->data['http_only']; - } - - /** - * Set whether or not this is an HTTP only cookie - * - * @param bool $httpOnly Set to true or false if this is HTTP only - * - * @return Cookie - */ - public function setHttpOnly($httpOnly) - { - return $this->setData('http_only', $httpOnly); - } - - /** - * Get an array of extra cookie data - * - * @return array - */ - public function getAttributes() - { - return $this->data['data']; - } - - /** - * Get a specific data point from the extra cookie data - * - * @param string $name Name of the data point to retrieve - * - * @return null|string - */ - public function getAttribute($name) - { - return array_key_exists($name, $this->data['data']) ? $this->data['data'][$name] : null; - } - - /** - * Set a cookie data attribute - * - * @param string $name Name of the attribute to set - * @param string $value Value to set - * - * @return Cookie - */ - public function setAttribute($name, $value) - { - $this->data['data'][$name] = $value; - - return $this; - } - - /** - * Check if the cookie matches a path value - * - * @param string $path Path to check against - * - * @return bool - */ - public function matchesPath($path) - { - // RFC6265 http://tools.ietf.org/search/rfc6265#section-5.1.4 - // A request-path path-matches a given cookie-path if at least one of - // the following conditions holds: - - // o The cookie-path and the request-path are identical. - if ($path == $this->getPath()) { - return true; - } - - $pos = stripos($path, $this->getPath()); - if ($pos === 0) { - // o The cookie-path is a prefix of the request-path, and the last - // character of the cookie-path is %x2F ("/"). - if (substr($this->getPath(), -1, 1) === "/") { - return true; - } - - // o The cookie-path is a prefix of the request-path, and the first - // character of the request-path that is not included in the cookie- - // path is a %x2F ("/") character. - if (substr($path, strlen($this->getPath()), 1) === "/") { - return true; - } - } - - return false; - } - - /** - * Check if the cookie matches a domain value - * - * @param string $domain Domain to check against - * - * @return bool - */ - public function matchesDomain($domain) - { - // Remove the leading '.' as per spec in RFC 6265: http://tools.ietf.org/html/rfc6265#section-5.2.3 - $cookieDomain = ltrim($this->getDomain(), '.'); - - // Domain not set or exact match. - if (!$cookieDomain || !strcasecmp($domain, $cookieDomain)) { - return true; - } - - // Matching the subdomain according to RFC 6265: http://tools.ietf.org/html/rfc6265#section-5.1.3 - if (filter_var($domain, FILTER_VALIDATE_IP)) { - return false; - } - - return (bool) preg_match('/\.' . preg_quote($cookieDomain, '/') . '$/i', $domain); - } - - /** - * Check if the cookie is compatible with a specific port - * - * @param int $port Port to check - * - * @return bool - */ - public function matchesPort($port) - { - return count($this->getPorts()) == 0 || in_array($port, $this->getPorts()); - } - - /** - * Check if the cookie is expired - * - * @return bool - */ - public function isExpired() - { - return $this->getExpires() && time() > $this->getExpires(); - } - - /** - * Check if the cookie is valid according to RFC 6265 - * - * @return bool|string Returns true if valid or an error message if invalid - */ - public function validate() - { - // Names must not be empty, but can be 0 - $name = $this->getName(); - if (empty($name) && !is_numeric($name)) { - return 'The cookie name must not be empty'; - } - - // Check if any of the invalid characters are present in the cookie name - if (strpbrk($name, self::getInvalidCharacters()) !== false) { - return 'The cookie name must not contain invalid characters: ' . $name; - } - - // Value must not be empty, but can be 0 - $value = $this->getValue(); - if (empty($value) && !is_numeric($value)) { - return 'The cookie value must not be empty'; - } - - // Domains must not be empty, but can be 0 - // A "0" is not a valid internet domain, but may be used as server name in a private network - $domain = $this->getDomain(); - if (empty($domain) && !is_numeric($domain)) { - return 'The cookie domain must not be empty'; - } - - return true; - } - - /** - * Set a value and return the cookie object - * - * @param string $key Key to set - * @param string $value Value to set - * - * @return Cookie - */ - private function setData($key, $value) - { - $this->data[$key] = $value; - - return $this; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cookie/CookieJar/ArrayCookieJar.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cookie/CookieJar/ArrayCookieJar.php deleted file mode 100644 index 6b675039f..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cookie/CookieJar/ArrayCookieJar.php +++ /dev/null @@ -1,237 +0,0 @@ -strictMode = $strictMode; - } - - /** - * Enable or disable strict mode on the cookie jar - * - * @param bool $strictMode Set to true to throw exceptions when invalid cookies are added. False to ignore them. - * - * @return self - */ - public function setStrictMode($strictMode) - { - $this->strictMode = $strictMode; - } - - public function remove($domain = null, $path = null, $name = null) - { - $cookies = $this->all($domain, $path, $name, false, false); - $this->cookies = array_filter($this->cookies, function (Cookie $cookie) use ($cookies) { - return !in_array($cookie, $cookies, true); - }); - - return $this; - } - - public function removeTemporary() - { - $this->cookies = array_filter($this->cookies, function (Cookie $cookie) { - return !$cookie->getDiscard() && $cookie->getExpires(); - }); - - return $this; - } - - public function removeExpired() - { - $currentTime = time(); - $this->cookies = array_filter($this->cookies, function (Cookie $cookie) use ($currentTime) { - return !$cookie->getExpires() || $currentTime < $cookie->getExpires(); - }); - - return $this; - } - - public function all($domain = null, $path = null, $name = null, $skipDiscardable = false, $skipExpired = true) - { - return array_values(array_filter($this->cookies, function (Cookie $cookie) use ( - $domain, - $path, - $name, - $skipDiscardable, - $skipExpired - ) { - return false === (($name && $cookie->getName() != $name) || - ($skipExpired && $cookie->isExpired()) || - ($skipDiscardable && ($cookie->getDiscard() || !$cookie->getExpires())) || - ($path && !$cookie->matchesPath($path)) || - ($domain && !$cookie->matchesDomain($domain))); - })); - } - - public function add(Cookie $cookie) - { - // Only allow cookies with set and valid domain, name, value - $result = $cookie->validate(); - if ($result !== true) { - if ($this->strictMode) { - throw new InvalidCookieException($result); - } else { - $this->removeCookieIfEmpty($cookie); - return false; - } - } - - // Resolve conflicts with previously set cookies - foreach ($this->cookies as $i => $c) { - - // Two cookies are identical, when their path, domain, port and name are identical - if ($c->getPath() != $cookie->getPath() || - $c->getDomain() != $cookie->getDomain() || - $c->getPorts() != $cookie->getPorts() || - $c->getName() != $cookie->getName() - ) { - continue; - } - - // The previously set cookie is a discard cookie and this one is not so allow the new cookie to be set - if (!$cookie->getDiscard() && $c->getDiscard()) { - unset($this->cookies[$i]); - continue; - } - - // If the new cookie's expiration is further into the future, then replace the old cookie - if ($cookie->getExpires() > $c->getExpires()) { - unset($this->cookies[$i]); - continue; - } - - // If the value has changed, we better change it - if ($cookie->getValue() !== $c->getValue()) { - unset($this->cookies[$i]); - continue; - } - - // The cookie exists, so no need to continue - return false; - } - - $this->cookies[] = $cookie; - - return true; - } - - /** - * Serializes the cookie cookieJar - * - * @return string - */ - public function serialize() - { - // Only serialize long term cookies and unexpired cookies - return json_encode(array_map(function (Cookie $cookie) { - return $cookie->toArray(); - }, $this->all(null, null, null, true, true))); - } - - /** - * Unserializes the cookie cookieJar - */ - public function unserialize($data) - { - $data = json_decode($data, true); - if (empty($data)) { - $this->cookies = array(); - } else { - $this->cookies = array_map(function (array $cookie) { - return new Cookie($cookie); - }, $data); - } - } - - /** - * Returns the total number of stored cookies - * - * @return int - */ - public function count() - { - return count($this->cookies); - } - - /** - * Returns an iterator - * - * @return \ArrayIterator - */ - public function getIterator() - { - return new \ArrayIterator($this->cookies); - } - - public function addCookiesFromResponse(Response $response, RequestInterface $request = null) - { - if ($cookieHeader = $response->getHeader('Set-Cookie')) { - $parser = ParserRegistry::getInstance()->getParser('cookie'); - foreach ($cookieHeader as $cookie) { - if ($parsed = $request - ? $parser->parseCookie($cookie, $request->getHost(), $request->getPath()) - : $parser->parseCookie($cookie) - ) { - // Break up cookie v2 into multiple cookies - foreach ($parsed['cookies'] as $key => $value) { - $row = $parsed; - $row['name'] = $key; - $row['value'] = $value; - unset($row['cookies']); - $this->add(new Cookie($row)); - } - } - } - } - } - - public function getMatchingCookies(RequestInterface $request) - { - // Find cookies that match this request - $cookies = $this->all($request->getHost(), $request->getPath()); - // Remove ineligible cookies - foreach ($cookies as $index => $cookie) { - if (!$cookie->matchesPort($request->getPort()) || ($cookie->getSecure() && $request->getScheme() != 'https')) { - unset($cookies[$index]); - } - }; - - return $cookies; - } - - /** - * If a cookie already exists and the server asks to set it again with a null value, the - * cookie must be deleted. - * - * @param \Guzzle\Plugin\Cookie\Cookie $cookie - */ - private function removeCookieIfEmpty(Cookie $cookie) - { - $cookieValue = $cookie->getValue(); - if ($cookieValue === null || $cookieValue === '') { - $this->remove($cookie->getDomain(), $cookie->getPath(), $cookie->getName()); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cookie/CookieJar/CookieJarInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cookie/CookieJar/CookieJarInterface.php deleted file mode 100644 index 7faa7d21f..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cookie/CookieJar/CookieJarInterface.php +++ /dev/null @@ -1,85 +0,0 @@ -filename = $cookieFile; - $this->load(); - } - - /** - * Saves the file when shutting down - */ - public function __destruct() - { - $this->persist(); - } - - /** - * Save the contents of the data array to the file - * - * @throws RuntimeException if the file cannot be found or created - */ - protected function persist() - { - if (false === file_put_contents($this->filename, $this->serialize())) { - // @codeCoverageIgnoreStart - throw new RuntimeException('Unable to open file ' . $this->filename); - // @codeCoverageIgnoreEnd - } - } - - /** - * Load the contents of the json formatted file into the data array and discard any unsaved state - */ - protected function load() - { - $json = file_get_contents($this->filename); - if (false === $json) { - // @codeCoverageIgnoreStart - throw new RuntimeException('Unable to open file ' . $this->filename); - // @codeCoverageIgnoreEnd - } - - $this->unserialize($json); - $this->cookies = $this->cookies ?: array(); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cookie/CookiePlugin.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cookie/CookiePlugin.php deleted file mode 100644 index df3210ee1..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cookie/CookiePlugin.php +++ /dev/null @@ -1,70 +0,0 @@ -cookieJar = $cookieJar ?: new ArrayCookieJar(); - } - - public static function getSubscribedEvents() - { - return array( - 'request.before_send' => array('onRequestBeforeSend', 125), - 'request.sent' => array('onRequestSent', 125) - ); - } - - /** - * Get the cookie cookieJar - * - * @return CookieJarInterface - */ - public function getCookieJar() - { - return $this->cookieJar; - } - - /** - * Add cookies before a request is sent - * - * @param Event $event - */ - public function onRequestBeforeSend(Event $event) - { - $request = $event['request']; - if (!$request->getParams()->get('cookies.disable')) { - $request->removeHeader('Cookie'); - // Find cookies that match this request - foreach ($this->cookieJar->getMatchingCookies($request) as $cookie) { - $request->addCookie($cookie->getName(), $cookie->getValue()); - } - } - } - - /** - * Extract cookies from a sent request - * - * @param Event $event - */ - public function onRequestSent(Event $event) - { - $this->cookieJar->addCookiesFromResponse($event['response'], $event['request']); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cookie/Exception/InvalidCookieException.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cookie/Exception/InvalidCookieException.php deleted file mode 100644 index b1fa6fd89..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Cookie/Exception/InvalidCookieException.php +++ /dev/null @@ -1,7 +0,0 @@ -=5.3.2", - "guzzle/http": "self.version" - }, - "autoload": { - "psr-0": { "Guzzle\\Plugin\\Cookie": "" } - }, - "target-dir": "Guzzle/Plugin/Cookie", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/CurlAuth/CurlAuthPlugin.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/CurlAuth/CurlAuthPlugin.php deleted file mode 100644 index 610e60cad..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/CurlAuth/CurlAuthPlugin.php +++ /dev/null @@ -1,46 +0,0 @@ -getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest'); - */ -class CurlAuthPlugin implements EventSubscriberInterface -{ - private $username; - private $password; - private $scheme; - - /** - * @param string $username HTTP basic auth username - * @param string $password Password - * @param int $scheme Curl auth scheme - */ - public function __construct($username, $password, $scheme=CURLAUTH_BASIC) - { - Version::warn(__CLASS__ . " is deprecated. Use \$client->getConfig()->setPath('request.options/auth', array('user', 'pass', 'Basic|Digest');"); - $this->username = $username; - $this->password = $password; - $this->scheme = $scheme; - } - - public static function getSubscribedEvents() - { - return array('client.create_request' => array('onRequestCreate', 255)); - } - - /** - * Add basic auth - * - * @param Event $event - */ - public function onRequestCreate(Event $event) - { - $event['request']->setAuth($this->username, $this->password, $this->scheme); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/CurlAuth/composer.json b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/CurlAuth/composer.json deleted file mode 100644 index edc8b24e5..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/CurlAuth/composer.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "guzzle/plugin-curlauth", - "description": "Guzzle cURL authorization plugin", - "homepage": "http://guzzlephp.org/", - "keywords": ["plugin", "curl", "guzzle"], - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "require": { - "php": ">=5.3.2", - "guzzle/http": "self.version" - }, - "autoload": { - "psr-0": { "Guzzle\\Plugin\\CurlAuth": "" } - }, - "target-dir": "Guzzle/Plugin/CurlAuth", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/ErrorResponse/ErrorResponseExceptionInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/ErrorResponse/ErrorResponseExceptionInterface.php deleted file mode 100644 index 5dce8bd6c..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/ErrorResponse/ErrorResponseExceptionInterface.php +++ /dev/null @@ -1,22 +0,0 @@ - array('onCommandBeforeSend', -1)); - } - - /** - * Adds a listener to requests before they sent from a command - * - * @param Event $event Event emitted - */ - public function onCommandBeforeSend(Event $event) - { - $command = $event['command']; - if ($operation = $command->getOperation()) { - if ($operation->getErrorResponses()) { - $request = $command->getRequest(); - $request->getEventDispatcher() - ->addListener('request.complete', $this->getErrorClosure($request, $command, $operation)); - } - } - } - - /** - * @param RequestInterface $request Request that received an error - * @param CommandInterface $command Command that created the request - * @param Operation $operation Operation that defines the request and errors - * - * @return \Closure Returns a closure - * @throws ErrorResponseException - */ - protected function getErrorClosure(RequestInterface $request, CommandInterface $command, Operation $operation) - { - return function (Event $event) use ($request, $command, $operation) { - $response = $event['response']; - foreach ($operation->getErrorResponses() as $error) { - if (!isset($error['class'])) { - continue; - } - if (isset($error['code']) && $response->getStatusCode() != $error['code']) { - continue; - } - if (isset($error['reason']) && $response->getReasonPhrase() != $error['reason']) { - continue; - } - $className = $error['class']; - $errorClassInterface = __NAMESPACE__ . '\\ErrorResponseExceptionInterface'; - if (!class_exists($className)) { - throw new ErrorResponseException("{$className} does not exist"); - } elseif (!(in_array($errorClassInterface, class_implements($className)))) { - throw new ErrorResponseException("{$className} must implement {$errorClassInterface}"); - } - throw $className::fromCommand($command, $response); - } - }; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/ErrorResponse/Exception/ErrorResponseException.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/ErrorResponse/Exception/ErrorResponseException.php deleted file mode 100644 index 1d89e40e7..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/ErrorResponse/Exception/ErrorResponseException.php +++ /dev/null @@ -1,7 +0,0 @@ -=5.3.2", - "guzzle/service": "self.version" - }, - "autoload": { - "psr-0": { "Guzzle\\Plugin\\ErrorResponse": "" } - }, - "target-dir": "Guzzle/Plugin/ErrorResponse", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/History/HistoryPlugin.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/History/HistoryPlugin.php deleted file mode 100644 index 7375e892b..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/History/HistoryPlugin.php +++ /dev/null @@ -1,163 +0,0 @@ - array('onRequestSent', 9999)); - } - - /** - * Convert to a string that contains all request and response headers - * - * @return string - */ - public function __toString() - { - $lines = array(); - foreach ($this->transactions as $entry) { - $response = isset($entry['response']) ? $entry['response'] : ''; - $lines[] = '> ' . trim($entry['request']) . "\n\n< " . trim($response) . "\n"; - } - - return implode("\n", $lines); - } - - /** - * Add a request to the history - * - * @param RequestInterface $request Request to add - * @param Response $response Response of the request - * - * @return HistoryPlugin - */ - public function add(RequestInterface $request, Response $response = null) - { - if (!$response && $request->getResponse()) { - $response = $request->getResponse(); - } - - $this->transactions[] = array('request' => $request, 'response' => $response); - if (count($this->transactions) > $this->getlimit()) { - array_shift($this->transactions); - } - - return $this; - } - - /** - * Set the max number of requests to store - * - * @param int $limit Limit - * - * @return HistoryPlugin - */ - public function setLimit($limit) - { - $this->limit = (int) $limit; - - return $this; - } - - /** - * Get the request limit - * - * @return int - */ - public function getLimit() - { - return $this->limit; - } - - /** - * Get all of the raw transactions in the form of an array of associative arrays containing - * 'request' and 'response' keys. - * - * @return array - */ - public function getAll() - { - return $this->transactions; - } - - /** - * Get the requests in the history - * - * @return \ArrayIterator - */ - public function getIterator() - { - // Return an iterator just like the old iteration of the HistoryPlugin for BC compatibility (use getAll()) - return new \ArrayIterator(array_map(function ($entry) { - $entry['request']->getParams()->set('actual_response', $entry['response']); - return $entry['request']; - }, $this->transactions)); - } - - /** - * Get the number of requests in the history - * - * @return int - */ - public function count() - { - return count($this->transactions); - } - - /** - * Get the last request sent - * - * @return RequestInterface - */ - public function getLastRequest() - { - $last = end($this->transactions); - - return $last['request']; - } - - /** - * Get the last response in the history - * - * @return Response|null - */ - public function getLastResponse() - { - $last = end($this->transactions); - - return isset($last['response']) ? $last['response'] : null; - } - - /** - * Clears the history - * - * @return HistoryPlugin - */ - public function clear() - { - $this->transactions = array(); - - return $this; - } - - public function onRequestSent(Event $event) - { - $this->add($event['request'], $event['response']); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/History/composer.json b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/History/composer.json deleted file mode 100644 index ba0bf2c4d..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/History/composer.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "guzzle/plugin-history", - "description": "Guzzle history plugin", - "homepage": "http://guzzlephp.org/", - "keywords": ["plugin", "guzzle"], - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "require": { - "php": ">=5.3.2", - "guzzle/http": "self.version" - }, - "autoload": { - "psr-0": { "Guzzle\\Plugin\\History": "" } - }, - "target-dir": "Guzzle/Plugin/History", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Log/LogPlugin.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Log/LogPlugin.php deleted file mode 100644 index cabdea854..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Log/LogPlugin.php +++ /dev/null @@ -1,161 +0,0 @@ -logAdapter = $logAdapter; - $this->formatter = $formatter instanceof MessageFormatter ? $formatter : new MessageFormatter($formatter); - $this->wireBodies = $wireBodies; - } - - /** - * Get a log plugin that outputs full request, response, and curl error information to stderr - * - * @param bool $wireBodies Set to false to disable request/response body output when they use are not repeatable - * @param resource $stream Stream to write to when logging. Defaults to STDERR when it is available - * - * @return self - */ - public static function getDebugPlugin($wireBodies = true, $stream = null) - { - if ($stream === null) { - if (defined('STDERR')) { - $stream = STDERR; - } else { - $stream = fopen('php://output', 'w'); - } - } - - return new self(new ClosureLogAdapter(function ($m) use ($stream) { - fwrite($stream, $m . PHP_EOL); - }), "# Request:\n{request}\n\n# Response:\n{response}\n\n# Errors: {curl_code} {curl_error}", $wireBodies); - } - - public static function getSubscribedEvents() - { - return array( - 'curl.callback.write' => array('onCurlWrite', 255), - 'curl.callback.read' => array('onCurlRead', 255), - 'request.before_send' => array('onRequestBeforeSend', 255), - 'request.sent' => array('onRequestSent', 255) - ); - } - - /** - * Event triggered when curl data is read from a request - * - * @param Event $event - */ - public function onCurlRead(Event $event) - { - // Stream the request body to the log if the body is not repeatable - if ($wire = $event['request']->getParams()->get('request_wire')) { - $wire->write($event['read']); - } - } - - /** - * Event triggered when curl data is written to a response - * - * @param Event $event - */ - public function onCurlWrite(Event $event) - { - // Stream the response body to the log if the body is not repeatable - if ($wire = $event['request']->getParams()->get('response_wire')) { - $wire->write($event['write']); - } - } - - /** - * Called before a request is sent - * - * @param Event $event - */ - public function onRequestBeforeSend(Event $event) - { - if ($this->wireBodies) { - $request = $event['request']; - // Ensure that curl IO events are emitted - $request->getCurlOptions()->set('emit_io', true); - // We need to make special handling for content wiring and non-repeatable streams. - if ($request instanceof EntityEnclosingRequestInterface && $request->getBody() - && (!$request->getBody()->isSeekable() || !$request->getBody()->isReadable()) - ) { - // The body of the request cannot be recalled so logging the body will require us to buffer it - $request->getParams()->set('request_wire', EntityBody::factory()); - } - if (!$request->getResponseBody()->isRepeatable()) { - // The body of the response cannot be recalled so logging the body will require us to buffer it - $request->getParams()->set('response_wire', EntityBody::factory()); - } - } - } - - /** - * Triggers the actual log write when a request completes - * - * @param Event $event - */ - public function onRequestSent(Event $event) - { - $request = $event['request']; - $response = $event['response']; - $handle = $event['handle']; - - if ($wire = $request->getParams()->get('request_wire')) { - $request = clone $request; - $request->setBody($wire); - } - - if ($wire = $request->getParams()->get('response_wire')) { - $response = clone $response; - $response->setBody($wire); - } - - // Send the log message to the adapter, adding a category and host - $priority = $response && $response->isError() ? LOG_ERR : LOG_DEBUG; - $message = $this->formatter->format($request, $response, $handle); - $this->logAdapter->log($message, $priority, array( - 'request' => $request, - 'response' => $response, - 'handle' => $handle - )); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Log/composer.json b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Log/composer.json deleted file mode 100644 index 130e6da0a..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Log/composer.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "guzzle/plugin-log", - "description": "Guzzle log plugin for over the wire logging", - "homepage": "http://guzzlephp.org/", - "keywords": ["plugin", "log", "guzzle"], - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "require": { - "php": ">=5.3.2", - "guzzle/http": "self.version", - "guzzle/log": "self.version" - }, - "autoload": { - "psr-0": { "Guzzle\\Plugin\\Log": "" } - }, - "target-dir": "Guzzle/Plugin/Log", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Md5/CommandContentMd5Plugin.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Md5/CommandContentMd5Plugin.php deleted file mode 100644 index 851242433..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Md5/CommandContentMd5Plugin.php +++ /dev/null @@ -1,57 +0,0 @@ -contentMd5Param = $contentMd5Param; - $this->validateMd5Param = $validateMd5Param; - } - - public static function getSubscribedEvents() - { - return array('command.before_send' => array('onCommandBeforeSend', -255)); - } - - public function onCommandBeforeSend(Event $event) - { - $command = $event['command']; - $request = $command->getRequest(); - - // Only add an MD5 is there is a MD5 option on the operation and it has a payload - if ($request instanceof EntityEnclosingRequestInterface && $request->getBody() - && $command->getOperation()->hasParam($this->contentMd5Param)) { - // Check if an MD5 checksum value should be passed along to the request - if ($command[$this->contentMd5Param] === true) { - if (false !== ($md5 = $request->getBody()->getContentMd5(true, true))) { - $request->setHeader('Content-MD5', $md5); - } - } - } - - // Check if MD5 validation should be used with the response - if ($command[$this->validateMd5Param] === true) { - $request->addSubscriber(new Md5ValidatorPlugin(true, false)); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Md5/Md5ValidatorPlugin.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Md5/Md5ValidatorPlugin.php deleted file mode 100644 index 5d7a3785e..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Md5/Md5ValidatorPlugin.php +++ /dev/null @@ -1,88 +0,0 @@ -contentLengthCutoff = $contentLengthCutoff; - $this->contentEncoded = $contentEncoded; - } - - public static function getSubscribedEvents() - { - return array('request.complete' => array('onRequestComplete', 255)); - } - - /** - * {@inheritdoc} - * @throws UnexpectedValueException - */ - public function onRequestComplete(Event $event) - { - $response = $event['response']; - - if (!$contentMd5 = $response->getContentMd5()) { - return; - } - - $contentEncoding = $response->getContentEncoding(); - if ($contentEncoding && !$this->contentEncoded) { - return false; - } - - // Make sure that the size of the request is under the cutoff size - if ($this->contentLengthCutoff) { - $size = $response->getContentLength() ?: $response->getBody()->getSize(); - if (!$size || $size > $this->contentLengthCutoff) { - return; - } - } - - if (!$contentEncoding) { - $hash = $response->getBody()->getContentMd5(); - } elseif ($contentEncoding == 'gzip') { - $response->getBody()->compress('zlib.deflate'); - $hash = $response->getBody()->getContentMd5(); - $response->getBody()->uncompress(); - } elseif ($contentEncoding == 'compress') { - $response->getBody()->compress('bzip2.compress'); - $hash = $response->getBody()->getContentMd5(); - $response->getBody()->uncompress(); - } else { - return; - } - - if ($contentMd5 !== $hash) { - throw new UnexpectedValueException( - "The response entity body may have been modified over the wire. The Content-MD5 " - . "received ({$contentMd5}) did not match the calculated MD5 hash ({$hash})." - ); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Md5/composer.json b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Md5/composer.json deleted file mode 100644 index 0602d0609..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Md5/composer.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "guzzle/plugin-md5", - "description": "Guzzle MD5 plugins", - "homepage": "http://guzzlephp.org/", - "keywords": ["plugin", "guzzle"], - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "require": { - "php": ">=5.3.2", - "guzzle/http": "self.version" - }, - "autoload": { - "psr-0": { "Guzzle\\Plugin\\Md5": "" } - }, - "target-dir": "Guzzle/Plugin/Md5", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Mock/MockPlugin.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Mock/MockPlugin.php deleted file mode 100644 index 2440578cf..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Mock/MockPlugin.php +++ /dev/null @@ -1,245 +0,0 @@ -readBodies = $readBodies; - $this->temporary = $temporary; - if ($items) { - foreach ($items as $item) { - if ($item instanceof \Exception) { - $this->addException($item); - } else { - $this->addResponse($item); - } - } - } - } - - public static function getSubscribedEvents() - { - // Use a number lower than the CachePlugin - return array('request.before_send' => array('onRequestBeforeSend', -999)); - } - - public static function getAllEvents() - { - return array('mock.request'); - } - - /** - * Get a mock response from a file - * - * @param string $path File to retrieve a mock response from - * - * @return Response - * @throws InvalidArgumentException if the file is not found - */ - public static function getMockFile($path) - { - if (!file_exists($path)) { - throw new InvalidArgumentException('Unable to open mock file: ' . $path); - } - - return Response::fromMessage(file_get_contents($path)); - } - - /** - * Set whether or not to consume the entity body of a request when a mock - * response is used - * - * @param bool $readBodies Set to true to read and consume entity bodies - * - * @return self - */ - public function readBodies($readBodies) - { - $this->readBodies = $readBodies; - - return $this; - } - - /** - * Returns the number of remaining mock responses - * - * @return int - */ - public function count() - { - return count($this->queue); - } - - /** - * Add a response to the end of the queue - * - * @param string|Response $response Response object or path to response file - * - * @return MockPlugin - * @throws InvalidArgumentException if a string or Response is not passed - */ - public function addResponse($response) - { - if (!($response instanceof Response)) { - if (!is_string($response)) { - throw new InvalidArgumentException('Invalid response'); - } - $response = self::getMockFile($response); - } - - $this->queue[] = $response; - - return $this; - } - - /** - * Add an exception to the end of the queue - * - * @param CurlException $e Exception to throw when the request is executed - * - * @return MockPlugin - */ - public function addException(CurlException $e) - { - $this->queue[] = $e; - - return $this; - } - - /** - * Clear the queue - * - * @return MockPlugin - */ - public function clearQueue() - { - $this->queue = array(); - - return $this; - } - - /** - * Returns an array of mock responses remaining in the queue - * - * @return array - */ - public function getQueue() - { - return $this->queue; - } - - /** - * Check if this is a temporary plugin - * - * @return bool - */ - public function isTemporary() - { - return $this->temporary; - } - - /** - * Get a response from the front of the list and add it to a request - * - * @param RequestInterface $request Request to mock - * - * @return self - * @throws CurlException When request.send is called and an exception is queued - */ - public function dequeue(RequestInterface $request) - { - $this->dispatch('mock.request', array('plugin' => $this, 'request' => $request)); - - $item = array_shift($this->queue); - if ($item instanceof Response) { - if ($this->readBodies && $request instanceof EntityEnclosingRequestInterface) { - $request->getEventDispatcher()->addListener('request.sent', $f = function (Event $event) use (&$f) { - while ($data = $event['request']->getBody()->read(8096)); - // Remove the listener after one-time use - $event['request']->getEventDispatcher()->removeListener('request.sent', $f); - }); - } - $request->setResponse($item); - } elseif ($item instanceof CurlException) { - // Emulates exceptions encountered while transferring requests - $item->setRequest($request); - $state = $request->setState(RequestInterface::STATE_ERROR, array('exception' => $item)); - // Only throw if the exception wasn't handled - if ($state == RequestInterface::STATE_ERROR) { - throw $item; - } - } - - return $this; - } - - /** - * Clear the array of received requests - */ - public function flush() - { - $this->received = array(); - } - - /** - * Get an array of requests that were mocked by this plugin - * - * @return array - */ - public function getReceivedRequests() - { - return $this->received; - } - - /** - * Called when a request is about to be sent - * - * @param Event $event - * @throws \OutOfBoundsException When queue is empty - */ - public function onRequestBeforeSend(Event $event) - { - if (!$this->queue) { - throw new \OutOfBoundsException('Mock queue is empty'); - } - - $request = $event['request']; - $this->received[] = $request; - // Detach the filter from the client so it's a one-time use - if ($this->temporary && count($this->queue) == 1 && $request->getClient()) { - $request->getClient()->getEventDispatcher()->removeSubscriber($this); - } - $this->dequeue($request); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Mock/composer.json b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Mock/composer.json deleted file mode 100644 index f8201e31f..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Mock/composer.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "guzzle/plugin-mock", - "description": "Guzzle Mock plugin", - "homepage": "http://guzzlephp.org/", - "keywords": ["mock", "plugin", "guzzle"], - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "require": { - "php": ">=5.3.2", - "guzzle/http": "self.version" - }, - "autoload": { - "psr-0": { "Guzzle\\Plugin\\Mock": "" } - }, - "target-dir": "Guzzle/Plugin/Mock", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Oauth/OauthPlugin.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Oauth/OauthPlugin.php deleted file mode 100644 index 95e0c3e4a..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Oauth/OauthPlugin.php +++ /dev/null @@ -1,306 +0,0 @@ -config = Collection::fromConfig($config, array( - 'version' => '1.0', - 'request_method' => self::REQUEST_METHOD_HEADER, - 'consumer_key' => 'anonymous', - 'consumer_secret' => 'anonymous', - 'signature_method' => 'HMAC-SHA1', - 'signature_callback' => function($stringToSign, $key) { - return hash_hmac('sha1', $stringToSign, $key, true); - } - ), array( - 'signature_method', 'signature_callback', 'version', - 'consumer_key', 'consumer_secret' - )); - } - - public static function getSubscribedEvents() - { - return array( - 'request.before_send' => array('onRequestBeforeSend', -1000) - ); - } - - /** - * Request before-send event handler - * - * @param Event $event Event received - * @return array - * @throws \InvalidArgumentException - */ - public function onRequestBeforeSend(Event $event) - { - $timestamp = $this->getTimestamp($event); - $request = $event['request']; - $nonce = $this->generateNonce($request); - $authorizationParams = $this->getOauthParams($timestamp, $nonce); - $authorizationParams['oauth_signature'] = $this->getSignature($request, $timestamp, $nonce); - - switch ($this->config['request_method']) { - case self::REQUEST_METHOD_HEADER: - $request->setHeader( - 'Authorization', - $this->buildAuthorizationHeader($authorizationParams) - ); - break; - case self::REQUEST_METHOD_QUERY: - foreach ($authorizationParams as $key => $value) { - $request->getQuery()->set($key, $value); - } - break; - default: - throw new \InvalidArgumentException(sprintf( - 'Invalid consumer method "%s"', - $this->config['request_method'] - )); - } - - return $authorizationParams; - } - - /** - * Builds the Authorization header for a request - * - * @param array $authorizationParams Associative array of authorization parameters - * - * @return string - */ - private function buildAuthorizationHeader($authorizationParams) - { - $authorizationString = 'OAuth '; - foreach ($authorizationParams as $key => $val) { - if ($val) { - $authorizationString .= $key . '="' . urlencode($val) . '", '; - } - } - - return substr($authorizationString, 0, -2); - } - - /** - * Calculate signature for request - * - * @param RequestInterface $request Request to generate a signature for - * @param integer $timestamp Timestamp to use for nonce - * @param string $nonce - * - * @return string - */ - public function getSignature(RequestInterface $request, $timestamp, $nonce) - { - $string = $this->getStringToSign($request, $timestamp, $nonce); - $key = urlencode($this->config['consumer_secret']) . '&' . urlencode($this->config['token_secret']); - - return base64_encode(call_user_func($this->config['signature_callback'], $string, $key)); - } - - /** - * Calculate string to sign - * - * @param RequestInterface $request Request to generate a signature for - * @param int $timestamp Timestamp to use for nonce - * @param string $nonce - * - * @return string - */ - public function getStringToSign(RequestInterface $request, $timestamp, $nonce) - { - $params = $this->getParamsToSign($request, $timestamp, $nonce); - - // Convert booleans to strings. - $params = $this->prepareParameters($params); - - // Build signing string from combined params - $parameterString = clone $request->getQuery(); - $parameterString->replace($params); - - $url = Url::factory($request->getUrl())->setQuery('')->setFragment(null); - - return strtoupper($request->getMethod()) . '&' - . rawurlencode($url) . '&' - . rawurlencode((string) $parameterString); - } - - /** - * Get the oauth parameters as named by the oauth spec - * - * @param $timestamp - * @param $nonce - * @return Collection - */ - protected function getOauthParams($timestamp, $nonce) - { - $params = new Collection(array( - 'oauth_consumer_key' => $this->config['consumer_key'], - 'oauth_nonce' => $nonce, - 'oauth_signature_method' => $this->config['signature_method'], - 'oauth_timestamp' => $timestamp, - )); - - // Optional parameters should not be set if they have not been set in the config as - // the parameter may be considered invalid by the Oauth service. - $optionalParams = array( - 'callback' => 'oauth_callback', - 'token' => 'oauth_token', - 'verifier' => 'oauth_verifier', - 'version' => 'oauth_version' - ); - - foreach ($optionalParams as $optionName => $oauthName) { - if (isset($this->config[$optionName]) == true) { - $params[$oauthName] = $this->config[$optionName]; - } - } - - return $params; - } - - /** - * Get all of the parameters required to sign a request including: - * * The oauth params - * * The request GET params - * * The params passed in the POST body (with a content-type of application/x-www-form-urlencoded) - * - * @param RequestInterface $request Request to generate a signature for - * @param integer $timestamp Timestamp to use for nonce - * @param string $nonce - * - * @return array - */ - public function getParamsToSign(RequestInterface $request, $timestamp, $nonce) - { - $params = $this->getOauthParams($timestamp, $nonce); - - // Add query string parameters - $params->merge($request->getQuery()); - - // Add POST fields to signing string if required - if ($this->shouldPostFieldsBeSigned($request)) - { - $params->merge($request->getPostFields()); - } - - // Sort params - $params = $params->toArray(); - uksort($params, 'strcmp'); - - return $params; - } - - /** - * Decide whether the post fields should be added to the base string that Oauth signs. - * This implementation is correct. Non-conformant APIs may require that this method be - * overwritten e.g. the Flickr API incorrectly adds the post fields when the Content-Type - * is 'application/x-www-form-urlencoded' - * - * @param $request - * @return bool Whether the post fields should be signed or not - */ - public function shouldPostFieldsBeSigned($request) - { - if (!$this->config->get('disable_post_params') && - $request instanceof EntityEnclosingRequestInterface && - false !== strpos($request->getHeader('Content-Type'), 'application/x-www-form-urlencoded')) - { - return true; - } - - return false; - } - - /** - * Returns a Nonce Based on the unique id and URL. This will allow for multiple requests in parallel with the same - * exact timestamp to use separate nonce's. - * - * @param RequestInterface $request Request to generate a nonce for - * - * @return string - */ - public function generateNonce(RequestInterface $request) - { - return sha1(uniqid('', true) . $request->getUrl()); - } - - /** - * Gets timestamp from event or create new timestamp - * - * @param Event $event Event containing contextual information - * - * @return int - */ - public function getTimestamp(Event $event) - { - return $event['timestamp'] ?: time(); - } - - /** - * Convert booleans to strings, removed unset parameters, and sorts the array - * - * @param array $data Data array - * - * @return array - */ - protected function prepareParameters($data) - { - ksort($data); - foreach ($data as $key => &$value) { - switch (gettype($value)) { - case 'NULL': - unset($data[$key]); - break; - case 'array': - $data[$key] = self::prepareParameters($value); - break; - case 'boolean': - $data[$key] = $value ? 'true' : 'false'; - break; - } - } - - return $data; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Oauth/composer.json b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Oauth/composer.json deleted file mode 100644 index c9766ba16..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/Oauth/composer.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "guzzle/plugin-oauth", - "description": "Guzzle OAuth plugin", - "homepage": "http://guzzlephp.org/", - "keywords": ["oauth", "plugin", "guzzle"], - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "require": { - "php": ">=5.3.2", - "guzzle/http": "self.version" - }, - "autoload": { - "psr-0": { "Guzzle\\Plugin\\Oauth": "" } - }, - "target-dir": "Guzzle/Plugin/Oauth", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/composer.json b/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/composer.json deleted file mode 100644 index 2bbe64cc5..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Plugin/composer.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "guzzle/plugin", - "description": "Guzzle plugin component containing all Guzzle HTTP plugins", - "homepage": "http://guzzlephp.org/", - "keywords": ["http", "client", "plugin", "extension", "guzzle"], - "license": "MIT", - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "require": { - "php": ">=5.3.2", - "guzzle/http": "self.version" - }, - "suggest": { - "guzzle/cache": "self.version", - "guzzle/log": "self.version" - }, - "autoload": { - "psr-0": { "Guzzle\\Plugin": "" } - }, - "target-dir": "Guzzle/Plugin", - "replace": { - "guzzle/plugin-async": "self.version", - "guzzle/plugin-backoff": "self.version", - "guzzle/plugin-cache": "self.version", - "guzzle/plugin-cookie": "self.version", - "guzzle/plugin-curlauth": "self.version", - "guzzle/plugin-error-response": "self.version", - "guzzle/plugin-history": "self.version", - "guzzle/plugin-log": "self.version", - "guzzle/plugin-md5": "self.version", - "guzzle/plugin-mock": "self.version", - "guzzle/plugin-oauth": "self.version" - }, - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/AbstractConfigLoader.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/AbstractConfigLoader.php deleted file mode 100644 index cd06f5722..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/AbstractConfigLoader.php +++ /dev/null @@ -1,177 +0,0 @@ - 'JSON_ERROR_NONE - No errors', - JSON_ERROR_DEPTH => 'JSON_ERROR_DEPTH - Maximum stack depth exceeded', - JSON_ERROR_STATE_MISMATCH => 'JSON_ERROR_STATE_MISMATCH - Underflow or the modes mismatch', - JSON_ERROR_CTRL_CHAR => 'JSON_ERROR_CTRL_CHAR - Unexpected control character found', - JSON_ERROR_SYNTAX => 'JSON_ERROR_SYNTAX - Syntax error, malformed JSON', - JSON_ERROR_UTF8 => 'JSON_ERROR_UTF8 - Malformed UTF-8 characters, possibly incorrectly encoded' - ); - - public function load($config, array $options = array()) - { - // Reset the array of loaded files because this is a new config - $this->loadedFiles = array(); - - if (is_string($config)) { - $config = $this->loadFile($config); - } elseif (!is_array($config)) { - throw new InvalidArgumentException('Unknown type passed to configuration loader: ' . gettype($config)); - } else { - $this->mergeIncludes($config); - } - - return $this->build($config, $options); - } - - /** - * Add an include alias to the loader - * - * @param string $filename Filename to alias (e.g. _foo) - * @param string $alias Actual file to use (e.g. /path/to/foo.json) - * - * @return self - */ - public function addAlias($filename, $alias) - { - $this->aliases[$filename] = $alias; - - return $this; - } - - /** - * Remove an alias from the loader - * - * @param string $alias Alias to remove - * - * @return self - */ - public function removeAlias($alias) - { - unset($this->aliases[$alias]); - - return $this; - } - - /** - * Perform the parsing of a config file and create the end result - * - * @param array $config Configuration data - * @param array $options Options to use when building - * - * @return mixed - */ - protected abstract function build($config, array $options); - - /** - * Load a configuration file (can load JSON or PHP files that return an array when included) - * - * @param string $filename File to load - * - * @return array - * @throws InvalidArgumentException - * @throws RuntimeException when the JSON cannot be parsed - */ - protected function loadFile($filename) - { - if (isset($this->aliases[$filename])) { - $filename = $this->aliases[$filename]; - } - - switch (pathinfo($filename, PATHINFO_EXTENSION)) { - case 'js': - case 'json': - $level = error_reporting(0); - $json = file_get_contents($filename); - error_reporting($level); - - if ($json === false) { - $err = error_get_last(); - throw new InvalidArgumentException("Unable to open {$filename}: " . $err['message']); - } - - $config = json_decode($json, true); - // Throw an exception if there was an error loading the file - if ($error = json_last_error()) { - $message = isset(self::$jsonErrors[$error]) ? self::$jsonErrors[$error] : 'Unknown error'; - throw new RuntimeException("Error loading JSON data from {$filename}: ({$error}) - {$message}"); - } - break; - case 'php': - if (!is_readable($filename)) { - throw new InvalidArgumentException("Unable to open {$filename} for reading"); - } - $config = require $filename; - if (!is_array($config)) { - throw new InvalidArgumentException('PHP files must return an array of configuration data'); - } - break; - default: - throw new InvalidArgumentException('Unknown file extension: ' . $filename); - } - - // Keep track of this file being loaded to prevent infinite recursion - $this->loadedFiles[$filename] = true; - - // Merge include files into the configuration array - $this->mergeIncludes($config, dirname($filename)); - - return $config; - } - - /** - * Merges in all include files - * - * @param array $config Config data that contains includes - * @param string $basePath Base path to use when a relative path is encountered - * - * @return array Returns the merged and included data - */ - protected function mergeIncludes(&$config, $basePath = null) - { - if (!empty($config['includes'])) { - foreach ($config['includes'] as &$path) { - // Account for relative paths - if ($path[0] != DIRECTORY_SEPARATOR && !isset($this->aliases[$path]) && $basePath) { - $path = "{$basePath}/{$path}"; - } - // Don't load the same files more than once - if (!isset($this->loadedFiles[$path])) { - $this->loadedFiles[$path] = true; - $config = $this->mergeData($this->loadFile($path), $config); - } - } - } - } - - /** - * Default implementation for merging two arrays of data (uses array_merge_recursive) - * - * @param array $a Original data - * @param array $b Data to merge into the original and overwrite existing values - * - * @return array - */ - protected function mergeData(array $a, array $b) - { - return array_merge_recursive($a, $b); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Builder/ServiceBuilder.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Builder/ServiceBuilder.php deleted file mode 100644 index 38150db4b..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Builder/ServiceBuilder.php +++ /dev/null @@ -1,189 +0,0 @@ -load($config, $globalParameters); - } - - /** - * @param array $serviceBuilderConfig Service configuration settings: - * - name: Name of the service - * - class: Client class to instantiate using a factory method - * - params: array of key value pair configuration settings for the builder - */ - public function __construct(array $serviceBuilderConfig = array()) - { - $this->builderConfig = $serviceBuilderConfig; - } - - public static function getAllEvents() - { - return array('service_builder.create_client'); - } - - public function unserialize($serialized) - { - $this->builderConfig = json_decode($serialized, true); - } - - public function serialize() - { - return json_encode($this->builderConfig); - } - - /** - * Attach a plugin to every client created by the builder - * - * @param EventSubscriberInterface $plugin Plugin to attach to each client - * - * @return self - */ - public function addGlobalPlugin(EventSubscriberInterface $plugin) - { - $this->plugins[] = $plugin; - - return $this; - } - - /** - * Get data from the service builder without triggering the building of a service - * - * @param string $name Name of the service to retrieve - * - * @return array|null - */ - public function getData($name) - { - return isset($this->builderConfig[$name]) ? $this->builderConfig[$name] : null; - } - - public function get($name, $throwAway = false) - { - if (!isset($this->builderConfig[$name])) { - - // Check to see if arbitrary data is being referenced - if (isset($this->clients[$name])) { - return $this->clients[$name]; - } - - // Check aliases and return a match if found - foreach ($this->builderConfig as $actualName => $config) { - if (isset($config['alias']) && $config['alias'] == $name) { - return $this->get($actualName, $throwAway); - } - } - throw new ServiceNotFoundException('No service is registered as ' . $name); - } - - if (!$throwAway && isset($this->clients[$name])) { - return $this->clients[$name]; - } - - $builder =& $this->builderConfig[$name]; - - // Convert references to the actual client - foreach ($builder['params'] as &$v) { - if (is_string($v) && substr($v, 0, 1) == '{' && substr($v, -1) == '}') { - $v = $this->get(trim($v, '{} ')); - } - } - - // Get the configured parameters and merge in any parameters provided for throw-away clients - $config = $builder['params']; - if (is_array($throwAway)) { - $config = $throwAway + $config; - } - - $client = $builder['class']::factory($config); - - if (!$throwAway) { - $this->clients[$name] = $client; - } - - if ($client instanceof ClientInterface) { - foreach ($this->plugins as $plugin) { - $client->addSubscriber($plugin); - } - // Dispatch an event letting listeners know a client was created - $this->dispatch('service_builder.create_client', array('client' => $client)); - } - - return $client; - } - - public function set($key, $service) - { - if (is_array($service) && isset($service['class']) && isset($service['params'])) { - $this->builderConfig[$key] = $service; - } else { - $this->clients[$key] = $service; - } - - return $this; - } - - public function offsetSet($offset, $value) - { - $this->set($offset, $value); - } - - public function offsetUnset($offset) - { - unset($this->builderConfig[$offset]); - unset($this->clients[$offset]); - } - - public function offsetExists($offset) - { - return isset($this->builderConfig[$offset]) || isset($this->clients[$offset]); - } - - public function offsetGet($offset) - { - return $this->get($offset); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Builder/ServiceBuilderInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Builder/ServiceBuilderInterface.php deleted file mode 100644 index 4fc310a47..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Builder/ServiceBuilderInterface.php +++ /dev/null @@ -1,40 +0,0 @@ - &$service) { - - $service['params'] = isset($service['params']) ? $service['params'] : array(); - - // Check if this client builder extends another client - if (!empty($service['extends'])) { - - // Make sure that the service it's extending has been defined - if (!isset($services[$service['extends']])) { - throw new ServiceNotFoundException( - "{$name} is trying to extend a non-existent service: {$service['extends']}" - ); - } - - $extended = &$services[$service['extends']]; - - // Use the correct class attribute - if (empty($service['class'])) { - $service['class'] = isset($extended['class']) ? $extended['class'] : ''; - } - if ($extendsParams = isset($extended['params']) ? $extended['params'] : false) { - $service['params'] = $service['params'] + $extendsParams; - } - } - - // Overwrite default values with global parameter values - if (!empty($options)) { - $service['params'] = $options + $service['params']; - } - - $service['class'] = isset($service['class']) ? $service['class'] : ''; - } - - return new $class($services); - } - - protected function mergeData(array $a, array $b) - { - $result = $b + $a; - - // Merge services using a recursive union of arrays - if (isset($a['services']) && $b['services']) { - - // Get a union of the services of the two arrays - $result['services'] = $b['services'] + $a['services']; - - // Merge each service in using a union of the two arrays - foreach ($result['services'] as $name => &$service) { - - // By default, services completely override a previously defined service unless it extends itself - if (isset($a['services'][$name]['extends']) - && isset($b['services'][$name]['extends']) - && $b['services'][$name]['extends'] == $name - ) { - $service += $a['services'][$name]; - // Use the `extends` attribute of the parent - $service['extends'] = $a['services'][$name]['extends']; - // Merge parameters using a union if both have parameters - if (isset($a['services'][$name]['params'])) { - $service['params'] += $a['services'][$name]['params']; - } - } - } - } - - return $result; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/CachingConfigLoader.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/CachingConfigLoader.php deleted file mode 100644 index 26f8360cc..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/CachingConfigLoader.php +++ /dev/null @@ -1,46 +0,0 @@ -loader = $loader; - $this->cache = $cache; - } - - public function load($config, array $options = array()) - { - if (!is_string($config)) { - $key = false; - } else { - $key = 'loader_' . crc32($config); - if ($result = $this->cache->fetch($key)) { - return $result; - } - } - - $result = $this->loader->load($config, $options); - if ($key) { - $this->cache->save($key, $result); - } - - return $result; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Client.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Client.php deleted file mode 100644 index 3e5f8e53d..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Client.php +++ /dev/null @@ -1,297 +0,0 @@ -getCommand($method, isset($args[0]) ? $args[0] : array())->getResult(); - } - - public function getCommand($name, array $args = array()) - { - // Add global client options to the command - if ($options = $this->getConfig(self::COMMAND_PARAMS)) { - $args += $options; - } - - if (!($command = $this->getCommandFactory()->factory($name, $args))) { - throw new InvalidArgumentException("Command was not found matching {$name}"); - } - - $command->setClient($this); - $this->dispatch('client.command.create', array('client' => $this, 'command' => $command)); - - return $command; - } - - /** - * Set the command factory used to create commands by name - * - * @param CommandFactoryInterface $factory Command factory - * - * @return self - */ - public function setCommandFactory(CommandFactoryInterface $factory) - { - $this->commandFactory = $factory; - - return $this; - } - - /** - * Set the resource iterator factory associated with the client - * - * @param ResourceIteratorFactoryInterface $factory Resource iterator factory - * - * @return self - */ - public function setResourceIteratorFactory(ResourceIteratorFactoryInterface $factory) - { - $this->resourceIteratorFactory = $factory; - - return $this; - } - - public function getIterator($command, array $commandOptions = null, array $iteratorOptions = array()) - { - if (!($command instanceof CommandInterface)) { - $command = $this->getCommand($command, $commandOptions ?: array()); - } - - return $this->getResourceIteratorFactory()->build($command, $iteratorOptions); - } - - public function execute($command) - { - if ($command instanceof CommandInterface) { - $this->send($this->prepareCommand($command)); - $this->dispatch('command.after_send', array('command' => $command)); - return $command->getResult(); - } elseif (is_array($command) || $command instanceof \Traversable) { - return $this->executeMultiple($command); - } else { - throw new InvalidArgumentException('Command must be a command or array of commands'); - } - } - - public function setDescription(ServiceDescriptionInterface $service) - { - $this->serviceDescription = $service; - - if ($this->getCommandFactory() && $this->getCommandFactory() instanceof CompositeFactory) { - $this->commandFactory->add(new Command\Factory\ServiceDescriptionFactory($service)); - } - - // If a baseUrl was set on the description, then update the client - if ($baseUrl = $service->getBaseUrl()) { - $this->setBaseUrl($baseUrl); - } - - return $this; - } - - public function getDescription() - { - return $this->serviceDescription; - } - - /** - * Set the inflector used with the client - * - * @param InflectorInterface $inflector Inflection object - * - * @return self - */ - public function setInflector(InflectorInterface $inflector) - { - $this->inflector = $inflector; - - return $this; - } - - /** - * Get the inflector used with the client - * - * @return self - */ - public function getInflector() - { - if (!$this->inflector) { - $this->inflector = Inflector::getDefault(); - } - - return $this->inflector; - } - - /** - * Prepare a command for sending and get the RequestInterface object created by the command - * - * @param CommandInterface $command Command to prepare - * - * @return RequestInterface - */ - protected function prepareCommand(CommandInterface $command) - { - // Set the client and prepare the command - $request = $command->setClient($this)->prepare(); - // Set the state to new if the command was previously executed - $request->setState(RequestInterface::STATE_NEW); - $this->dispatch('command.before_send', array('command' => $command)); - - return $request; - } - - /** - * Execute multiple commands in parallel - * - * @param array|Traversable $commands Array of CommandInterface objects to execute - * - * @return array Returns an array of the executed commands - * @throws Exception\CommandTransferException - */ - protected function executeMultiple($commands) - { - $requests = array(); - $commandRequests = new \SplObjectStorage(); - - foreach ($commands as $command) { - $request = $this->prepareCommand($command); - $commandRequests[$request] = $command; - $requests[] = $request; - } - - try { - $this->send($requests); - foreach ($commands as $command) { - $this->dispatch('command.after_send', array('command' => $command)); - } - return $commands; - } catch (MultiTransferException $failureException) { - // Throw a CommandTransferException using the successful and failed commands - $e = CommandTransferException::fromMultiTransferException($failureException); - - // Remove failed requests from the successful requests array and add to the failures array - foreach ($failureException->getFailedRequests() as $request) { - if (isset($commandRequests[$request])) { - $e->addFailedCommand($commandRequests[$request]); - unset($commandRequests[$request]); - } - } - - // Always emit the command after_send events for successful commands - foreach ($commandRequests as $success) { - $e->addSuccessfulCommand($commandRequests[$success]); - $this->dispatch('command.after_send', array('command' => $commandRequests[$success])); - } - - throw $e; - } - } - - protected function getResourceIteratorFactory() - { - if (!$this->resourceIteratorFactory) { - // Build the default resource iterator factory if one is not set - $clientClass = get_class($this); - $prefix = substr($clientClass, 0, strrpos($clientClass, '\\')); - $this->resourceIteratorFactory = new ResourceIteratorClassFactory(array( - "{$prefix}\\Iterator", - "{$prefix}\\Model" - )); - } - - return $this->resourceIteratorFactory; - } - - /** - * Get the command factory associated with the client - * - * @return CommandFactoryInterface - */ - protected function getCommandFactory() - { - if (!$this->commandFactory) { - $this->commandFactory = CompositeFactory::getDefaultChain($this); - } - - return $this->commandFactory; - } - - /** - * @deprecated - * @codeCoverageIgnore - */ - public function enableMagicMethods($isEnabled) - { - Version::warn(__METHOD__ . ' is deprecated'); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/ClientInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/ClientInterface.php deleted file mode 100644 index 814154f00..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/ClientInterface.php +++ /dev/null @@ -1,68 +0,0 @@ -operation = $operation ?: $this->createOperation(); - foreach ($this->operation->getParams() as $name => $arg) { - $currentValue = $this[$name]; - $configValue = $arg->getValue($currentValue); - // If default or static values are set, then this should always be updated on the config object - if ($currentValue !== $configValue) { - $this[$name] = $configValue; - } - } - - $headers = $this[self::HEADERS_OPTION]; - if (!$headers instanceof Collection) { - $this[self::HEADERS_OPTION] = new Collection((array) $headers); - } - - // You can set a command.on_complete option in your parameters to set an onComplete callback - if ($onComplete = $this['command.on_complete']) { - unset($this['command.on_complete']); - $this->setOnComplete($onComplete); - } - - // Set the hidden additional parameters - if (!$this[self::HIDDEN_PARAMS]) { - $this[self::HIDDEN_PARAMS] = array( - self::HEADERS_OPTION, - self::RESPONSE_PROCESSING, - self::HIDDEN_PARAMS, - self::REQUEST_OPTIONS - ); - } - - $this->init(); - } - - /** - * Custom clone behavior - */ - public function __clone() - { - $this->request = null; - $this->result = null; - } - - /** - * Execute the command in the same manner as calling a function - * - * @return mixed Returns the result of {@see AbstractCommand::execute} - */ - public function __invoke() - { - return $this->execute(); - } - - public function getName() - { - return $this->operation->getName(); - } - - /** - * Get the API command information about the command - * - * @return OperationInterface - */ - public function getOperation() - { - return $this->operation; - } - - public function setOnComplete($callable) - { - if (!is_callable($callable)) { - throw new InvalidArgumentException('The onComplete function must be callable'); - } - - $this->onComplete = $callable; - - return $this; - } - - public function execute() - { - if (!$this->client) { - throw new CommandException('A client must be associated with the command before it can be executed.'); - } - - return $this->client->execute($this); - } - - public function getClient() - { - return $this->client; - } - - public function setClient(ClientInterface $client) - { - $this->client = $client; - - return $this; - } - - public function getRequest() - { - if (!$this->request) { - throw new CommandException('The command must be prepared before retrieving the request'); - } - - return $this->request; - } - - public function getResponse() - { - if (!$this->isExecuted()) { - $this->execute(); - } - - return $this->request->getResponse(); - } - - public function getResult() - { - if (!$this->isExecuted()) { - $this->execute(); - } - - if (null === $this->result) { - $this->process(); - // Call the onComplete method if one is set - if ($this->onComplete) { - call_user_func($this->onComplete, $this); - } - } - - return $this->result; - } - - public function setResult($result) - { - $this->result = $result; - - return $this; - } - - public function isPrepared() - { - return $this->request !== null; - } - - public function isExecuted() - { - return $this->request !== null && $this->request->getState() == 'complete'; - } - - public function prepare() - { - if (!$this->isPrepared()) { - if (!$this->client) { - throw new CommandException('A client must be associated with the command before it can be prepared.'); - } - - // If no response processing value was specified, then attempt to use the highest level of processing - if (!isset($this[self::RESPONSE_PROCESSING])) { - $this[self::RESPONSE_PROCESSING] = self::TYPE_MODEL; - } - - // Notify subscribers of the client that the command is being prepared - $this->client->dispatch('command.before_prepare', array('command' => $this)); - - // Fail on missing required arguments, and change parameters via filters - $this->validate(); - // Delegate to the subclass that implements the build method - $this->build(); - - // Add custom request headers set on the command - if ($headers = $this[self::HEADERS_OPTION]) { - foreach ($headers as $key => $value) { - $this->request->setHeader($key, $value); - } - } - - // Add any curl options to the request - if ($options = $this[Client::CURL_OPTIONS]) { - $this->request->getCurlOptions()->overwriteWith(CurlHandle::parseCurlConfig($options)); - } - - // Set a custom response body - if ($responseBody = $this[self::RESPONSE_BODY]) { - $this->request->setResponseBody($responseBody); - } - - $this->client->dispatch('command.after_prepare', array('command' => $this)); - } - - return $this->request; - } - - /** - * Set the validator used to validate and prepare command parameters and nested JSON schemas. If no validator is - * set, then the command will validate using the default {@see SchemaValidator}. - * - * @param ValidatorInterface $validator Validator used to prepare and validate properties against a JSON schema - * - * @return self - */ - public function setValidator(ValidatorInterface $validator) - { - $this->validator = $validator; - - return $this; - } - - public function getRequestHeaders() - { - return $this[self::HEADERS_OPTION]; - } - - /** - * Initialize the command (hook that can be implemented in subclasses) - */ - protected function init() {} - - /** - * Create the request object that will carry out the command - */ - abstract protected function build(); - - /** - * Hook used to create an operation for concrete commands that are not associated with a service description - * - * @return OperationInterface - */ - protected function createOperation() - { - return new Operation(array('name' => get_class($this))); - } - - /** - * Create the result of the command after the request has been completed. - * Override this method in subclasses to customize this behavior - */ - protected function process() - { - $this->result = $this[self::RESPONSE_PROCESSING] != self::TYPE_RAW - ? DefaultResponseParser::getInstance()->parse($this) - : $this->request->getResponse(); - } - - /** - * Validate and prepare the command based on the schema and rules defined by the command's Operation object - * - * @throws ValidationException when validation errors occur - */ - protected function validate() - { - // Do not perform request validation/transformation if it is disable - if ($this[self::DISABLE_VALIDATION]) { - return; - } - - $errors = array(); - $validator = $this->getValidator(); - foreach ($this->operation->getParams() as $name => $schema) { - $value = $this[$name]; - if (!$validator->validate($schema, $value)) { - $errors = array_merge($errors, $validator->getErrors()); - } elseif ($value !== $this[$name]) { - // Update the config value if it changed and no validation errors were encountered - $this->data[$name] = $value; - } - } - - // Validate additional parameters - $hidden = $this[self::HIDDEN_PARAMS]; - - if ($properties = $this->operation->getAdditionalParameters()) { - foreach ($this->toArray() as $name => $value) { - // It's only additional if it isn't defined in the schema - if (!$this->operation->hasParam($name) && !in_array($name, $hidden)) { - // Always set the name so that error messages are useful - $properties->setName($name); - if (!$validator->validate($properties, $value)) { - $errors = array_merge($errors, $validator->getErrors()); - } elseif ($value !== $this[$name]) { - $this->data[$name] = $value; - } - } - } - } - - if (!empty($errors)) { - $e = new ValidationException('Validation errors: ' . implode("\n", $errors)); - $e->setErrors($errors); - throw $e; - } - } - - /** - * Get the validator used to prepare and validate properties. If no validator has been set on the command, then - * the default {@see SchemaValidator} will be used. - * - * @return ValidatorInterface - */ - protected function getValidator() - { - if (!$this->validator) { - $this->validator = SchemaValidator::getInstance(); - } - - return $this->validator; - } - - /** - * Get array of any validation errors - * If no validator has been set then return false - */ - public function getValidationErrors() - { - if (!$this->validator) { - return false; - } - - return $this->validator->getErrors(); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/ClosureCommand.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/ClosureCommand.php deleted file mode 100644 index cb6ac40ce..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/ClosureCommand.php +++ /dev/null @@ -1,41 +0,0 @@ -request = $closure($this, $this->operation); - - if (!$this->request || !$this->request instanceof RequestInterface) { - throw new UnexpectedValueException('Closure command did not return a RequestInterface object'); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/CommandInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/CommandInterface.php deleted file mode 100644 index fbb61d2ff..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/CommandInterface.php +++ /dev/null @@ -1,128 +0,0 @@ -stopPropagation(); - } - - /** - * Get the created object - * - * @return mixed - */ - public function getResult() - { - return $this['result']; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/DefaultRequestSerializer.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/DefaultRequestSerializer.php deleted file mode 100644 index 2dc4acd37..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/DefaultRequestSerializer.php +++ /dev/null @@ -1,169 +0,0 @@ -factory = $factory; - } - - /** - * Add a location visitor to the serializer - * - * @param string $location Location to associate with the visitor - * @param RequestVisitorInterface $visitor Visitor to attach - * - * @return self - */ - public function addVisitor($location, RequestVisitorInterface $visitor) - { - $this->factory->addRequestVisitor($location, $visitor); - - return $this; - } - - public function prepare(CommandInterface $command) - { - $request = $this->createRequest($command); - // Keep an array of visitors found in the operation - $foundVisitors = array(); - $operation = $command->getOperation(); - - // Add arguments to the request using the location attribute - foreach ($operation->getParams() as $name => $arg) { - /** @var $arg \Guzzle\Service\Description\Parameter */ - $location = $arg->getLocation(); - // Skip 'uri' locations because they've already been processed - if ($location && $location != 'uri') { - // Instantiate visitors as they are detected in the properties - if (!isset($foundVisitors[$location])) { - $foundVisitors[$location] = $this->factory->getRequestVisitor($location); - } - // Ensure that a value has been set for this parameter - $value = $command[$name]; - if ($value !== null) { - // Apply the parameter value with the location visitor - $foundVisitors[$location]->visit($command, $request, $arg, $value); - } - } - } - - // Serialize additional parameters - if ($additional = $operation->getAdditionalParameters()) { - if ($visitor = $this->prepareAdditionalParameters($operation, $command, $request, $additional)) { - $foundVisitors[$additional->getLocation()] = $visitor; - } - } - - // Call the after method on each visitor found in the operation - foreach ($foundVisitors as $visitor) { - $visitor->after($command, $request); - } - - return $request; - } - - /** - * Serialize additional parameters - * - * @param OperationInterface $operation Operation that owns the command - * @param CommandInterface $command Command to prepare - * @param RequestInterface $request Request to serialize - * @param Parameter $additional Additional parameters - * - * @return null|RequestVisitorInterface - */ - protected function prepareAdditionalParameters( - OperationInterface $operation, - CommandInterface $command, - RequestInterface $request, - Parameter $additional - ) { - if (!($location = $additional->getLocation())) { - return; - } - - $visitor = $this->factory->getRequestVisitor($location); - $hidden = $command[$command::HIDDEN_PARAMS]; - - foreach ($command->toArray() as $key => $value) { - // Ignore values that are null or built-in command options - if ($value !== null - && !in_array($key, $hidden) - && !$operation->hasParam($key) - ) { - $additional->setName($key); - $visitor->visit($command, $request, $additional, $value); - } - } - - return $visitor; - } - - /** - * Create a request for the command and operation - * - * @param CommandInterface $command Command to create a request for - * - * @return RequestInterface - */ - protected function createRequest(CommandInterface $command) - { - $operation = $command->getOperation(); - $client = $command->getClient(); - $options = $command[AbstractCommand::REQUEST_OPTIONS] ?: array(); - - // If the command does not specify a template, then assume the base URL of the client - if (!($uri = $operation->getUri())) { - return $client->createRequest($operation->getHttpMethod(), $client->getBaseUrl(), null, null, $options); - } - - // Get the path values and use the client config settings - $variables = array(); - foreach ($operation->getParams() as $name => $arg) { - if ($arg->getLocation() == 'uri') { - if (isset($command[$name])) { - $variables[$name] = $arg->filter($command[$name]); - if (!is_array($variables[$name])) { - $variables[$name] = (string) $variables[$name]; - } - } - } - } - - return $client->createRequest($operation->getHttpMethod(), array($uri, $variables), null, null, $options); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/DefaultResponseParser.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/DefaultResponseParser.php deleted file mode 100644 index 4fe380376..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/DefaultResponseParser.php +++ /dev/null @@ -1,55 +0,0 @@ -getRequest()->getResponse(); - - // Account for hard coded content-type values specified in service descriptions - if ($contentType = $command['command.expects']) { - $response->setHeader('Content-Type', $contentType); - } else { - $contentType = (string) $response->getHeader('Content-Type'); - } - - return $this->handleParsing($command, $response, $contentType); - } - - protected function handleParsing(CommandInterface $command, Response $response, $contentType) - { - $result = $response; - if ($result->getBody()) { - if (stripos($contentType, 'json') !== false) { - $result = $result->json(); - } elseif (stripos($contentType, 'xml') !== false) { - $result = $result->xml(); - } - } - - return $result; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/Factory/AliasFactory.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/Factory/AliasFactory.php deleted file mode 100644 index 1c5ce0741..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/Factory/AliasFactory.php +++ /dev/null @@ -1,39 +0,0 @@ -client = $client; - $this->aliases = $aliases; - } - - public function factory($name, array $args = array()) - { - if (isset($this->aliases[$name])) { - try { - return $this->client->getCommand($this->aliases[$name], $args); - } catch (InvalidArgumentException $e) { - return null; - } - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/Factory/CompositeFactory.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/Factory/CompositeFactory.php deleted file mode 100644 index 8c46983d6..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/Factory/CompositeFactory.php +++ /dev/null @@ -1,154 +0,0 @@ -getDescription()) { - $factories[] = new ServiceDescriptionFactory($description); - } - $factories[] = new ConcreteClassFactory($client); - - return new self($factories); - } - - /** - * @param array $factories Array of command factories - */ - public function __construct(array $factories = array()) - { - $this->factories = $factories; - } - - /** - * Add a command factory to the chain - * - * @param FactoryInterface $factory Factory to add - * @param string|FactoryInterface $before Insert the new command factory before a command factory class or object - * matching a class name. - * @return CompositeFactory - */ - public function add(FactoryInterface $factory, $before = null) - { - $pos = null; - - if ($before) { - foreach ($this->factories as $i => $f) { - if ($before instanceof FactoryInterface) { - if ($f === $before) { - $pos = $i; - break; - } - } elseif (is_string($before)) { - if ($f instanceof $before) { - $pos = $i; - break; - } - } - } - } - - if ($pos === null) { - $this->factories[] = $factory; - } else { - array_splice($this->factories, $i, 0, array($factory)); - } - - return $this; - } - - /** - * Check if the chain contains a specific command factory - * - * @param FactoryInterface|string $factory Factory to check - * - * @return bool - */ - public function has($factory) - { - return (bool) $this->find($factory); - } - - /** - * Remove a specific command factory from the chain - * - * @param string|FactoryInterface $factory Factory to remove by name or instance - * - * @return CompositeFactory - */ - public function remove($factory = null) - { - if (!($factory instanceof FactoryInterface)) { - $factory = $this->find($factory); - } - - $this->factories = array_values(array_filter($this->factories, function($f) use ($factory) { - return $f !== $factory; - })); - - return $this; - } - - /** - * Get a command factory by class name - * - * @param string|FactoryInterface $factory Command factory class or instance - * - * @return null|FactoryInterface - */ - public function find($factory) - { - foreach ($this->factories as $f) { - if ($factory === $f || (is_string($factory) && $f instanceof $factory)) { - return $f; - } - } - } - - /** - * Create a command using the associated command factories - * - * @param string $name Name of the command - * @param array $args Command arguments - * - * @return CommandInterface - */ - public function factory($name, array $args = array()) - { - foreach ($this->factories as $factory) { - $command = $factory->factory($name, $args); - if ($command) { - return $command; - } - } - } - - public function count() - { - return count($this->factories); - } - - public function getIterator() - { - return new \ArrayIterator($this->factories); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/Factory/ConcreteClassFactory.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/Factory/ConcreteClassFactory.php deleted file mode 100644 index 0e93deaa0..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/Factory/ConcreteClassFactory.php +++ /dev/null @@ -1,47 +0,0 @@ -client = $client; - $this->inflector = $inflector ?: Inflector::getDefault(); - } - - public function factory($name, array $args = array()) - { - // Determine the class to instantiate based on the namespace of the current client and the default directory - $prefix = $this->client->getConfig('command.prefix'); - if (!$prefix) { - // The prefix can be specified in a factory method and is cached - $prefix = implode('\\', array_slice(explode('\\', get_class($this->client)), 0, -1)) . '\\Command\\'; - $this->client->getConfig()->set('command.prefix', $prefix); - } - - $class = $prefix . str_replace(' ', '\\', ucwords(str_replace('.', ' ', $this->inflector->camel($name)))); - - // Create the concrete command if it exists - if (class_exists($class)) { - return new $class($args); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/Factory/FactoryInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/Factory/FactoryInterface.php deleted file mode 100644 index 35c299d9d..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/Factory/FactoryInterface.php +++ /dev/null @@ -1,21 +0,0 @@ -map = $map; - } - - public function factory($name, array $args = array()) - { - if (isset($this->map[$name])) { - $class = $this->map[$name]; - - return new $class($args); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/Factory/ServiceDescriptionFactory.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/Factory/ServiceDescriptionFactory.php deleted file mode 100644 index b943a5b50..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/Factory/ServiceDescriptionFactory.php +++ /dev/null @@ -1,71 +0,0 @@ -setServiceDescription($description); - $this->inflector = $inflector; - } - - /** - * Change the service description used with the factory - * - * @param ServiceDescriptionInterface $description Service description to use - * - * @return FactoryInterface - */ - public function setServiceDescription(ServiceDescriptionInterface $description) - { - $this->description = $description; - - return $this; - } - - /** - * Returns the service description - * - * @return ServiceDescriptionInterface - */ - public function getServiceDescription() - { - return $this->description; - } - - public function factory($name, array $args = array()) - { - $command = $this->description->getOperation($name); - - // If a command wasn't found, then try to uppercase the first letter and try again - if (!$command) { - $command = $this->description->getOperation(ucfirst($name)); - // If an inflector was passed, then attempt to get the command using snake_case inflection - if (!$command && $this->inflector) { - $command = $this->description->getOperation($this->inflector->snake($name)); - } - } - - if ($command) { - $class = $command->getClass(); - return new $class($args, $command, $this->description); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/AbstractRequestVisitor.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/AbstractRequestVisitor.php deleted file mode 100644 index adcfca1ba..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/AbstractRequestVisitor.php +++ /dev/null @@ -1,69 +0,0 @@ -resolveRecursively($value, $param) - : $param->filter($value); - } - - /** - * Map nested parameters into the location_key based parameters - * - * @param array $value Value to map - * @param Parameter $param Parameter that holds information about the current key - * - * @return array Returns the mapped array - */ - protected function resolveRecursively(array $value, Parameter $param) - { - foreach ($value as $name => &$v) { - switch ($param->getType()) { - case 'object': - if ($subParam = $param->getProperty($name)) { - $key = $subParam->getWireName(); - $value[$key] = $this->prepareValue($v, $subParam); - if ($name != $key) { - unset($value[$name]); - } - } elseif ($param->getAdditionalProperties() instanceof Parameter) { - $v = $this->prepareValue($v, $param->getAdditionalProperties()); - } - break; - case 'array': - if ($items = $param->getItems()) { - $v = $this->prepareValue($v, $items); - } - break; - } - } - - return $param->filter($value); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/BodyVisitor.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/BodyVisitor.php deleted file mode 100644 index 168d7806f..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/BodyVisitor.php +++ /dev/null @@ -1,58 +0,0 @@ -filter($value); - $entityBody = EntityBody::factory($value); - $request->setBody($entityBody); - $this->addExpectHeader($request, $entityBody, $param->getData('expect_header')); - // Add the Content-Encoding header if one is set on the EntityBody - if ($encoding = $entityBody->getContentEncoding()) { - $request->setHeader('Content-Encoding', $encoding); - } - } - - /** - * Add the appropriate expect header to a request - * - * @param EntityEnclosingRequestInterface $request Request to update - * @param EntityBodyInterface $body Entity body of the request - * @param string|int $expect Expect header setting - */ - protected function addExpectHeader(EntityEnclosingRequestInterface $request, EntityBodyInterface $body, $expect) - { - // Allow the `expect` data parameter to be set to remove the Expect header from the request - if ($expect === false) { - $request->removeHeader('Expect'); - } elseif ($expect !== true) { - // Default to using a MB as the point in which to start using the expect header - $expect = $expect ?: 1048576; - // If the expect_header value is numeric then only add if the size is greater than the cutoff - if (is_numeric($expect) && $body->getSize()) { - if ($body->getSize() < $expect) { - $request->removeHeader('Expect'); - } else { - $request->setHeader('Expect', '100-Continue'); - } - } - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/HeaderVisitor.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/HeaderVisitor.php deleted file mode 100644 index 2a537542c..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/HeaderVisitor.php +++ /dev/null @@ -1,44 +0,0 @@ -filter($value); - if ($param->getType() == 'object' && $param->getAdditionalProperties() instanceof Parameter) { - $this->addPrefixedHeaders($request, $param, $value); - } else { - $request->setHeader($param->getWireName(), $value); - } - } - - /** - * Add a prefixed array of headers to the request - * - * @param RequestInterface $request Request to update - * @param Parameter $param Parameter object - * @param array $value Header array to add - * - * @throws InvalidArgumentException - */ - protected function addPrefixedHeaders(RequestInterface $request, Parameter $param, $value) - { - if (!is_array($value)) { - throw new InvalidArgumentException('An array of mapped headers expected, but received a single value'); - } - $prefix = $param->getSentAs(); - foreach ($value as $headerName => $headerValue) { - $request->setHeader($prefix . $headerName, $headerValue); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/JsonVisitor.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/JsonVisitor.php deleted file mode 100644 index 757e1c520..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/JsonVisitor.php +++ /dev/null @@ -1,63 +0,0 @@ -data = new \SplObjectStorage(); - } - - /** - * Set the Content-Type header to add to the request if JSON is added to the body. This visitor does not add a - * Content-Type header unless you specify one here. - * - * @param string $header Header to set when JSON is added (e.g. application/json) - * - * @return self - */ - public function setContentTypeHeader($header = 'application/json') - { - $this->jsonContentType = $header; - - return $this; - } - - public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value) - { - if (isset($this->data[$command])) { - $json = $this->data[$command]; - } else { - $json = array(); - } - $json[$param->getWireName()] = $this->prepareValue($value, $param); - $this->data[$command] = $json; - } - - public function after(CommandInterface $command, RequestInterface $request) - { - if (isset($this->data[$command])) { - // Don't overwrite the Content-Type if one is set - if ($this->jsonContentType && !$request->hasHeader('Content-Type')) { - $request->setHeader('Content-Type', $this->jsonContentType); - } - - $request->setBody(json_encode($this->data[$command])); - unset($this->data[$command]); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/PostFieldVisitor.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/PostFieldVisitor.php deleted file mode 100644 index 975850b74..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/PostFieldVisitor.php +++ /dev/null @@ -1,18 +0,0 @@ -setPostField($param->getWireName(), $this->prepareValue($value, $param)); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/PostFileVisitor.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/PostFileVisitor.php deleted file mode 100644 index 0853ebe62..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/PostFileVisitor.php +++ /dev/null @@ -1,24 +0,0 @@ -filter($value); - if ($value instanceof PostFileInterface) { - $request->addPostFile($value); - } else { - $request->addPostFile($param->getWireName(), $value); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/QueryVisitor.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/QueryVisitor.php deleted file mode 100644 index 315877aa0..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/QueryVisitor.php +++ /dev/null @@ -1,18 +0,0 @@ -getQuery()->set($param->getWireName(), $this->prepareValue($value, $param)); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/RequestVisitorInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/RequestVisitorInterface.php deleted file mode 100644 index 14e0b2d2b..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/RequestVisitorInterface.php +++ /dev/null @@ -1,31 +0,0 @@ -setResponseBody($value); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/XmlVisitor.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/XmlVisitor.php deleted file mode 100644 index 5b7148787..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Request/XmlVisitor.php +++ /dev/null @@ -1,252 +0,0 @@ -data = new \SplObjectStorage(); - } - - /** - * Change the content-type header that is added when XML is found - * - * @param string $header Header to set when XML is found - * - * @return self - */ - public function setContentTypeHeader($header) - { - $this->contentType = $header; - - return $this; - } - - public function visit(CommandInterface $command, RequestInterface $request, Parameter $param, $value) - { - $xml = isset($this->data[$command]) - ? $this->data[$command] - : $this->createRootElement($param->getParent()); - $this->addXml($xml, $param, $value); - - $this->data[$command] = $xml; - } - - public function after(CommandInterface $command, RequestInterface $request) - { - $xml = null; - - // If data was found that needs to be serialized, then do so - if (isset($this->data[$command])) { - $xml = $this->finishDocument($this->data[$command]); - unset($this->data[$command]); - } else { - // Check if XML should always be sent for the command - $operation = $command->getOperation(); - if ($operation->getData('xmlAllowEmpty')) { - $xmlWriter = $this->createRootElement($operation); - $xml = $this->finishDocument($xmlWriter); - } - } - - if ($xml) { - // Don't overwrite the Content-Type if one is set - if ($this->contentType && !$request->hasHeader('Content-Type')) { - $request->setHeader('Content-Type', $this->contentType); - } - $request->setBody($xml); - } - } - - /** - * Create the root XML element to use with a request - * - * @param Operation $operation Operation object - * - * @return \XMLWriter - */ - protected function createRootElement(Operation $operation) - { - static $defaultRoot = array('name' => 'Request'); - // If no root element was specified, then just wrap the XML in 'Request' - $root = $operation->getData('xmlRoot') ?: $defaultRoot; - // Allow the XML declaration to be customized with xmlEncoding - $encoding = $operation->getData('xmlEncoding'); - - $xmlWriter = $this->startDocument($encoding); - - $xmlWriter->startElement($root['name']); - // Create the wrapping element with no namespaces if no namespaces were present - if (!empty($root['namespaces'])) { - // Create the wrapping element with an array of one or more namespaces - foreach ((array) $root['namespaces'] as $prefix => $uri) { - $nsLabel = 'xmlns'; - if (!is_numeric($prefix)) { - $nsLabel .= ':'.$prefix; - } - $xmlWriter->writeAttribute($nsLabel, $uri); - } - } - return $xmlWriter; - } - - /** - * Recursively build the XML body - * - * @param \XMLWriter $xmlWriter XML to modify - * @param Parameter $param API Parameter - * @param mixed $value Value to add - */ - protected function addXml(\XMLWriter $xmlWriter, Parameter $param, $value) - { - if ($value === null) { - return; - } - - $value = $param->filter($value); - $type = $param->getType(); - $name = $param->getWireName(); - $prefix = null; - $namespace = $param->getData('xmlNamespace'); - if (false !== strpos($name, ':')) { - list($prefix, $name) = explode(':', $name, 2); - } - - if ($type == 'object' || $type == 'array') { - if (!$param->getData('xmlFlattened')) { - $xmlWriter->startElementNS(null, $name, $namespace); - } - if ($param->getType() == 'array') { - $this->addXmlArray($xmlWriter, $param, $value); - } elseif ($param->getType() == 'object') { - $this->addXmlObject($xmlWriter, $param, $value); - } - if (!$param->getData('xmlFlattened')) { - $xmlWriter->endElement(); - } - return; - } - if ($param->getData('xmlAttribute')) { - $this->writeAttribute($xmlWriter, $prefix, $name, $namespace, $value); - } else { - $this->writeElement($xmlWriter, $prefix, $name, $namespace, $value); - } - } - - /** - * Write an attribute with namespace if used - * - * @param \XMLWriter $xmlWriter XMLWriter instance - * @param string $prefix Namespace prefix if any - * @param string $name Attribute name - * @param string $namespace The uri of the namespace - * @param string $value The attribute content - */ - protected function writeAttribute($xmlWriter, $prefix, $name, $namespace, $value) - { - if (empty($namespace)) { - $xmlWriter->writeAttribute($name, $value); - } else { - $xmlWriter->writeAttributeNS($prefix, $name, $namespace, $value); - } - } - - /** - * Write an element with namespace if used - * - * @param \XMLWriter $xmlWriter XML writer resource - * @param string $prefix Namespace prefix if any - * @param string $name Element name - * @param string $namespace The uri of the namespace - * @param string $value The element content - */ - protected function writeElement(\XMLWriter $xmlWriter, $prefix, $name, $namespace, $value) - { - $xmlWriter->startElementNS($prefix, $name, $namespace); - if (strpbrk($value, '<>&')) { - $xmlWriter->writeCData($value); - } else { - $xmlWriter->writeRaw($value); - } - $xmlWriter->endElement(); - } - - /** - * Create a new xml writer and start a document - * - * @param string $encoding document encoding - * - * @return \XMLWriter the writer resource - */ - protected function startDocument($encoding) - { - $xmlWriter = new \XMLWriter(); - $xmlWriter->openMemory(); - $xmlWriter->startDocument('1.0', $encoding); - - return $xmlWriter; - } - - /** - * End the document and return the output - * - * @param \XMLWriter $xmlWriter - * - * @return \string the writer resource - */ - protected function finishDocument($xmlWriter) - { - $xmlWriter->endDocument(); - - return $xmlWriter->outputMemory(); - } - - /** - * Add an array to the XML - */ - protected function addXmlArray(\XMLWriter $xmlWriter, Parameter $param, &$value) - { - if ($items = $param->getItems()) { - foreach ($value as $v) { - $this->addXml($xmlWriter, $items, $v); - } - } - } - - /** - * Add an object to the XML - */ - protected function addXmlObject(\XMLWriter $xmlWriter, Parameter $param, &$value) - { - $noAttributes = array(); - // add values which have attributes - foreach ($value as $name => $v) { - if ($property = $param->getProperty($name)) { - if ($property->getData('xmlAttribute')) { - $this->addXml($xmlWriter, $property, $v); - } else { - $noAttributes[] = array('value' => $v, 'property' => $property); - } - } - } - // now add values with no attributes - foreach ($noAttributes as $element) { - $this->addXml($xmlWriter, $element['property'], $element['value']); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Response/AbstractResponseVisitor.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Response/AbstractResponseVisitor.php deleted file mode 100644 index d87eeb945..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Response/AbstractResponseVisitor.php +++ /dev/null @@ -1,26 +0,0 @@ -getName()] = $param->filter($response->getBody()); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Response/HeaderVisitor.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Response/HeaderVisitor.php deleted file mode 100644 index 0f8737cbd..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Response/HeaderVisitor.php +++ /dev/null @@ -1,50 +0,0 @@ -getType() == 'object' && $param->getAdditionalProperties() instanceof Parameter) { - $this->processPrefixedHeaders($response, $param, $value); - } else { - $value[$param->getName()] = $param->filter((string) $response->getHeader($param->getWireName())); - } - } - - /** - * Process a prefixed header array - * - * @param Response $response Response that contains the headers - * @param Parameter $param Parameter object - * @param array $value Value response array to modify - */ - protected function processPrefixedHeaders(Response $response, Parameter $param, &$value) - { - // Grab prefixed headers that should be placed into an array with the prefix stripped - if ($prefix = $param->getSentAs()) { - $container = $param->getName(); - $len = strlen($prefix); - // Find all matching headers and place them into the containing element - foreach ($response->getHeaders()->toArray() as $key => $header) { - if (stripos($key, $prefix) === 0) { - // Account for multi-value headers - $value[$container][substr($key, $len)] = count($header) == 1 ? end($header) : $header; - } - } - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Response/JsonVisitor.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Response/JsonVisitor.php deleted file mode 100644 index a609ebd8c..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Response/JsonVisitor.php +++ /dev/null @@ -1,93 +0,0 @@ -getResponse()->json(); - } - - public function visit( - CommandInterface $command, - Response $response, - Parameter $param, - &$value, - $context = null - ) { - $name = $param->getName(); - $key = $param->getWireName(); - if (isset($value[$key])) { - $this->recursiveProcess($param, $value[$key]); - if ($key != $name) { - $value[$name] = $value[$key]; - unset($value[$key]); - } - } - } - - /** - * Recursively process a parameter while applying filters - * - * @param Parameter $param API parameter being validated - * @param mixed $value Value to validate and process. The value may change during this process. - */ - protected function recursiveProcess(Parameter $param, &$value) - { - if ($value === null) { - return; - } - - if (is_array($value)) { - $type = $param->getType(); - if ($type == 'array') { - foreach ($value as &$item) { - $this->recursiveProcess($param->getItems(), $item); - } - } elseif ($type == 'object' && !isset($value[0])) { - // On the above line, we ensure that the array is associative and not numerically indexed - $knownProperties = array(); - if ($properties = $param->getProperties()) { - foreach ($properties as $property) { - $name = $property->getName(); - $key = $property->getWireName(); - $knownProperties[$name] = 1; - if (isset($value[$key])) { - $this->recursiveProcess($property, $value[$key]); - if ($key != $name) { - $value[$name] = $value[$key]; - unset($value[$key]); - } - } - } - } - - // Remove any unknown and potentially unsafe properties - if ($param->getAdditionalProperties() === false) { - $value = array_intersect_key($value, $knownProperties); - } elseif (($additional = $param->getAdditionalProperties()) !== true) { - // Validate and filter additional properties - foreach ($value as &$v) { - $this->recursiveProcess($additional, $v); - } - } - } - } - - $value = $param->filter($value); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Response/ReasonPhraseVisitor.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Response/ReasonPhraseVisitor.php deleted file mode 100644 index 1b10ebce7..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Response/ReasonPhraseVisitor.php +++ /dev/null @@ -1,23 +0,0 @@ -getName()] = $response->getReasonPhrase(); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Response/ResponseVisitorInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Response/ResponseVisitorInterface.php deleted file mode 100644 index 033f40c3f..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Response/ResponseVisitorInterface.php +++ /dev/null @@ -1,46 +0,0 @@ -getName()] = $response->getStatusCode(); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Response/XmlVisitor.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Response/XmlVisitor.php deleted file mode 100644 index bb7124be7..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/Response/XmlVisitor.php +++ /dev/null @@ -1,151 +0,0 @@ -getResponse()->xml()), true); - } - - public function visit( - CommandInterface $command, - Response $response, - Parameter $param, - &$value, - $context = null - ) { - $sentAs = $param->getWireName(); - $name = $param->getName(); - if (isset($value[$sentAs])) { - $this->recursiveProcess($param, $value[$sentAs]); - if ($name != $sentAs) { - $value[$name] = $value[$sentAs]; - unset($value[$sentAs]); - } - } - } - - /** - * Recursively process a parameter while applying filters - * - * @param Parameter $param API parameter being processed - * @param mixed $value Value to validate and process. The value may change during this process. - */ - protected function recursiveProcess(Parameter $param, &$value) - { - $type = $param->getType(); - - if (!is_array($value)) { - if ($type == 'array') { - // Cast to an array if the value was a string, but should be an array - $this->recursiveProcess($param->getItems(), $value); - $value = array($value); - } - } elseif ($type == 'object') { - $this->processObject($param, $value); - } elseif ($type == 'array') { - $this->processArray($param, $value); - } elseif ($type == 'string' && gettype($value) == 'array') { - $value = ''; - } - - if ($value !== null) { - $value = $param->filter($value); - } - } - - /** - * Process an array - * - * @param Parameter $param API parameter being parsed - * @param mixed $value Value to process - */ - protected function processArray(Parameter $param, &$value) - { - // Convert the node if it was meant to be an array - if (!isset($value[0])) { - // Collections fo nodes are sometimes wrapped in an additional array. For example: - // 12 should become: - // array('Items' => array(array('a' => 1), array('a' => 2)) - // Some nodes are not wrapped. For example: 12 - // should become array('Foo' => array(array('a' => 1), array('a' => 2)) - if ($param->getItems() && isset($value[$param->getItems()->getWireName()])) { - // Account for the case of a collection wrapping wrapped nodes: Items => Item[] - $value = $value[$param->getItems()->getWireName()]; - // If the wrapped node only had one value, then make it an array of nodes - if (!isset($value[0]) || !is_array($value)) { - $value = array($value); - } - } elseif (!empty($value)) { - // Account for repeated nodes that must be an array: Foo => Baz, Foo => Baz, but only if the - // value is set and not empty - $value = array($value); - } - } - - foreach ($value as &$item) { - $this->recursiveProcess($param->getItems(), $item); - } - } - - /** - * Process an object - * - * @param Parameter $param API parameter being parsed - * @param mixed $value Value to process - */ - protected function processObject(Parameter $param, &$value) - { - // Ensure that the array is associative and not numerically indexed - if (!isset($value[0]) && ($properties = $param->getProperties())) { - $knownProperties = array(); - foreach ($properties as $property) { - $name = $property->getName(); - $sentAs = $property->getWireName(); - $knownProperties[$name] = 1; - if ($property->getData('xmlAttribute')) { - $this->processXmlAttribute($property, $value); - } elseif (isset($value[$sentAs])) { - $this->recursiveProcess($property, $value[$sentAs]); - if ($name != $sentAs) { - $value[$name] = $value[$sentAs]; - unset($value[$sentAs]); - } - } - } - - // Remove any unknown and potentially unsafe properties - if ($param->getAdditionalProperties() === false) { - $value = array_intersect_key($value, $knownProperties); - } - } - } - - /** - * Process an XML attribute property - * - * @param Parameter $property Property to process - * @param array $value Value to process and update - */ - protected function processXmlAttribute(Parameter $property, array &$value) - { - $sentAs = $property->getWireName(); - if (isset($value['@attributes'][$sentAs])) { - $value[$property->getName()] = $value['@attributes'][$sentAs]; - unset($value['@attributes'][$sentAs]); - if (empty($value['@attributes'])) { - unset($value['@attributes']); - } - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/VisitorFlyweight.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/VisitorFlyweight.php deleted file mode 100644 index 74cb62813..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/LocationVisitor/VisitorFlyweight.php +++ /dev/null @@ -1,138 +0,0 @@ - 'Guzzle\Service\Command\LocationVisitor\Request\BodyVisitor', - 'request.header' => 'Guzzle\Service\Command\LocationVisitor\Request\HeaderVisitor', - 'request.json' => 'Guzzle\Service\Command\LocationVisitor\Request\JsonVisitor', - 'request.postField' => 'Guzzle\Service\Command\LocationVisitor\Request\PostFieldVisitor', - 'request.postFile' => 'Guzzle\Service\Command\LocationVisitor\Request\PostFileVisitor', - 'request.query' => 'Guzzle\Service\Command\LocationVisitor\Request\QueryVisitor', - 'request.response_body' => 'Guzzle\Service\Command\LocationVisitor\Request\ResponseBodyVisitor', - 'request.responseBody' => 'Guzzle\Service\Command\LocationVisitor\Request\ResponseBodyVisitor', - 'request.xml' => 'Guzzle\Service\Command\LocationVisitor\Request\XmlVisitor', - 'response.body' => 'Guzzle\Service\Command\LocationVisitor\Response\BodyVisitor', - 'response.header' => 'Guzzle\Service\Command\LocationVisitor\Response\HeaderVisitor', - 'response.json' => 'Guzzle\Service\Command\LocationVisitor\Response\JsonVisitor', - 'response.reasonPhrase' => 'Guzzle\Service\Command\LocationVisitor\Response\ReasonPhraseVisitor', - 'response.statusCode' => 'Guzzle\Service\Command\LocationVisitor\Response\StatusCodeVisitor', - 'response.xml' => 'Guzzle\Service\Command\LocationVisitor\Response\XmlVisitor' - ); - - /** @var array Array of mappings of location names to classes */ - protected $mappings; - - /** @var array Cache of instantiated visitors */ - protected $cache = array(); - - /** - * @return self - * @codeCoverageIgnore - */ - public static function getInstance() - { - if (!self::$instance) { - self::$instance = new self(); - } - - return self::$instance; - } - - /** - * @param array $mappings Array mapping request.name and response.name to location visitor classes. Leave null to - * use the default values. - */ - public function __construct(array $mappings = null) - { - $this->mappings = $mappings === null ? self::$defaultMappings : $mappings; - } - - /** - * Get an instance of a request visitor by location name - * - * @param string $visitor Visitor name - * - * @return RequestVisitorInterface - */ - public function getRequestVisitor($visitor) - { - return $this->getKey('request.' . $visitor); - } - - /** - * Get an instance of a response visitor by location name - * - * @param string $visitor Visitor name - * - * @return ResponseVisitorInterface - */ - public function getResponseVisitor($visitor) - { - return $this->getKey('response.' . $visitor); - } - - /** - * Add a response visitor to the factory by name - * - * @param string $name Name of the visitor - * @param RequestVisitorInterface $visitor Visitor to add - * - * @return self - */ - public function addRequestVisitor($name, RequestVisitorInterface $visitor) - { - $this->cache['request.' . $name] = $visitor; - - return $this; - } - - /** - * Add a response visitor to the factory by name - * - * @param string $name Name of the visitor - * @param ResponseVisitorInterface $visitor Visitor to add - * - * @return self - */ - public function addResponseVisitor($name, ResponseVisitorInterface $visitor) - { - $this->cache['response.' . $name] = $visitor; - - return $this; - } - - /** - * Get a visitor by key value name - * - * @param string $key Key name to retrieve - * - * @return mixed - * @throws InvalidArgumentException - */ - private function getKey($key) - { - if (!isset($this->cache[$key])) { - if (!isset($this->mappings[$key])) { - list($type, $name) = explode('.', $key); - throw new InvalidArgumentException("No {$type} visitor has been mapped for {$name}"); - } - $this->cache[$key] = new $this->mappings[$key]; - } - - return $this->cache[$key]; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/OperationCommand.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/OperationCommand.php deleted file mode 100644 index 0748b5af0..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/OperationCommand.php +++ /dev/null @@ -1,89 +0,0 @@ -responseParser = $parser; - - return $this; - } - - /** - * Set the request serializer used with the command - * - * @param RequestSerializerInterface $serializer Request serializer - * - * @return self - */ - public function setRequestSerializer(RequestSerializerInterface $serializer) - { - $this->requestSerializer = $serializer; - - return $this; - } - - /** - * Get the request serializer used with the command - * - * @return RequestSerializerInterface - */ - public function getRequestSerializer() - { - if (!$this->requestSerializer) { - // Use the default request serializer if none was found - $this->requestSerializer = DefaultRequestSerializer::getInstance(); - } - - return $this->requestSerializer; - } - - /** - * Get the response parser used for the operation - * - * @return ResponseParserInterface - */ - public function getResponseParser() - { - if (!$this->responseParser) { - // Use the default response parser if none was found - $this->responseParser = OperationResponseParser::getInstance(); - } - - return $this->responseParser; - } - - protected function build() - { - // Prepare and serialize the request - $this->request = $this->getRequestSerializer()->prepare($this); - } - - protected function process() - { - // Do not process the response if 'command.response_processing' is set to 'raw' - $this->result = $this[self::RESPONSE_PROCESSING] == self::TYPE_RAW - ? $this->request->getResponse() - : $this->getResponseParser()->parse($this); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/OperationResponseParser.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/OperationResponseParser.php deleted file mode 100644 index ca00bc062..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/OperationResponseParser.php +++ /dev/null @@ -1,195 +0,0 @@ -factory = $factory; - $this->schemaInModels = $schemaInModels; - } - - /** - * Add a location visitor to the command - * - * @param string $location Location to associate with the visitor - * @param ResponseVisitorInterface $visitor Visitor to attach - * - * @return self - */ - public function addVisitor($location, ResponseVisitorInterface $visitor) - { - $this->factory->addResponseVisitor($location, $visitor); - - return $this; - } - - protected function handleParsing(CommandInterface $command, Response $response, $contentType) - { - $operation = $command->getOperation(); - $type = $operation->getResponseType(); - $model = null; - - if ($type == OperationInterface::TYPE_MODEL) { - $model = $operation->getServiceDescription()->getModel($operation->getResponseClass()); - } elseif ($type == OperationInterface::TYPE_CLASS) { - return $this->parseClass($command); - } - - if (!$model) { - // Return basic processing if the responseType is not model or the model cannot be found - return parent::handleParsing($command, $response, $contentType); - } elseif ($command[AbstractCommand::RESPONSE_PROCESSING] != AbstractCommand::TYPE_MODEL) { - // Returns a model with no visiting if the command response processing is not model - return new Model(parent::handleParsing($command, $response, $contentType)); - } else { - // Only inject the schema into the model if "schemaInModel" is true - return new Model($this->visitResult($model, $command, $response), $this->schemaInModels ? $model : null); - } - } - - /** - * Parse a class object - * - * @param CommandInterface $command Command to parse into an object - * - * @return mixed - * @throws ResponseClassException - */ - protected function parseClass(CommandInterface $command) - { - // Emit the operation.parse_class event. If a listener injects a 'result' property, then that will be the result - $event = new CreateResponseClassEvent(array('command' => $command)); - $command->getClient()->getEventDispatcher()->dispatch('command.parse_response', $event); - if ($result = $event->getResult()) { - return $result; - } - - $className = $command->getOperation()->getResponseClass(); - if (!method_exists($className, 'fromCommand')) { - throw new ResponseClassException("{$className} must exist and implement a static fromCommand() method"); - } - - return $className::fromCommand($command); - } - - /** - * Perform transformations on the result array - * - * @param Parameter $model Model that defines the structure - * @param CommandInterface $command Command that performed the operation - * @param Response $response Response received - * - * @return array Returns the array of result data - */ - protected function visitResult(Parameter $model, CommandInterface $command, Response $response) - { - $foundVisitors = $result = $knownProps = array(); - $props = $model->getProperties(); - - foreach ($props as $schema) { - if ($location = $schema->getLocation()) { - // Trigger the before method on the first found visitor of this type - if (!isset($foundVisitors[$location])) { - $foundVisitors[$location] = $this->factory->getResponseVisitor($location); - $foundVisitors[$location]->before($command, $result); - } - } - } - - // Visit additional properties when it is an actual schema - if (($additional = $model->getAdditionalProperties()) instanceof Parameter) { - $this->visitAdditionalProperties($model, $command, $response, $additional, $result, $foundVisitors); - } - - // Apply the parameter value with the location visitor - foreach ($props as $schema) { - $knownProps[$schema->getName()] = 1; - if ($location = $schema->getLocation()) { - $foundVisitors[$location]->visit($command, $response, $schema, $result); - } - } - - // Remove any unknown and potentially unsafe top-level properties - if ($additional === false) { - $result = array_intersect_key($result, $knownProps); - } - - // Call the after() method of each found visitor - foreach ($foundVisitors as $visitor) { - $visitor->after($command); - } - - return $result; - } - - protected function visitAdditionalProperties( - Parameter $model, - CommandInterface $command, - Response $response, - Parameter $additional, - &$result, - array &$foundVisitors - ) { - // Only visit when a location is specified - if ($location = $additional->getLocation()) { - if (!isset($foundVisitors[$location])) { - $foundVisitors[$location] = $this->factory->getResponseVisitor($location); - $foundVisitors[$location]->before($command, $result); - } - // Only traverse if an array was parsed from the before() visitors - if (is_array($result)) { - // Find each additional property - foreach (array_keys($result) as $key) { - // Check if the model actually knows this property. If so, then it is not additional - if (!$model->getProperty($key)) { - // Set the name to the key so that we can parse it with each visitor - $additional->setName($key); - $foundVisitors[$location]->visit($command, $response, $additional, $result); - } - } - // Reset the additionalProperties name to null - $additional->setName(null); - } - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/RequestSerializerInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/RequestSerializerInterface.php deleted file mode 100644 index 60b9334d4..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Command/RequestSerializerInterface.php +++ /dev/null @@ -1,21 +0,0 @@ - true, 'httpMethod' => true, 'uri' => true, 'class' => true, 'responseClass' => true, - 'responseType' => true, 'responseNotes' => true, 'notes' => true, 'summary' => true, 'documentationUrl' => true, - 'deprecated' => true, 'data' => true, 'parameters' => true, 'additionalParameters' => true, - 'errorResponses' => true - ); - - /** @var array Parameters */ - protected $parameters = array(); - - /** @var Parameter Additional parameters schema */ - protected $additionalParameters; - - /** @var string Name of the command */ - protected $name; - - /** @var string HTTP method */ - protected $httpMethod; - - /** @var string This is a short summary of what the operation does */ - protected $summary; - - /** @var string A longer text field to explain the behavior of the operation. */ - protected $notes; - - /** @var string Reference URL providing more information about the operation */ - protected $documentationUrl; - - /** @var string HTTP URI of the command */ - protected $uri; - - /** @var string Class of the command object */ - protected $class; - - /** @var string This is what is returned from the method */ - protected $responseClass; - - /** @var string Type information about the response */ - protected $responseType; - - /** @var string Information about the response returned by the operation */ - protected $responseNotes; - - /** @var bool Whether or not the command is deprecated */ - protected $deprecated; - - /** @var array Array of errors that could occur when running the command */ - protected $errorResponses; - - /** @var ServiceDescriptionInterface */ - protected $description; - - /** @var array Extra operation information */ - protected $data; - - /** - * Builds an Operation object using an array of configuration data: - * - name: (string) Name of the command - * - httpMethod: (string) HTTP method of the operation - * - uri: (string) URI template that can create a relative or absolute URL - * - class: (string) Concrete class that implements this command - * - parameters: (array) Associative array of parameters for the command. {@see Parameter} for information. - * - summary: (string) This is a short summary of what the operation does - * - notes: (string) A longer text field to explain the behavior of the operation. - * - documentationUrl: (string) Reference URL providing more information about the operation - * - responseClass: (string) This is what is returned from the method. Can be a primitive, PSR-0 compliant - * class name, or model. - * - responseNotes: (string) Information about the response returned by the operation - * - responseType: (string) One of 'primitive', 'class', 'model', or 'documentation'. If not specified, this - * value will be automatically inferred based on whether or not there is a model matching the - * name, if a matching PSR-0 compliant class name is found, or set to 'primitive' by default. - * - deprecated: (bool) Set to true if this is a deprecated command - * - errorResponses: (array) Errors that could occur when executing the command. Array of hashes, each with a - * 'code' (the HTTP response code), 'reason' (response reason phrase or description of the - * error), and 'class' (a custom exception class that would be thrown if the error is - * encountered). - * - data: (array) Any extra data that might be used to help build or serialize the operation - * - additionalParameters: (null|array) Parameter schema to use when an option is passed to the operation that is - * not in the schema - * - * @param array $config Array of configuration data - * @param ServiceDescriptionInterface $description Service description used to resolve models if $ref tags are found - */ - public function __construct(array $config = array(), ServiceDescriptionInterface $description = null) - { - $this->description = $description; - - // Get the intersection of the available properties and properties set on the operation - foreach (array_intersect_key($config, self::$properties) as $key => $value) { - $this->{$key} = $value; - } - - $this->class = $this->class ?: self::DEFAULT_COMMAND_CLASS; - $this->deprecated = (bool) $this->deprecated; - $this->errorResponses = $this->errorResponses ?: array(); - $this->data = $this->data ?: array(); - - if (!$this->responseClass) { - $this->responseClass = 'array'; - $this->responseType = 'primitive'; - } elseif ($this->responseType) { - // Set the response type to perform validation - $this->setResponseType($this->responseType); - } else { - // A response class was set and no response type was set, so guess what the type is - $this->inferResponseType(); - } - - // Parameters need special handling when adding - if ($this->parameters) { - foreach ($this->parameters as $name => $param) { - if ($param instanceof Parameter) { - $param->setName($name)->setParent($this); - } elseif (is_array($param)) { - $param['name'] = $name; - $this->addParam(new Parameter($param, $this->description)); - } - } - } - - if ($this->additionalParameters) { - if ($this->additionalParameters instanceof Parameter) { - $this->additionalParameters->setParent($this); - } elseif (is_array($this->additionalParameters)) { - $this->setadditionalParameters(new Parameter($this->additionalParameters, $this->description)); - } - } - } - - public function toArray() - { - $result = array(); - // Grab valid properties and filter out values that weren't set - foreach (array_keys(self::$properties) as $check) { - if ($value = $this->{$check}) { - $result[$check] = $value; - } - } - // Remove the name property - unset($result['name']); - // Parameters need to be converted to arrays - $result['parameters'] = array(); - foreach ($this->parameters as $key => $param) { - $result['parameters'][$key] = $param->toArray(); - } - // Additional parameters need to be cast to an array - if ($this->additionalParameters instanceof Parameter) { - $result['additionalParameters'] = $this->additionalParameters->toArray(); - } - - return $result; - } - - public function getServiceDescription() - { - return $this->description; - } - - public function setServiceDescription(ServiceDescriptionInterface $description) - { - $this->description = $description; - - return $this; - } - - public function getParams() - { - return $this->parameters; - } - - public function getParamNames() - { - return array_keys($this->parameters); - } - - public function hasParam($name) - { - return isset($this->parameters[$name]); - } - - public function getParam($param) - { - return isset($this->parameters[$param]) ? $this->parameters[$param] : null; - } - - /** - * Add a parameter to the command - * - * @param Parameter $param Parameter to add - * - * @return self - */ - public function addParam(Parameter $param) - { - $this->parameters[$param->getName()] = $param; - $param->setParent($this); - - return $this; - } - - /** - * Remove a parameter from the command - * - * @param string $name Name of the parameter to remove - * - * @return self - */ - public function removeParam($name) - { - unset($this->parameters[$name]); - - return $this; - } - - public function getHttpMethod() - { - return $this->httpMethod; - } - - /** - * Set the HTTP method of the command - * - * @param string $httpMethod Method to set - * - * @return self - */ - public function setHttpMethod($httpMethod) - { - $this->httpMethod = $httpMethod; - - return $this; - } - - public function getClass() - { - return $this->class; - } - - /** - * Set the concrete class of the command - * - * @param string $className Concrete class name - * - * @return self - */ - public function setClass($className) - { - $this->class = $className; - - return $this; - } - - public function getName() - { - return $this->name; - } - - /** - * Set the name of the command - * - * @param string $name Name of the command - * - * @return self - */ - public function setName($name) - { - $this->name = $name; - - return $this; - } - - public function getSummary() - { - return $this->summary; - } - - /** - * Set a short summary of what the operation does - * - * @param string $summary Short summary of the operation - * - * @return self - */ - public function setSummary($summary) - { - $this->summary = $summary; - - return $this; - } - - public function getNotes() - { - return $this->notes; - } - - /** - * Set a longer text field to explain the behavior of the operation. - * - * @param string $notes Notes on the operation - * - * @return self - */ - public function setNotes($notes) - { - $this->notes = $notes; - - return $this; - } - - public function getDocumentationUrl() - { - return $this->documentationUrl; - } - - /** - * Set the URL pointing to additional documentation on the command - * - * @param string $docUrl Documentation URL - * - * @return self - */ - public function setDocumentationUrl($docUrl) - { - $this->documentationUrl = $docUrl; - - return $this; - } - - public function getResponseClass() - { - return $this->responseClass; - } - - /** - * Set what is returned from the method. Can be a primitive, class name, or model. For example: 'array', - * 'Guzzle\\Foo\\Baz', or 'MyModelName' (to reference a model by ID). - * - * @param string $responseClass Type of response - * - * @return self - */ - public function setResponseClass($responseClass) - { - $this->responseClass = $responseClass; - $this->inferResponseType(); - - return $this; - } - - public function getResponseType() - { - return $this->responseType; - } - - /** - * Set qualifying information about the responseClass. One of 'primitive', 'class', 'model', or 'documentation' - * - * @param string $responseType Response type information - * - * @return self - * @throws InvalidArgumentException - */ - public function setResponseType($responseType) - { - static $types = array( - self::TYPE_PRIMITIVE => true, - self::TYPE_CLASS => true, - self::TYPE_MODEL => true, - self::TYPE_DOCUMENTATION => true - ); - if (!isset($types[$responseType])) { - throw new InvalidArgumentException('responseType must be one of ' . implode(', ', array_keys($types))); - } - - $this->responseType = $responseType; - - return $this; - } - - public function getResponseNotes() - { - return $this->responseNotes; - } - - /** - * Set notes about the response of the operation - * - * @param string $notes Response notes - * - * @return self - */ - public function setResponseNotes($notes) - { - $this->responseNotes = $notes; - - return $this; - } - - public function getDeprecated() - { - return $this->deprecated; - } - - /** - * Set whether or not the command is deprecated - * - * @param bool $isDeprecated Set to true to mark as deprecated - * - * @return self - */ - public function setDeprecated($isDeprecated) - { - $this->deprecated = $isDeprecated; - - return $this; - } - - public function getUri() - { - return $this->uri; - } - - /** - * Set the URI template of the command - * - * @param string $uri URI template to set - * - * @return self - */ - public function setUri($uri) - { - $this->uri = $uri; - - return $this; - } - - public function getErrorResponses() - { - return $this->errorResponses; - } - - /** - * Add an error to the command - * - * @param string $code HTTP response code - * @param string $reason HTTP response reason phrase or information about the error - * @param string $class Exception class associated with the error - * - * @return self - */ - public function addErrorResponse($code, $reason, $class) - { - $this->errorResponses[] = array('code' => $code, 'reason' => $reason, 'class' => $class); - - return $this; - } - - /** - * Set all of the error responses of the operation - * - * @param array $errorResponses Hash of error name to a hash containing a code, reason, class - * - * @return self - */ - public function setErrorResponses(array $errorResponses) - { - $this->errorResponses = $errorResponses; - - return $this; - } - - public function getData($name) - { - return isset($this->data[$name]) ? $this->data[$name] : null; - } - - /** - * Set a particular data point on the operation - * - * @param string $name Name of the data value - * @param mixed $value Value to set - * - * @return self - */ - public function setData($name, $value) - { - $this->data[$name] = $value; - - return $this; - } - - /** - * Get the additionalParameters of the operation - * - * @return Parameter|null - */ - public function getAdditionalParameters() - { - return $this->additionalParameters; - } - - /** - * Set the additionalParameters of the operation - * - * @param Parameter|null $parameter Parameter to set - * - * @return self - */ - public function setAdditionalParameters($parameter) - { - if ($this->additionalParameters = $parameter) { - $this->additionalParameters->setParent($this); - } - - return $this; - } - - /** - * Infer the response type from the responseClass value - */ - protected function inferResponseType() - { - static $primitives = array('array' => 1, 'boolean' => 1, 'string' => 1, 'integer' => 1, '' => 1); - if (isset($primitives[$this->responseClass])) { - $this->responseType = self::TYPE_PRIMITIVE; - } elseif ($this->description && $this->description->hasModel($this->responseClass)) { - $this->responseType = self::TYPE_MODEL; - } else { - $this->responseType = self::TYPE_CLASS; - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Description/OperationInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Description/OperationInterface.php deleted file mode 100644 index 4de41bd67..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Description/OperationInterface.php +++ /dev/null @@ -1,159 +0,0 @@ -getModel($data['$ref'])) { - $data = $model->toArray() + $data; - } - } elseif (isset($data['extends'])) { - // If this parameter extends from another parameter then start with the actual data - // union in the parent's data (e.g. actual supersedes parent) - if ($extends = $description->getModel($data['extends'])) { - $data += $extends->toArray(); - } - } - } - - // Pull configuration data into the parameter - foreach ($data as $key => $value) { - $this->{$key} = $value; - } - - $this->serviceDescription = $description; - $this->required = (bool) $this->required; - $this->data = (array) $this->data; - - if ($this->filters) { - $this->setFilters((array) $this->filters); - } - - if ($this->type == 'object' && $this->additionalProperties === null) { - $this->additionalProperties = true; - } - } - - /** - * Convert the object to an array - * - * @return array - */ - public function toArray() - { - static $checks = array('required', 'description', 'static', 'type', 'format', 'instanceOf', 'location', 'sentAs', - 'pattern', 'minimum', 'maximum', 'minItems', 'maxItems', 'minLength', 'maxLength', 'data', 'enum', - 'filters'); - - $result = array(); - - // Anything that is in the `Items` attribute of an array *must* include it's name if available - if ($this->parent instanceof self && $this->parent->getType() == 'array' && isset($this->name)) { - $result['name'] = $this->name; - } - - foreach ($checks as $c) { - if ($value = $this->{$c}) { - $result[$c] = $value; - } - } - - if ($this->default !== null) { - $result['default'] = $this->default; - } - - if ($this->items !== null) { - $result['items'] = $this->getItems()->toArray(); - } - - if ($this->additionalProperties !== null) { - $result['additionalProperties'] = $this->getAdditionalProperties(); - if ($result['additionalProperties'] instanceof self) { - $result['additionalProperties'] = $result['additionalProperties']->toArray(); - } - } - - if ($this->type == 'object' && $this->properties) { - $result['properties'] = array(); - foreach ($this->getProperties() as $name => $property) { - $result['properties'][$name] = $property->toArray(); - } - } - - return $result; - } - - /** - * Get the default or static value of the command based on a value - * - * @param string $value Value that is currently set - * - * @return mixed Returns the value, a static value if one is present, or a default value - */ - public function getValue($value) - { - if ($this->static || ($this->default !== null && $value === null)) { - return $this->default; - } - - return $value; - } - - /** - * Run a value through the filters OR format attribute associated with the parameter - * - * @param mixed $value Value to filter - * - * @return mixed Returns the filtered value - */ - public function filter($value) - { - // Formats are applied exclusively and supersed filters - if ($this->format) { - return SchemaFormatter::format($this->format, $value); - } - - // Convert Boolean values - if ($this->type == 'boolean' && !is_bool($value)) { - $value = filter_var($value, FILTER_VALIDATE_BOOLEAN); - } - - // Apply filters to the value - if ($this->filters) { - foreach ($this->filters as $filter) { - if (is_array($filter)) { - // Convert complex filters that hold value place holders - foreach ($filter['args'] as &$data) { - if ($data == '@value') { - $data = $value; - } elseif ($data == '@api') { - $data = $this; - } - } - $value = call_user_func_array($filter['method'], $filter['args']); - } else { - $value = call_user_func($filter, $value); - } - } - } - - return $value; - } - - /** - * Get the name of the parameter - * - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Get the key of the parameter, where sentAs will supersede name if it is set - * - * @return string - */ - public function getWireName() - { - return $this->sentAs ?: $this->name; - } - - /** - * Set the name of the parameter - * - * @param string $name Name to set - * - * @return self - */ - public function setName($name) - { - $this->name = $name; - - return $this; - } - - /** - * Get the type(s) of the parameter - * - * @return string|array - */ - public function getType() - { - return $this->type; - } - - /** - * Set the type(s) of the parameter - * - * @param string|array $type Type of parameter or array of simple types used in a union - * - * @return self - */ - public function setType($type) - { - $this->type = $type; - - return $this; - } - - /** - * Get if the parameter is required - * - * @return bool - */ - public function getRequired() - { - return $this->required; - } - - /** - * Set if the parameter is required - * - * @param bool $isRequired Whether or not the parameter is required - * - * @return self - */ - public function setRequired($isRequired) - { - $this->required = (bool) $isRequired; - - return $this; - } - - /** - * Get the default value of the parameter - * - * @return string|null - */ - public function getDefault() - { - return $this->default; - } - - /** - * Set the default value of the parameter - * - * @param string|null $default Default value to set - * - * @return self - */ - public function setDefault($default) - { - $this->default = $default; - - return $this; - } - - /** - * Get the description of the parameter - * - * @return string|null - */ - public function getDescription() - { - return $this->description; - } - - /** - * Set the description of the parameter - * - * @param string $description Description - * - * @return self - */ - public function setDescription($description) - { - $this->description = $description; - - return $this; - } - - /** - * Get the minimum acceptable value for an integer - * - * @return int|null - */ - public function getMinimum() - { - return $this->minimum; - } - - /** - * Set the minimum acceptable value for an integer - * - * @param int|null $min Minimum - * - * @return self - */ - public function setMinimum($min) - { - $this->minimum = $min; - - return $this; - } - - /** - * Get the maximum acceptable value for an integer - * - * @return int|null - */ - public function getMaximum() - { - return $this->maximum; - } - - /** - * Set the maximum acceptable value for an integer - * - * @param int $max Maximum - * - * @return self - */ - public function setMaximum($max) - { - $this->maximum = $max; - - return $this; - } - - /** - * Get the minimum allowed length of a string value - * - * @return int - */ - public function getMinLength() - { - return $this->minLength; - } - - /** - * Set the minimum allowed length of a string value - * - * @param int|null $min Minimum - * - * @return self - */ - public function setMinLength($min) - { - $this->minLength = $min; - - return $this; - } - - /** - * Get the maximum allowed length of a string value - * - * @return int|null - */ - public function getMaxLength() - { - return $this->maxLength; - } - - /** - * Set the maximum allowed length of a string value - * - * @param int $max Maximum length - * - * @return self - */ - public function setMaxLength($max) - { - $this->maxLength = $max; - - return $this; - } - - /** - * Get the maximum allowed number of items in an array value - * - * @return int|null - */ - public function getMaxItems() - { - return $this->maxItems; - } - - /** - * Set the maximum allowed number of items in an array value - * - * @param int $max Maximum - * - * @return self - */ - public function setMaxItems($max) - { - $this->maxItems = $max; - - return $this; - } - - /** - * Get the minimum allowed number of items in an array value - * - * @return int - */ - public function getMinItems() - { - return $this->minItems; - } - - /** - * Set the minimum allowed number of items in an array value - * - * @param int|null $min Minimum - * - * @return self - */ - public function setMinItems($min) - { - $this->minItems = $min; - - return $this; - } - - /** - * Get the location of the parameter - * - * @return string|null - */ - public function getLocation() - { - return $this->location; - } - - /** - * Set the location of the parameter - * - * @param string|null $location Location of the parameter - * - * @return self - */ - public function setLocation($location) - { - $this->location = $location; - - return $this; - } - - /** - * Get the sentAs attribute of the parameter that used with locations to sentAs an attribute when it is being - * applied to a location. - * - * @return string|null - */ - public function getSentAs() - { - return $this->sentAs; - } - - /** - * Set the sentAs attribute - * - * @param string|null $name Name of the value as it is sent over the wire - * - * @return self - */ - public function setSentAs($name) - { - $this->sentAs = $name; - - return $this; - } - - /** - * Retrieve a known property from the parameter by name or a data property by name. When not specific name value - * is specified, all data properties will be returned. - * - * @param string|null $name Specify a particular property name to retrieve - * - * @return array|mixed|null - */ - public function getData($name = null) - { - if (!$name) { - return $this->data; - } - - if (isset($this->data[$name])) { - return $this->data[$name]; - } elseif (isset($this->{$name})) { - return $this->{$name}; - } - - return null; - } - - /** - * Set the extra data properties of the parameter or set a specific extra property - * - * @param string|array|null $nameOrData The name of a specific extra to set or an array of extras to set - * @param mixed|null $data When setting a specific extra property, specify the data to set for it - * - * @return self - */ - public function setData($nameOrData, $data = null) - { - if (is_array($nameOrData)) { - $this->data = $nameOrData; - } else { - $this->data[$nameOrData] = $data; - } - - return $this; - } - - /** - * Get whether or not the default value can be changed - * - * @return mixed|null - */ - public function getStatic() - { - return $this->static; - } - - /** - * Set to true if the default value cannot be changed - * - * @param bool $static True or false - * - * @return self - */ - public function setStatic($static) - { - $this->static = (bool) $static; - - return $this; - } - - /** - * Get an array of filters used by the parameter - * - * @return array - */ - public function getFilters() - { - return $this->filters ?: array(); - } - - /** - * Set the array of filters used by the parameter - * - * @param array $filters Array of functions to use as filters - * - * @return self - */ - public function setFilters(array $filters) - { - $this->filters = array(); - foreach ($filters as $filter) { - $this->addFilter($filter); - } - - return $this; - } - - /** - * Add a filter to the parameter - * - * @param string|array $filter Method to filter the value through - * - * @return self - * @throws InvalidArgumentException - */ - public function addFilter($filter) - { - if (is_array($filter)) { - if (!isset($filter['method'])) { - throw new InvalidArgumentException('A [method] value must be specified for each complex filter'); - } - } - - if (!$this->filters) { - $this->filters = array($filter); - } else { - $this->filters[] = $filter; - } - - return $this; - } - - /** - * Get the parent object (an {@see OperationInterface} or {@see Parameter} - * - * @return OperationInterface|Parameter|null - */ - public function getParent() - { - return $this->parent; - } - - /** - * Set the parent object of the parameter - * - * @param OperationInterface|Parameter|null $parent Parent container of the parameter - * - * @return self - */ - public function setParent($parent) - { - $this->parent = $parent; - - return $this; - } - - /** - * Get the properties of the parameter - * - * @return array - */ - public function getProperties() - { - if (!$this->propertiesCache) { - $this->propertiesCache = array(); - foreach (array_keys($this->properties) as $name) { - $this->propertiesCache[$name] = $this->getProperty($name); - } - } - - return $this->propertiesCache; - } - - /** - * Get a specific property from the parameter - * - * @param string $name Name of the property to retrieve - * - * @return null|Parameter - */ - public function getProperty($name) - { - if (!isset($this->properties[$name])) { - return null; - } - - if (!($this->properties[$name] instanceof self)) { - $this->properties[$name]['name'] = $name; - $this->properties[$name] = new static($this->properties[$name], $this->serviceDescription); - $this->properties[$name]->setParent($this); - } - - return $this->properties[$name]; - } - - /** - * Remove a property from the parameter - * - * @param string $name Name of the property to remove - * - * @return self - */ - public function removeProperty($name) - { - unset($this->properties[$name]); - $this->propertiesCache = null; - - return $this; - } - - /** - * Add a property to the parameter - * - * @param Parameter $property Properties to set - * - * @return self - */ - public function addProperty(Parameter $property) - { - $this->properties[$property->getName()] = $property; - $property->setParent($this); - $this->propertiesCache = null; - - return $this; - } - - /** - * Get the additionalProperties value of the parameter - * - * @return bool|Parameter|null - */ - public function getAdditionalProperties() - { - if (is_array($this->additionalProperties)) { - $this->additionalProperties = new static($this->additionalProperties, $this->serviceDescription); - $this->additionalProperties->setParent($this); - } - - return $this->additionalProperties; - } - - /** - * Set the additionalProperties value of the parameter - * - * @param bool|Parameter|null $additional Boolean to allow any, an Parameter to specify a schema, or false to disallow - * - * @return self - */ - public function setAdditionalProperties($additional) - { - $this->additionalProperties = $additional; - - return $this; - } - - /** - * Set the items data of the parameter - * - * @param Parameter|null $items Items to set - * - * @return self - */ - public function setItems(Parameter $items = null) - { - if ($this->items = $items) { - $this->items->setParent($this); - } - - return $this; - } - - /** - * Get the item data of the parameter - * - * @return Parameter|null - */ - public function getItems() - { - if (is_array($this->items)) { - $this->items = new static($this->items, $this->serviceDescription); - $this->items->setParent($this); - } - - return $this->items; - } - - /** - * Get the class that the parameter must implement - * - * @return null|string - */ - public function getInstanceOf() - { - return $this->instanceOf; - } - - /** - * Set the class that the parameter must be an instance of - * - * @param string|null $instanceOf Class or interface name - * - * @return self - */ - public function setInstanceOf($instanceOf) - { - $this->instanceOf = $instanceOf; - - return $this; - } - - /** - * Get the enum of strings that are valid for the parameter - * - * @return array|null - */ - public function getEnum() - { - return $this->enum; - } - - /** - * Set the enum of strings that are valid for the parameter - * - * @param array|null $enum Array of strings or null - * - * @return self - */ - public function setEnum(array $enum = null) - { - $this->enum = $enum; - - return $this; - } - - /** - * Get the regex pattern that must match a value when the value is a string - * - * @return string - */ - public function getPattern() - { - return $this->pattern; - } - - /** - * Set the regex pattern that must match a value when the value is a string - * - * @param string $pattern Regex pattern - * - * @return self - */ - public function setPattern($pattern) - { - $this->pattern = $pattern; - - return $this; - } - - /** - * Get the format attribute of the schema - * - * @return string - */ - public function getFormat() - { - return $this->format; - } - - /** - * Set the format attribute of the schema - * - * @param string $format Format to set (e.g. date, date-time, timestamp, time, date-time-http) - * - * @return self - */ - public function setFormat($format) - { - $this->format = $format; - - return $this; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Description/SchemaFormatter.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Description/SchemaFormatter.php deleted file mode 100644 index 7f47fc9d7..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Description/SchemaFormatter.php +++ /dev/null @@ -1,156 +0,0 @@ -setTimezone(self::getUtcTimeZone())->format($format); - } - - throw new InvalidArgumentException('Date/Time values must be either a string, integer, or DateTime object'); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Description/SchemaValidator.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Description/SchemaValidator.php deleted file mode 100644 index b045422d4..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Description/SchemaValidator.php +++ /dev/null @@ -1,291 +0,0 @@ -castIntegerToStringType = $castIntegerToStringType; - } - - public function validate(Parameter $param, &$value) - { - $this->errors = array(); - $this->recursiveProcess($param, $value); - - if (empty($this->errors)) { - return true; - } else { - sort($this->errors); - return false; - } - } - - /** - * Get the errors encountered while validating - * - * @return array - */ - public function getErrors() - { - return $this->errors ?: array(); - } - - /** - * Recursively validate a parameter - * - * @param Parameter $param API parameter being validated - * @param mixed $value Value to validate and validate. The value may change during this validate. - * @param string $path Current validation path (used for error reporting) - * @param int $depth Current depth in the validation validate - * - * @return bool Returns true if valid, or false if invalid - */ - protected function recursiveProcess(Parameter $param, &$value, $path = '', $depth = 0) - { - // Update the value by adding default or static values - $value = $param->getValue($value); - - $required = $param->getRequired(); - // if the value is null and the parameter is not required or is static, then skip any further recursion - if ((null === $value && !$required) || $param->getStatic()) { - return true; - } - - $type = $param->getType(); - // Attempt to limit the number of times is_array is called by tracking if the value is an array - $valueIsArray = is_array($value); - // If a name is set then update the path so that validation messages are more helpful - if ($name = $param->getName()) { - $path .= "[{$name}]"; - } - - if ($type == 'object') { - - // Objects are either associative arrays, ToArrayInterface, or some other object - if ($param->getInstanceOf()) { - $instance = $param->getInstanceOf(); - if (!($value instanceof $instance)) { - $this->errors[] = "{$path} must be an instance of {$instance}"; - return false; - } - } - - // Determine whether or not this "value" has properties and should be traversed - $traverse = $temporaryValue = false; - - // Convert the value to an array - if (!$valueIsArray && $value instanceof ToArrayInterface) { - $value = $value->toArray(); - } - - if ($valueIsArray) { - // Ensure that the array is associative and not numerically indexed - if (isset($value[0])) { - $this->errors[] = "{$path} must be an array of properties. Got a numerically indexed array."; - return false; - } - $traverse = true; - } elseif ($value === null) { - // Attempt to let the contents be built up by default values if possible - $value = array(); - $temporaryValue = $valueIsArray = $traverse = true; - } - - if ($traverse) { - - if ($properties = $param->getProperties()) { - // if properties were found, the validate each property of the value - foreach ($properties as $property) { - $name = $property->getName(); - if (isset($value[$name])) { - $this->recursiveProcess($property, $value[$name], $path, $depth + 1); - } else { - $current = null; - $this->recursiveProcess($property, $current, $path, $depth + 1); - // Only set the value if it was populated with something - if (null !== $current) { - $value[$name] = $current; - } - } - } - } - - $additional = $param->getAdditionalProperties(); - if ($additional !== true) { - // If additional properties were found, then validate each against the additionalProperties attr. - $keys = array_keys($value); - // Determine the keys that were specified that were not listed in the properties of the schema - $diff = array_diff($keys, array_keys($properties)); - if (!empty($diff)) { - // Determine which keys are not in the properties - if ($additional instanceOf Parameter) { - foreach ($diff as $key) { - $this->recursiveProcess($additional, $value[$key], "{$path}[{$key}]", $depth); - } - } else { - // if additionalProperties is set to false and there are additionalProperties in the values, then fail - foreach ($diff as $prop) { - $this->errors[] = sprintf('%s[%s] is not an allowed property', $path, $prop); - } - } - } - } - - // A temporary value will be used to traverse elements that have no corresponding input value. - // This allows nested required parameters with default values to bubble up into the input. - // Here we check if we used a temp value and nothing bubbled up, then we need to remote the value. - if ($temporaryValue && empty($value)) { - $value = null; - $valueIsArray = false; - } - } - - } elseif ($type == 'array' && $valueIsArray && $param->getItems()) { - foreach ($value as $i => &$item) { - // Validate each item in an array against the items attribute of the schema - $this->recursiveProcess($param->getItems(), $item, $path . "[{$i}]", $depth + 1); - } - } - - // If the value is required and the type is not null, then there is an error if the value is not set - if ($required && $value === null && $type != 'null') { - $message = "{$path} is " . ($param->getType() ? ('a required ' . implode(' or ', (array) $param->getType())) : 'required'); - if ($param->getDescription()) { - $message .= ': ' . $param->getDescription(); - } - $this->errors[] = $message; - return false; - } - - // Validate that the type is correct. If the type is string but an integer was passed, the class can be - // instructed to cast the integer to a string to pass validation. This is the default behavior. - if ($type && (!$type = $this->determineType($type, $value))) { - if ($this->castIntegerToStringType && $param->getType() == 'string' && is_integer($value)) { - $value = (string) $value; - } else { - $this->errors[] = "{$path} must be of type " . implode(' or ', (array) $param->getType()); - } - } - - // Perform type specific validation for strings, arrays, and integers - if ($type == 'string') { - - // Strings can have enums which are a list of predefined values - if (($enum = $param->getEnum()) && !in_array($value, $enum)) { - $this->errors[] = "{$path} must be one of " . implode(' or ', array_map(function ($s) { - return '"' . addslashes($s) . '"'; - }, $enum)); - } - // Strings can have a regex pattern that the value must match - if (($pattern = $param->getPattern()) && !preg_match($pattern, $value)) { - $this->errors[] = "{$path} must match the following regular expression: {$pattern}"; - } - - $strLen = null; - if ($min = $param->getMinLength()) { - $strLen = strlen($value); - if ($strLen < $min) { - $this->errors[] = "{$path} length must be greater than or equal to {$min}"; - } - } - if ($max = $param->getMaxLength()) { - if (($strLen ?: strlen($value)) > $max) { - $this->errors[] = "{$path} length must be less than or equal to {$max}"; - } - } - - } elseif ($type == 'array') { - - $size = null; - if ($min = $param->getMinItems()) { - $size = count($value); - if ($size < $min) { - $this->errors[] = "{$path} must contain {$min} or more elements"; - } - } - if ($max = $param->getMaxItems()) { - if (($size ?: count($value)) > $max) { - $this->errors[] = "{$path} must contain {$max} or fewer elements"; - } - } - - } elseif ($type == 'integer' || $type == 'number' || $type == 'numeric') { - if (($min = $param->getMinimum()) && $value < $min) { - $this->errors[] = "{$path} must be greater than or equal to {$min}"; - } - if (($max = $param->getMaximum()) && $value > $max) { - $this->errors[] = "{$path} must be less than or equal to {$max}"; - } - } - - return empty($this->errors); - } - - /** - * From the allowable types, determine the type that the variable matches - * - * @param string $type Parameter type - * @param mixed $value Value to determine the type - * - * @return string|bool Returns the matching type on - */ - protected function determineType($type, $value) - { - foreach ((array) $type as $t) { - if ($t == 'string' && (is_string($value) || (is_object($value) && method_exists($value, '__toString')))) { - return 'string'; - } elseif ($t == 'object' && (is_array($value) || is_object($value))) { - return 'object'; - } elseif ($t == 'array' && is_array($value)) { - return 'array'; - } elseif ($t == 'integer' && is_integer($value)) { - return 'integer'; - } elseif ($t == 'boolean' && is_bool($value)) { - return 'boolean'; - } elseif ($t == 'number' && is_numeric($value)) { - return 'number'; - } elseif ($t == 'numeric' && is_numeric($value)) { - return 'numeric'; - } elseif ($t == 'null' && !$value) { - return 'null'; - } elseif ($t == 'any') { - return 'any'; - } - } - - return false; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Description/ServiceDescription.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Description/ServiceDescription.php deleted file mode 100644 index 286e65eec..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Description/ServiceDescription.php +++ /dev/null @@ -1,271 +0,0 @@ -load($config, $options); - } - - /** - * @param array $config Array of configuration data - */ - public function __construct(array $config = array()) - { - $this->fromArray($config); - } - - public function serialize() - { - return json_encode($this->toArray()); - } - - public function unserialize($json) - { - $this->operations = array(); - $this->fromArray(json_decode($json, true)); - } - - public function toArray() - { - $result = array( - 'name' => $this->name, - 'apiVersion' => $this->apiVersion, - 'baseUrl' => $this->baseUrl, - 'description' => $this->description - ) + $this->extraData; - $result['operations'] = array(); - foreach ($this->getOperations() as $name => $operation) { - $result['operations'][$operation->getName() ?: $name] = $operation->toArray(); - } - if (!empty($this->models)) { - $result['models'] = array(); - foreach ($this->models as $id => $model) { - $result['models'][$id] = $model instanceof Parameter ? $model->toArray(): $model; - } - } - - return array_filter($result); - } - - public function getBaseUrl() - { - return $this->baseUrl; - } - - /** - * Set the baseUrl of the description - * - * @param string $baseUrl Base URL of each operation - * - * @return self - */ - public function setBaseUrl($baseUrl) - { - $this->baseUrl = $baseUrl; - - return $this; - } - - public function getOperations() - { - foreach (array_keys($this->operations) as $name) { - $this->getOperation($name); - } - - return $this->operations; - } - - public function hasOperation($name) - { - return isset($this->operations[$name]); - } - - public function getOperation($name) - { - // Lazily retrieve and build operations - if (!isset($this->operations[$name])) { - return null; - } - - if (!($this->operations[$name] instanceof Operation)) { - $this->operations[$name] = new Operation($this->operations[$name], $this); - } - - return $this->operations[$name]; - } - - /** - * Add a operation to the service description - * - * @param OperationInterface $operation Operation to add - * - * @return self - */ - public function addOperation(OperationInterface $operation) - { - $this->operations[$operation->getName()] = $operation->setServiceDescription($this); - - return $this; - } - - public function getModel($id) - { - if (!isset($this->models[$id])) { - return null; - } - - if (!($this->models[$id] instanceof Parameter)) { - $this->models[$id] = new Parameter($this->models[$id] + array('name' => $id), $this); - } - - return $this->models[$id]; - } - - public function getModels() - { - // Ensure all models are converted into parameter objects - foreach (array_keys($this->models) as $id) { - $this->getModel($id); - } - - return $this->models; - } - - public function hasModel($id) - { - return isset($this->models[$id]); - } - - /** - * Add a model to the service description - * - * @param Parameter $model Model to add - * - * @return self - */ - public function addModel(Parameter $model) - { - $this->models[$model->getName()] = $model; - - return $this; - } - - public function getApiVersion() - { - return $this->apiVersion; - } - - public function getName() - { - return $this->name; - } - - public function getDescription() - { - return $this->description; - } - - public function getData($key) - { - return isset($this->extraData[$key]) ? $this->extraData[$key] : null; - } - - public function setData($key, $value) - { - $this->extraData[$key] = $value; - - return $this; - } - - /** - * Initialize the state from an array - * - * @param array $config Configuration data - * @throws InvalidArgumentException - */ - protected function fromArray(array $config) - { - // Keep a list of default keys used in service descriptions that is later used to determine extra data keys - static $defaultKeys = array('name', 'models', 'apiVersion', 'baseUrl', 'description'); - // Pull in the default configuration values - foreach ($defaultKeys as $key) { - if (isset($config[$key])) { - $this->{$key} = $config[$key]; - } - } - - // Account for the Swagger name for Guzzle's baseUrl - if (isset($config['basePath'])) { - $this->baseUrl = $config['basePath']; - } - - // Ensure that the models and operations properties are always arrays - $this->models = (array) $this->models; - $this->operations = (array) $this->operations; - - // We want to add operations differently than adding the other properties - $defaultKeys[] = 'operations'; - - // Create operations for each operation - if (isset($config['operations'])) { - foreach ($config['operations'] as $name => $operation) { - if (!($operation instanceof Operation) && !is_array($operation)) { - throw new InvalidArgumentException('Invalid operation in service description: ' - . gettype($operation)); - } - $this->operations[$name] = $operation; - } - } - - // Get all of the additional properties of the service description and store them in a data array - foreach (array_diff(array_keys($config), $defaultKeys) as $key) { - $this->extraData[$key] = $config[$key]; - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Description/ServiceDescriptionInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Description/ServiceDescriptionInterface.php deleted file mode 100644 index 5983e586b..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Description/ServiceDescriptionInterface.php +++ /dev/null @@ -1,106 +0,0 @@ - $op) { - $name = $op['name'] = isset($op['name']) ? $op['name'] : $name; - // Extend other operations - if (!empty($op['extends'])) { - $this->resolveExtension($name, $op, $operations); - } - $op['parameters'] = isset($op['parameters']) ? $op['parameters'] : array(); - $operations[$name] = $op; - } - } - - return new ServiceDescription(array( - 'apiVersion' => isset($config['apiVersion']) ? $config['apiVersion'] : null, - 'baseUrl' => isset($config['baseUrl']) ? $config['baseUrl'] : null, - 'description' => isset($config['description']) ? $config['description'] : null, - 'operations' => $operations, - 'models' => isset($config['models']) ? $config['models'] : null - ) + $config); - } - - /** - * @param string $name Name of the operation - * @param array $op Operation value array - * @param array $operations Currently loaded operations - * @throws DescriptionBuilderException when extending a non-existent operation - */ - protected function resolveExtension($name, array &$op, array &$operations) - { - $resolved = array(); - $original = empty($op['parameters']) ? false: $op['parameters']; - $hasClass = !empty($op['class']); - foreach ((array) $op['extends'] as $extendedCommand) { - if (empty($operations[$extendedCommand])) { - throw new DescriptionBuilderException("{$name} extends missing operation {$extendedCommand}"); - } - $toArray = $operations[$extendedCommand]; - $resolved = empty($resolved) - ? $toArray['parameters'] - : array_merge($resolved, $toArray['parameters']); - - $op = $op + $toArray; - if (!$hasClass && isset($toArray['class'])) { - $op['class'] = $toArray['class']; - } - } - $op['parameters'] = $original ? array_merge($resolved, $original) : $resolved; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Description/ValidatorInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Description/ValidatorInterface.php deleted file mode 100644 index 94ca77da4..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Description/ValidatorInterface.php +++ /dev/null @@ -1,28 +0,0 @@ -getMessage(), $e->getCode(), $e->getPrevious()); - $ce->setSuccessfulRequests($e->getSuccessfulRequests()); - - $alreadyAddedExceptions = array(); - foreach ($e->getFailedRequests() as $request) { - if ($re = $e->getExceptionForFailedRequest($request)) { - $alreadyAddedExceptions[] = $re; - $ce->addFailedRequestWithException($request, $re); - } else { - $ce->addFailedRequest($request); - } - } - - // Add any exceptions that did not map to a request - if (count($alreadyAddedExceptions) < count($e)) { - foreach ($e as $ex) { - if (!in_array($ex, $alreadyAddedExceptions)) { - $ce->add($ex); - } - } - } - - return $ce; - } - - /** - * Get all of the commands in the transfer - * - * @return array - */ - public function getAllCommands() - { - return array_merge($this->successfulCommands, $this->failedCommands); - } - - /** - * Add to the array of successful commands - * - * @param CommandInterface $command Successful command - * - * @return self - */ - public function addSuccessfulCommand(CommandInterface $command) - { - $this->successfulCommands[] = $command; - - return $this; - } - - /** - * Add to the array of failed commands - * - * @param CommandInterface $command Failed command - * - * @return self - */ - public function addFailedCommand(CommandInterface $command) - { - $this->failedCommands[] = $command; - - return $this; - } - - /** - * Get an array of successful commands - * - * @return array - */ - public function getSuccessfulCommands() - { - return $this->successfulCommands; - } - - /** - * Get an array of failed commands - * - * @return array - */ - public function getFailedCommands() - { - return $this->failedCommands; - } - - /** - * Get the Exception that caused the given $command to fail - * - * @param CommandInterface $command Failed command - * - * @return \Exception|null - */ - public function getExceptionForFailedCommand(CommandInterface $command) - { - return $this->getExceptionForFailedRequest($command->getRequest()); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Exception/DescriptionBuilderException.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Exception/DescriptionBuilderException.php deleted file mode 100644 index 1407e5687..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Exception/DescriptionBuilderException.php +++ /dev/null @@ -1,7 +0,0 @@ -invalidCommands = $commands; - parent::__construct( - 'Encountered commands in a batch transfer that use inconsistent clients. The batching ' . - 'strategy you use with a command transfer must divide command batches by client.' - ); - } - - /** - * Get the invalid commands - * - * @return array - */ - public function getCommands() - { - return $this->invalidCommands; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Exception/ResponseClassException.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Exception/ResponseClassException.php deleted file mode 100644 index d59ff2185..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Exception/ResponseClassException.php +++ /dev/null @@ -1,9 +0,0 @@ -errors = $errors; - } - - /** - * Get any validation errors - * - * @return array - */ - public function getErrors() - { - return $this->errors; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/AbstractResourceIteratorFactory.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/AbstractResourceIteratorFactory.php deleted file mode 100644 index 21140e772..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/AbstractResourceIteratorFactory.php +++ /dev/null @@ -1,37 +0,0 @@ -canBuild($command)) { - throw new InvalidArgumentException('Iterator was not found for ' . $command->getName()); - } - - $className = $this->getClassName($command); - - return new $className($command, $options); - } - - public function canBuild(CommandInterface $command) - { - return (bool) $this->getClassName($command); - } - - /** - * Get the name of the class to instantiate for the command - * - * @param CommandInterface $command Command that is associated with the iterator - * - * @return string - */ - abstract protected function getClassName(CommandInterface $command); -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/CompositeResourceIteratorFactory.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/CompositeResourceIteratorFactory.php deleted file mode 100644 index 2efc133c6..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/CompositeResourceIteratorFactory.php +++ /dev/null @@ -1,67 +0,0 @@ -factories = $factories; - } - - public function build(CommandInterface $command, array $options = array()) - { - if (!($factory = $this->getFactory($command))) { - throw new InvalidArgumentException('Iterator was not found for ' . $command->getName()); - } - - return $factory->build($command, $options); - } - - public function canBuild(CommandInterface $command) - { - return $this->getFactory($command) !== false; - } - - /** - * Add a factory to the composite factory - * - * @param ResourceIteratorFactoryInterface $factory Factory to add - * - * @return self - */ - public function addFactory(ResourceIteratorFactoryInterface $factory) - { - $this->factories[] = $factory; - - return $this; - } - - /** - * Get the factory that matches the command object - * - * @param CommandInterface $command Command retrieving the iterator for - * - * @return ResourceIteratorFactoryInterface|bool - */ - protected function getFactory(CommandInterface $command) - { - foreach ($this->factories as $factory) { - if ($factory->canBuild($command)) { - return $factory; - } - } - - return false; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/MapResourceIteratorFactory.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/MapResourceIteratorFactory.php deleted file mode 100644 index c71ca9d85..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/MapResourceIteratorFactory.php +++ /dev/null @@ -1,34 +0,0 @@ -map = $map; - } - - public function getClassName(CommandInterface $command) - { - $className = $command->getName(); - - if (isset($this->map[$className])) { - return $this->map[$className]; - } elseif (isset($this->map['*'])) { - // If a wildcard was added, then always use that - return $this->map['*']; - } - - return null; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/Model.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/Model.php deleted file mode 100644 index 2322434a5..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/Model.php +++ /dev/null @@ -1,64 +0,0 @@ -data = $data; - $this->structure = $structure; - } - - /** - * Get the structure of the model - * - * @return Parameter - */ - public function getStructure() - { - return $this->structure ?: new Parameter(); - } - - /** - * Provides debug information about the model object - * - * @return string - */ - public function __toString() - { - $output = 'Debug output of '; - if ($this->structure) { - $output .= $this->structure->getName() . ' '; - } - $output .= 'model'; - $output = str_repeat('=', strlen($output)) . "\n" . $output . "\n" . str_repeat('=', strlen($output)) . "\n\n"; - $output .= "Model data\n-----------\n\n"; - $output .= "This data can be retrieved from the model object using the get() method of the model " - . "(e.g. \$model->get(\$key)) or accessing the model like an associative array (e.g. \$model['key']).\n\n"; - $lines = array_slice(explode("\n", trim(print_r($this->toArray(), true))), 2, -1); - $output .= implode("\n", $lines); - - if ($this->structure) { - $output .= "\n\nModel structure\n---------------\n\n"; - $output .= "The following JSON document defines how the model was parsed from an HTTP response into the " - . "associative array structure you see above.\n\n"; - $output .= ' ' . json_encode($this->structure->toArray()) . "\n\n"; - } - - return $output . "\n"; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/ResourceIterator.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/ResourceIterator.php deleted file mode 100644 index e14152432..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/ResourceIterator.php +++ /dev/null @@ -1,254 +0,0 @@ -originalCommand = $command; - - // Parse options from the array of options - $this->data = $data; - $this->limit = array_key_exists('limit', $data) ? $data['limit'] : 0; - $this->pageSize = array_key_exists('page_size', $data) ? $data['page_size'] : false; - } - - /** - * Get all of the resources as an array (Warning: this could issue a large number of requests) - * - * @return array - */ - public function toArray() - { - return iterator_to_array($this, false); - } - - public function setLimit($limit) - { - $this->limit = $limit; - $this->resetState(); - - return $this; - } - - public function setPageSize($pageSize) - { - $this->pageSize = $pageSize; - $this->resetState(); - - return $this; - } - - /** - * Get an option from the iterator - * - * @param string $key Key of the option to retrieve - * - * @return mixed|null Returns NULL if not set or the value if set - */ - public function get($key) - { - return array_key_exists($key, $this->data) ? $this->data[$key] : null; - } - - /** - * Set an option on the iterator - * - * @param string $key Key of the option to set - * @param mixed $value Value to set for the option - * - * @return ResourceIterator - */ - public function set($key, $value) - { - $this->data[$key] = $value; - - return $this; - } - - public function current() - { - return $this->resources ? current($this->resources) : false; - } - - public function key() - { - return max(0, $this->iteratedCount - 1); - } - - public function count() - { - return $this->retrievedCount; - } - - /** - * Get the total number of requests sent - * - * @return int - */ - public function getRequestCount() - { - return $this->requestCount; - } - - /** - * Rewind the Iterator to the first element and send the original command - */ - public function rewind() - { - // Use the original command - $this->command = clone $this->originalCommand; - $this->resetState(); - $this->next(); - } - - public function valid() - { - return !$this->invalid && (!$this->resources || $this->current() || $this->nextToken) - && (!$this->limit || $this->iteratedCount < $this->limit + 1); - } - - public function next() - { - $this->iteratedCount++; - - // Check if a new set of resources needs to be retrieved - $sendRequest = false; - if (!$this->resources) { - $sendRequest = true; - } else { - // iterate over the internal array - $current = next($this->resources); - $sendRequest = $current === false && $this->nextToken && (!$this->limit || $this->iteratedCount < $this->limit + 1); - } - - if ($sendRequest) { - - $this->dispatch('resource_iterator.before_send', array( - 'iterator' => $this, - 'resources' => $this->resources - )); - - // Get a new command object from the original command - $this->command = clone $this->originalCommand; - // Send a request and retrieve the newly loaded resources - $this->resources = $this->sendRequest(); - $this->requestCount++; - - // If no resources were found, then the last request was not needed - // and iteration must stop - if (empty($this->resources)) { - $this->invalid = true; - } else { - // Add to the number of retrieved resources - $this->retrievedCount += count($this->resources); - // Ensure that we rewind to the beginning of the array - reset($this->resources); - } - - $this->dispatch('resource_iterator.after_send', array( - 'iterator' => $this, - 'resources' => $this->resources - )); - } - } - - /** - * Retrieve the NextToken that can be used in other iterators. - * - * @return string Returns a NextToken - */ - public function getNextToken() - { - return $this->nextToken; - } - - /** - * Returns the value that should be specified for the page size for a request that will maintain any hard limits, - * but still honor the specified pageSize if the number of items retrieved + pageSize < hard limit - * - * @return int Returns the page size of the next request. - */ - protected function calculatePageSize() - { - if ($this->limit && $this->iteratedCount + $this->pageSize > $this->limit) { - return 1 + ($this->limit - $this->iteratedCount); - } - - return (int) $this->pageSize; - } - - /** - * Reset the internal state of the iterator without triggering a rewind() - */ - protected function resetState() - { - $this->iteratedCount = 0; - $this->retrievedCount = 0; - $this->nextToken = false; - $this->resources = null; - $this->invalid = false; - } - - /** - * Send a request to retrieve the next page of results. Hook for subclasses to implement. - * - * @return array Returns the newly loaded resources - */ - abstract protected function sendRequest(); -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/ResourceIteratorApplyBatched.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/ResourceIteratorApplyBatched.php deleted file mode 100644 index 6aa36153f..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/ResourceIteratorApplyBatched.php +++ /dev/null @@ -1,111 +0,0 @@ -iterator = $iterator; - $this->callback = $callback; - Version::warn(__CLASS__ . ' is deprecated'); - } - - /** - * Apply the callback to the contents of the resource iterator - * - * @param int $perBatch The number of records to group per batch transfer - * - * @return int Returns the number of iterated resources - */ - public function apply($perBatch = 50) - { - $this->iterated = $this->batches = $batches = 0; - $that = $this; - $it = $this->iterator; - $callback = $this->callback; - - $batch = BatchBuilder::factory() - ->createBatchesWith(new BatchSizeDivisor($perBatch)) - ->transferWith(new BatchClosureTransfer(function (array $batch) use ($that, $callback, &$batches, $it) { - $batches++; - $that->dispatch('iterator_batch.before_batch', array('iterator' => $it, 'batch' => $batch)); - call_user_func_array($callback, array($it, $batch)); - $that->dispatch('iterator_batch.after_batch', array('iterator' => $it, 'batch' => $batch)); - })) - ->autoFlushAt($perBatch) - ->build(); - - $this->dispatch('iterator_batch.created_batch', array('batch' => $batch)); - - foreach ($this->iterator as $resource) { - $this->iterated++; - $batch->add($resource); - } - - $batch->flush(); - $this->batches = $batches; - - return $this->iterated; - } - - /** - * Get the total number of batches sent - * - * @return int - */ - public function getBatchCount() - { - return $this->batches; - } - - /** - * Get the total number of iterated resources - * - * @return int - */ - public function getIteratedCount() - { - return $this->iterated; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/ResourceIteratorClassFactory.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/ResourceIteratorClassFactory.php deleted file mode 100644 index 2fd998071..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/ResourceIteratorClassFactory.php +++ /dev/null @@ -1,60 +0,0 @@ - AbcFoo). - */ -class ResourceIteratorClassFactory extends AbstractResourceIteratorFactory -{ - /** @var array List of namespaces used to look for classes */ - protected $namespaces; - - /** @var InflectorInterface Inflector used to determine class names */ - protected $inflector; - - /** - * @param string|array $namespaces List of namespaces for iterator objects - * @param InflectorInterface $inflector Inflector used to resolve class names - */ - public function __construct($namespaces = array(), InflectorInterface $inflector = null) - { - $this->namespaces = (array) $namespaces; - $this->inflector = $inflector ?: Inflector::getDefault(); - } - - /** - * Registers a namespace to check for Iterators - * - * @param string $namespace Namespace which contains Iterator classes - * - * @return self - */ - public function registerNamespace($namespace) - { - array_unshift($this->namespaces, $namespace); - - return $this; - } - - protected function getClassName(CommandInterface $command) - { - $iteratorName = $this->inflector->camel($command->getName()) . 'Iterator'; - - // Determine the name of the class to load - foreach ($this->namespaces as $namespace) { - $potentialClassName = $namespace . '\\' . $iteratorName; - if (class_exists($potentialClassName)) { - return $potentialClassName; - } - } - - return false; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/ResourceIteratorFactoryInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/ResourceIteratorFactoryInterface.php deleted file mode 100644 index 8b4e8dbe0..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Service/Resource/ResourceIteratorFactoryInterface.php +++ /dev/null @@ -1,30 +0,0 @@ -=5.3.2", - "guzzle/cache": "self.version", - "guzzle/http": "self.version", - "guzzle/inflection": "self.version" - }, - "autoload": { - "psr-0": { "Guzzle\\Service": "" } - }, - "target-dir": "Guzzle/Service", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Stream/PhpStreamRequestFactory.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Stream/PhpStreamRequestFactory.php deleted file mode 100644 index d115fd890..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Stream/PhpStreamRequestFactory.php +++ /dev/null @@ -1,284 +0,0 @@ -contextOptions = stream_context_get_options($context); - $this->context = $context; - } elseif (is_array($context) || !$context) { - $this->contextOptions = $context; - $this->createContext($params); - } elseif ($context) { - throw new InvalidArgumentException('$context must be an array or resource'); - } - - // Dispatch the before send event - $request->dispatch('request.before_send', array( - 'request' => $request, - 'context' => $this->context, - 'context_options' => $this->contextOptions - )); - - $this->setUrl($request); - $this->addDefaultContextOptions($request); - $this->addSslOptions($request); - $this->addBodyOptions($request); - $this->addProxyOptions($request); - - // Create the file handle but silence errors - return $this->createStream($params) - ->setCustomData('request', $request) - ->setCustomData('response_headers', $this->getLastResponseHeaders()); - } - - /** - * Set an option on the context and the internal options array - * - * @param string $wrapper Stream wrapper name of http - * @param string $name Context name - * @param mixed $value Context value - * @param bool $overwrite Set to true to overwrite an existing value - */ - protected function setContextValue($wrapper, $name, $value, $overwrite = false) - { - if (!isset($this->contextOptions[$wrapper])) { - $this->contextOptions[$wrapper] = array($name => $value); - } elseif (!$overwrite && isset($this->contextOptions[$wrapper][$name])) { - return; - } - $this->contextOptions[$wrapper][$name] = $value; - stream_context_set_option($this->context, $wrapper, $name, $value); - } - - /** - * Create a stream context - * - * @param array $params Parameter array - */ - protected function createContext(array $params) - { - $options = $this->contextOptions; - $this->context = $this->createResource(function () use ($params, $options) { - return stream_context_create($options, $params); - }); - } - - /** - * Get the last response headers received by the HTTP request - * - * @return array - */ - public function getLastResponseHeaders() - { - return $this->lastResponseHeaders; - } - - /** - * Adds the default context options to the stream context options - * - * @param RequestInterface $request Request - */ - protected function addDefaultContextOptions(RequestInterface $request) - { - $this->setContextValue('http', 'method', $request->getMethod()); - $headers = $request->getHeaderLines(); - - // "Connection: close" is required to get streams to work in HTTP 1.1 - if (!$request->hasHeader('Connection')) { - $headers[] = 'Connection: close'; - } - - $this->setContextValue('http', 'header', $headers); - $this->setContextValue('http', 'protocol_version', $request->getProtocolVersion()); - $this->setContextValue('http', 'ignore_errors', true); - } - - /** - * Set the URL to use with the factory - * - * @param RequestInterface $request Request that owns the URL - */ - protected function setUrl(RequestInterface $request) - { - $this->url = $request->getUrl(true); - - // Check for basic Auth username - if ($request->getUsername()) { - $this->url->setUsername($request->getUsername()); - } - - // Check for basic Auth password - if ($request->getPassword()) { - $this->url->setPassword($request->getPassword()); - } - } - - /** - * Add SSL options to the stream context - * - * @param RequestInterface $request Request - */ - protected function addSslOptions(RequestInterface $request) - { - if ($request->getCurlOptions()->get(CURLOPT_SSL_VERIFYPEER)) { - $this->setContextValue('ssl', 'verify_peer', true, true); - if ($cafile = $request->getCurlOptions()->get(CURLOPT_CAINFO)) { - $this->setContextValue('ssl', 'cafile', $cafile, true); - } - } else { - $this->setContextValue('ssl', 'verify_peer', false, true); - } - } - - /** - * Add body (content) specific options to the context options - * - * @param RequestInterface $request - */ - protected function addBodyOptions(RequestInterface $request) - { - // Add the content for the request if needed - if (!($request instanceof EntityEnclosingRequestInterface)) { - return; - } - - if (count($request->getPostFields())) { - $this->setContextValue('http', 'content', (string) $request->getPostFields(), true); - } elseif ($request->getBody()) { - $this->setContextValue('http', 'content', (string) $request->getBody(), true); - } - - // Always ensure a content-length header is sent - if (isset($this->contextOptions['http']['content'])) { - $headers = isset($this->contextOptions['http']['header']) ? $this->contextOptions['http']['header'] : array(); - $headers[] = 'Content-Length: ' . strlen($this->contextOptions['http']['content']); - $this->setContextValue('http', 'header', $headers, true); - } - } - - /** - * Add proxy parameters to the context if needed - * - * @param RequestInterface $request Request - */ - protected function addProxyOptions(RequestInterface $request) - { - if ($proxy = $request->getCurlOptions()->get(CURLOPT_PROXY)) { - $this->setContextValue('http', 'proxy', $proxy); - } - } - - /** - * Create the stream for the request with the context options - * - * @param array $params Parameters of the stream - * - * @return StreamInterface - */ - protected function createStream(array $params) - { - $http_response_header = null; - $url = $this->url; - $context = $this->context; - $fp = $this->createResource(function () use ($context, $url, &$http_response_header) { - return fopen((string) $url, 'r', false, $context); - }); - - // Determine the class to instantiate - $className = isset($params['stream_class']) ? $params['stream_class'] : __NAMESPACE__ . '\\Stream'; - - /** @var $stream StreamInterface */ - $stream = new $className($fp); - - // Track the response headers of the request - if (isset($http_response_header)) { - $this->lastResponseHeaders = $http_response_header; - $this->processResponseHeaders($stream); - } - - return $stream; - } - - /** - * Process response headers - * - * @param StreamInterface $stream - */ - protected function processResponseHeaders(StreamInterface $stream) - { - // Set the size on the stream if it was returned in the response - foreach ($this->lastResponseHeaders as $header) { - if ((stripos($header, 'Content-Length:')) === 0) { - $stream->setSize(trim(substr($header, 15))); - } - } - } - - /** - * Create a resource and check to ensure it was created successfully - * - * @param callable $callback Closure to invoke that must return a valid resource - * - * @return resource - * @throws RuntimeException on error - */ - protected function createResource($callback) - { - $errors = null; - set_error_handler(function ($_, $msg, $file, $line) use (&$errors) { - $errors[] = array( - 'message' => $msg, - 'file' => $file, - 'line' => $line - ); - return true; - }); - $resource = call_user_func($callback); - restore_error_handler(); - - if (!$resource) { - $message = 'Error creating resource. '; - foreach ($errors as $err) { - foreach ($err as $key => $value) { - $message .= "[$key] $value" . PHP_EOL; - } - } - throw new RuntimeException(trim($message)); - } - - return $resource; - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php deleted file mode 100644 index 12bed268d..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Stream/Stream.php +++ /dev/null @@ -1,289 +0,0 @@ - array( - 'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true, - 'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true, 'c+b' => true, - 'rt' => true, 'w+t' => true, 'r+t' => true, 'x+t' => true, 'c+t' => true, 'a+' => true - ), - 'write' => array( - 'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true, 'c+' => true, - 'wb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true, 'c+b' => true, - 'w+t' => true, 'r+t' => true, 'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true - ) - ); - - /** - * @param resource $stream Stream resource to wrap - * @param int $size Size of the stream in bytes. Only pass if the size cannot be obtained from the stream. - * - * @throws InvalidArgumentException if the stream is not a stream resource - */ - public function __construct($stream, $size = null) - { - $this->setStream($stream, $size); - } - - /** - * Closes the stream when the helper is destructed - */ - public function __destruct() - { - $this->close(); - } - - public function __toString() - { - if (!$this->isReadable() || (!$this->isSeekable() && $this->isConsumed())) { - return ''; - } - - $originalPos = $this->ftell(); - $body = stream_get_contents($this->stream, -1, 0); - $this->seek($originalPos); - - return $body; - } - - public function close() - { - if (is_resource($this->stream)) { - fclose($this->stream); - } - $this->cache[self::IS_READABLE] = false; - $this->cache[self::IS_WRITABLE] = false; - } - - /** - * Calculate a hash of a Stream - * - * @param StreamInterface $stream Stream to calculate the hash for - * @param string $algo Hash algorithm (e.g. md5, crc32, etc) - * @param bool $rawOutput Whether or not to use raw output - * - * @return bool|string Returns false on failure or a hash string on success - */ - public static function getHash(StreamInterface $stream, $algo, $rawOutput = false) - { - $pos = $stream->ftell(); - if (!$stream->seek(0)) { - return false; - } - - $ctx = hash_init($algo); - while (!$stream->feof()) { - hash_update($ctx, $stream->read(8192)); - } - - $out = hash_final($ctx, (bool) $rawOutput); - $stream->seek($pos); - - return $out; - } - - public function getMetaData($key = null) - { - $meta = stream_get_meta_data($this->stream); - - return !$key ? $meta : (array_key_exists($key, $meta) ? $meta[$key] : null); - } - - public function getStream() - { - return $this->stream; - } - - public function setStream($stream, $size = null) - { - if (!is_resource($stream)) { - throw new InvalidArgumentException('Stream must be a resource'); - } - - $this->size = $size; - $this->stream = $stream; - $this->rebuildCache(); - - return $this; - } - - public function detachStream() - { - $this->stream = null; - - return $this; - } - - public function getWrapper() - { - return $this->cache[self::WRAPPER_TYPE]; - } - - public function getWrapperData() - { - return $this->getMetaData('wrapper_data') ?: array(); - } - - public function getStreamType() - { - return $this->cache[self::STREAM_TYPE]; - } - - public function getUri() - { - return $this->cache['uri']; - } - - public function getSize() - { - if ($this->size !== null) { - return $this->size; - } - - // If the stream is a file based stream and local, then use fstat - clearstatcache(true, $this->cache['uri']); - $stats = fstat($this->stream); - if (isset($stats['size'])) { - $this->size = $stats['size']; - return $this->size; - } elseif ($this->cache[self::IS_READABLE] && $this->cache[self::SEEKABLE]) { - // Only get the size based on the content if the the stream is readable and seekable - $pos = $this->ftell(); - $this->size = strlen((string) $this); - $this->seek($pos); - return $this->size; - } - - return false; - } - - public function isReadable() - { - return $this->cache[self::IS_READABLE]; - } - - public function isRepeatable() - { - return $this->cache[self::IS_READABLE] && $this->cache[self::SEEKABLE]; - } - - public function isWritable() - { - return $this->cache[self::IS_WRITABLE]; - } - - public function isConsumed() - { - return feof($this->stream); - } - - public function feof() - { - return $this->isConsumed(); - } - - public function isLocal() - { - return $this->cache[self::IS_LOCAL]; - } - - public function isSeekable() - { - return $this->cache[self::SEEKABLE]; - } - - public function setSize($size) - { - $this->size = $size; - - return $this; - } - - public function seek($offset, $whence = SEEK_SET) - { - return $this->cache[self::SEEKABLE] ? fseek($this->stream, $offset, $whence) === 0 : false; - } - - public function read($length) - { - return fread($this->stream, $length); - } - - public function write($string) - { - // We can't know the size after writing anything - $this->size = null; - - return fwrite($this->stream, $string); - } - - public function ftell() - { - return ftell($this->stream); - } - - public function rewind() - { - return $this->seek(0); - } - - public function readLine($maxLength = null) - { - if (!$this->cache[self::IS_READABLE]) { - return false; - } else { - return $maxLength ? fgets($this->getStream(), $maxLength) : fgets($this->getStream()); - } - } - - public function setCustomData($key, $value) - { - $this->customData[$key] = $value; - - return $this; - } - - public function getCustomData($key) - { - return isset($this->customData[$key]) ? $this->customData[$key] : null; - } - - /** - * Reprocess stream metadata - */ - protected function rebuildCache() - { - $this->cache = stream_get_meta_data($this->stream); - $this->cache[self::IS_LOCAL] = stream_is_local($this->stream); - $this->cache[self::IS_READABLE] = isset(self::$readWriteHash['read'][$this->cache['mode']]); - $this->cache[self::IS_WRITABLE] = isset(self::$readWriteHash['write'][$this->cache['mode']]); - } -} diff --git a/bb-vendor/guzzle/guzzle/src/Guzzle/Stream/StreamInterface.php b/bb-vendor/guzzle/guzzle/src/Guzzle/Stream/StreamInterface.php deleted file mode 100644 index 6d7dc3761..000000000 --- a/bb-vendor/guzzle/guzzle/src/Guzzle/Stream/StreamInterface.php +++ /dev/null @@ -1,218 +0,0 @@ -=5.3.2", - "guzzle/common": "self.version" - }, - "suggest": { - "guzzle/http": "To convert Guzzle request objects to PHP streams" - }, - "autoload": { - "psr-0": { "Guzzle\\Stream": "" } - }, - "target-dir": "Guzzle/Stream", - "extra": { - "branch-alias": { - "dev-master": "3.7-dev" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/AbstractBatchDecoratorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/AbstractBatchDecoratorTest.php deleted file mode 100644 index 951738d2a..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/AbstractBatchDecoratorTest.php +++ /dev/null @@ -1,33 +0,0 @@ -getMock('Guzzle\Batch\BatchTransferInterface'), - $this->getMock('Guzzle\Batch\BatchDivisorInterface') - ); - - $decoratorA = $this->getMockBuilder('Guzzle\Batch\AbstractBatchDecorator') - ->setConstructorArgs(array($batch)) - ->getMockForAbstractClass(); - - $decoratorB = $this->getMockBuilder('Guzzle\Batch\AbstractBatchDecorator') - ->setConstructorArgs(array($decoratorA)) - ->getMockForAbstractClass(); - - $decoratorA->add('foo'); - $this->assertFalse($decoratorB->isEmpty()); - $this->assertFalse($batch->isEmpty()); - $this->assertEquals(array($decoratorB, $decoratorA), $decoratorB->getDecorators()); - $this->assertEquals(array(), $decoratorB->flush()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchBuilderTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchBuilderTest.php deleted file mode 100644 index 4da09d30e..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchBuilderTest.php +++ /dev/null @@ -1,86 +0,0 @@ -getMock('Guzzle\Batch\BatchTransferInterface'); - } - - private function getMockDivisor() - { - return $this->getMock('Guzzle\Batch\BatchDivisorInterface'); - } - - private function getMockBatchBuilder() - { - return BatchBuilder::factory() - ->transferWith($this->getMockTransfer()) - ->createBatchesWith($this->getMockDivisor()); - } - - public function testFactoryCreatesInstance() - { - $builder = BatchBuilder::factory(); - $this->assertInstanceOf('Guzzle\Batch\BatchBuilder', $builder); - } - - public function testAddsAutoFlush() - { - $batch = $this->getMockBatchBuilder()->autoFlushAt(10)->build(); - $this->assertInstanceOf('Guzzle\Batch\FlushingBatch', $batch); - } - - public function testAddsExceptionBuffering() - { - $batch = $this->getMockBatchBuilder()->bufferExceptions()->build(); - $this->assertInstanceOf('Guzzle\Batch\ExceptionBufferingBatch', $batch); - } - - public function testAddHistory() - { - $batch = $this->getMockBatchBuilder()->keepHistory()->build(); - $this->assertInstanceOf('Guzzle\Batch\HistoryBatch', $batch); - } - - public function testAddsNotify() - { - $batch = $this->getMockBatchBuilder()->notify(function() {})->build(); - $this->assertInstanceOf('Guzzle\Batch\NotifyingBatch', $batch); - } - - /** - * @expectedException Guzzle\Common\Exception\RuntimeException - */ - public function testTransferStrategyMustBeSet() - { - $batch = BatchBuilder::factory()->createBatchesWith($this->getMockDivisor())->build(); - } - - /** - * @expectedException Guzzle\Common\Exception\RuntimeException - */ - public function testDivisorStrategyMustBeSet() - { - $batch = BatchBuilder::factory()->transferWith($this->getMockTransfer())->build(); - } - - public function testTransfersRequests() - { - $batch = BatchBuilder::factory()->transferRequests(10)->build(); - $this->assertInstanceOf('Guzzle\Batch\BatchRequestTransfer', $this->readAttribute($batch, 'transferStrategy')); - } - - public function testTransfersCommands() - { - $batch = BatchBuilder::factory()->transferCommands(10)->build(); - $this->assertInstanceOf('Guzzle\Batch\BatchCommandTransfer', $this->readAttribute($batch, 'transferStrategy')); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchClosureDivisorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchClosureDivisorTest.php deleted file mode 100644 index 753db7dab..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchClosureDivisorTest.php +++ /dev/null @@ -1,36 +0,0 @@ -createBatches($queue); - $this->assertEquals(array(array('foo'), array('baz')), $batches); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchClosureTransferTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchClosureTransferTest.php deleted file mode 100644 index 6ba7ae052..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchClosureTransferTest.php +++ /dev/null @@ -1,52 +0,0 @@ -itemsTransferred = null; - $itemsTransferred =& $this->itemsTransferred; - - $this->transferStrategy = new BatchClosureTransfer(function (array $batch) use (&$itemsTransferred) { - $itemsTransferred = $batch; - return; - }); - } - - public function testTransfersBatch() - { - $batchedItems = array('foo', 'bar', 'baz'); - $this->transferStrategy->transfer($batchedItems); - - $this->assertEquals($batchedItems, $this->itemsTransferred); - } - - public function testTransferBailsOnEmptyBatch() - { - $batchedItems = array(); - $this->transferStrategy->transfer($batchedItems); - - $this->assertNull($this->itemsTransferred); - } - - /** - * @expectedException Guzzle\Common\Exception\InvalidArgumentException - */ - public function testEnsuresCallableIsCallable() - { - $foo = new BatchClosureTransfer('uh oh!'); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchCommandTransferTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchCommandTransferTest.php deleted file mode 100644 index a04efabbb..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchCommandTransferTest.php +++ /dev/null @@ -1,83 +0,0 @@ - $command) { - if ($i % 2) { - $command->setClient($client1); - } else { - $command->setClient($client2); - } - $queue[] = $command; - } - - $batch = new BatchCommandTransfer(2); - $this->assertEquals(array( - array($commands[0], $commands[2]), - array($commands[4]), - array($commands[1], $commands[3]) - ), $batch->createBatches($queue)); - } - - /** - * @expectedException Guzzle\Common\Exception\InvalidArgumentException - */ - public function testEnsuresAllItemsAreCommands() - { - $queue = new \SplQueue(); - $queue[] = 'foo'; - $batch = new BatchCommandTransfer(2); - $batch->createBatches($queue); - } - - public function testTransfersBatches() - { - $client = $this->getMockBuilder('Guzzle\Service\Client') - ->setMethods(array('send')) - ->getMock(); - $client->expects($this->once()) - ->method('send'); - $command = new Mc(); - $command->setClient($client); - $batch = new BatchCommandTransfer(2); - $batch->transfer(array($command)); - } - - public function testDoesNotTransfersEmptyBatches() - { - $batch = new BatchCommandTransfer(2); - $batch->transfer(array()); - } - - /** - * @expectedException Guzzle\Service\Exception\InconsistentClientTransferException - */ - public function testEnsuresAllCommandsUseTheSameClient() - { - $batch = new BatchCommandTransfer(2); - $client1 = new Client('http://www.example.com'); - $client2 = new Client('http://www.example.com'); - $command1 = new Mc(); - $command1->setClient($client1); - $command2 = new Mc(); - $command2->setClient($client2); - $batch->transfer(array($command1, $command2)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchRequestTransferTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchRequestTransferTest.php deleted file mode 100644 index dec7bd55e..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchRequestTransferTest.php +++ /dev/null @@ -1,80 +0,0 @@ -setCurlMulti(new CurlMulti()); - - $client2 = new Client('http://www.example.com'); - $client2->setCurlMulti(new CurlMulti()); - - $request1 = $client1->get(); - $request2 = $client2->get(); - $request3 = $client1->get(); - $request4 = $client2->get(); - $request5 = $client1->get(); - - $queue = new \SplQueue(); - $queue[] = $request1; - $queue[] = $request2; - $queue[] = $request3; - $queue[] = $request4; - $queue[] = $request5; - - $batch = new BatchRequestTransfer(2); - $this->assertEquals(array( - array($request1, $request3), - array($request3), - array($request2, $request4) - ), $batch->createBatches($queue)); - } - - /** - * @expectedException \Guzzle\Common\Exception\InvalidArgumentException - */ - public function testEnsuresAllItemsAreRequests() - { - $queue = new \SplQueue(); - $queue[] = 'foo'; - $batch = new BatchRequestTransfer(2); - $batch->createBatches($queue); - } - - public function testTransfersBatches() - { - $client = new Client('http://127.0.0.1:123'); - $request = $client->get(); - // For some reason... PHP unit clones the request, which emits a request.clone event. This causes the - // 'sorted' property of the event dispatcher to contain an array in the cloned request that is not present in - // the original. - $request->dispatch('request.clone'); - - $multi = $this->getMock('Guzzle\Http\Curl\CurlMultiInterface'); - $client->setCurlMulti($multi); - $multi->expects($this->once()) - ->method('add') - ->with($request); - $multi->expects($this->once()) - ->method('send'); - - $batch = new BatchRequestTransfer(2); - $batch->transfer(array($request)); - } - - public function testDoesNotTransfersEmptyBatches() - { - $batch = new BatchRequestTransfer(2); - $batch->transfer(array()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchSizeDivisorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchSizeDivisorTest.php deleted file mode 100644 index 5542228fd..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchSizeDivisorTest.php +++ /dev/null @@ -1,24 +0,0 @@ -assertEquals(3, $d->getSize()); - $d->setSize(2); - $batches = $d->createBatches($queue); - $this->assertEquals(array(array('foo', 'baz'), array('bar')), $batches); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchTest.php deleted file mode 100644 index 296f57aef..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/BatchTest.php +++ /dev/null @@ -1,91 +0,0 @@ -getMock('Guzzle\Batch\BatchTransferInterface'); - } - - private function getMockDivisor() - { - return $this->getMock('Guzzle\Batch\BatchDivisorInterface'); - } - - public function testAddsItemsToQueue() - { - $batch = new Batch($this->getMockTransfer(), $this->getMockDivisor()); - $this->assertSame($batch, $batch->add('foo')); - $this->assertEquals(1, count($batch)); - } - - public function testFlushReturnsItems() - { - $transfer = $this->getMockTransfer(); - $transfer->expects($this->exactly(2)) - ->method('transfer'); - - $divisor = $this->getMockDivisor(); - $divisor->expects($this->once()) - ->method('createBatches') - ->will($this->returnValue(array(array('foo', 'baz'), array('bar')))); - - $batch = new Batch($transfer, $divisor); - - $batch->add('foo')->add('baz')->add('bar'); - $items = $batch->flush(); - - $this->assertEquals(array('foo', 'baz', 'bar'), $items); - } - - public function testThrowsExceptionContainingTheFailedBatch() - { - $called = 0; - $originalException = new \Exception('Foo!'); - - $transfer = $this->getMockTransfer(); - $transfer->expects($this->exactly(2)) - ->method('transfer') - ->will($this->returnCallback(function () use (&$called, $originalException) { - if (++$called == 2) { - throw $originalException; - } - })); - - $divisor = $this->getMockDivisor(); - $batch = new Batch($transfer, $divisor); - - // PHPunit clones objects before passing them to a callback. - // Horrible hack to get around this! - $queue = $this->readAttribute($batch, 'queue'); - - $divisor->expects($this->once()) - ->method('createBatches') - ->will($this->returnCallback(function ($batch) use ($queue) { - foreach ($queue as $item) { - $items[] = $item; - } - return array_chunk($items, 2); - })); - - $batch->add('foo')->add('baz')->add('bar')->add('bee')->add('boo'); - $this->assertFalse($batch->isEmpty()); - - try { - $items = $batch->flush(); - $this->fail('Expected exception'); - } catch (BatchTransferException $e) { - $this->assertEquals($originalException, $e->getPrevious()); - $this->assertEquals(array('bar', 'bee'), array_values($e->getBatch())); - $this->assertEquals(1, count($batch)); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/ExceptionBufferingBatchTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/ExceptionBufferingBatchTest.php deleted file mode 100644 index fd810b11f..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/ExceptionBufferingBatchTest.php +++ /dev/null @@ -1,45 +0,0 @@ -getMockBuilder('Guzzle\Batch\BatchTransferInterface') - ->setMethods(array('transfer')) - ->getMock(); - - $d = new BatchSizeDivisor(1); - $batch = new Batch($t, $d); - - $called = 0; - $t->expects($this->exactly(3)) - ->method('transfer') - ->will($this->returnCallback(function ($batch) use (&$called) { - if (++$called === 2) { - throw new \Exception('Foo'); - } - })); - - $decorator = new ExceptionBufferingBatch($batch); - $decorator->add('foo')->add('baz')->add('bar'); - $result = $decorator->flush(); - - $e = $decorator->getExceptions(); - $this->assertEquals(1, count($e)); - $this->assertEquals(array('baz'), $e[0]->getBatch()); - - $decorator->clearExceptions(); - $this->assertEquals(0, count($decorator->getExceptions())); - - $this->assertEquals(array('foo', 'bar'), $result); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/FlushingBatchTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/FlushingBatchTest.php deleted file mode 100644 index 9b37a485f..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/FlushingBatchTest.php +++ /dev/null @@ -1,40 +0,0 @@ -getMock('Guzzle\Batch\BatchTransferInterface', array('transfer')); - $d = $this->getMock('Guzzle\Batch\BatchDivisorInterface', array('createBatches')); - - $batch = new Batch($t, $d); - $queue = $this->readAttribute($batch, 'queue'); - - $d->expects($this->exactly(2)) - ->method('createBatches') - ->will($this->returnCallback(function () use ($queue) { - $items = array(); - foreach ($queue as $item) { - $items[] = $item; - } - return array($items); - })); - - $t->expects($this->exactly(2)) - ->method('transfer'); - - $flush = new FlushingBatch($batch, 3); - $this->assertEquals(3, $flush->getThreshold()); - $flush->setThreshold(2); - $flush->add('foo')->add('baz')->add('bar')->add('bee')->add('boo'); - $this->assertEquals(1, count($flush)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/HistoryBatchTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/HistoryBatchTest.php deleted file mode 100644 index 60d6f951a..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/HistoryBatchTest.php +++ /dev/null @@ -1,26 +0,0 @@ -getMock('Guzzle\Batch\BatchTransferInterface'), - $this->getMock('Guzzle\Batch\BatchDivisorInterface') - ); - - $history = new HistoryBatch($batch); - $history->add('foo')->add('baz'); - $this->assertEquals(array('foo', 'baz'), $history->getHistory()); - $history->clearHistory(); - $this->assertEquals(array(), $history->getHistory()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/NotifyingBatchTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/NotifyingBatchTest.php deleted file mode 100644 index 69a89007a..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Batch/NotifyingBatchTest.php +++ /dev/null @@ -1,45 +0,0 @@ -getMock('Guzzle\Batch\Batch', array('flush'), array( - $this->getMock('Guzzle\Batch\BatchTransferInterface'), - $this->getMock('Guzzle\Batch\BatchDivisorInterface') - )); - - $batch->expects($this->once()) - ->method('flush') - ->will($this->returnValue(array('foo', 'baz'))); - - $data = array(); - $decorator = new NotifyingBatch($batch, function ($batch) use (&$data) { - $data[] = $batch; - }); - - $decorator->add('foo')->add('baz'); - $decorator->flush(); - $this->assertEquals(array(array('foo', 'baz')), $data); - } - - /** - * @expectedException Guzzle\Common\Exception\InvalidArgumentException - */ - public function testEnsuresCallableIsValid() - { - $batch = new Batch( - $this->getMock('Guzzle\Batch\BatchTransferInterface'), - $this->getMock('Guzzle\Batch\BatchDivisorInterface') - ); - $decorator = new NotifyingBatch($batch, 'foo'); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Cache/CacheAdapterFactoryTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Cache/CacheAdapterFactoryTest.php deleted file mode 100644 index c4140a91d..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Cache/CacheAdapterFactoryTest.php +++ /dev/null @@ -1,64 +0,0 @@ -cache = new ArrayCache(); - $this->adapter = new DoctrineCacheAdapter($this->cache); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testEnsuresConfigIsObject() - { - CacheAdapterFactory::fromCache(array()); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testEnsuresKnownType() - { - CacheAdapterFactory::fromCache(new \stdClass()); - } - - public function cacheProvider() - { - return array( - array(new DoctrineCacheAdapter(new ArrayCache()), 'Guzzle\Cache\DoctrineCacheAdapter'), - array(new ArrayCache(), 'Guzzle\Cache\DoctrineCacheAdapter'), - array(StorageFactory::factory(array('adapter' => 'memory')), 'Guzzle\Cache\Zf2CacheAdapter'), - ); - } - - /** - * @dataProvider cacheProvider - */ - public function testCreatesNullCacheAdapterByDefault($cache, $type) - { - $adapter = CacheAdapterFactory::fromCache($cache); - $this->assertInstanceOf($type, $adapter); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Cache/CacheAdapterTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Cache/CacheAdapterTest.php deleted file mode 100644 index 3e30dddc5..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Cache/CacheAdapterTest.php +++ /dev/null @@ -1,68 +0,0 @@ -cache = new ArrayCache(); - $this->adapter = new DoctrineCacheAdapter($this->cache); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->adapter = null; - $this->cache = null; - parent::tearDown(); - } - - public function testGetCacheObject() - { - $this->assertEquals($this->cache, $this->adapter->getCacheObject()); - } - - public function testSave() - { - $this->assertTrue($this->adapter->save('test', 'data', 1000)); - } - - public function testFetch() - { - $this->assertTrue($this->adapter->save('test', 'data', 1000)); - $this->assertEquals('data', $this->adapter->fetch('test')); - } - - public function testContains() - { - $this->assertTrue($this->adapter->save('test', 'data', 1000)); - $this->assertTrue($this->adapter->contains('test')); - } - - public function testDelete() - { - $this->assertTrue($this->adapter->save('test', 'data', 1000)); - $this->assertTrue($this->adapter->delete('test')); - $this->assertFalse($this->adapter->contains('test')); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Cache/ClosureCacheAdapterTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Cache/ClosureCacheAdapterTest.php deleted file mode 100644 index 12de65b5a..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Cache/ClosureCacheAdapterTest.php +++ /dev/null @@ -1,94 +0,0 @@ -callables = array( - 'contains' => function($id, $options = array()) use ($that) { - return array_key_exists($id, $that->data); - }, - 'delete' => function($id, $options = array()) use ($that) { - unset($that->data[$id]); - return true; - }, - 'fetch' => function($id, $options = array()) use ($that) { - return array_key_exists($id, $that->data) ? $that->data[$id] : null; - }, - 'save' => function($id, $data, $lifeTime, $options = array()) use ($that) { - $that->data[$id] = $data; - return true; - } - ); - - $this->adapter = new ClosureCacheAdapter($this->callables); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->cache = null; - $this->callables = null; - parent::tearDown(); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testEnsuresCallablesArePresent() - { - $callables = $this->callables; - unset($callables['delete']); - $cache = new ClosureCacheAdapter($callables); - } - - public function testAllCallablesMustBePresent() - { - $cache = new ClosureCacheAdapter($this->callables); - } - - public function testCachesDataUsingCallables() - { - $this->assertTrue($this->adapter->save('test', 'data', 1000)); - $this->assertEquals('data', $this->adapter->fetch('test')); - } - - public function testChecksIfCacheContainsKeys() - { - $this->adapter->save('test', 'data', 1000); - $this->assertTrue($this->adapter->contains('test')); - $this->assertFalse($this->adapter->contains('foo')); - } - - public function testDeletesFromCacheByKey() - { - $this->adapter->save('test', 'data', 1000); - $this->assertTrue($this->adapter->contains('test')); - $this->adapter->delete('test'); - $this->assertFalse($this->adapter->contains('test')); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Cache/NullCacheAdapterTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Cache/NullCacheAdapterTest.php deleted file mode 100644 index e05df3f78..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Cache/NullCacheAdapterTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertEquals(false, $c->contains('foo')); - $this->assertEquals(true, $c->delete('foo')); - $this->assertEquals(false, $c->fetch('foo')); - $this->assertEquals(true, $c->save('foo', 'bar')); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Cache/Zf2CacheAdapterTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Cache/Zf2CacheAdapterTest.php deleted file mode 100644 index 9077c12d3..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Cache/Zf2CacheAdapterTest.php +++ /dev/null @@ -1,58 +0,0 @@ -cache = StorageFactory::factory(array( - 'adapter' => 'memory' - )); - $this->adapter = new Zf2CacheAdapter($this->cache); - } - - /** - * Cleans up the environment after running a test. - */ - protected function tearDown() - { - $this->adapter = null; - $this->cache = null; - parent::tearDown(); - } - - public function testCachesDataUsingCallables() - { - $this->assertTrue($this->adapter->save('test', 'data', 1000)); - $this->assertEquals('data', $this->adapter->fetch('test')); - } - - public function testChecksIfCacheContainsKeys() - { - $this->adapter->save('test', 'data', 1000); - $this->assertTrue($this->adapter->contains('test')); - $this->assertFalse($this->adapter->contains('foo')); - } - - public function testDeletesFromCacheByKey() - { - $this->adapter->save('test', 'data', 1000); - $this->assertTrue($this->adapter->contains('test')); - $this->adapter->delete('test'); - $this->assertFalse($this->adapter->contains('test')); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Common/AbstractHasDispatcherTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Common/AbstractHasDispatcherTest.php deleted file mode 100644 index 19d12e6f6..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Common/AbstractHasDispatcherTest.php +++ /dev/null @@ -1,63 +0,0 @@ -assertEquals(array(), AbstractHasDispatcher::getAllEvents()); - } - - public function testAllowsDispatcherToBeInjected() - { - $d = new EventDispatcher(); - $mock = $this->getMockForAbstractClass('Guzzle\Common\AbstractHasDispatcher'); - $this->assertSame($mock, $mock->setEventDispatcher($d)); - $this->assertSame($d, $mock->getEventDispatcher()); - } - - public function testCreatesDefaultEventDispatcherIfNeeded() - { - $mock = $this->getMockForAbstractClass('Guzzle\Common\AbstractHasDispatcher'); - $this->assertInstanceOf('Symfony\Component\EventDispatcher\EventDispatcher', $mock->getEventDispatcher()); - } - - public function testHelperDispatchesEvents() - { - $data = array(); - $mock = $this->getMockForAbstractClass('Guzzle\Common\AbstractHasDispatcher'); - $mock->getEventDispatcher()->addListener('test', function(Event $e) use (&$data) { - $data = $e->getIterator()->getArrayCopy(); - }); - $mock->dispatch('test', array( - 'param' => 'abc' - )); - $this->assertEquals(array( - 'param' => 'abc', - ), $data); - } - - public function testHelperAttachesSubscribers() - { - $mock = $this->getMockForAbstractClass('Guzzle\Common\AbstractHasDispatcher'); - $subscriber = $this->getMockForAbstractClass('Symfony\Component\EventDispatcher\EventSubscriberInterface'); - - $dispatcher = $this->getMockBuilder('Symfony\Component\EventDispatcher\EventDispatcher') - ->setMethods(array('addSubscriber')) - ->getMock(); - - $dispatcher->expects($this->once()) - ->method('addSubscriber'); - - $mock->setEventDispatcher($dispatcher); - $mock->addSubscriber($subscriber); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Common/CollectionTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Common/CollectionTest.php deleted file mode 100644 index 0648a02b8..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Common/CollectionTest.php +++ /dev/null @@ -1,529 +0,0 @@ -coll = new Collection(); - } - - public function testConstructorCanBeCalledWithNoParams() - { - $this->coll = new Collection(); - $p = $this->coll->getAll(); - $this->assertEmpty($p, '-> Collection must be empty when no data is passed'); - } - - public function testConstructorCanBeCalledWithParams() - { - $testData = array( - 'test' => 'value', - 'test_2' => 'value2' - ); - $this->coll = new Collection($testData); - $this->assertEquals($this->coll->getAll(), $testData, '-> getAll() must return the data passed in the constructor'); - $this->assertEquals($this->coll->getAll(), $this->coll->toArray()); - } - - public function testImplementsIteratorAggregate() - { - $this->coll->set('key', 'value'); - $this->assertInstanceOf('ArrayIterator', $this->coll->getIterator()); - $this->assertEquals(1, count($this->coll)); - $total = 0; - foreach ($this->coll as $key => $value) { - $this->assertEquals('key', $key); - $this->assertEquals('value', $value); - $total++; - } - $this->assertEquals(1, $total); - } - - public function testCanAddValuesToExistingKeysByUsingArray() - { - $this->coll->add('test', 'value1'); - $this->assertEquals($this->coll->getAll(), array('test' => 'value1')); - $this->coll->add('test', 'value2'); - $this->assertEquals($this->coll->getAll(), array('test' => array('value1', 'value2'))); - $this->coll->add('test', 'value3'); - $this->assertEquals($this->coll->getAll(), array('test' => array('value1', 'value2', 'value3'))); - } - - public function testHandlesMergingInDisparateDataSources() - { - $params = array( - 'test' => 'value1', - 'test2' => 'value2', - 'test3' => array('value3', 'value4') - ); - $this->coll->merge($params); - $this->assertEquals($this->coll->getAll(), $params); - - // Pass the same object to itself - $this->assertEquals($this->coll->merge($this->coll), $this->coll); - } - - public function testCanClearAllDataOrSpecificKeys() - { - $this->coll->merge(array( - 'test' => 'value1', - 'test2' => 'value2' - )); - - // Clear a specific parameter by name - $this->coll->remove('test'); - - $this->assertEquals($this->coll->getAll(), array( - 'test2' => 'value2' - )); - - // Clear all parameters - $this->coll->clear(); - - $this->assertEquals($this->coll->getAll(), array()); - } - - public function testGetsValuesByKey() - { - $this->assertNull($this->coll->get('test')); - $this->coll->add('test', 'value'); - $this->assertEquals('value', $this->coll->get('test')); - $this->coll->set('test2', 'v2'); - $this->coll->set('test3', 'v3'); - $this->assertEquals(array( - 'test' => 'value', - 'test2' => 'v2' - ), $this->coll->getAll(array('test', 'test2'))); - } - - public function testProvidesKeys() - { - $this->assertEquals(array(), $this->coll->getKeys()); - $this->coll->merge(array( - 'test1' => 'value1', - 'test2' => 'value2' - )); - $this->assertEquals(array('test1', 'test2'), $this->coll->getKeys()); - // Returns the cached array previously returned - $this->assertEquals(array('test1', 'test2'), $this->coll->getKeys()); - $this->coll->remove('test1'); - $this->assertEquals(array('test2'), $this->coll->getKeys()); - $this->coll->add('test3', 'value3'); - $this->assertEquals(array('test2', 'test3'), $this->coll->getKeys()); - } - - public function testChecksIfHasKey() - { - $this->assertFalse($this->coll->hasKey('test')); - $this->coll->add('test', 'value'); - $this->assertEquals(true, $this->coll->hasKey('test')); - $this->coll->add('test2', 'value2'); - $this->assertEquals(true, $this->coll->hasKey('test')); - $this->assertEquals(true, $this->coll->hasKey('test2')); - $this->assertFalse($this->coll->hasKey('testing')); - $this->assertEquals(false, $this->coll->hasKey('AB-C', 'junk')); - } - - public function testChecksIfHasValue() - { - $this->assertFalse($this->coll->hasValue('value')); - $this->coll->add('test', 'value'); - $this->assertEquals('test', $this->coll->hasValue('value')); - $this->coll->add('test2', 'value2'); - $this->assertEquals('test', $this->coll->hasValue('value')); - $this->assertEquals('test2', $this->coll->hasValue('value2')); - $this->assertFalse($this->coll->hasValue('val')); - } - - public function testCanGetAllValuesByArray() - { - $this->coll->add('foo', 'bar'); - $this->coll->add('tEsT', 'value'); - $this->coll->add('tesTing', 'v2'); - $this->coll->add('key', 'v3'); - $this->assertNull($this->coll->get('test')); - $this->assertEquals(array( - 'foo' => 'bar', - 'tEsT' => 'value', - 'tesTing' => 'v2' - ), $this->coll->getAll(array( - 'foo', 'tesTing', 'tEsT' - ))); - } - - public function testImplementsCount() - { - $data = new Collection(); - $this->assertEquals(0, $data->count()); - $data->add('key', 'value'); - $this->assertEquals(1, count($data)); - $data->add('key', 'value2'); - $this->assertEquals(1, count($data)); - $data->add('key_2', 'value3'); - $this->assertEquals(2, count($data)); - } - - public function testAddParamsByMerging() - { - $params = array( - 'test' => 'value1', - 'test2' => 'value2', - 'test3' => array('value3', 'value4') - ); - - // Add some parameters - $this->coll->merge($params); - - // Add more parameters by merging them in - $this->coll->merge(array( - 'test' => 'another', - 'different_key' => 'new value' - )); - - $this->assertEquals(array( - 'test' => array('value1', 'another'), - 'test2' => 'value2', - 'test3' => array('value3', 'value4'), - 'different_key' => 'new value' - ), $this->coll->getAll()); - } - - public function testAllowsFunctionalFilter() - { - $this->coll->merge(array( - 'fruit' => 'apple', - 'number' => 'ten', - 'prepositions' => array('about', 'above', 'across', 'after'), - 'same_number' => 'ten' - )); - - $filtered = $this->coll->filter(function($key, $value) { - return $value == 'ten'; - }); - - $this->assertNotEquals($filtered, $this->coll); - - $this->assertEquals(array( - 'number' => 'ten', - 'same_number' => 'ten' - ), $filtered->getAll()); - } - - public function testAllowsFunctionalMapping() - { - $this->coll->merge(array( - 'number_1' => 1, - 'number_2' => 2, - 'number_3' => 3 - )); - - $mapped = $this->coll->map(function($key, $value) { - return $value * $value; - }); - - $this->assertNotEquals($mapped, $this->coll); - - $this->assertEquals(array( - 'number_1' => 1, - 'number_2' => 4, - 'number_3' => 9 - ), $mapped->getAll()); - } - - public function testImplementsArrayAccess() - { - $this->coll->merge(array( - 'k1' => 'v1', - 'k2' => 'v2' - )); - - $this->assertTrue($this->coll->offsetExists('k1')); - $this->assertFalse($this->coll->offsetExists('Krull')); - - $this->coll->offsetSet('k3', 'v3'); - $this->assertEquals('v3', $this->coll->offsetGet('k3')); - $this->assertEquals('v3', $this->coll->get('k3')); - - $this->coll->offsetUnset('k1'); - $this->assertFalse($this->coll->offsetExists('k1')); - } - - public function testUsesStaticWhenCreatingNew() - { - $qs = new QueryString(array( - 'a' => 'b', - 'c' => 'd' - )); - - $this->assertInstanceOf('Guzzle\\Http\\QueryString', $qs->map(function($a, $b) {})); - $this->assertInstanceOf('Guzzle\\Common\\Collection', $qs->map(function($a, $b) {}, array(), false)); - - $this->assertInstanceOf('Guzzle\\Http\\QueryString', $qs->filter(function($a, $b) {})); - $this->assertInstanceOf('Guzzle\\Common\\Collection', $qs->filter(function($a, $b) {}, false)); - } - - public function testCanReplaceAllData() - { - $this->assertSame($this->coll, $this->coll->replace(array( - 'a' => '123' - ))); - - $this->assertEquals(array( - 'a' => '123' - ), $this->coll->getAll()); - } - - public function dataProvider() - { - return array( - array('this_is_a_test', '{a}_is_a_{b}', array( - 'a' => 'this', - 'b' => 'test' - )), - array('this_is_a_test', '{abc}_is_a_{0}', array( - 'abc' => 'this', - 0 => 'test' - )), - array('this_is_a_test', '{abc}_is_a_{0}', array( - 'abc' => 'this', - 0 => 'test' - )), - array('this_is_a_test', 'this_is_a_test', array( - 'abc' => 'this' - )), - array('{abc}_is_{not_found}a_{0}', '{abc}_is_{not_found}a_{0}', array()) - ); - } - - /** - * @dataProvider dataProvider - */ - public function testInjectsConfigData($output, $input, $config) - { - $collection = new Collection($config); - $this->assertEquals($output, $collection->inject($input)); - } - - public function testCanSearchByKey() - { - $collection = new Collection(array( - 'foo' => 'bar', - 'BaZ' => 'pho' - )); - - $this->assertEquals('foo', $collection->keySearch('FOO')); - $this->assertEquals('BaZ', $collection->keySearch('baz')); - $this->assertEquals(false, $collection->keySearch('Bar')); - } - - public function testPreparesFromConfig() - { - $c = Collection::fromConfig(array( - 'a' => '123', - 'base_url' => 'http://www.test.com/' - ), array( - 'a' => 'xyz', - 'b' => 'lol' - ), array('a')); - - $this->assertInstanceOf('Guzzle\Common\Collection', $c); - $this->assertEquals(array( - 'a' => '123', - 'b' => 'lol', - 'base_url' => 'http://www.test.com/' - ), $c->getAll()); - - try { - $c = Collection::fromConfig(array(), array(), array('a')); - $this->fail('Exception not throw when missing config'); - } catch (InvalidArgumentException $e) { - } - } - - function falseyDataProvider() - { - return array( - array(false, false), - array(null, null), - array('', ''), - array(array(), array()), - array(0, 0), - ); - } - - /** - * @dataProvider falseyDataProvider - */ - public function testReturnsCorrectData($a, $b) - { - $c = new Collection(array('value' => $a)); - $this->assertSame($b, $c->get('value')); - } - - public function testRetrievesNestedKeysUsingPath() - { - $data = array( - 'foo' => 'bar', - 'baz' => array( - 'mesa' => array( - 'jar' => 'jar' - ) - ) - ); - $collection = new Collection($data); - $this->assertEquals('bar', $collection->getPath('foo')); - $this->assertEquals('jar', $collection->getPath('baz/mesa/jar')); - $this->assertNull($collection->getPath('wewewf')); - $this->assertNull($collection->getPath('baz/mesa/jar/jar')); - } - - public function testFalseyKeysStillDescend() - { - $collection = new Collection(array( - '0' => array( - 'a' => 'jar' - ), - 1 => 'other' - )); - $this->assertEquals('jar', $collection->getPath('0/a')); - $this->assertEquals('other', $collection->getPath('1')); - } - - public function getPathProvider() - { - $data = array( - 'foo' => 'bar', - 'baz' => array( - 'mesa' => array( - 'jar' => 'jar', - 'array' => array('a', 'b', 'c') - ), - 'bar' => array( - 'baz' => 'bam', - 'array' => array('d', 'e', 'f') - ) - ), - 'bam' => array( - array('foo' => 1), - array('foo' => 2), - array('array' => array('h', 'i')) - ) - ); - $c = new Collection($data); - - return array( - // Simple path selectors - array($c, 'foo', 'bar'), - array($c, 'baz', $data['baz']), - array($c, 'bam', $data['bam']), - array($c, 'baz/mesa', $data['baz']['mesa']), - array($c, 'baz/mesa/jar', 'jar'), - // Merge everything two levels under baz - array($c, 'baz/*', array( - 'jar' => 'jar', - 'array' => array_merge($data['baz']['mesa']['array'], $data['baz']['bar']['array']), - 'baz' => 'bam' - )), - // Does not barf on missing keys - array($c, 'fefwfw', null), - // Does not barf when a wildcard does not resolve correctly - array($c, '*/*/*/*/*/wefwfe', array()), - // Allows custom separator - array($c, '*|mesa', $data['baz']['mesa'], '|'), - // Merge all 'array' keys two levels under baz (the trailing * does not hurt the results) - array($c, 'baz/*/array/*', array_merge($data['baz']['mesa']['array'], $data['baz']['bar']['array'])), - // Merge all 'array' keys two levels under baz - array($c, 'baz/*/array', array_merge($data['baz']['mesa']['array'], $data['baz']['bar']['array'])), - array($c, 'baz/mesa/array', $data['baz']['mesa']['array']), - // Having a trailing * does not hurt the results - array($c, 'baz/mesa/array/*', $data['baz']['mesa']['array']), - // Merge of anything one level deep - array($c, '*', array_merge(array('bar'), $data['baz'], $data['bam'])), - // Funky merge of anything two levels deep - array($c, '*/*', array( - 'jar' => 'jar', - 'array' => array('a', 'b', 'c', 'd', 'e', 'f', 'h', 'i'), - 'baz' => 'bam', - 'foo' => array(1, 2) - )), - // Funky merge of all 'array' keys that are two levels deep - array($c, '*/*/array', array('a', 'b', 'c', 'd', 'e', 'f', 'h', 'i')) - ); - } - - /** - * @dataProvider getPathProvider - */ - public function testGetPath(Collection $c, $path, $expected, $separator = '/') - { - $this->assertEquals($expected, $c->getPath($path, $separator)); - } - - public function testOverridesSettings() - { - $c = new Collection(array('foo' => 1, 'baz' => 2, 'bar' => 3)); - $c->overwriteWith(array('foo' => 10, 'bar' => 300)); - $this->assertEquals(array('foo' => 10, 'baz' => 2, 'bar' => 300), $c->getAll()); - } - - public function testOverwriteWithCollection() - { - $c = new Collection(array('foo' => 1, 'baz' => 2, 'bar' => 3)); - $b = new Collection(array('foo' => 10, 'bar' => 300)); - $c->overwriteWith($b); - $this->assertEquals(array('foo' => 10, 'baz' => 2, 'bar' => 300), $c->getAll()); - } - - public function testOverwriteWithTraversable() - { - $c = new Collection(array('foo' => 1, 'baz' => 2, 'bar' => 3)); - $b = new Collection(array('foo' => 10, 'bar' => 300)); - $c->overwriteWith($b->getIterator()); - $this->assertEquals(array('foo' => 10, 'baz' => 2, 'bar' => 300), $c->getAll()); - } - - public function testCanSetNestedPathValueThatDoesNotExist() - { - $c = new Collection(array()); - $c->setPath('foo/bar/baz/123', 'hi'); - $this->assertEquals('hi', $c['foo']['bar']['baz']['123']); - } - - public function testCanSetNestedPathValueThatExists() - { - $c = new Collection(array('foo' => array('bar' => 'test'))); - $c->setPath('foo/bar', 'hi'); - $this->assertEquals('hi', $c['foo']['bar']); - } - - /** - * @expectedException \Guzzle\Common\Exception\RuntimeException - */ - public function testVerifiesNestedPathIsValidAtExactLevel() - { - $c = new Collection(array('foo' => 'bar')); - $c->setPath('foo/bar', 'hi'); - $this->assertEquals('hi', $c['foo']['bar']); - } - - /** - * @expectedException \Guzzle\Common\Exception\RuntimeException - */ - public function testVerifiesThatNestedPathIsValidAtAnyLevel() - { - $c = new Collection(array('foo' => 'bar')); - $c->setPath('foo/bar/baz', 'test'); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Common/EventTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Common/EventTest.php deleted file mode 100644 index 5484e1446..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Common/EventTest.php +++ /dev/null @@ -1,62 +0,0 @@ - '123', - 'other' => '456', - 'event' => 'test.notify' - )); - } - - public function testAllowsParameterInjection() - { - $event = new Event(array( - 'test' => '123' - )); - $this->assertEquals('123', $event['test']); - } - - public function testImplementsArrayAccess() - { - $event = $this->getEvent(); - $this->assertEquals('123', $event['test']); - $this->assertNull($event['foobar']); - - $this->assertTrue($event->offsetExists('test')); - $this->assertFalse($event->offsetExists('foobar')); - - unset($event['test']); - $this->assertFalse($event->offsetExists('test')); - - $event['test'] = 'new'; - $this->assertEquals('new', $event['test']); - } - - public function testImplementsIteratorAggregate() - { - $event = $this->getEvent(); - $this->assertInstanceOf('ArrayIterator', $event->getIterator()); - } - - public function testConvertsToArray() - { - $this->assertEquals(array( - 'test' => '123', - 'other' => '456', - 'event' => 'test.notify' - ), $this->getEvent()->toArray()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Common/Exception/BatchTransferExceptionTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Common/Exception/BatchTransferExceptionTest.php deleted file mode 100644 index c72a2a637..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Common/Exception/BatchTransferExceptionTest.php +++ /dev/null @@ -1,21 +0,0 @@ -getMock('Guzzle\Batch\BatchTransferInterface'); - $d = $this->getMock('Guzzle\Batch\BatchDivisorInterface'); - $transferException = new BatchTransferException(array('foo'), array(1, 2), $e, $t, $d); - $this->assertEquals(array('foo'), $transferException->getBatch()); - $this->assertSame($t, $transferException->getTransferStrategy()); - $this->assertSame($d, $transferException->getDivisorStrategy()); - $this->assertSame($e, $transferException->getPrevious()); - $this->assertEquals(array(1, 2), $transferException->getTransferredItems()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Common/Exception/ExceptionCollectionTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Common/Exception/ExceptionCollectionTest.php deleted file mode 100644 index 2aecf2a06..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Common/Exception/ExceptionCollectionTest.php +++ /dev/null @@ -1,66 +0,0 @@ -getExceptions(); - $e->add($exceptions[0]); - $e->add($exceptions[1]); - $this->assertContains("(Exception) ./tests/Guzzle/Tests/Common/Exception/ExceptionCollectionTest.php line ", $e->getMessage()); - $this->assertContains(" Test\n\n #0 ./", $e->getMessage()); - $this->assertSame($exceptions[0], $e->getFirst()); - } - - public function testCanSetExceptions() - { - $ex = new \Exception('foo'); - $e = new ExceptionCollection(); - $e->setExceptions(array($ex)); - $this->assertSame($ex, $e->getFirst()); - } - - public function testActsAsArray() - { - $e = new ExceptionCollection(); - $exceptions = $this->getExceptions(); - $e->add($exceptions[0]); - $e->add($exceptions[1]); - $this->assertEquals(2, count($e)); - $this->assertEquals($exceptions, $e->getIterator()->getArrayCopy()); - } - - public function testCanAddSelf() - { - $e1 = new ExceptionCollection(); - $e1->add(new \Exception("Test")); - $e2 = new ExceptionCollection('Meta description!'); - $e2->add(new \Exception("Test 2")); - $e3 = new ExceptionCollection(); - $e3->add(new \Exception('Baz')); - $e2->add($e3); - $e1->add($e2); - $message = $e1->getMessage(); - $this->assertContains("(Exception) ./tests/Guzzle/Tests/Common/Exception/ExceptionCollectionTest.php line ", $message); - $this->assertContains("\n Test\n\n #0 ", $message); - $this->assertContains("\n\n(Guzzle\\Common\\Exception\\ExceptionCollection) ./tests/Guzzle/Tests/Common/Exception/ExceptionCollectionTest.php line ", $message); - $this->assertContains("\n\n Meta description!\n\n", $message); - $this->assertContains(" (Exception) ./tests/Guzzle/Tests/Common/Exception/ExceptionCollectionTest.php line ", $message); - $this->assertContains("\n Test 2\n\n #0 ", $message); - $this->assertContains(" (Exception) ./tests/Guzzle/Tests/Common/Exception/ExceptionCollectionTest.php line ", $message); - $this->assertContains(" Baz\n\n #0", $message); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Common/VersionTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Common/VersionTest.php deleted file mode 100644 index c3a81d1e4..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Common/VersionTest.php +++ /dev/null @@ -1,27 +0,0 @@ -isRunning()) { - self::$server->flush(); - } else { - self::$server->start(); - } - } - - return self::$server; - } - - /** - * Set the service builder to use for tests - * - * @param ServiceBuilderInterface $builder Service builder - */ - public static function setServiceBuilder(ServiceBuilderInterface $builder) - { - self::$serviceBuilder = $builder; - } - - /** - * Get a service builder object that can be used throughout the service tests - * - * @return ServiceBuilder - */ - public static function getServiceBuilder() - { - if (!self::$serviceBuilder) { - throw new RuntimeException('No service builder has been set via setServiceBuilder()'); - } - - return self::$serviceBuilder; - } - - /** - * Check if an event dispatcher has a subscriber - * - * @param HasDispatcherInterface $dispatcher - * @param EventSubscriberInterface $subscriber - * - * @return bool - */ - protected function hasSubscriber(HasDispatcherInterface $dispatcher, EventSubscriberInterface $subscriber) - { - $class = get_class($subscriber); - $all = array_keys(call_user_func(array($class, 'getSubscribedEvents'))); - - foreach ($all as $i => $event) { - foreach ($dispatcher->getEventDispatcher()->getListeners($event) as $e) { - if ($e[0] === $subscriber) { - unset($all[$i]); - break; - } - } - } - - return count($all) == 0; - } - - /** - * Get a wildcard observer for an event dispatcher - * - * @param HasDispatcherInterface $hasDispatcher - * - * @return MockObserver - */ - public function getWildcardObserver(HasDispatcherInterface $hasDispatcher) - { - $class = get_class($hasDispatcher); - $o = new MockObserver(); - $events = call_user_func(array($class, 'getAllEvents')); - foreach ($events as $event) { - $hasDispatcher->getEventDispatcher()->addListener($event, array($o, 'update')); - } - - return $o; - } - - /** - * Set the mock response base path - * - * @param string $path Path to mock response folder - * - * @return GuzzleTestCase - */ - public static function setMockBasePath($path) - { - self::$mockBasePath = $path; - } - - /** - * Mark a request as being mocked - * - * @param RequestInterface $request - * - * @return self - */ - public function addMockedRequest(RequestInterface $request) - { - $this->requests[] = $request; - - return $this; - } - - /** - * Get all of the mocked requests - * - * @return array - */ - public function getMockedRequests() - { - return $this->requests; - } - - /** - * Get a mock response for a client by mock file name - * - * @param string $path Relative path to the mock response file - * - * @return Response - */ - public function getMockResponse($path) - { - return $path instanceof Response - ? $path - : MockPlugin::getMockFile(self::$mockBasePath . DIRECTORY_SEPARATOR . $path); - } - - /** - * Set a mock response from a mock file on the next client request. - * - * This method assumes that mock response files are located under the - * Command/Mock/ directory of the Service being tested - * (e.g. Unfuddle/Command/Mock/). A mock response is added to the next - * request sent by the client. - * - * @param Client $client Client object to modify - * @param string $paths Path to files within the Mock folder of the service - * - * @return MockPlugin returns the created mock plugin - */ - public function setMockResponse(Client $client, $paths) - { - $this->requests = array(); - $that = $this; - $mock = new MockPlugin(null, true); - $client->getEventDispatcher()->removeSubscriber($mock); - $mock->getEventDispatcher()->addListener('mock.request', function(Event $event) use ($that) { - $that->addMockedRequest($event['request']); - }); - - if ($paths instanceof Response) { - // A single response instance has been specified, create an array with that instance - // as the only element for the following loop to work as expected - $paths = array($paths); - } - - foreach ((array) $paths as $path) { - $mock->addResponse($this->getMockResponse($path)); - } - - $client->getEventDispatcher()->addSubscriber($mock); - - return $mock; - } - - /** - * Compare HTTP headers and use special markup to filter values - * A header prefixed with '!' means it must not exist - * A header prefixed with '_' means it must be ignored - * A header value of '*' means anything after the * will be ignored - * - * @param array $filteredHeaders Array of special headers - * @param array $actualHeaders Array of headers to check against - * - * @return array|bool Returns an array of the differences or FALSE if none - */ - public function compareHeaders($filteredHeaders, $actualHeaders) - { - $comparison = new HeaderComparison(); - - return $comparison->compare($filteredHeaders, $actualHeaders); - } - - /** - * Case insensitive assertContains - * - * @param string $needle Search string - * @param string $haystack Search this - * @param string $message Optional failure message - */ - public function assertContainsIns($needle, $haystack, $message = null) - { - $this->assertContains(strtolower($needle), strtolower($haystack), $message); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/AbstractEntityBodyDecoratorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/AbstractEntityBodyDecoratorTest.php deleted file mode 100644 index 20feaa875..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/AbstractEntityBodyDecoratorTest.php +++ /dev/null @@ -1,34 +0,0 @@ -getMockForAbstractClass('Guzzle\Http\AbstractEntityBodyDecorator', array($e)); - - $this->assertSame($e->getStream(), $mock->getStream()); - $this->assertSame($e->getContentLength(), $mock->getContentLength()); - $this->assertSame($e->getSize(), $mock->getSize()); - $this->assertSame($e->getContentMd5(), $mock->getContentMd5()); - $this->assertSame($e->getContentType(), $mock->getContentType()); - $this->assertSame($e->__toString(), $mock->__toString()); - $this->assertSame($e->getUri(), $mock->getUri()); - $this->assertSame($e->getStreamType(), $mock->getStreamType()); - $this->assertSame($e->getWrapper(), $mock->getWrapper()); - $this->assertSame($e->getWrapperData(), $mock->getWrapperData()); - $this->assertSame($e->isReadable(), $mock->isReadable()); - $this->assertSame($e->isWritable(), $mock->isWritable()); - $this->assertSame($e->isConsumed(), $mock->isConsumed()); - $this->assertSame($e->isLocal(), $mock->isLocal()); - $this->assertSame($e->isSeekable(), $mock->isSeekable()); - $this->assertSame($e->getContentEncoding(), $mock->getContentEncoding()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/CachingEntityBodyTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/CachingEntityBodyTest.php deleted file mode 100644 index e6e6cdbf5..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/CachingEntityBodyTest.php +++ /dev/null @@ -1,249 +0,0 @@ -decorated = EntityBody::factory('testing'); - $this->body = new CachingEntityBody($this->decorated); - } - - public function testUsesRemoteSizeIfPossible() - { - $body = EntityBody::factory('test'); - $caching = new CachingEntityBody($body); - $this->assertEquals(4, $caching->getSize()); - $this->assertEquals(4, $caching->getContentLength()); - } - - /** - * @expectedException \Guzzle\Common\Exception\RuntimeException - * @expectedExceptionMessage does not support custom stream rewind - */ - public function testDoesNotAllowRewindFunction() - { - $this->body->setRewindFunction(true); - } - - /** - * @expectedException \Guzzle\Common\Exception\RuntimeException - * @expectedExceptionMessage Cannot seek to byte 10 - */ - public function testCannotSeekPastWhatHasBeenRead() - { - $this->body->seek(10); - } - - /** - * @expectedException \Guzzle\Common\Exception\RuntimeException - * @expectedExceptionMessage supports only SEEK_SET and SEEK_CUR - */ - public function testCannotUseSeekEnd() - { - $this->body->seek(2, SEEK_END); - } - - public function testChangingUnderlyingStreamUpdatesSizeAndStream() - { - $size = filesize(__FILE__); - $s = fopen(__FILE__, 'r'); - $this->body->setStream($s, $size); - $this->assertEquals($size, $this->body->getSize()); - $this->assertEquals($size, $this->decorated->getSize()); - $this->assertSame($s, $this->body->getStream()); - $this->assertSame($s, $this->decorated->getStream()); - } - - public function testRewindUsesSeek() - { - $a = EntityBody::factory('foo'); - $d = $this->getMockBuilder('Guzzle\Http\CachingEntityBody') - ->setMethods(array('seek')) - ->setConstructorArgs(array($a)) - ->getMock(); - $d->expects($this->once()) - ->method('seek') - ->with(0) - ->will($this->returnValue(true)); - $d->rewind(); - } - - public function testCanSeekToReadBytes() - { - $this->assertEquals('te', $this->body->read(2)); - $this->body->seek(0); - $this->assertEquals('test', $this->body->read(4)); - $this->assertEquals(4, $this->body->ftell()); - $this->body->seek(2); - $this->assertEquals(2, $this->body->ftell()); - $this->body->seek(2, SEEK_CUR); - $this->assertEquals(4, $this->body->ftell()); - $this->assertEquals('ing', $this->body->read(3)); - } - - public function testWritesToBufferStream() - { - $this->body->read(2); - $this->body->write('hi'); - $this->body->rewind(); - $this->assertEquals('tehiing', (string) $this->body); - } - - public function testReadLinesFromBothStreams() - { - $this->body->seek($this->body->ftell()); - $this->body->write("test\n123\nhello\n1234567890\n"); - $this->body->rewind(); - $this->assertEquals("test\n", $this->body->readLine(7)); - $this->assertEquals("123\n", $this->body->readLine(7)); - $this->assertEquals("hello\n", $this->body->readLine(7)); - $this->assertEquals("123456", $this->body->readLine(7)); - $this->assertEquals("7890\n", $this->body->readLine(7)); - // We overwrote the decorated stream, so no more data - $this->assertEquals('', $this->body->readLine(7)); - } - - public function testSkipsOverwrittenBytes() - { - $decorated = EntityBody::factory( - implode("\n", array_map(function ($n) { - return str_pad($n, 4, '0', STR_PAD_LEFT); - }, range(0, 25))) - ); - - $body = new CachingEntityBody($decorated); - - $this->assertEquals("0000\n", $body->readLine()); - $this->assertEquals("0001\n", $body->readLine()); - // Write over part of the body yet to be read, so skip some bytes - $this->assertEquals(5, $body->write("TEST\n")); - $this->assertEquals(5, $this->readAttribute($body, 'skipReadBytes')); - // Read, which skips bytes, then reads - $this->assertEquals("0003\n", $body->readLine()); - $this->assertEquals(0, $this->readAttribute($body, 'skipReadBytes')); - $this->assertEquals("0004\n", $body->readLine()); - $this->assertEquals("0005\n", $body->readLine()); - - // Overwrite part of the cached body (so don't skip any bytes) - $body->seek(5); - $this->assertEquals(5, $body->write("ABCD\n")); - $this->assertEquals(0, $this->readAttribute($body, 'skipReadBytes')); - $this->assertEquals("TEST\n", $body->readLine()); - $this->assertEquals("0003\n", $body->readLine()); - $this->assertEquals("0004\n", $body->readLine()); - $this->assertEquals("0005\n", $body->readLine()); - $this->assertEquals("0006\n", $body->readLine()); - $this->assertEquals(5, $body->write("1234\n")); - $this->assertEquals(5, $this->readAttribute($body, 'skipReadBytes')); - - // Seek to 0 and ensure the overwritten bit is replaced - $body->rewind(); - $this->assertEquals("0000\nABCD\nTEST\n0003\n0004\n0005\n0006\n1234\n0008\n0009\n", $body->read(50)); - - // Ensure that casting it to a string does not include the bit that was overwritten - $this->assertContains("0000\nABCD\nTEST\n0003\n0004\n0005\n0006\n1234\n0008\n0009\n", (string) $body); - } - - public function testWrapsContentType() - { - $a = $this->getMockBuilder('Guzzle\Http\EntityBody') - ->setMethods(array('getContentType')) - ->setConstructorArgs(array(fopen(__FILE__, 'r'))) - ->getMock(); - $a->expects($this->once()) - ->method('getContentType') - ->will($this->returnValue('foo')); - $d = new CachingEntityBody($a); - $this->assertEquals('foo', $d->getContentType()); - } - - public function testWrapsContentEncoding() - { - $a = $this->getMockBuilder('Guzzle\Http\EntityBody') - ->setMethods(array('getContentEncoding')) - ->setConstructorArgs(array(fopen(__FILE__, 'r'))) - ->getMock(); - $a->expects($this->once()) - ->method('getContentEncoding') - ->will($this->returnValue('foo')); - $d = new CachingEntityBody($a); - $this->assertEquals('foo', $d->getContentEncoding()); - } - - public function testWrapsMetadata() - { - $a = $this->getMockBuilder('Guzzle\Http\EntityBody') - ->setMethods(array('getMetadata', 'getWrapper', 'getWrapperData', 'getStreamType', 'getUri')) - ->setConstructorArgs(array(fopen(__FILE__, 'r'))) - ->getMock(); - - $a->expects($this->once()) - ->method('getMetadata') - ->will($this->returnValue(array())); - // Called twice for getWrapper and getWrapperData - $a->expects($this->exactly(1)) - ->method('getWrapper') - ->will($this->returnValue('wrapper')); - $a->expects($this->once()) - ->method('getWrapperData') - ->will($this->returnValue(array())); - $a->expects($this->once()) - ->method('getStreamType') - ->will($this->returnValue('baz')); - $a->expects($this->once()) - ->method('getUri') - ->will($this->returnValue('path/to/foo')); - - $d = new CachingEntityBody($a); - $this->assertEquals(array(), $d->getMetaData()); - $this->assertEquals('wrapper', $d->getWrapper()); - $this->assertEquals(array(), $d->getWrapperData()); - $this->assertEquals('baz', $d->getStreamType()); - $this->assertEquals('path/to/foo', $d->getUri()); - } - - public function testWrapsCustomData() - { - $a = $this->getMockBuilder('Guzzle\Http\EntityBody') - ->setMethods(array('getCustomData', 'setCustomData')) - ->setConstructorArgs(array(fopen(__FILE__, 'r'))) - ->getMock(); - - $a->expects($this->exactly(1)) - ->method('getCustomData') - ->with('foo') - ->will($this->returnValue('bar')); - - $a->expects($this->exactly(1)) - ->method('setCustomData') - ->with('foo', 'bar') - ->will($this->returnSelf()); - - $d = new CachingEntityBody($a); - $this->assertSame($d, $d->setCustomData('foo', 'bar')); - $this->assertEquals('bar', $d->getCustomData('foo')); - } - - public function testClosesBothStreams() - { - $s = fopen('php://temp', 'r'); - $a = EntityBody::factory($s); - $d = new CachingEntityBody($a); - $d->close(); - $this->assertFalse(is_resource($s)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/ClientTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/ClientTest.php deleted file mode 100644 index 4a91a18f9..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/ClientTest.php +++ /dev/null @@ -1,601 +0,0 @@ -assertEquals('http://www.google.com/', $client->getBaseUrl()); - $this->assertSame($client, $client->setConfig(array( - 'test' => '123' - ))); - $this->assertEquals(array('test' => '123'), $client->getConfig()->getAll()); - $this->assertEquals('123', $client->getConfig('test')); - $this->assertSame($client, $client->setBaseUrl('http://www.test.com/{test}')); - $this->assertEquals('http://www.test.com/123', $client->getBaseUrl()); - $this->assertEquals('http://www.test.com/{test}', $client->getBaseUrl(false)); - - try { - $client->setConfig(false); - } catch (\InvalidArgumentException $e) { - } - } - - public function testDescribesEvents() - { - $this->assertEquals(array('client.create_request'), Client::getAllEvents()); - } - - public function testConstructorCanAcceptConfig() - { - $client = new Client('http://www.test.com/', array( - 'data' => '123' - )); - $this->assertEquals('123', $client->getConfig('data')); - } - - public function testCanUseCollectionAsConfig() - { - $client = new Client('http://www.google.com/'); - $client->setConfig(new Collection(array( - 'api' => 'v1', - 'key' => 'value', - 'base_url' => 'http://www.google.com/' - ))); - $this->assertEquals('v1', $client->getConfig('api')); - } - - public function testExpandsUriTemplatesUsingConfig() - { - $client = new Client('http://www.google.com/'); - $client->setConfig(array('api' => 'v1', 'key' => 'value', 'foo' => 'bar')); - $ref = new \ReflectionMethod($client, 'expandTemplate'); - $ref->setAccessible(true); - $this->assertEquals('Testing...api/v1/key/value', $ref->invoke($client, 'Testing...api/{api}/key/{key}')); - } - - public function testClientAttachersObserversToRequests() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - - $client = new Client($this->getServer()->getUrl()); - $logPlugin = $this->getLogPlugin(); - $client->getEventDispatcher()->addSubscriber($logPlugin); - - // Get a request from the client and ensure the the observer was - // attached to the new request - $request = $client->createRequest(); - $this->assertTrue($this->hasSubscriber($request, $logPlugin)); - } - - public function testClientReturnsValidBaseUrls() - { - $client = new Client('http://www.{foo}.{data}/', array( - 'data' => '123', - 'foo' => 'bar' - )); - $this->assertEquals('http://www.bar.123/', $client->getBaseUrl()); - $client->setBaseUrl('http://www.google.com/'); - $this->assertEquals('http://www.google.com/', $client->getBaseUrl()); - } - - public function testClientAddsCurlOptionsToRequests() - { - $client = new Client('http://www.test.com/', array( - 'api' => 'v1', - // Adds the option using the curl values - 'curl.options' => array( - 'CURLOPT_HTTPAUTH' => 'CURLAUTH_DIGEST', - 'abc' => 'foo', - 'blacklist' => 'abc', - 'debug' => true - ) - )); - - $request = $client->createRequest(); - $options = $request->getCurlOptions(); - $this->assertEquals(CURLAUTH_DIGEST, $options->get(CURLOPT_HTTPAUTH)); - $this->assertEquals('foo', $options->get('abc')); - $this->assertEquals('abc', $options->get('blacklist')); - } - - public function testClientAllowsFineGrainedSslControlButIsSecureByDefault() - { - $client = new Client('https://www.secure.com/'); - - // secure by default - $request = $client->createRequest(); - $options = $request->getCurlOptions(); - $this->assertTrue($options->get(CURLOPT_SSL_VERIFYPEER)); - - // set a capath if you prefer - $client = new Client('https://www.secure.com/'); - $client->setSslVerification(__DIR__); - $request = $client->createRequest(); - $options = $request->getCurlOptions(); - $this->assertSame(__DIR__, $options->get(CURLOPT_CAPATH)); - } - - public function testConfigSettingsControlSslConfiguration() - { - // Use the default ca certs on the system - $client = new Client('https://www.secure.com/', array('ssl.certificate_authority' => 'system')); - $this->assertNull($client->getConfig('curl.options')); - // Can set the cacert value as well - $client = new Client('https://www.secure.com/', array('ssl.certificate_authority' => false)); - $options = $client->getConfig('curl.options'); - $this->assertArrayNotHasKey(CURLOPT_CAINFO, $options); - $this->assertSame(false, $options[CURLOPT_SSL_VERIFYPEER]); - $this->assertSame(0, $options[CURLOPT_SSL_VERIFYHOST]); - } - - public function testClientAllowsUnsafeOperationIfRequested() - { - // be really unsafe if you insist - $client = new Client('https://www.secure.com/', array( - 'api' => 'v1' - )); - - $client->setSslVerification(false); - $request = $client->createRequest(); - $options = $request->getCurlOptions(); - $this->assertFalse($options->get(CURLOPT_SSL_VERIFYPEER)); - $this->assertNull($options->get(CURLOPT_CAINFO)); - } - - /** - * @expectedException \Guzzle\Common\Exception\RuntimeException - */ - public function testThrowsExceptionForInvalidCertificate() - { - $client = new Client('https://www.secure.com/'); - $client->setSslVerification('/path/to/missing/file'); - } - - public function testClientAllowsSettingSpecificSslCaInfo() - { - // set a file other than the provided cacert.pem - $client = new Client('https://www.secure.com/', array( - 'api' => 'v1' - )); - - $client->setSslVerification(__FILE__); - $request = $client->createRequest(); - $options = $request->getCurlOptions(); - $this->assertSame(__FILE__, $options->get(CURLOPT_CAINFO)); - } - - /** - * @expectedException Guzzle\Common\Exception\InvalidArgumentException - */ - public function testClientPreventsInadvertentInsecureVerifyHostSetting() - { - // set a file other than the provided cacert.pem - $client = new Client('https://www.secure.com/', array( - 'api' => 'v1' - )); - $client->setSslVerification(__FILE__, true, true); - } - - /** - * @expectedException Guzzle\Common\Exception\InvalidArgumentException - */ - public function testClientPreventsInvalidVerifyPeerSetting() - { - // set a file other than the provided cacert.pem - $client = new Client('https://www.secure.com/', array( - 'api' => 'v1' - )); - $client->setSslVerification(__FILE__, 'yes'); - } - - public function testClientAddsParamsToRequests() - { - Version::$emitWarnings = false; - $client = new Client('http://www.example.com', array( - 'api' => 'v1', - 'request.params' => array( - 'foo' => 'bar', - 'baz' => 'jar' - ) - )); - $request = $client->createRequest(); - $this->assertEquals('bar', $request->getParams()->get('foo')); - $this->assertEquals('jar', $request->getParams()->get('baz')); - Version::$emitWarnings = true; - } - - public function urlProvider() - { - $u = $this->getServer()->getUrl() . 'base/'; - $u2 = $this->getServer()->getUrl() . 'base?z=1'; - return array( - array($u, '', $u), - array($u, 'relative/path/to/resource', $u . 'relative/path/to/resource'), - array($u, 'relative/path/to/resource?a=b&c=d', $u . 'relative/path/to/resource?a=b&c=d'), - array($u, '/absolute/path/to/resource', $this->getServer()->getUrl() . 'absolute/path/to/resource'), - array($u, '/absolute/path/to/resource?a=b&c=d', $this->getServer()->getUrl() . 'absolute/path/to/resource?a=b&c=d'), - array($u2, '/absolute/path/to/resource?a=b&c=d', $this->getServer()->getUrl() . 'absolute/path/to/resource?a=b&c=d&z=1'), - array($u2, 'relative/path/to/resource', $this->getServer()->getUrl() . 'base/relative/path/to/resource?z=1'), - array($u2, 'relative/path/to/resource?another=query', $this->getServer()->getUrl() . 'base/relative/path/to/resource?another=query&z=1') - ); - } - - /** - * @dataProvider urlProvider - */ - public function testBuildsRelativeUrls($baseUrl, $url, $result) - { - $client = new Client($baseUrl); - $this->assertEquals($result, $client->get($url)->getUrl()); - } - - public function testAllowsConfigsToBeChangedAndInjectedInBaseUrl() - { - $client = new Client('http://{a}/{b}'); - $this->assertEquals('http:///', $client->getBaseUrl()); - $this->assertEquals('http://{a}/{b}', $client->getBaseUrl(false)); - $client->setConfig(array( - 'a' => 'test.com', - 'b' => 'index.html' - )); - $this->assertEquals('http://test.com/index.html', $client->getBaseUrl()); - } - - public function testCreatesRequestsWithDefaultValues() - { - $client = new Client($this->getServer()->getUrl() . 'base'); - - // Create a GET request - $request = $client->createRequest(); - $this->assertEquals('GET', $request->getMethod()); - $this->assertEquals($client->getBaseUrl(), $request->getUrl()); - - // Create a DELETE request - $request = $client->createRequest('DELETE'); - $this->assertEquals('DELETE', $request->getMethod()); - $this->assertEquals($client->getBaseUrl(), $request->getUrl()); - - // Create a HEAD request with custom headers - $request = $client->createRequest('HEAD', 'http://www.test.com/'); - $this->assertEquals('HEAD', $request->getMethod()); - $this->assertEquals('http://www.test.com/', $request->getUrl()); - - // Create a PUT request - $request = $client->createRequest('PUT'); - $this->assertEquals('PUT', $request->getMethod()); - - // Create a PUT request with injected config - $client->getConfig()->set('a', 1)->set('b', 2); - $request = $client->createRequest('PUT', '/path/{a}?q={b}'); - $this->assertEquals($request->getUrl(), $this->getServer()->getUrl() . 'path/1?q=2'); - } - - public function testClientHasHelperMethodsForCreatingRequests() - { - $url = $this->getServer()->getUrl(); - $client = new Client($url . 'base'); - $this->assertEquals('GET', $client->get()->getMethod()); - $this->assertEquals('PUT', $client->put()->getMethod()); - $this->assertEquals('POST', $client->post()->getMethod()); - $this->assertEquals('HEAD', $client->head()->getMethod()); - $this->assertEquals('DELETE', $client->delete()->getMethod()); - $this->assertEquals('OPTIONS', $client->options()->getMethod()); - $this->assertEquals('PATCH', $client->patch()->getMethod()); - $this->assertEquals($url . 'base/abc', $client->get('abc')->getUrl()); - $this->assertEquals($url . 'zxy', $client->put('/zxy')->getUrl()); - $this->assertEquals($url . 'zxy?a=b', $client->post('/zxy?a=b')->getUrl()); - $this->assertEquals($url . 'base?a=b', $client->head('?a=b')->getUrl()); - $this->assertEquals($url . 'base?a=b', $client->delete('/base?a=b')->getUrl()); - } - - public function testClientInjectsConfigsIntoUrls() - { - $client = new Client('http://www.test.com/api/v1', array( - 'test' => '123' - )); - $request = $client->get('relative/{test}'); - $this->assertEquals('http://www.test.com/api/v1/relative/123', $request->getUrl()); - } - - public function testAllowsEmptyBaseUrl() - { - $client = new Client(); - $request = $client->get('http://www.google.com/'); - $this->assertEquals('http://www.google.com/', $request->getUrl()); - $request->setResponse(new Response(200), true); - $request->send(); - } - - public function testAllowsCustomCurlMultiObjects() - { - $mock = $this->getMock('Guzzle\\Http\\Curl\\CurlMulti', array('add', 'send')); - $mock->expects($this->once()) - ->method('add') - ->will($this->returnSelf()); - $mock->expects($this->once()) - ->method('send') - ->will($this->returnSelf()); - - $client = new Client(); - $client->setCurlMulti($mock); - - $request = $client->get(); - $request->setResponse(new Response(200), true); - $client->send($request); - } - - public function testClientSendsMultipleRequests() - { - $client = new Client($this->getServer()->getUrl()); - $mock = new MockPlugin(); - - $responses = array( - new Response(200), - new Response(201), - new Response(202) - ); - - $mock->addResponse($responses[0]); - $mock->addResponse($responses[1]); - $mock->addResponse($responses[2]); - - $client->getEventDispatcher()->addSubscriber($mock); - - $requests = array( - $client->get(), - $client->head(), - $client->put('/', null, 'test') - ); - - $this->assertEquals(array( - $responses[0], - $responses[1], - $responses[2] - ), $client->send($requests)); - } - - public function testClientSendsSingleRequest() - { - $client = new Client($this->getServer()->getUrl()); - $mock = new MockPlugin(); - $response = new Response(200); - $mock->addResponse($response); - $client->getEventDispatcher()->addSubscriber($mock); - $this->assertEquals($response, $client->send($client->get())); - } - - /** - * @expectedException \Guzzle\Http\Exception\BadResponseException - */ - public function testClientThrowsExceptionForSingleRequest() - { - $client = new Client($this->getServer()->getUrl()); - $mock = new MockPlugin(); - $response = new Response(404); - $mock->addResponse($response); - $client->getEventDispatcher()->addSubscriber($mock); - $client->send($client->get()); - } - - /** - * @expectedException \Guzzle\Common\Exception\ExceptionCollection - */ - public function testClientThrowsExceptionForMultipleRequests() - { - $client = new Client($this->getServer()->getUrl()); - $mock = new MockPlugin(); - $mock->addResponse(new Response(200)); - $mock->addResponse(new Response(404)); - $client->getEventDispatcher()->addSubscriber($mock); - $client->send(array($client->get(), $client->head())); - } - - public function testQueryStringsAreNotDoubleEncoded() - { - $client = new Client('http://test.com', array( - 'path' => array('foo', 'bar'), - 'query' => 'hi there', - 'data' => array( - 'test' => 'a&b' - ) - )); - - $request = $client->get('{/path*}{?query,data*}'); - $this->assertEquals('http://test.com/foo/bar?query=hi%20there&test=a%26b', $request->getUrl()); - $this->assertEquals('hi there', $request->getQuery()->get('query')); - $this->assertEquals('a&b', $request->getQuery()->get('test')); - } - - public function testQueryStringsAreNotDoubleEncodedUsingAbsolutePaths() - { - $client = new Client('http://test.com', array( - 'path' => array('foo', 'bar'), - 'query' => 'hi there', - )); - $request = $client->get('http://test.com{?query}'); - $this->assertEquals('http://test.com?query=hi%20there', $request->getUrl()); - $this->assertEquals('hi there', $request->getQuery()->get('query')); - } - - public function testAllowsUriTemplateInjection() - { - $client = new Client('http://test.com'); - $ref = new \ReflectionMethod($client, 'getUriTemplate'); - $ref->setAccessible(true); - $a = $ref->invoke($client); - $this->assertSame($a, $ref->invoke($client)); - $client->setUriTemplate(new UriTemplate()); - $this->assertNotSame($a, $ref->invoke($client)); - } - - public function testAllowsCustomVariablesWhenExpandingTemplates() - { - $client = new Client('http://test.com', array('test' => 'hi')); - $ref = new \ReflectionMethod($client, 'expandTemplate'); - $ref->setAccessible(true); - $uri = $ref->invoke($client, 'http://{test}{?query*}', array('query' => array('han' => 'solo'))); - $this->assertEquals('http://hi?han=solo', $uri); - } - - public function testUriArrayAllowsCustomTemplateVariables() - { - $client = new Client(); - $vars = array( - 'var' => 'hi' - ); - $this->assertEquals('/hi', (string) $client->createRequest('GET', array('/{var}', $vars))->getUrl()); - $this->assertEquals('/hi', (string) $client->get(array('/{var}', $vars))->getUrl()); - $this->assertEquals('/hi', (string) $client->put(array('/{var}', $vars))->getUrl()); - $this->assertEquals('/hi', (string) $client->post(array('/{var}', $vars))->getUrl()); - $this->assertEquals('/hi', (string) $client->head(array('/{var}', $vars))->getUrl()); - $this->assertEquals('/hi', (string) $client->options(array('/{var}', $vars))->getUrl()); - } - - public function testAllowsDefaultHeaders() - { - Version::$emitWarnings = false; - $default = array('X-Test' => 'Hi!'); - $other = array('X-Other' => 'Foo'); - - $client = new Client(); - $client->setDefaultHeaders($default); - $this->assertEquals($default, $client->getDefaultHeaders()->getAll()); - $client->setDefaultHeaders(new Collection($default)); - $this->assertEquals($default, $client->getDefaultHeaders()->getAll()); - - $request = $client->createRequest('GET', null, $other); - $this->assertEquals('Hi!', $request->getHeader('X-Test')); - $this->assertEquals('Foo', $request->getHeader('X-Other')); - - $request = $client->createRequest('GET', null, new Collection($other)); - $this->assertEquals('Hi!', $request->getHeader('X-Test')); - $this->assertEquals('Foo', $request->getHeader('X-Other')); - - $request = $client->createRequest('GET'); - $this->assertEquals('Hi!', $request->getHeader('X-Test')); - Version::$emitWarnings = true; - } - - public function testDontReuseCurlMulti() - { - $client1 = new Client(); - $client2 = new Client(); - $this->assertNotSame($client1->getCurlMulti(), $client2->getCurlMulti()); - } - - public function testGetDefaultUserAgent() - { - $client = new Client(); - $agent = $this->readAttribute($client, 'userAgent'); - $version = curl_version(); - $testAgent = sprintf('Guzzle/%s curl/%s PHP/%s', Version::VERSION, $version['version'], PHP_VERSION); - $this->assertEquals($agent, $testAgent); - - $client->setUserAgent('foo'); - $this->assertEquals('foo', $this->readAttribute($client, 'userAgent')); - } - - public function testOverwritesUserAgent() - { - $client = new Client(); - $request = $client->createRequest('GET', 'http://www.foo.com', array('User-agent' => 'foo')); - $this->assertEquals('foo', (string) $request->getHeader('User-Agent')); - } - - public function testUsesDefaultUserAgent() - { - $client = new Client(); - $request = $client->createRequest('GET', 'http://www.foo.com'); - $this->assertContains('Guzzle/', (string) $request->getHeader('User-Agent')); - } - - public function testCanSetDefaultRequestOptions() - { - $client = new Client(); - $client->getConfig()->set('request.options', array( - 'query' => array('test' => '123', 'other' => 'abc'), - 'headers' => array('Foo' => 'Bar', 'Baz' => 'Bam') - )); - $request = $client->createRequest('GET', 'http://www.foo.com?test=hello', array('Foo' => 'Test')); - // Explicit options on a request should overrule default options - $this->assertEquals('Test', (string) $request->getHeader('Foo')); - $this->assertEquals('hello', $request->getQuery()->get('test')); - // Default options should still be set - $this->assertEquals('abc', $request->getQuery()->get('other')); - $this->assertEquals('Bam', (string) $request->getHeader('Baz')); - } - - public function testCanSetSetOptionsOnRequests() - { - $client = new Client(); - $request = $client->createRequest('GET', 'http://www.foo.com?test=hello', array('Foo' => 'Test'), null, array( - 'cookies' => array('michael' => 'test') - )); - $this->assertEquals('test', $request->getCookie('michael')); - } - - public function testHasDefaultOptionsHelperMethods() - { - $client = new Client(); - // With path - $client->setDefaultOption('headers/foo', 'bar'); - $this->assertEquals('bar', $client->getDefaultOption('headers/foo')); - // With simple key - $client->setDefaultOption('allow_redirects', false); - $this->assertFalse($client->getDefaultOption('allow_redirects')); - - $this->assertEquals(array( - 'headers' => array('foo' => 'bar'), - 'allow_redirects' => false - ), $client->getConfig('request.options')); - - $request = $client->get('/'); - $this->assertEquals('bar', $request->getHeader('foo')); - } - - public function testHeadCanUseOptions() - { - $client = new Client(); - $head = $client->head('http://www.foo.com', array(), array('query' => array('foo' => 'bar'))); - $this->assertEquals('bar', $head->getQuery()->get('foo')); - } - - public function testCanSetRelativeUrlStartingWithHttp() - { - $client = new Client('http://www.foo.com'); - $this->assertEquals( - 'http://www.foo.com/httpfoo', - $client->createRequest('GET', 'httpfoo')->getUrl() - ); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Curl/CurlHandleTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Curl/CurlHandleTest.php deleted file mode 100644 index 5bf28de36..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Curl/CurlHandleTest.php +++ /dev/null @@ -1,947 +0,0 @@ -getEventDispatcher()->addListener('request.sent', function (Event $e) use ($that) { - $that->requestHandle = $e['handle']; - }); - - return $request; - } - - public function setUp() - { - $this->requestHandle = null; - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testConstructorExpectsCurlResource() - { - $h = new CurlHandle(false, array()); - } - - public function testConstructorExpectsProperOptions() - { - $h = curl_init($this->getServer()->getUrl()); - try { - $ha = new CurlHandle($h, false); - $this->fail('Expected InvalidArgumentException'); - } catch (\InvalidArgumentException $e) { - } - - $ha = new CurlHandle($h, array( - CURLOPT_URL => $this->getServer()->getUrl() - )); - $this->assertEquals($this->getServer()->getUrl(), $ha->getOptions()->get(CURLOPT_URL)); - - $ha = new CurlHandle($h, new Collection(array( - CURLOPT_URL => $this->getServer()->getUrl() - ))); - $this->assertEquals($this->getServer()->getUrl(), $ha->getOptions()->get(CURLOPT_URL)); - } - - public function testConstructorInitializesObject() - { - $handle = curl_init($this->getServer()->getUrl()); - $h = new CurlHandle($handle, array( - CURLOPT_URL => $this->getServer()->getUrl() - )); - $this->assertSame($handle, $h->getHandle()); - $this->assertInstanceOf('Guzzle\\Http\\Url', $h->getUrl()); - $this->assertEquals($this->getServer()->getUrl(), (string) $h->getUrl()); - $this->assertEquals($this->getServer()->getUrl(), $h->getOptions()->get(CURLOPT_URL)); - } - - public function testStoresStdErr() - { - $request = RequestFactory::getInstance()->create('GET', 'http://test.com'); - $request->getCurlOptions()->set('debug', true); - $h = CurlHandle::factory($request); - $this->assertEquals($h->getStderr(true), $h->getOptions()->get(CURLOPT_STDERR)); - $this->assertInternalType('resource', $h->getStderr(true)); - $this->assertInternalType('string', $h->getStderr(false)); - $r = $h->getStderr(true); - fwrite($r, 'test'); - $this->assertEquals('test', $h->getStderr(false)); - } - - public function testStoresCurlErrorNumber() - { - $h = new CurlHandle(curl_init('http://test.com'), array(CURLOPT_URL => 'http://test.com')); - $this->assertEquals(CURLE_OK, $h->getErrorNo()); - $h->setErrorNo(CURLE_OPERATION_TIMEOUTED); - $this->assertEquals(CURLE_OPERATION_TIMEOUTED, $h->getErrorNo()); - } - - public function testAccountsForMissingStdErr() - { - $handle = curl_init('http://www.test.com/'); - $h = new CurlHandle($handle, array( - CURLOPT_URL => 'http://www.test.com/' - )); - $this->assertNull($h->getStderr(false)); - } - - public function testDeterminesIfResourceIsAvailable() - { - $handle = curl_init($this->getServer()->getUrl()); - $h = new CurlHandle($handle, array()); - $this->assertTrue($h->isAvailable()); - - // Mess it up by closing the handle - curl_close($handle); - $this->assertFalse($h->isAvailable()); - - // Mess it up by unsetting the handle - $handle = null; - $this->assertFalse($h->isAvailable()); - } - - public function testWrapsErrorsAndInfo() - { - if (!defined('CURLOPT_TIMEOUT_MS')) { - $this->markTestSkipped('Update curl'); - } - - $settings = array( - CURLOPT_PORT => 123, - CURLOPT_CONNECTTIMEOUT_MS => 1, - CURLOPT_TIMEOUT_MS => 1 - ); - - $handle = curl_init($this->getServer()->getUrl()); - curl_setopt_array($handle, $settings); - $h = new CurlHandle($handle, $settings); - @curl_exec($handle); - - $errors = array( - "couldn't connect to host", - 'timeout was reached', - 'connection time-out', - 'connect() timed out!', - 'failed connect to 127.0.0.1:123; connection refused', - 'failed to connect to 127.0.0.1 port 123: connection refused' - ); - $this->assertTrue(in_array(strtolower($h->getError()), $errors), $h->getError() . ' was not the error'); - - $this->assertTrue($h->getErrorNo() > 0); - - $this->assertEquals($this->getServer()->getUrl(), $h->getInfo(CURLINFO_EFFECTIVE_URL)); - $this->assertInternalType('array', $h->getInfo()); - - curl_close($handle); - $this->assertEquals(null, $h->getInfo('url')); - } - - public function testGetInfoWithoutDebugMode() - { - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $client = new Client($this->getServer()->getUrl()); - $request = $client->get($this->getServer()->getUrl()); - $response = $request->send(); - - $info = $response->getInfo(); - $this->assertFalse(empty($info)); - $this->assertEquals($this->getServer()->getUrl(), $info['url']); - } - - public function testWrapsCurlOptions() - { - $handle = curl_init($this->getServer()->getUrl()); - $h = new CurlHandle($handle, array( - CURLOPT_AUTOREFERER => true, - CURLOPT_BUFFERSIZE => 1024 - )); - - $this->assertEquals(true, $h->getOptions()->get(CURLOPT_AUTOREFERER)); - $this->assertEquals(1024, $h->getOptions()->get(CURLOPT_BUFFERSIZE)); - } - - /** - * Data provider for factory tests - * - * @return array - */ - public function dataProvider() - { - $testFile = __DIR__ . '/../../../../../phpunit.xml.dist'; - - $postBody = new QueryString(array('file' => '@' . $testFile)); - $qs = new QueryString(array( - 'x' => 'y', - 'z' => 'a' - )); - - $client = new Client(); - $userAgent = $client->getDefaultUserAgent(); - $auth = base64_encode('michael:123'); - $testFileSize = filesize($testFile); - - $tests = array( - // Send a regular GET - array('GET', 'http://www.google.com/', null, null, array( - CURLOPT_RETURNTRANSFER => 0, - CURLOPT_HEADER => 0, - CURLOPT_CONNECTTIMEOUT => 150, - CURLOPT_WRITEFUNCTION => 'callback', - CURLOPT_HEADERFUNCTION => 'callback', - CURLOPT_HTTPHEADER => array('Accept:', 'Host: www.google.com', 'User-Agent: ' . $userAgent), - )), - // Test that custom request methods can be used - array('TRACE', 'http://www.google.com/', null, null, array( - CURLOPT_CUSTOMREQUEST => 'TRACE' - )), - // Send a GET using a port - array('GET', 'http://127.0.0.1:8080', null, null, array( - CURLOPT_RETURNTRANSFER => 0, - CURLOPT_HEADER => 0, - CURLOPT_CONNECTTIMEOUT => 150, - CURLOPT_WRITEFUNCTION => 'callback', - CURLOPT_HEADERFUNCTION => 'callback', - CURLOPT_PORT => 8080, - CURLOPT_HTTPHEADER => array('Accept:', 'Host: 127.0.0.1:8080', 'User-Agent: ' . $userAgent), - )), - // Send a HEAD request - array('HEAD', 'http://www.google.com/', null, null, array( - CURLOPT_RETURNTRANSFER => 0, - CURLOPT_HEADER => 0, - CURLOPT_CONNECTTIMEOUT => 150, - CURLOPT_HEADERFUNCTION => 'callback', - CURLOPT_HTTPHEADER => array('Accept:', 'Host: www.google.com', 'User-Agent: ' . $userAgent), - CURLOPT_NOBODY => 1 - )), - // Send a GET using basic auth - array('GET', 'https://michael:123@127.0.0.1/index.html?q=2', null, null, array( - CURLOPT_RETURNTRANSFER => 0, - CURLOPT_HEADER => 0, - CURLOPT_CONNECTTIMEOUT => 150, - CURLOPT_WRITEFUNCTION => 'callback', - CURLOPT_HEADERFUNCTION => 'callback', - CURLOPT_HTTPHEADER => array( - 'Accept:', - 'Host: 127.0.0.1', - 'Authorization: Basic ' . $auth, - 'User-Agent: ' . $userAgent - ), - CURLOPT_PORT => 443 - )), - // Send a GET request with custom headers - array('GET', 'http://127.0.0.1:8124/', array( - 'x-test-data' => 'Guzzle' - ), null, array( - CURLOPT_PORT => 8124, - CURLOPT_HTTPHEADER => array( - 'Accept:', - 'Host: 127.0.0.1:8124', - 'x-test-data: Guzzle', - 'User-Agent: ' . $userAgent - ) - ), array( - 'Host' => '*', - 'User-Agent' => '*', - 'x-test-data' => 'Guzzle' - )), - // Send a POST using a query string - array('POST', 'http://127.0.0.1:8124/post.php', null, $qs, array( - CURLOPT_RETURNTRANSFER => 0, - CURLOPT_HEADER => 0, - CURLOPT_CONNECTTIMEOUT => 150, - CURLOPT_WRITEFUNCTION => 'callback', - CURLOPT_HEADERFUNCTION => 'callback', - CURLOPT_POSTFIELDS => 'x=y&z=a', - CURLOPT_HTTPHEADER => array ( - 'Expect:', - 'Accept:', - 'Host: 127.0.0.1:8124', - 'Content-Type: application/x-www-form-urlencoded; charset=utf-8', - 'User-Agent: ' . $userAgent - ) - ), array( - 'Host' => '*', - 'User-Agent' => '*', - 'Content-Length' => '7', - '!Expect' => null, - 'Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8', - '!Transfer-Encoding' => null - )), - // Send a PUT using raw data - array('PUT', 'http://127.0.0.1:8124/put.php', null, EntityBody::factory(fopen($testFile, 'r+')), array( - CURLOPT_RETURNTRANSFER => 0, - CURLOPT_HEADER => 0, - CURLOPT_CONNECTTIMEOUT => 150, - CURLOPT_WRITEFUNCTION => 'callback', - CURLOPT_HEADERFUNCTION => 'callback', - CURLOPT_READFUNCTION => 'callback', - CURLOPT_INFILESIZE => filesize($testFile), - CURLOPT_HTTPHEADER => array ( - 'Expect:', - 'Accept:', - 'Host: 127.0.0.1:8124', - 'User-Agent: ' . $userAgent - ) - ), array( - 'Host' => '*', - 'User-Agent' => '*', - '!Expect' => null, - 'Content-Length' => $testFileSize, - '!Transfer-Encoding' => null - )), - // Send a POST request using an array of fields - array('POST', 'http://127.0.0.1:8124/post.php', null, array( - 'x' => 'y', - 'a' => 'b' - ), array( - CURLOPT_RETURNTRANSFER => 0, - CURLOPT_HEADER => 0, - CURLOPT_CONNECTTIMEOUT => 150, - CURLOPT_WRITEFUNCTION => 'callback', - CURLOPT_HEADERFUNCTION => 'callback', - CURLOPT_POST => 1, - CURLOPT_POSTFIELDS => 'x=y&a=b', - CURLOPT_HTTPHEADER => array ( - 'Expect:', - 'Accept:', - 'Host: 127.0.0.1:8124', - 'Content-Type: application/x-www-form-urlencoded; charset=utf-8', - 'User-Agent: ' . $userAgent - ) - ), array( - 'Host' => '*', - 'User-Agent' => '*', - 'Content-Length' => '7', - '!Expect' => null, - 'Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8', - '!Transfer-Encoding' => null - )), - // Send a POST request with raw POST data and a custom content-type - array('POST', 'http://127.0.0.1:8124/post.php', array( - 'Content-Type' => 'application/json' - ), '{"hi":"there"}', array( - CURLOPT_RETURNTRANSFER => 0, - CURLOPT_HEADER => 0, - CURLOPT_CONNECTTIMEOUT => 150, - CURLOPT_WRITEFUNCTION => 'callback', - CURLOPT_HEADERFUNCTION => 'callback', - CURLOPT_CUSTOMREQUEST => 'POST', - CURLOPT_UPLOAD => true, - CURLOPT_INFILESIZE => 14, - CURLOPT_HTTPHEADER => array ( - 'Expect:', - 'Accept:', - 'Host: 127.0.0.1:8124', - 'Content-Type: application/json', - 'User-Agent: ' . $userAgent - ), - ), array( - 'Host' => '*', - 'User-Agent' => '*', - 'Content-Type' => 'application/json', - '!Expect' => null, - 'Content-Length' => '14', - '!Transfer-Encoding' => null - )), - // Send a POST request with raw POST data, a custom content-type, and use chunked encoding - array('POST', 'http://127.0.0.1:8124/post.php', array( - 'Content-Type' => 'application/json', - 'Transfer-Encoding' => 'chunked' - ), '{"hi":"there"}', array( - CURLOPT_RETURNTRANSFER => 0, - CURLOPT_HEADER => 0, - CURLOPT_CONNECTTIMEOUT => 150, - CURLOPT_WRITEFUNCTION => 'callback', - CURLOPT_HEADERFUNCTION => 'callback', - CURLOPT_CUSTOMREQUEST => 'POST', - CURLOPT_UPLOAD => true, - CURLOPT_HTTPHEADER => array ( - 'Expect:', - 'Accept:', - 'Host: 127.0.0.1:8124', - 'Transfer-Encoding: chunked', - 'Content-Type: application/json', - 'User-Agent: ' . $userAgent - ), - ), array( - 'Host' => '*', - 'User-Agent' => '*', - 'Content-Type' => 'application/json', - '!Expect' => null, - 'Transfer-Encoding' => 'chunked', - '!Content-Length' => '' - )), - // Send a POST request with no body - array('POST', 'http://127.0.0.1:8124/post.php', null, '', array( - CURLOPT_CUSTOMREQUEST => 'POST', - CURLOPT_HTTPHEADER => array ( - 'Expect:', - 'Accept:', - 'Host: 127.0.0.1:8124', - 'User-Agent: ' . $userAgent - ) - ), array( - 'Host' => '*', - 'User-Agent' => '*', - 'Content-Length' => '0', - '!Transfer-Encoding' => null - )), - // Send a POST request with empty post fields - array('POST', 'http://127.0.0.1:8124/post.php', null, array(), array( - CURLOPT_CUSTOMREQUEST => 'POST', - CURLOPT_HTTPHEADER => array ( - 'Expect:', - 'Accept:', - 'Host: 127.0.0.1:8124', - 'User-Agent: ' . $userAgent - ) - ), array( - 'Host' => '*', - 'User-Agent' => '*', - 'Content-Length' => '0', - '!Transfer-Encoding' => null - )), - // Send a PATCH request - array('PATCH', 'http://127.0.0.1:8124/patch.php', null, 'body', array( - CURLOPT_INFILESIZE => 4, - CURLOPT_HTTPHEADER => array ( - 'Expect:', - 'Accept:', - 'Host: 127.0.0.1:8124', - 'User-Agent: ' . $userAgent - ) - )), - // Send a DELETE request with a body - array('DELETE', 'http://127.0.0.1:8124/delete.php', null, 'body', array( - CURLOPT_CUSTOMREQUEST => 'DELETE', - CURLOPT_INFILESIZE => 4, - CURLOPT_HTTPHEADER => array ( - 'Expect:', - 'Accept:', - 'Host: 127.0.0.1:8124', - 'User-Agent: ' . $userAgent - ) - ), array( - 'Host' => '*', - 'User-Agent' => '*', - 'Content-Length' => '4', - '!Expect' => null, - '!Transfer-Encoding' => null - )), - - /** - * Send a request with empty path and a fragment - the fragment must be - * stripped out before sending it to curl - * - * @issue 453 - * @link https://github.com/guzzle/guzzle/issues/453 - */ - array('GET', 'http://www.google.com#head', null, null, array( - CURLOPT_RETURNTRANSFER => 0, - CURLOPT_HEADER => 0, - CURLOPT_CONNECTTIMEOUT => 150, - CURLOPT_WRITEFUNCTION => 'callback', - CURLOPT_HEADERFUNCTION => 'callback', - CURLOPT_HTTPHEADER => array('Accept:', 'Host: www.google.com', 'User-Agent: ' . $userAgent), - )), - ); - - $postTest = array('POST', 'http://127.0.0.1:8124/post.php', null, $postBody, array( - CURLOPT_RETURNTRANSFER => 0, - CURLOPT_HEADER => 0, - CURLOPT_CONNECTTIMEOUT => 150, - CURLOPT_WRITEFUNCTION => 'callback', - CURLOPT_HEADERFUNCTION => 'callback', - CURLOPT_POST => 1, - CURLOPT_POSTFIELDS => array( - 'file' => '@' . $testFile . ';filename=phpunit.xml.dist;type=application/octet-stream' - ), - CURLOPT_HTTPHEADER => array ( - 'Accept:', - 'Host: 127.0.0.1:8124', - 'Content-Type: multipart/form-data', - 'Expect: 100-Continue', - 'User-Agent: ' . $userAgent - ) - ), array( - 'Host' => '*', - 'User-Agent' => '*', - 'Content-Length' => '*', - 'Expect' => '100-Continue', - 'Content-Type' => 'multipart/form-data; boundary=*', - '!Transfer-Encoding' => null - )); - - if (version_compare(phpversion(), '5.5.0', '>=')) { - $postTest[4][CURLOPT_POSTFIELDS] = array( - 'file' => new \CurlFile($testFile, 'application/octet-stream', 'phpunit.xml.dist') - ); - } - - $tests[] = $postTest; - - return $tests; - } - - /** - * @dataProvider dataProvider - */ - public function testFactoryCreatesCurlBasedOnRequest($method, $url, $headers, $body, $options, $expectedHeaders = null) - { - $client = new Client(); - $request = $client->createRequest($method, $url, $headers, $body); - $request->getCurlOptions()->set('debug', true); - - $originalRequest = clone $request; - $curlTest = clone $request; - $handle = CurlHandle::factory($curlTest); - - $this->assertInstanceOf('Guzzle\\Http\\Curl\\CurlHandle', $handle); - $o = $handle->getOptions()->getAll(); - - // Headers are case-insensitive - if (isset($o[CURLOPT_HTTPHEADER])) { - $o[CURLOPT_HTTPHEADER] = array_map('strtolower', $o[CURLOPT_HTTPHEADER]); - } - if (isset($options[CURLOPT_HTTPHEADER])) { - $options[CURLOPT_HTTPHEADER] = array_map('strtolower', $options[CURLOPT_HTTPHEADER]); - } - - $check = 0; - foreach ($options as $key => $value) { - $check++; - $this->assertArrayHasKey($key, $o, '-> Check number ' . $check); - if ($key != CURLOPT_HTTPHEADER && $key != CURLOPT_POSTFIELDS && (is_array($o[$key])) || $o[$key] instanceof \Closure) { - $this->assertEquals('callback', $value, '-> Check number ' . $check); - } else { - $this->assertTrue($value == $o[$key], '-> Check number ' . $check . ' - ' . var_export($value, true) . ' != ' . var_export($o[$key], true)); - } - } - - // If we are testing the actual sent headers - if ($expectedHeaders) { - - // Send the request to the test server - $client = new Client($this->getServer()->getUrl()); - $request->setClient($client); - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $request->send(); - - // Get the request that was sent and create a request that we expected - $requests = $this->getServer()->getReceivedRequests(true); - $this->assertEquals($method, $requests[0]->getMethod()); - - $test = $this->compareHeaders($expectedHeaders, $requests[0]->getHeaders()); - $this->assertFalse($test, $test . "\nSent: \n" . $request . "\n\n" . $requests[0]); - - // Ensure only one Content-Length header is sent - if ($request->getHeader('Content-Length')) { - $this->assertEquals((string) $request->getHeader('Content-Length'), (string) $requests[0]->getHeader('Content-Length')); - } - } - } - - public function testFactoryUsesSpecifiedProtocol() - { - $request = RequestFactory::getInstance()->create('GET', 'http://127.0.0.1:8124/'); - $request->setProtocolVersion('1.1'); - $handle = CurlHandle::factory($request); - $options = $handle->getOptions(); - $this->assertEquals(CURL_HTTP_VERSION_1_1, $options[CURLOPT_HTTP_VERSION]); - } - - public function testUploadsPutData() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\nhi"); - - $client = new Client($this->getServer()->getUrl()); - $request = $client->put('/'); - $request->getCurlOptions()->set('debug', true); - $request->setBody(EntityBody::factory('test'), 'text/plain', false); - $request->getCurlOptions()->set('progress', true); - - $o = $this->getWildcardObserver($request); - $request->send(); - - // Make sure that the events were dispatched - $this->assertTrue($o->has('curl.callback.progress')); - - // Ensure that the request was received exactly as intended - $r = $this->getServer()->getReceivedRequests(true); - $this->assertFalse($r[0]->hasHeader('Transfer-Encoding')); - $this->assertEquals(4, (string) $r[0]->getHeader('Content-Length')); - $sent = strtolower($r[0]); - $this->assertContains('put / http/1.1', $sent); - $this->assertContains('host: 127.0.0.1', $sent); - $this->assertContains('user-agent:', $sent); - $this->assertContains('content-type: text/plain', $sent); - } - - public function testUploadsPutDataUsingChunkedEncodingWhenLengthCannotBeDetermined() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\nhi" - )); - $client = new Client($this->getServer()->getUrl()); - $request = $client->put('/'); - $request->setBody(EntityBody::factory(fopen($this->getServer()->getUrl(), 'r')), 'text/plain'); - $request->send(); - - $r = $this->getServer()->getReceivedRequests(true); - $this->assertEquals('chunked', $r[1]->getHeader('Transfer-Encoding')); - $this->assertFalse($r[1]->hasHeader('Content-Length')); - } - - public function testUploadsPutDataUsingChunkedEncodingWhenForced() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\nhi"); - - $client = new Client($this->getServer()->getUrl()); - $request = $client->put('/', array('Transfer-Encoding' => 'chunked'), 'hi!'); - $request->send(); - - $r = $this->getServer()->getReceivedRequests(true); - $this->assertEquals('chunked', $r[0]->getHeader('Transfer-Encoding')); - $this->assertFalse($r[0]->hasHeader('Content-Length')); - $this->assertEquals('hi!', $r[0]->getBody(true)); - } - - public function testSendsPostRequestsWithFields() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\nhi"); - - $request = RequestFactory::getInstance()->create('POST', $this->getServer()->getUrl()); - $request->getCurlOptions()->set('debug', true); - $request->setClient(new Client()); - $request->addPostFields(array( - 'a' => 'b', - 'c' => 'ay! ~This is a test, isn\'t it?' - )); - $request->send(); - - // Make sure that the request was sent correctly - $r = $this->getServer()->getReceivedRequests(true); - $this->assertEquals('a=b&c=ay%21%20~This%20is%20a%20test%2C%20isn%27t%20it%3F', (string) $r[0]->getBody()); - $this->assertFalse($r[0]->hasHeader('Transfer-Encoding')); - $this->assertEquals(56, (string) $r[0]->getHeader('Content-Length')); - $sent = strtolower($r[0]); - $this->assertContains('post / http/1.1', $sent); - $this->assertContains('content-type: application/x-www-form-urlencoded; charset=utf-8', $sent); - } - - public function testSendsPostRequestsWithFiles() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\nhi"); - - $request = RequestFactory::getInstance()->create('POST', $this->getServer()->getUrl()); - $request->getCurlOptions()->set('debug', true); - $request->setClient(new Client()); - $request->addPostFiles(array( - 'foo' => __FILE__, - )); - $request->addPostFields(array( - 'bar' => 'baz', - 'arr' => array('a' => 1, 'b' => 2), - )); - $this->updateForHandle($request); - $request->send(); - - // Ensure the CURLOPT_POSTFIELDS option was set properly - $options = $this->requestHandle->getOptions()->getAll(); - if (version_compare(phpversion(), '5.5.0', '<')) { - $this->assertContains('@' . __FILE__ . ';filename=CurlHandleTest.php;type=text/x-', $options[CURLOPT_POSTFIELDS]['foo']); - } else{ - $this->assertInstanceOf('CURLFile', $options[CURLOPT_POSTFIELDS]['foo']); - } - $this->assertEquals('baz', $options[CURLOPT_POSTFIELDS]['bar']); - $this->assertEquals('1', $options[CURLOPT_POSTFIELDS]['arr[a]']); - $this->assertEquals('2', $options[CURLOPT_POSTFIELDS]['arr[b]']); - // Ensure that a Content-Length header was sent by cURL - $this->assertTrue($request->hasHeader('Content-Length')); - } - - public function testCurlConfigurationOptionsAreSet() - { - $request = RequestFactory::getInstance()->create('PUT', $this->getServer()->getUrl()); - $request->setClient(new Client('http://www.example.com')); - $request->getCurlOptions()->set(CURLOPT_CONNECTTIMEOUT, 99); - $request->getCurlOptions()->set('curl.fake_opt', 99); - $request->getCurlOptions()->set(CURLOPT_PORT, 8181); - $handle = CurlHandle::factory($request); - $this->assertEquals(99, $handle->getOptions()->get(CURLOPT_CONNECTTIMEOUT)); - $this->assertEquals(8181, $handle->getOptions()->get(CURLOPT_PORT)); - $this->assertNull($handle->getOptions()->get('curl.fake_opt')); - $this->assertNull($handle->getOptions()->get('fake_opt')); - } - - public function testEnsuresRequestsHaveResponsesWhenUpdatingFromTransfer() - { - $request = RequestFactory::getInstance()->create('PUT', $this->getServer()->getUrl()); - $handle = CurlHandle::factory($request); - $handle->updateRequestFromTransfer($request); - } - - public function testCanSendBodyAsString() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $client = new Client($this->getServer()->getUrl()); - $request = $client->put('/', null, 'foo'); - $request->getCurlOptions()->set('body_as_string', true); - $request->send(); - $requests = $this->getServer()->getReceivedRequests(false); - $this->assertContains('PUT /', $requests[0]); - $this->assertContains("\nfoo", $requests[0]); - $this->assertContains('content-length: 3', $requests[0]); - $this->assertNotContains('content-type', $requests[0]); - } - - public function testCanSendPostBodyAsString() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $client = new Client($this->getServer()->getUrl()); - $request = $client->post('/', null, 'foo'); - $request->getCurlOptions()->set('body_as_string', true); - $request->send(); - $requests = $this->getServer()->getReceivedRequests(false); - $this->assertContains('POST /', $requests[0]); - $this->assertContains("\nfoo", $requests[0]); - $this->assertContains('content-length: 3', $requests[0]); - $this->assertNotContains('content-type', $requests[0]); - } - - public function testAllowsWireTransferInfoToBeEnabled() - { - $request = RequestFactory::getInstance()->create('PUT', $this->getServer()->getUrl()); - $request->getCurlOptions()->set('debug', true); - $handle = CurlHandle::factory($request); - $this->assertNotNull($handle->getOptions()->get(CURLOPT_STDERR)); - $this->assertNotNull($handle->getOptions()->get(CURLOPT_VERBOSE)); - } - - public function testAddsCustomCurlOptions() - { - $request = RequestFactory::getInstance()->create('PUT', $this->getServer()->getUrl()); - $request->getCurlOptions()->set(CURLOPT_TIMEOUT, 200); - $handle = CurlHandle::factory($request); - $this->assertEquals(200, $handle->getOptions()->get(CURLOPT_TIMEOUT)); - } - - public function testSendsPostUploadsWithContentDispositionHeaders() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\n\r\nContent-Length: 0\r\n\r\n"); - - $fileToUpload = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'TestData' . DIRECTORY_SEPARATOR . 'test_service.json'; - - $client = new Client($this->getServer()->getUrl()); - $request = $client->post(); - $request->addPostFile('foo', $fileToUpload, 'application/json'); - $request->addPostFile('foo', __FILE__); - - $request->send(); - $requests = $this->getServer()->getReceivedRequests(true); - $body = (string) $requests[0]->getBody(); - - $this->assertContains('Content-Disposition: form-data; name="foo[0]"; filename="', $body); - $this->assertContains('Content-Type: application/json', $body); - $this->assertContains('Content-Type: text/x-', $body); - $this->assertContains('Content-Disposition: form-data; name="foo[1]"; filename="', $body); - } - - public function requestMethodProvider() - { - return array(array('POST'), array('PUT'), array('PATCH')); - } - - /** - * @dataProvider requestMethodProvider - */ - public function testSendsRequestsWithNoBodyUsingContentLengthZero($method) - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $client = new Client($this->getServer()->getUrl()); - $client->createRequest($method)->send(); - $requests = $this->getServer()->getReceivedRequests(true); - $this->assertFalse($requests[0]->hasHeader('Transfer-Encoding')); - $this->assertTrue($requests[0]->hasHeader('Content-Length')); - $this->assertEquals('0', (string) $requests[0]->getHeader('Content-Length')); - } - - /** - * @dataProvider provideCurlConfig - */ - public function testParseCurlConfigConvertsStringKeysToConstantKeys($options, $expected) - { - $actual = CurlHandle::parseCurlConfig($options); - $this->assertEquals($expected, $actual); - } - - /** - * Data provider for curl configurations - * - * @return array - */ - public function provideCurlConfig() - { - return array( - // Conversion of option name to constant value - array( - array( - 'CURLOPT_PORT' => 10, - 'CURLOPT_TIMEOUT' => 99 - ), - array( - CURLOPT_PORT => 10, - CURLOPT_TIMEOUT => 99 - ) - ), - // Keeps non constant options - array( - array('debug' => true), - array('debug' => true) - ), - // Conversion of constant names to constant values - array( - array('debug' => 'CURLPROXY_HTTP'), - array('debug' => CURLPROXY_HTTP) - ) - ); - } - - public function testSeeksToBeginningOfStreamWhenSending() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n" - )); - - $client = new Client($this->getServer()->getUrl()); - $request = $client->put('/', null, 'test'); - $request->send(); - $request->send(); - - $received = $this->getServer()->getReceivedRequests(true); - $this->assertEquals(2, count($received)); - $this->assertEquals('test', (string) $received[0]->getBody()); - $this->assertEquals('test', (string) $received[1]->getBody()); - } - - public function testAllowsCurloptEncodingToBeSet() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - - $client = new Client($this->getServer()->getUrl()); - $request = $client->get('/', null); - $request->getCurlOptions()->set(CURLOPT_ENCODING, ''); - $this->updateForHandle($request); - $request->send(); - $options = $this->requestHandle->getOptions()->getAll(); - $this->assertSame('', $options[CURLOPT_ENCODING]); - $received = $this->getServer()->getReceivedRequests(false); - $this->assertContainsIns('accept: */*', $received[0]); - $this->assertContainsIns('accept-encoding: ', $received[0]); - } - - public function testSendsExpectHeaderWhenSizeIsGreaterThanCutoff() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $client = new Client($this->getServer()->getUrl()); - $request = $client->put('/', null, 'test'); - // Start sending the expect header to 2 bytes - $this->updateForHandle($request); - $request->setExpectHeaderCutoff(2)->send(); - $options = $this->requestHandle->getOptions()->getAll(); - $this->assertContains('Expect: 100-Continue', $options[CURLOPT_HTTPHEADER]); - $received = $this->getServer()->getReceivedRequests(false); - $this->assertContainsIns('expect: 100-continue', $received[0]); - } - - public function testSetsCurloptEncodingWhenAcceptEncodingHeaderIsSet() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\ndata"); - $client = new Client($this->getServer()->getUrl()); - $request = $client->get('/', array( - 'Accept' => 'application/json', - 'Accept-Encoding' => 'gzip, deflate', - )); - $this->updateForHandle($request); - $request->send(); - $options = $this->requestHandle->getOptions()->getAll(); - $this->assertSame('gzip, deflate', $options[CURLOPT_ENCODING]); - $received = $this->getServer()->getReceivedRequests(false); - $this->assertContainsIns('accept: application/json', $received[0]); - $this->assertContainsIns('accept-encoding: gzip, deflate', $received[0]); - } - - public function testSendsPostFieldsForNonPostRequests() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\n\r\nContent-Length: 0\r\n\r\n"); - - $client = new Client(); - $request = $client->put($this->getServer()->getUrl(), null, array( - 'foo' => 'baz', - 'baz' => 'bar' - )); - - $request->send(); - $requests = $this->getServer()->getReceivedRequests(true); - $this->assertEquals('PUT', $requests[0]->getMethod()); - $this->assertEquals( - 'application/x-www-form-urlencoded; charset=utf-8', - (string) $requests[0]->getHeader('Content-Type') - ); - $this->assertEquals(15, (string) $requests[0]->getHeader('Content-Length')); - $this->assertEquals('foo=baz&baz=bar', (string) $requests[0]->getBody()); - } - - public function testSendsPostFilesForNonPostRequests() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\n\r\nContent-Length: 0\r\n\r\n"); - - $client = new Client(); - $request = $client->put($this->getServer()->getUrl(), null, array( - 'foo' => '@' . __FILE__ - )); - - $request->send(); - $requests = $this->getServer()->getReceivedRequests(true); - $this->assertEquals('PUT', $requests[0]->getMethod()); - $this->assertContains('multipart/form-data', (string) $requests[0]->getHeader('Content-Type')); - $this->assertContains('testSendsPostFilesForNonPostRequests', (string) $requests[0]->getBody()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Curl/CurlMultiProxyTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Curl/CurlMultiProxyTest.php deleted file mode 100644 index e04141c5f..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Curl/CurlMultiProxyTest.php +++ /dev/null @@ -1,110 +0,0 @@ -multi = new CurlMultiProxy(self::MAX_HANDLES, self::SELECT_TIMEOUT); - } - - public function tearDown() - { - unset($this->multi); - } - - public function testConstructorSetsMaxHandles() - { - $m = new CurlMultiProxy(self::MAX_HANDLES, self::SELECT_TIMEOUT); - $this->assertEquals(self::MAX_HANDLES, $this->readAttribute($m, 'maxHandles')); - } - - public function testConstructorSetsSelectTimeout() - { - $m = new CurlMultiProxy(self::MAX_HANDLES, self::SELECT_TIMEOUT); - $this->assertEquals(self::SELECT_TIMEOUT, $this->readAttribute($m, 'selectTimeout')); - } - - public function testAddingRequestsAddsToQueue() - { - $r = new Request('GET', 'http://www.foo.com'); - $this->assertSame($this->multi, $this->multi->add($r)); - $this->assertEquals(1, count($this->multi)); - $this->assertEquals(array($r), $this->multi->all()); - - $this->assertTrue($this->multi->remove($r)); - $this->assertFalse($this->multi->remove($r)); - $this->assertEquals(0, count($this->multi)); - } - - public function testResetClearsState() - { - $r = new Request('GET', 'http://www.foo.com'); - $this->multi->add($r); - $this->multi->reset(); - $this->assertEquals(0, count($this->multi)); - } - - public function testSendWillSendQueuedRequestsFirst() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n" - )); - $client = new Client($this->getServer()->getUrl()); - $events = array(); - $client->getCurlMulti()->getEventDispatcher()->addListener( - CurlMultiProxy::ADD_REQUEST, - function ($e) use (&$events) { - $events[] = $e; - } - ); - $request = $client->get(); - $request->getEventDispatcher()->addListener('request.complete', function () use ($client) { - $client->get('/foo')->send(); - }); - $request->send(); - $received = $this->getServer()->getReceivedRequests(true); - $this->assertEquals(2, count($received)); - $this->assertEquals($this->getServer()->getUrl(), $received[0]->getUrl()); - $this->assertEquals($this->getServer()->getUrl() . 'foo', $received[1]->getUrl()); - $this->assertEquals(2, count($events)); - } - - public function testTrimsDownMaxHandleCount() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 307 OK\r\nLocation: /foo\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 307 OK\r\nLocation: /foo\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 307 OK\r\nLocation: /foo\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 307 OK\r\nLocation: /foo\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n" - )); - $client = new Client($this->getServer()->getUrl()); - $client->setCurlMulti(new CurlMultiProxy(self::MAX_HANDLES, self::SELECT_TIMEOUT)); - $request = $client->get(); - $request->send(); - $this->assertEquals(200, $request->getResponse()->getStatusCode()); - $handles = $this->readAttribute($client->getCurlMulti(), 'handles'); - $this->assertEquals(2, count($handles)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Curl/CurlMultiTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Curl/CurlMultiTest.php deleted file mode 100644 index 1272281f9..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Curl/CurlMultiTest.php +++ /dev/null @@ -1,455 +0,0 @@ -multi = new MockMulti(); - } - - public function tearDown() - { - unset($this->multi); - } - - public function testConstructorCreateMultiHandle() - { - $this->assertInternalType('resource', $this->multi->getHandle()); - $this->assertEquals('curl_multi', get_resource_type($this->multi->getHandle())); - } - - public function testDestructorClosesMultiHandle() - { - $handle = $this->multi->getHandle(); - $this->multi->__destruct(); - $this->assertFalse(is_resource($handle)); - } - - public function testRequestsCanBeAddedAndCounted() - { - $multi = new CurlMulti(); - $request1 = new Request('GET', 'http://www.google.com/'); - $multi->add($request1); - $this->assertEquals(array($request1), $multi->all()); - $request2 = new Request('POST', 'http://www.google.com/'); - $multi->add($request2); - $this->assertEquals(array($request1, $request2), $multi->all()); - $this->assertEquals(2, count($multi)); - } - - public function testRequestsCanBeRemoved() - { - $request1 = new Request('GET', 'http://www.google.com/'); - $this->multi->add($request1); - $request2 = new Request('PUT', 'http://www.google.com/'); - $this->multi->add($request2); - $this->assertEquals(array($request1, $request2), $this->multi->all()); - $this->assertTrue($this->multi->remove($request1)); - $this->assertFalse($this->multi->remove($request1)); - $this->assertEquals(array($request2), $this->multi->all()); - } - - public function testsResetRemovesRequestsAndResetsState() - { - $this->multi->add(new Request('GET', 'http://www.google.com/')); - $this->multi->reset(); - $this->assertEquals(array(), $this->multi->all()); - } - - public function testSendsRequestsThroughCurl() - { - $this->getServer()->enqueue(array( - "HTTP/1.1 204 No content\r\n" . - "Content-Length: 0\r\n" . - "Server: Jetty(6.1.3)\r\n\r\n", - "HTTP/1.1 200 OK\r\n" . - "Content-Type: text/html; charset=utf-8\r\n" . - "Content-Length: 4\r\n" . - "Server: Jetty(6.1.3)\r\n\r\n" . - "data" - )); - - $request1 = new Request('GET', $this->getServer()->getUrl()); - $request2 = new Request('GET', $this->getServer()->getUrl()); - $this->multi->add($request1); - $this->multi->add($request2); - $this->multi->send(); - - $response1 = $request1->getResponse(); - $response2 = $request2->getResponse(); - $this->assertInstanceOf('Guzzle\\Http\\Message\\Response', $response1); - $this->assertInstanceOf('Guzzle\\Http\\Message\\Response', $response2); - - $this->assertTrue($response1->getBody(true) == 'data' || $response2->getBody(true) == 'data'); - $this->assertTrue($response1->getBody(true) == '' || $response2->getBody(true) == ''); - $this->assertTrue($response1->getStatusCode() == '204' || $response2->getStatusCode() == '204'); - $this->assertNotEquals((string) $response1, (string) $response2); - } - - public function testSendsThroughCurlAndAggregatesRequestExceptions() - { - $this->getServer()->enqueue(array( - "HTTP/1.1 200 OK\r\n" . - "Content-Type: text/html; charset=utf-8\r\n" . - "Content-Length: 4\r\n" . - "Server: Jetty(6.1.3)\r\n" . - "\r\n" . - "data", - "HTTP/1.1 204 No content\r\n" . - "Content-Length: 0\r\n" . - "Server: Jetty(6.1.3)\r\n" . - "\r\n", - "HTTP/1.1 404 Not Found\r\n" . - "Content-Length: 0\r\n" . - "\r\n" - )); - - $request1 = new Request('GET', $this->getServer()->getUrl()); - $request2 = new Request('HEAD', $this->getServer()->getUrl()); - $request3 = new Request('GET', $this->getServer()->getUrl()); - $this->multi->add($request1); - $this->multi->add($request2); - $this->multi->add($request3); - - try { - $this->multi->send(); - $this->fail('MultiTransferException not thrown when aggregating request exceptions'); - } catch (MultiTransferException $e) { - - $this->assertTrue($e->containsRequest($request1)); - $this->assertTrue($e->containsRequest($request2)); - $this->assertTrue($e->containsRequest($request3)); - $this->assertInstanceOf('ArrayIterator', $e->getIterator()); - $this->assertEquals(1, count($e)); - $exceptions = $e->getIterator(); - - $response1 = $request1->getResponse(); - $response2 = $request2->getResponse(); - $response3 = $request3->getResponse(); - - $this->assertNotEquals((string) $response1, (string) $response2); - $this->assertNotEquals((string) $response3, (string) $response1); - $this->assertInstanceOf('Guzzle\\Http\\Message\\Response', $response1); - $this->assertInstanceOf('Guzzle\\Http\\Message\\Response', $response2); - $this->assertInstanceOf('Guzzle\\Http\\Message\\Response', $response3); - - $failed = $exceptions[0]->getResponse(); - $this->assertEquals(404, $failed->getStatusCode()); - $this->assertEquals(1, count($e)); - - // Test the IteratorAggregate functionality - foreach ($e as $except) { - $this->assertEquals($failed, $except->getResponse()); - } - - $this->assertEquals(1, count($e->getFailedRequests())); - $this->assertEquals(2, count($e->getSuccessfulRequests())); - $this->assertEquals(3, count($e->getAllRequests())); - } - } - - public function testCurlErrorsAreCaught() - { - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - try { - $request = RequestFactory::getInstance()->create('GET', 'http://127.0.0.1:9876/'); - $request->setClient(new Client()); - $request->getCurlOptions()->set(CURLOPT_FRESH_CONNECT, true); - $request->getCurlOptions()->set(CURLOPT_FORBID_REUSE, true); - $request->getCurlOptions()->set(CURLOPT_CONNECTTIMEOUT_MS, 5); - $request->send(); - $this->fail('CurlException not thrown'); - } catch (CurlException $e) { - $m = $e->getMessage(); - $this->assertContains('[curl] ', $m); - $this->assertContains('[url] http://127.0.0.1:9876/', $m); - $this->assertInternalType('array', $e->getCurlInfo()); - } - } - - public function testRemovesQueuedRequests() - { - $request = RequestFactory::getInstance()->create('GET', 'http://127.0.0.1:9876/'); - $r = new Response(200); - $request->setClient(new Client()); - $request->setResponse($r, true); - $this->multi->add($request); - $this->multi->send(); - $this->assertSame($r, $request->getResponse()); - } - - public function testRemovesQueuedRequestsAddedInTransit() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n")); - $client = new Client($this->getServer()->getUrl()); - $r = $client->get(); - $r->getEventDispatcher()->addListener('request.receive.status_line', function (Event $event) use ($client) { - // Create a request using a queued response - $request = $client->get()->setResponse(new Response(200), true); - $request->send(); - }); - $r->send(); - $this->assertEquals(1, count($this->getServer()->getReceivedRequests(false))); - } - - public function testCatchesExceptionsBeforeSendingSingleRequest() - { - $client = new Client($this->getServer()->getUrl()); - $multi = new CurlMulti(); - $client->setCurlMulti($multi); - $request = $client->get(); - $request->getEventDispatcher()->addListener('request.before_send', function() { - throw new \RuntimeException('Testing!'); - }); - try { - $request->send(); - $this->fail('Did not throw'); - } catch (\RuntimeException $e) { - // Ensure it was removed - $this->assertEquals(0, count($multi)); - } - } - - /** - * @expectedException \Guzzle\Common\Exception\ExceptionCollection - * @expectedExceptionMessage Thrown before sending! - */ - public function testCatchesExceptionsBeforeSendingMultipleRequests() - { - $client = new Client($this->getServer()->getUrl()); - $request = $client->get(); - $request->getEventDispatcher()->addListener('request.before_send', function() { - throw new \RuntimeException('Thrown before sending!'); - }); - $client->send(array($request)); - } - - public function testCatchesExceptionsWhenRemovingQueuedRequests() - { - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $client = new Client($this->getServer()->getUrl()); - $r = $client->get(); - $r->getEventDispatcher()->addListener('request.sent', function() use ($client) { - // Create a request using a queued response - $client->get()->setResponse(new Response(404), true)->send(); - }); - try { - $r->send(); - $this->fail('Did not throw'); - } catch (BadResponseException $e) { - $this->assertCount(0, $client->getCurlMulti()); - } - } - - public function testCatchesExceptionsWhenRemovingQueuedRequestsBeforeSending() - { - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $client = new Client($this->getServer()->getUrl()); - $r = $client->get(); - $r->getEventDispatcher()->addListener('request.before_send', function() use ($client) { - // Create a request using a queued response - $client->get()->setResponse(new Response(404), true)->send(); - }); - try { - $r->send(); - $this->fail('Did not throw'); - } catch (BadResponseException $e) { - $this->assertCount(0, $client->getCurlMulti()); - } - } - - /** - * @expectedException \RuntimeException - * @expectedExceptionMessage test - */ - public function testDoesNotCatchRandomExceptionsThrownDuringPerform() - { - $client = new Client($this->getServer()->getUrl()); - $multi = $this->getMock('Guzzle\\Http\\Curl\\CurlMulti', array('perform')); - $multi->expects($this->once()) - ->method('perform') - ->will($this->throwException(new \RuntimeException('test'))); - $multi->add($client->get()); - $multi->send(); - } - - public function testDoesNotSendRequestsDecliningToBeSent() - { - if (!defined('CURLOPT_TIMEOUT_MS')) { - $this->markTestSkipped('Update curl'); - } - - // Create a client that is bound to fail connecting - $client = new Client('http://127.0.0.1:123', array( - 'curl.CURLOPT_PORT' => 123, - 'curl.CURLOPT_CONNECTTIMEOUT_MS' => 1, - )); - - $request = $client->get(); - $multi = new CurlMulti(); - $multi->add($request); - - // Listen for request exceptions, and when they occur, first change the - // state of the request back to transferring, and then just allow it to - // exception out - $request->getEventDispatcher()->addListener('request.exception', function(Event $event) use ($multi) { - $retries = $event['request']->getParams()->get('retries'); - // Allow the first failure to retry - if ($retries == 0) { - $event['request']->setState('transfer'); - $event['request']->getParams()->set('retries', 1); - // Remove the request to try again - $multi->remove($event['request']); - $multi->add($event['request']); - } - }); - - try { - $multi->send(); - $this->fail('Did not throw an exception at all!?!'); - } catch (\Exception $e) { - $this->assertEquals(1, $request->getParams()->get('retries')); - } - } - - public function testDoesNotThrowExceptionsWhenRequestsRecoverWithRetry() - { - $this->getServer()->flush(); - $client = new Client($this->getServer()->getUrl()); - $request = $client->get(); - $request->getEventDispatcher()->addListener('request.before_send', function(Event $event) { - $event['request']->setResponse(new Response(200)); - }); - - $multi = new CurlMulti(); - $multi->add($request); - $multi->send(); - $this->assertEquals(0, count($this->getServer()->getReceivedRequests(false))); - } - - public function testDoesNotThrowExceptionsWhenRequestsRecoverWithSuccess() - { - // Attempt a port that 99.9% is not listening - $client = new Client('http://127.0.0.1:123'); - $request = $client->get(); - // Ensure it times out quickly if needed - $request->getCurlOptions()->set(CURLOPT_TIMEOUT_MS, 1)->set(CURLOPT_CONNECTTIMEOUT_MS, 1); - - $request->getEventDispatcher()->addListener('request.exception', function(Event $event) use (&$count) { - $event['request']->setResponse(new Response(200)); - }); - - $multi = new CurlMulti(); - $multi->add($request); - $multi->send(); - - // Ensure that the exception was caught, and the response was set manually - $this->assertEquals(200, $request->getResponse()->getStatusCode()); - } - - public function testHardResetReopensMultiHandle() - { - $this->getServer()->enqueue(array( - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n" - )); - - $stream = fopen('php://temp', 'w+'); - $client = new Client($this->getServer()->getUrl()); - $client->getConfig()->set('curl.CURLOPT_VERBOSE', true)->set('curl.CURLOPT_STDERR', $stream); - - $request = $client->get(); - $multi = new CurlMulti(); - $multi->add($request); - $multi->send(); - $multi->reset(true); - $multi->add($request); - $multi->send(); - - rewind($stream); - $this->assertNotContains('Re-using existing connection', stream_get_contents($stream)); - } - - public function testThrowsMeaningfulExceptionsForCurlMultiErrors() - { - $multi = new CurlMulti(); - - // Set the state of the multi object to sending to trigger the exception - $reflector = new \ReflectionMethod('Guzzle\Http\Curl\CurlMulti', 'checkCurlResult'); - $reflector->setAccessible(true); - - // Successful - $reflector->invoke($multi, 0); - - // Known error - try { - $reflector->invoke($multi, CURLM_BAD_HANDLE); - $this->fail('Expected an exception here'); - } catch (CurlException $e) { - $this->assertContains('The passed-in handle is not a valid CURLM handle.', $e->getMessage()); - $this->assertContains('CURLM_BAD_HANDLE', $e->getMessage()); - $this->assertContains(strval(CURLM_BAD_HANDLE), $e->getMessage()); - } - - // Unknown error - try { - $reflector->invoke($multi, 255); - $this->fail('Expected an exception here'); - } catch (CurlException $e) { - $this->assertEquals('Unexpected cURL error: 255', $e->getMessage()); - } - } - - public function testRequestBeforeSendIncludesContentLengthHeaderIfEmptyBody() - { - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $request = new Request('PUT', $this->getServer()->getUrl()); - $that = $this; - $request->getEventDispatcher()->addListener('request.before_send', function ($event) use ($that) { - $that->assertEquals(0, $event['request']->getHeader('Content-Length')); - }); - $this->multi->add($request); - $this->multi->send(); - } - - public function testRemovesConflictingTransferEncodingHeader() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\ntest", - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n" - )); - $client = new Client($this->getServer()->getUrl()); - $request = $client->put('/', null, fopen($this->getServer()->getUrl(), 'r')); - $request->setHeader('Content-Length', 4); - $request->send(); - $received = $this->getServer()->getReceivedRequests(true); - $this->assertFalse($received[1]->hasHeader('Transfer-Encoding')); - $this->assertEquals(4, (string) $received[1]->getHeader('Content-Length')); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Curl/CurlVersionTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Curl/CurlVersionTest.php deleted file mode 100644 index c7b5ee6e9..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Curl/CurlVersionTest.php +++ /dev/null @@ -1,39 +0,0 @@ -getProperty('version'); - $refProperty->setAccessible(true); - $refProperty->setValue($instance, array()); - - $this->assertEquals($info, $instance->getAll()); - $this->assertEquals($info, $instance->getAll()); - - $this->assertEquals($info['version'], $instance->get('version')); - $this->assertFalse($instance->get('foo')); - } - - public function testIsSingleton() - { - $refObject = new \ReflectionClass('Guzzle\Http\Curl\CurlVersion'); - $refProperty = $refObject->getProperty('instance'); - $refProperty->setAccessible(true); - $refProperty->setValue(null, null); - - $this->assertInstanceOf('Guzzle\Http\Curl\CurlVersion', CurlVersion::getInstance()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Curl/RequestMediatorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Curl/RequestMediatorTest.php deleted file mode 100644 index c69e0c904..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Curl/RequestMediatorTest.php +++ /dev/null @@ -1,67 +0,0 @@ -events[] = $event; - } - - public function testEmitsEvents() - { - $request = new EntityEnclosingRequest('PUT', 'http://www.example.com'); - $request->setBody('foo'); - $request->setResponse(new Response(200)); - - // Ensure that IO events are emitted - $request->getCurlOptions()->set('emit_io', true); - - // Attach listeners for each event type - $request->getEventDispatcher()->addListener('curl.callback.progress', array($this, 'event')); - $request->getEventDispatcher()->addListener('curl.callback.read', array($this, 'event')); - $request->getEventDispatcher()->addListener('curl.callback.write', array($this, 'event')); - - $mediator = new RequestMediator($request, true); - - $mediator->progress('a', 'b', 'c', 'd'); - $this->assertEquals(1, count($this->events)); - $this->assertEquals('curl.callback.progress', $this->events[0]->getName()); - - $this->assertEquals(3, $mediator->writeResponseBody('foo', 'bar')); - $this->assertEquals(2, count($this->events)); - $this->assertEquals('curl.callback.write', $this->events[1]->getName()); - $this->assertEquals('bar', $this->events[1]['write']); - $this->assertSame($request, $this->events[1]['request']); - - $this->assertEquals('foo', $mediator->readRequestBody('a', 'b', 3)); - $this->assertEquals(3, count($this->events)); - $this->assertEquals('curl.callback.read', $this->events[2]->getName()); - $this->assertEquals('foo', $this->events[2]['read']); - $this->assertSame($request, $this->events[2]['request']); - } - - public function testDoesNotUseRequestResponseBodyWhenNotCustom() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 307 Foo\r\nLocation: /foo\r\nContent-Length: 2\r\n\r\nHI", - "HTTP/1.1 301 Foo\r\nLocation: /foo\r\nContent-Length: 2\r\n\r\nFI", - "HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\ntest", - )); - $client = new Client($this->getServer()->getUrl()); - $response = $client->get()->send(); - $this->assertEquals('test', $response->getBody(true)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/EntityBodyTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/EntityBodyTest.php deleted file mode 100644 index 124a44da6..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/EntityBodyTest.php +++ /dev/null @@ -1,182 +0,0 @@ -assertEquals('data', (string) $body); - $this->assertEquals(4, $body->getContentLength()); - $this->assertEquals('PHP', $body->getWrapper()); - $this->assertEquals('TEMP', $body->getStreamType()); - - $handle = fopen(__DIR__ . '/../../../../phpunit.xml.dist', 'r'); - if (!$handle) { - $this->fail('Could not open test file'); - } - $body = EntityBody::factory($handle); - $this->assertEquals(__DIR__ . '/../../../../phpunit.xml.dist', $body->getUri()); - $this->assertTrue($body->isLocal()); - $this->assertEquals(__DIR__ . '/../../../../phpunit.xml.dist', $body->getUri()); - $this->assertEquals(filesize(__DIR__ . '/../../../../phpunit.xml.dist'), $body->getContentLength()); - - // make sure that a body will return as the same object - $this->assertTrue($body === EntityBody::factory($body)); - } - - public function testFactoryCreatesTempStreamByDefault() - { - $body = EntityBody::factory(''); - $this->assertEquals('PHP', $body->getWrapper()); - $this->assertEquals('TEMP', $body->getStreamType()); - $body = EntityBody::factory(); - $this->assertEquals('PHP', $body->getWrapper()); - $this->assertEquals('TEMP', $body->getStreamType()); - } - - public function testFactoryCanCreateFromObject() - { - $body = EntityBody::factory(new QueryString(array('foo' => 'bar'))); - $this->assertEquals('foo=bar', (string) $body); - } - - /** - * @expectedException \Guzzle\Common\Exception\InvalidArgumentException - */ - public function testFactoryEnsuresObjectsHaveToStringMethod() - { - EntityBody::factory(new \stdClass('a')); - } - - public function testHandlesCompression() - { - $body = EntityBody::factory('testing 123...testing 123'); - $this->assertFalse($body->getContentEncoding(), '-> getContentEncoding() must initially return FALSE'); - $size = $body->getContentLength(); - $body->compress(); - $this->assertEquals('gzip', $body->getContentEncoding(), '-> getContentEncoding() must return the correct encoding after compressing'); - $this->assertEquals(gzdeflate('testing 123...testing 123'), (string) $body); - $this->assertTrue($body->getContentLength() < $size); - $this->assertTrue($body->uncompress()); - $this->assertEquals('testing 123...testing 123', (string) $body); - $this->assertFalse($body->getContentEncoding(), '-> getContentEncoding() must reset to FALSE'); - - if (in_array('bzip2.*', stream_get_filters())) { - $this->assertTrue($body->compress('bzip2.compress')); - $this->assertEquals('compress', $body->getContentEncoding(), '-> compress() must set \'compress\' as the Content-Encoding'); - } - - $this->assertFalse($body->compress('non-existent'), '-> compress() must return false when a non-existent stream filter is used'); - - // Release the body - unset($body); - - // Use gzip compression on the initial content. This will include a - // gzip header which will need to be stripped when deflating the stream - $body = EntityBody::factory(gzencode('test')); - $this->assertSame($body, $body->setStreamFilterContentEncoding('zlib.deflate')); - $this->assertTrue($body->uncompress('zlib.inflate')); - $this->assertEquals('test', (string) $body); - unset($body); - - // Test using a very long string - $largeString = ''; - for ($i = 0; $i < 25000; $i++) { - $largeString .= chr(rand(33, 126)); - } - $body = EntityBody::factory($largeString); - $this->assertEquals($largeString, (string) $body); - $this->assertTrue($body->compress()); - $this->assertNotEquals($largeString, (string) $body); - $compressed = (string) $body; - $this->assertTrue($body->uncompress()); - $this->assertEquals($largeString, (string) $body); - $this->assertEquals($compressed, gzdeflate($largeString)); - - $body = EntityBody::factory(fopen(__DIR__ . '/../TestData/compress_test', 'w')); - $this->assertFalse($body->compress()); - unset($body); - - unlink(__DIR__ . '/../TestData/compress_test'); - } - - public function testDeterminesContentType() - { - // Test using a string/temp stream - $body = EntityBody::factory('testing 123...testing 123'); - $this->assertNull($body->getContentType()); - - // Use a local file - $body = EntityBody::factory(fopen(__FILE__, 'r')); - $this->assertContains('text/x-', $body->getContentType()); - } - - public function testCreatesMd5Checksum() - { - $body = EntityBody::factory('testing 123...testing 123'); - $this->assertEquals(md5('testing 123...testing 123'), $body->getContentMd5()); - - $server = $this->getServer()->enqueue( - "HTTP/1.1 200 OK" . "\r\n" . - "Content-Length: 3" . "\r\n\r\n" . - "abc" - ); - - $body = EntityBody::factory(fopen($this->getServer()->getUrl(), 'r')); - $this->assertFalse($body->getContentMd5()); - } - - public function testSeeksToOriginalPosAfterMd5() - { - $body = EntityBody::factory('testing 123'); - $body->seek(4); - $this->assertEquals(md5('testing 123'), $body->getContentMd5()); - $this->assertEquals(4, $body->ftell()); - $this->assertEquals('ing 123', $body->read(1000)); - } - - public function testGetTypeFormBodyFactoring() - { - $body = EntityBody::factory(array('key1' => 'val1', 'key2' => 'val2')); - $this->assertEquals('key1=val1&key2=val2', (string) $body); - } - - public function testAllowsCustomRewind() - { - $body = EntityBody::factory('foo'); - $rewound = false; - $body->setRewindFunction(function ($body) use (&$rewound) { - $rewound = true; - return $body->seek(0); - }); - $body->seek(2); - $this->assertTrue($body->rewind()); - $this->assertTrue($rewound); - } - - /** - * @expectedException \Guzzle\Common\Exception\InvalidArgumentException - */ - public function testCustomRewindFunctionMustBeCallable() - { - $body = EntityBody::factory(); - $body->setRewindFunction('foo'); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Exception/CurlExceptionTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Exception/CurlExceptionTest.php deleted file mode 100644 index df3e4b791..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Exception/CurlExceptionTest.php +++ /dev/null @@ -1,27 +0,0 @@ -assertNull($e->getError()); - $this->assertNull($e->getErrorNo()); - $this->assertSame($e, $e->setError('test', 12)); - $this->assertEquals('test', $e->getError()); - $this->assertEquals(12, $e->getErrorNo()); - - $handle = new CurlHandle(curl_init(), array()); - $e->setCurlHandle($handle); - $this->assertSame($handle, $e->getCurlHandle()); - $handle->close(); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Exception/ExceptionTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Exception/ExceptionTest.php deleted file mode 100644 index 12cfd369e..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Exception/ExceptionTest.php +++ /dev/null @@ -1,66 +0,0 @@ -setRequest($request); - $this->assertEquals($request, $e->getRequest()); - } - - /** - * @covers Guzzle\Http\Exception\BadResponseException - */ - public function testBadResponseException() - { - $e = new BadResponseException('Message'); - $response = new Response(200); - $e->setResponse($response); - $this->assertEquals($response, $e->getResponse()); - } - - /** - * @covers Guzzle\Http\Exception\BadResponseException::factory - */ - public function testCreatesGenericErrorExceptionOnError() - { - $request = new Request('GET', 'http://www.example.com'); - $response = new Response(307); - $e = BadResponseException::factory($request, $response); - $this->assertInstanceOf('Guzzle\Http\Exception\BadResponseException', $e); - } - - /** - * @covers Guzzle\Http\Exception\BadResponseException::factory - */ - public function testCreatesClientErrorExceptionOnClientError() - { - $request = new Request('GET', 'http://www.example.com'); - $response = new Response(404); - $e = BadResponseException::factory($request, $response); - $this->assertInstanceOf('Guzzle\Http\Exception\ClientErrorResponseException', $e); - } - - /** - * @covers Guzzle\Http\Exception\BadResponseException::factory - */ - public function testCreatesServerErrorExceptionOnServerError() - { - $request = new Request('GET', 'http://www.example.com'); - $response = new Response(503); - $e = BadResponseException::factory($request, $response); - $this->assertInstanceOf('Guzzle\Http\Exception\ServerErrorResponseException', $e); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Exception/MultiTransferExceptionTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Exception/MultiTransferExceptionTest.php deleted file mode 100644 index fa4ec2626..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Exception/MultiTransferExceptionTest.php +++ /dev/null @@ -1,51 +0,0 @@ -addSuccessfulRequest($r1); - $e->addFailedRequest($r2); - $this->assertEquals(array($r1), $e->getSuccessfulRequests()); - $this->assertEquals(array($r2), $e->getSuccessfulRequests()); - $this->assertEquals(array($r1, $r2), $e->getAllRequests()); - $this->assertTrue($e->containsRequest($r1)); - $this->assertTrue($e->containsRequest($r2)); - $this->assertFalse($e->containsRequest(new Request('POST', '/foo'))); - } - - public function testCanSetRequests() - { - $s = array($r1 = new Request('GET', 'http://www.foo.com')); - $f = array($r2 = new Request('GET', 'http://www.foo.com')); - $e = new MultiTransferException(); - $e->setSuccessfulRequests($s); - $e->setFailedRequests($f); - $this->assertEquals(array($r1), $e->getSuccessfulRequests()); - $this->assertEquals(array($r2), $e->getSuccessfulRequests()); - } - - public function testAssociatesExceptionsWithRequests() - { - $r1 = new Request('GET', 'http://www.foo.com'); - $re1 = new \Exception('foo'); - $re2 = new \Exception('bar'); - $e = new MultiTransferException(); - $e->add($re2); - $e->addFailedRequestWithException($r1, $re1); - $this->assertSame($re1, $e->getExceptionForFailedRequest($r1)); - $this->assertNull($e->getExceptionForFailedRequest(new Request('POST', '/foo'))); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/IoEmittingEntityBodyTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/IoEmittingEntityBodyTest.php deleted file mode 100644 index cd6355f3b..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/IoEmittingEntityBodyTest.php +++ /dev/null @@ -1,47 +0,0 @@ -decorated = EntityBody::factory('hello'); - $this->body = new IoEmittingEntityBody($this->decorated); - } - - public function testEmitsReadEvents() - { - $e = null; - $this->body->getEventDispatcher()->addListener('body.read', function ($event) use (&$e) { - $e = $event; - }); - $this->assertEquals('hel', $this->body->read(3)); - $this->assertEquals('hel', $e['read']); - $this->assertEquals(3, $e['length']); - $this->assertSame($this->body, $e['body']); - } - - public function testEmitsWriteEvents() - { - $e = null; - $this->body->getEventDispatcher()->addListener('body.write', function ($event) use (&$e) { - $e = $event; - }); - $this->body->seek(0, SEEK_END); - $this->assertEquals(5, $this->body->write('there')); - $this->assertEquals('there', $e['write']); - $this->assertEquals(5, $e['result']); - $this->assertSame($this->body, $e['body']); - $this->assertEquals('hellothere', (string) $this->body); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/AbstractMessageTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/AbstractMessageTest.php deleted file mode 100644 index 9447d8c5d..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/AbstractMessageTest.php +++ /dev/null @@ -1,136 +0,0 @@ -mock = $this->getMockForAbstractClass('Guzzle\Http\Message\AbstractMessage'); - } - - public function tearDown() - { - $this->mock = $this->request = null; - } - - public function testGetParams() - { - $request = new Request('GET', 'http://example.com'); - $this->assertInstanceOf('Guzzle\\Common\\Collection', $request->getParams()); - } - - public function testAddHeaders() - { - $this->mock->setHeader('A', 'B'); - - $this->assertEquals($this->mock, $this->mock->addHeaders(array( - 'X-Data' => '123' - ))); - - $this->assertTrue($this->mock->hasHeader('X-Data') !== false); - $this->assertTrue($this->mock->hasHeader('A') !== false); - } - - public function testAllowsHeaderToSetAsHeader() - { - $h = new Header('A', 'B'); - $this->mock->setHeader('A', $h); - $this->assertSame($h, $this->mock->getHeader('A')); - } - - public function testGetHeader() - { - $this->mock->setHeader('Test', '123'); - $this->assertEquals('123', $this->mock->getHeader('Test')); - } - - public function testGetHeaders() - { - $this->assertSame($this->mock, $this->mock->setHeaders(array('a' => 'b', 'c' => 'd'))); - $h = $this->mock->getHeaders(); - $this->assertArrayHasKey('a', $h->toArray()); - $this->assertArrayHasKey('c', $h->toArray()); - $this->assertInstanceOf('Guzzle\Http\Message\Header\HeaderInterface', $h->get('a')); - $this->assertInstanceOf('Guzzle\Http\Message\Header\HeaderInterface', $h->get('c')); - } - - public function testGetHeaderLinesUsesGlue() - { - $this->mock->setHeaders(array('a' => 'b', 'c' => 'd')); - $this->mock->addHeader('a', 'e'); - $this->mock->getHeader('a')->setGlue('!'); - $this->assertEquals(array( - 'a: b! e', - 'c: d' - ), $this->mock->getHeaderLines()); - } - - public function testHasHeader() - { - $this->assertFalse($this->mock->hasHeader('Foo')); - $this->mock->setHeader('Foo', 'Bar'); - $this->assertEquals(true, $this->mock->hasHeader('Foo')); - $this->mock->setHeader('foo', 'yoo'); - $this->assertEquals(true, $this->mock->hasHeader('Foo')); - $this->assertEquals(true, $this->mock->hasHeader('foo')); - $this->assertEquals(false, $this->mock->hasHeader('bar')); - } - - public function testRemoveHeader() - { - $this->mock->setHeader('Foo', 'Bar'); - $this->assertEquals(true, $this->mock->hasHeader('Foo')); - $this->mock->removeHeader('Foo'); - $this->assertFalse($this->mock->hasHeader('Foo')); - } - - public function testReturnsNullWhenHeaderIsNotFound() - { - $this->assertNull($this->mock->getHeader('foo')); - } - - public function testAddingHeadersPreservesOriginalHeaderCase() - { - $this->mock->addHeaders(array( - 'test' => '123', - 'Test' => 'abc' - )); - $this->mock->addHeader('test', '456'); - $this->mock->addHeader('test', '789'); - - $header = $this->mock->getHeader('test'); - $this->assertContains('123', $header->toArray()); - $this->assertContains('456', $header->toArray()); - $this->assertContains('789', $header->toArray()); - $this->assertContains('abc', $header->toArray()); - } - - public function testCanStoreEmptyHeaders() - { - $this->mock->setHeader('Content-Length', 0); - $this->assertTrue($this->mock->hasHeader('Content-Length')); - $this->assertEquals(0, (string) $this->mock->getHeader('Content-Length')); - } - - public function testCanSetCustomHeaderFactory() - { - $f = new Header\HeaderFactory(); - $this->mock->setHeaderFactory($f); - $this->assertSame($f, $this->readAttribute($this->mock, 'headerFactory')); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/EntityEnclosingRequestTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/EntityEnclosingRequestTest.php deleted file mode 100644 index 191b02223..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/EntityEnclosingRequestTest.php +++ /dev/null @@ -1,434 +0,0 @@ -client = new Client(); - } - - public function tearDown() - { - $this->client = null; - } - - public function testConstructorConfiguresRequest() - { - $request = new EntityEnclosingRequest('PUT', 'http://test.com', array( - 'X-Test' => '123' - )); - $request->setBody('Test'); - $this->assertEquals('123', $request->getHeader('X-Test')); - $this->assertNull($request->getHeader('Expect')); - } - - public function testCanSetBodyWithoutOverridingContentType() - { - $request = new EntityEnclosingRequest('PUT', 'http://test.com', array('Content-Type' => 'foooooo')); - $request->setBody('{"a":"b"}'); - $this->assertEquals('foooooo', $request->getHeader('Content-Type')); - } - - public function testRequestIncludesBodyInMessage() - { - - $request = RequestFactory::getInstance()->create('PUT', 'http://www.guzzle-project.com/', null, 'data'); - $this->assertEquals("PUT / HTTP/1.1\r\n" - . "Host: www.guzzle-project.com\r\n" - . "Content-Length: 4\r\n\r\n" - . "data", (string) $request); - } - - public function testRequestIncludesPostBodyInMessageOnlyWhenNoPostFiles() - { - $request = RequestFactory::getInstance()->create('POST', 'http://www.guzzle-project.com/', null, array( - 'foo' => 'bar' - )); - $this->assertEquals("POST / HTTP/1.1\r\n" - . "Host: www.guzzle-project.com\r\n" - . "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n\r\n" - . "foo=bar", (string) $request); - - $request = RequestFactory::getInstance()->create('POST', 'http://www.guzzle-project.com/', null, array( - 'foo' => '@' . __FILE__ - )); - $this->assertEquals("POST / HTTP/1.1\r\n" - . "Host: www.guzzle-project.com\r\n" - . "Content-Type: multipart/form-data\r\n" - . "Expect: 100-Continue\r\n\r\n", (string) $request); - } - - public function testAddsPostFieldsAndSetsContentLength() - { - $request = RequestFactory::getInstance()->create('POST', 'http://www.guzzle-project.com/', null, array( - 'data' => '123' - )); - $this->assertEquals("POST / HTTP/1.1\r\n" - . "Host: www.guzzle-project.com\r\n" - . "Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n\r\n" - . "data=123", (string) $request); - } - - public function testAddsPostFilesAndSetsContentType() - { - $request = RequestFactory::getInstance()->create('POST', 'http://www.test.com/') - ->addPostFiles(array( - 'file' => __FILE__ - ))->addPostFields(array( - 'a' => 'b' - )); - $message = (string) $request; - $this->assertEquals('multipart/form-data', $request->getHeader('Content-Type')); - $this->assertEquals('100-Continue', $request->getHeader('Expect')); - } - - public function testRequestBodyContainsPostFiles() - { - $request = RequestFactory::getInstance()->create('POST', 'http://www.test.com/'); - $request->addPostFields(array( - 'test' => '123' - )); - $this->assertContains("\r\n\r\ntest=123", (string) $request); - } - - public function testRequestBodyAddsContentLength() - { - $request = RequestFactory::getInstance()->create('PUT', 'http://www.test.com/'); - $request->setBody(EntityBody::factory('test')); - $this->assertEquals(4, (string) $request->getHeader('Content-Length')); - $this->assertFalse($request->hasHeader('Transfer-Encoding')); - } - - public function testRequestBodyDoesNotUseContentLengthWhenChunked() - { - $request = RequestFactory::getInstance()->create('PUT', 'http://www.test.com/', array( - 'Transfer-Encoding' => 'chunked' - ), 'test'); - $this->assertNull($request->getHeader('Content-Length')); - $this->assertTrue($request->hasHeader('Transfer-Encoding')); - } - - public function testRequestHasMutableBody() - { - $request = RequestFactory::getInstance()->create('PUT', 'http://www.guzzle-project.com/', null, 'data'); - $body = $request->getBody(); - $this->assertInstanceOf('Guzzle\\Http\\EntityBody', $body); - $this->assertSame($body, $request->getBody()); - - $newBody = EntityBody::factory('foobar'); - $request->setBody($newBody); - $this->assertEquals('foobar', (string) $request->getBody()); - $this->assertSame($newBody, $request->getBody()); - } - - public function testSetPostFields() - { - $request = RequestFactory::getInstance()->create('POST', 'http://www.guzzle-project.com/'); - $this->assertInstanceOf('Guzzle\\Http\\QueryString', $request->getPostFields()); - - $fields = new QueryString(array( - 'a' => 'b' - )); - $request->addPostFields($fields); - $this->assertEquals($fields->getAll(), $request->getPostFields()->getAll()); - $this->assertEquals(array(), $request->getPostFiles()); - } - - public function testSetPostFiles() - { - $request = RequestFactory::getInstance()->create('POST', $this->getServer()->getUrl()) - ->setClient(new Client()) - ->addPostFiles(array(__FILE__)) - ->addPostFields(array( - 'test' => 'abc' - )); - - $request->getCurlOptions()->set('debug', true); - - $this->assertEquals(array( - 'test' => 'abc' - ), $request->getPostFields()->getAll()); - - $files = $request->getPostFiles(); - $post = $files['file'][0]; - $this->assertEquals('file', $post->getFieldName()); - $this->assertContains('text/x-', $post->getContentType()); - $this->assertEquals(__FILE__, $post->getFilename()); - - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $request->send(); - - $this->assertNotNull($request->getHeader('Content-Length')); - $this->assertContains('multipart/form-data; boundary=', (string) $request->getHeader('Content-Type'), '-> cURL must add the boundary'); - } - - /** - * @expectedException Guzzle\Common\Exception\InvalidArgumentException - */ - public function testSetPostFilesThrowsExceptionWhenFileIsNotFound() - { - $request = RequestFactory::getInstance()->create('POST', 'http://www.guzzle-project.com/') - ->addPostFiles(array( - 'file' => 'filenotfound.ini' - )); - } - - /** - * @expectedException Guzzle\Http\Exception\RequestException - */ - public function testThrowsExceptionWhenNonStringsAreAddedToPost() - { - $request = RequestFactory::getInstance()->create('POST', 'http://www.guzzle-project.com/') - ->addPostFile('foo', new \stdClass()); - } - - public function testAllowsContentTypeInPostUploads() - { - $request = RequestFactory::getInstance()->create('POST', 'http://www.guzzle-project.com/') - ->addPostFile('foo', __FILE__, 'text/plain'); - - $this->assertEquals(array( - new PostFile('foo', __FILE__, 'text/plain') - ), $request->getPostFile('foo')); - } - - public function testGuessesContentTypeOfPostUpload() - { - $request = RequestFactory::getInstance()->create('POST', 'http://www.guzzle-project.com/') - ->addPostFile('foo', __FILE__); - $file = $request->getPostFile('foo'); - $this->assertContains('text/x-', $file[0]->getContentType()); - } - - public function testAllowsContentDispositionFieldsInPostUploadsWhenSettingInBulk() - { - $postFile = new PostFile('foo', __FILE__, 'text/x-php'); - $request = RequestFactory::getInstance()->create('POST', 'http://www.guzzle-project.com/') - ->addPostFiles(array('foo' => $postFile)); - - $this->assertEquals(array($postFile), $request->getPostFile('foo')); - } - - public function testPostRequestsUseApplicationXwwwForUrlEncodedForArrays() - { - $request = RequestFactory::getInstance()->create('POST', 'http://www.guzzle-project.com/'); - $request->setPostField('a', 'b'); - $this->assertContains("\r\n\r\na=b", (string) $request); - $this->assertEquals('application/x-www-form-urlencoded; charset=utf-8', $request->getHeader('Content-Type')); - } - - public function testProcessMethodAddsContentType() - { - $request = RequestFactory::getInstance()->create('POST', 'http://www.guzzle-project.com/'); - $request->setPostField('a', 'b'); - $this->assertEquals('application/x-www-form-urlencoded; charset=utf-8', $request->getHeader('Content-Type')); - } - - public function testPostRequestsUseMultipartFormDataWithFiles() - { - $request = RequestFactory::getInstance()->create('POST', 'http://www.guzzle-project.com/'); - $request->addPostFiles(array('file' => __FILE__)); - $this->assertEquals('multipart/form-data', $request->getHeader('Content-Type')); - } - - public function testCanSendMultipleRequestsUsingASingleRequestObject() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 201 Created\r\nContent-Length: 0\r\n\r\n", - )); - - // Send the first request - $request = RequestFactory::getInstance()->create('PUT', $this->getServer()->getUrl()) - ->setBody('test') - ->setClient(new Client()); - $request->send(); - $this->assertEquals(200, $request->getResponse()->getStatusCode()); - - // Send the second request - $request->setBody('abcdefg', 'application/json', false); - $request->send(); - $this->assertEquals(201, $request->getResponse()->getStatusCode()); - - // Ensure that the same request was sent twice with different bodies - $requests = $this->getServer()->getReceivedRequests(true); - $this->assertEquals(2, count($requests)); - $this->assertEquals(4, (string) $requests[0]->getHeader('Content-Length')); - $this->assertEquals(7, (string) $requests[1]->getHeader('Content-Length')); - } - - public function testRemovingPostFieldRebuildsPostFields() - { - $request = new EntityEnclosingRequest('POST', 'http://test.com'); - $request->setPostField('test', 'value'); - $request->removePostField('test'); - $this->assertNull($request->getPostField('test')); - } - - public function testUsesChunkedTransferWhenBodyLengthCannotBeDetermined() - { - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $request = new EntityEnclosingRequest('PUT', 'http://test.com/'); - $request->setBody(fopen($this->getServer()->getUrl(), 'r')); - $this->assertEquals('chunked', $request->getHeader('Transfer-Encoding')); - $this->assertFalse($request->hasHeader('Content-Length')); - } - - /** - * @expectedException \Guzzle\Http\Exception\RequestException - */ - public function testThrowsExceptionWhenContentLengthCannotBeDeterminedAndUsingHttp1() - { - $request = new EntityEnclosingRequest('PUT', 'http://test.com/'); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $request->setProtocolVersion('1.0'); - $request->setBody(fopen($this->getServer()->getUrl(), 'r')); - } - - public function testAllowsNestedPostData() - { - $request = new EntityEnclosingRequest('POST', 'http://test.com/'); - $request->addPostFields(array( - 'a' => array('b', 'c') - )); - $this->assertEquals(array( - 'a' => array('b', 'c') - ), $request->getPostFields()->getAll()); - } - - public function testAllowsEmptyFields() - { - $request = new EntityEnclosingRequest('POST', 'http://test.com/'); - $request->addPostFields(array( - 'a' => '' - )); - $this->assertEquals(array( - 'a' => '' - ), $request->getPostFields()->getAll()); - } - - /** - * @expectedException \Guzzle\Http\Exception\RequestException - */ - public function testFailsOnInvalidFiles() - { - $request = new EntityEnclosingRequest('POST', 'http://test.com/'); - $request->addPostFiles(array( - 'a' => new \stdClass() - )); - } - - public function testHandlesEmptyStrings() - { - $request = new EntityEnclosingRequest('POST', 'http://test.com/'); - $request->addPostFields(array( - 'a' => '', - 'b' => null, - 'c' => 'Foo' - )); - $this->assertEquals(array( - 'a' => '', - 'b' => null, - 'c' => 'Foo' - ), $request->getPostFields()->getAll()); - } - - public function testHoldsPostFiles() - { - $request = new EntityEnclosingRequest('POST', 'http://test.com/'); - $request->addPostFile('foo', __FILE__); - $request->addPostFile(new PostFile('foo', __FILE__)); - - $this->assertArrayHasKey('foo', $request->getPostFiles()); - $foo = $request->getPostFile('foo'); - $this->assertEquals(2, count($foo)); - $this->assertEquals(__FILE__, $foo[0]->getFilename()); - $this->assertEquals(__FILE__, $foo[1]->getFilename()); - - $request->removePostFile('foo'); - $this->assertEquals(array(), $request->getPostFiles()); - } - - public function testAllowsAtPrefixWhenAddingPostFiles() - { - $request = new EntityEnclosingRequest('POST', 'http://test.com/'); - $request->addPostFiles(array( - 'foo' => '@' . __FILE__ - )); - $foo = $request->getPostFile('foo'); - $this->assertEquals(__FILE__, $foo[0]->getFilename()); - } - - public function testSetStateToTransferWithEmptyBodySetsContentLengthToZero() - { - $request = new EntityEnclosingRequest('POST', 'http://test.com/'); - $request->setState($request::STATE_TRANSFER); - $this->assertEquals('0', (string) $request->getHeader('Content-Length')); - } - - public function testSettingExpectHeaderCutoffChangesRequest() - { - $request = new EntityEnclosingRequest('PUT', 'http://test.com/'); - $request->setHeader('Expect', '100-Continue'); - $request->setExpectHeaderCutoff(false); - $this->assertNull($request->getHeader('Expect')); - // There is not body, so remove the expect header - $request->setHeader('Expect', '100-Continue'); - $request->setExpectHeaderCutoff(10); - $this->assertNull($request->getHeader('Expect')); - // The size is less than the cutoff - $request->setBody('foo'); - $this->assertNull($request->getHeader('Expect')); - // The size is greater than the cutoff - $request->setBody('foobazbarbamboo'); - $this->assertNotNull($request->getHeader('Expect')); - } - - public function testStrictRedirectsCanBeSpecifiedOnEntityEnclosingRequests() - { - $request = new EntityEnclosingRequest('PUT', 'http://test.com/'); - $request->configureRedirects(true); - $this->assertTrue($request->getParams()->get(RedirectPlugin::STRICT_REDIRECTS)); - } - - public function testCanDisableRedirects() - { - $request = new EntityEnclosingRequest('PUT', 'http://test.com/'); - $request->configureRedirects(false, false); - $this->assertTrue($request->getParams()->get(RedirectPlugin::DISABLE)); - } - - public function testSetsContentTypeWhenSettingBodyByGuessingFromEntityBody() - { - $request = new EntityEnclosingRequest('PUT', 'http://test.com/foo'); - $request->setBody(EntityBody::factory(fopen(__FILE__, 'r'))); - $this->assertEquals('text/x-php', (string) $request->getHeader('Content-Type')); - } - - public function testDoesNotCloneBody() - { - $request = new EntityEnclosingRequest('PUT', 'http://test.com/foo'); - $request->setBody('test'); - $newRequest = clone $request; - $newRequest->setBody('foo'); - $this->assertInternalType('string', (string) $request->getBody()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/Header/HeaderFactoryTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/Header/HeaderFactoryTest.php deleted file mode 100644 index 62ca5559d..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/Header/HeaderFactoryTest.php +++ /dev/null @@ -1,29 +0,0 @@ -createHeader('Foo', 'Bar'); - $this->assertInstanceOf('Guzzle\Http\Message\Header', $h); - $this->assertEquals('Foo', $h->getName()); - $this->assertEquals('Bar', (string) $h); - } - - public function testCreatesSpecificHeaders() - { - $f = new HeaderFactory(); - $h = $f->createHeader('Link', '; rel="test"'); - $this->assertInstanceOf('Guzzle\Http\Message\Header\Link', $h); - $this->assertEquals('Link', $h->getName()); - $this->assertEquals('; rel="test"', (string) $h); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/Header/LinkTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/Header/LinkTest.php deleted file mode 100644 index c834d1016..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/Header/LinkTest.php +++ /dev/null @@ -1,63 +0,0 @@ -; rel=front; type="image/jpeg", ; rel=back; type="image/jpeg", ; rel=side; type="image/jpeg"'); - $links = $link->getLinks(); - $this->assertEquals(array( - array( - 'rel' => 'front', - 'type' => 'image/jpeg', - 'url' => 'http:/.../front.jpeg', - ), - array( - 'rel' => 'back', - 'type' => 'image/jpeg', - 'url' => 'http://.../back.jpeg', - ), - array( - 'rel' => 'side', - 'type' => 'image/jpeg', - 'url' => 'http://.../side.jpeg?test=1' - ) - ), $links); - - $this->assertEquals(array( - 'rel' => 'back', - 'type' => 'image/jpeg', - 'url' => 'http://.../back.jpeg', - ), $link->getLink('back')); - - $this->assertTrue($link->hasLink('front')); - $this->assertFalse($link->hasLink('foo')); - } - - public function testCanAddLink() - { - $link = new Link('Link', '; rel=a; type="image/jpeg"'); - $link->addLink('http://test.com', 'test', array('foo' => 'bar')); - $this->assertEquals( - '; rel=a; type="image/jpeg", ; rel="test"; foo="bar"', - (string) $link - ); - } - - public function testCanParseLinksWithCommas() - { - $link = new Link('Link', '; rel="previous"; title="start, index"'); - $this->assertEquals(array( - array( - 'rel' => 'previous', - 'title' => 'start, index', - 'url' => 'http://example.com/TheBook/chapter1', - ) - ), $link->getLinks()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/HeaderComparison.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/HeaderComparison.php deleted file mode 100644 index a3f511bfc..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/HeaderComparison.php +++ /dev/null @@ -1,135 +0,0 @@ -toArray(); - } - - foreach ($filteredHeaders as $k => $v) { - if ($k[0] == '_') { - // This header should be ignored - $ignore[] = str_replace('_', '', $k); - } elseif ($k[0] == '!') { - // This header must not be present - $absent[] = str_replace('!', '', $k); - } else { - $expected[$k] = $v; - } - } - - return $this->compareArray($expected, $actualHeaders, $ignore, $absent); - } - - /** - * Check if an array of HTTP headers matches another array of HTTP headers while taking * into account as a wildcard - * - * @param array $expected Expected HTTP headers (allows wildcard values) - * @param array|Collection $actual Actual HTTP header array - * @param array $ignore Headers to ignore from the comparison - * @param array $absent Array of headers that must not be present - * - * @return array|bool Returns an array of the differences or FALSE if none - */ - public function compareArray(array $expected, $actual, array $ignore = array(), array $absent = array()) - { - $differences = array(); - - // Add information about headers that were present but weren't supposed to be - foreach ($absent as $header) { - if ($this->hasKey($header, $actual)) { - $differences["++ {$header}"] = $actual[$header]; - unset($actual[$header]); - } - } - - // Check if expected headers are missing - foreach ($expected as $header => $value) { - if (!$this->hasKey($header, $actual)) { - $differences["- {$header}"] = $value; - } - } - - // Flip the ignore array so it works with the case insensitive helper - $ignore = array_flip($ignore); - // Allow case-insensitive comparisons in wildcards - $expected = array_change_key_case($expected); - - // Compare the expected and actual HTTP headers in no particular order - foreach ($actual as $key => $value) { - - // If this is to be ignored, the skip it - if ($this->hasKey($key, $ignore)) { - continue; - } - - // If the header was not expected - if (!$this->hasKey($key, $expected)) { - $differences["+ {$key}"] = $value; - continue; - } - - // Check values and take wildcards into account - $lkey = strtolower($key); - $pos = is_string($expected[$lkey]) ? strpos($expected[$lkey], '*') : false; - - foreach ((array) $actual[$key] as $v) { - if (($pos === false && $v != $expected[$lkey]) || $pos > 0 && substr($v, 0, $pos) != substr($expected[$lkey], 0, $pos)) { - $differences[$key] = "{$value} != {$expected[$lkey]}"; - } - } - } - - return empty($differences) ? false : $differences; - } - - /** - * Case insensitive check if an array have a key - * - * @param string $key Key to check - * @param array $array Array to check - * - * @return bool - */ - protected function hasKey($key, $array) - { - if ($array instanceof Collection) { - $keys = $array->getKeys(); - } else { - $keys = array_keys($array); - } - - foreach ($keys as $k) { - if (!strcasecmp($k, $key)) { - return true; - } - } - - return false; - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/HeaderComparisonTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/HeaderComparisonTest.php deleted file mode 100644 index 86c4fe866..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/HeaderComparisonTest.php +++ /dev/null @@ -1,115 +0,0 @@ - 'Foo' - ), array( - 'Content-Length' => 'Foo' - ), false), - - // Missing header - array(array( - 'X-Foo' => 'Bar' - ), array(), array( - '- X-Foo' => 'Bar' - )), - - // Extra headers is present - array(array( - 'X-Foo' => 'Bar' - ), array( - 'X-Foo' => 'Bar', - 'X-Baz' => 'Jar' - ), array( - '+ X-Baz' => 'Jar' - )), - - // Header is present but must be absent - array(array( - '!X-Foo' => '*' - ), array( - 'X-Foo' => 'Bar' - ), array( - '++ X-Foo' => 'Bar' - )), - - // Different values - array(array( - 'X-Foo' => 'Bar' - ), array( - 'X-Foo' => 'Baz' - ), array( - 'X-Foo' => 'Baz != Bar' - )), - - // Wildcard search passes - array(array( - 'X-Foo' => '*' - ), array( - 'X-Foo' => 'Bar' - ), false), - - // Wildcard search fails - array(array( - 'X-Foo' => '*' - ), array(), array( - '- X-Foo' => '*' - )), - - // Ignore extra header if present - array(array( - 'X-Foo' => '*', - '_X-Bar' => '*', - ), array( - 'X-Foo' => 'Baz', - 'X-Bar' => 'Jar' - ), false), - - // Ignore extra header if present and is not - array(array( - 'X-Foo' => '*', - '_X-Bar' => '*', - ), array( - 'X-Foo' => 'Baz' - ), false), - - // Case insensitive - array(array( - 'X-Foo' => '*', - '_X-Bar' => '*', - ), array( - 'x-foo' => 'Baz', - 'x-BAR' => 'baz' - ), false), - - // Case insensitive with collection - array(array( - 'X-Foo' => '*', - '_X-Bar' => '*', - ), new Collection(array( - 'x-foo' => 'Baz', - 'x-BAR' => 'baz' - )), false), - ); - } - - /** - * @dataProvider filterProvider - */ - public function testComparesHeaders($filters, $headers, $result) - { - $compare = new HeaderComparison(); - $this->assertEquals($result, $compare->compare($filters, $headers)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/HeaderTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/HeaderTest.php deleted file mode 100644 index c7502349f..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/HeaderTest.php +++ /dev/null @@ -1,162 +0,0 @@ - array('foo', 'Foo'), - 'Zoo' => 'bar', - ); - - public function testStoresHeaderName() - { - $i = new Header('Zoo', $this->test); - $this->assertEquals('Zoo', $i->getName()); - } - - public function testConvertsToString() - { - $i = new Header('Zoo', $this->test); - $this->assertEquals('foo, Foo, bar', (string) $i); - $i->setGlue(';'); - $this->assertEquals('foo; Foo; bar', (string) $i); - } - - public function testNormalizesGluedHeaders() - { - $h = new Header('Zoo', array('foo, Faz', 'bar')); - $result = $h->normalize(true)->toArray(); - natsort($result); - $this->assertEquals(array('bar', 'foo', 'Faz'), $result); - } - - public function testCanSearchForValues() - { - $h = new Header('Zoo', $this->test); - $this->assertTrue($h->hasValue('foo')); - $this->assertTrue($h->hasValue('Foo')); - $this->assertTrue($h->hasValue('bar')); - $this->assertFalse($h->hasValue('moo')); - $this->assertFalse($h->hasValue('FoO')); - } - - public function testIsCountable() - { - $h = new Header('Zoo', $this->test); - $this->assertEquals(3, count($h)); - } - - public function testCanBeIterated() - { - $h = new Header('Zoo', $this->test); - $results = array(); - foreach ($h as $key => $value) { - $results[$key] = $value; - } - $this->assertEquals(array( - 'foo', 'Foo', 'bar' - ), $results); - } - - public function testAllowsFalseyValues() - { - // Allows 0 - $h = new Header('Foo', 0, ';'); - $this->assertEquals('0', (string) $h); - $this->assertEquals(1, count($h)); - $this->assertEquals(';', $h->getGlue()); - - // Does not add a null header by default - $h = new Header('Foo'); - $this->assertEquals('', (string) $h); - $this->assertEquals(0, count($h)); - - // Allows null array for a single null header - $h = new Header('Foo', array(null)); - $this->assertEquals('', (string) $h); - - // Allows empty string - $h = new Header('Foo', ''); - $this->assertEquals('', (string) $h); - $this->assertEquals(1, count($h)); - $this->assertEquals(1, count($h->normalize()->toArray())); - } - - public function testCanRemoveValues() - { - $h = new Header('Foo', array('Foo', 'baz', 'bar')); - $h->removeValue('bar'); - $this->assertTrue($h->hasValue('Foo')); - $this->assertFalse($h->hasValue('bar')); - $this->assertTrue($h->hasValue('baz')); - } - - public function testAllowsArrayInConstructor() - { - $h = new Header('Foo', array('Testing', '123', 'Foo=baz')); - $this->assertEquals(array('Testing', '123', 'Foo=baz'), $h->toArray()); - } - - public function parseParamsProvider() - { - $res1 = array( - array( - '' => '', - 'rel' => 'front', - 'type' => 'image/jpeg', - ), - array( - '' => '', - 'rel' => 'back', - 'type' => 'image/jpeg', - ), - ); - - return array( - array( - '; rel="front"; type="image/jpeg", ; rel=back; type="image/jpeg"', - $res1 - ), - array( - '; rel="front"; type="image/jpeg",; rel=back; type="image/jpeg"', - $res1 - ), - array( - 'foo="baz"; bar=123, boo, test="123", foobar="foo;bar"', - array( - array('foo' => 'baz', 'bar' => '123'), - array('boo' => ''), - array('test' => '123'), - array('foobar' => 'foo;bar') - ) - ), - array( - '; rel="side"; type="image/jpeg",; rel=side; type="image/jpeg"', - array( - array('' => '', 'rel' => 'side', 'type' => 'image/jpeg'), - array('' => '', 'rel' => 'side', 'type' => 'image/jpeg') - ) - ), - array( - '', - array() - ) - ); - } - - /** - * @dataProvider parseParamsProvider - */ - public function testParseParams($header, $result) - { - $response = new Response(200, array('Link' => $header)); - $this->assertEquals($result, $response->getHeader('Link')->parseParams()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/PostFileTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/PostFileTest.php deleted file mode 100644 index be048cb95..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/PostFileTest.php +++ /dev/null @@ -1,88 +0,0 @@ -assertEquals('foo', $file->getFieldName()); - $this->assertEquals(__FILE__, $file->getFilename()); - $this->assertEquals('boo', $file->getPostName()); - $this->assertEquals('x-foo', $file->getContentType()); - } - - public function testRemovesLeadingAtSymbolFromPath() - { - $file = new PostFile('foo', '@' . __FILE__); - $this->assertEquals(__FILE__, $file->getFilename()); - } - - /** - * @expectedException Guzzle\Common\Exception\InvalidArgumentException - */ - public function testEnsuresFileIsReadable() - { - $file = new PostFile('foo', '/foo/baz/bar'); - } - - public function testCanChangeContentType() - { - $file = new PostFile('foo', '@' . __FILE__); - $file->setContentType('Boo'); - $this->assertEquals('Boo', $file->getContentType()); - } - - public function testCanChangeFieldName() - { - $file = new PostFile('foo', '@' . __FILE__); - $file->setFieldName('Boo'); - $this->assertEquals('Boo', $file->getFieldName()); - } - - public function testReturnsCurlValueString() - { - $file = new PostFile('foo', __FILE__); - if (version_compare(phpversion(), '5.5.0', '<')) { - $this->assertContains('@' . __FILE__ . ';filename=PostFileTest.php;type=text/x-', $file->getCurlValue()); - } else { - $c = $file->getCurlValue(); - $this->assertEquals(__FILE__, $c->getFilename()); - $this->assertEquals('PostFileTest.php', $c->getPostFilename()); - $this->assertContains('text/x-', $c->getMimeType()); - } - } - - public function testReturnsCurlValueStringAndPostname() - { - $file = new PostFile('foo', __FILE__, null, 'NewPostFileTest.php'); - if (version_compare(phpversion(), '5.5.0', '<')) { - $this->assertContains('@' . __FILE__ . ';filename=NewPostFileTest.php;type=text/x-', $file->getCurlValue()); - } else { - $c = $file->getCurlValue(); - $this->assertEquals(__FILE__, $c->getFilename()); - $this->assertEquals('NewPostFileTest.php', $c->getPostFilename()); - $this->assertContains('text/x-', $c->getMimeType()); - } - } - - public function testContentDispositionFilePathIsStripped() - { - $this->getServer()->flush(); - $client = new Client($this->getServer()->getUrl()); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $request = $client->post()->addPostFile('file', __FILE__); - $request->send(); - $requests = $this->getServer()->getReceivedRequests(false); - $this->assertContains('POST / HTTP/1.1', $requests[0]); - $this->assertContains('Content-Disposition: form-data; name="file"; filename="PostFileTest.php"', $requests[0]); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/RequestFactoryTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/RequestFactoryTest.php deleted file mode 100644 index 80b8d5415..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/RequestFactoryTest.php +++ /dev/null @@ -1,616 +0,0 @@ -assertSame($factory, RequestFactory::getInstance()); - } - - public function testCreatesNewGetRequests() - { - $request = RequestFactory::getInstance()->create('GET', 'http://www.google.com/'); - $this->assertInstanceOf('Guzzle\\Http\\Message\\MessageInterface', $request); - $this->assertInstanceOf('Guzzle\\Http\\Message\\RequestInterface', $request); - $this->assertInstanceOf('Guzzle\\Http\\Message\\Request', $request); - $this->assertEquals('GET', $request->getMethod()); - $this->assertEquals('http', $request->getScheme()); - $this->assertEquals('http://www.google.com/', $request->getUrl()); - $this->assertEquals('www.google.com', $request->getHost()); - $this->assertEquals('/', $request->getPath()); - $this->assertEquals('/', $request->getResource()); - - // Create a GET request with a custom receiving body - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $b = EntityBody::factory(); - $request = RequestFactory::getInstance()->create('GET', $this->getServer()->getUrl(), null, $b); - $request->setClient(new Client()); - $response = $request->send(); - $this->assertSame($b, $response->getBody()); - } - - public function testCreatesPutRequests() - { - // Test using a string - $request = RequestFactory::getInstance()->create('PUT', 'http://www.google.com/path?q=1&v=2', null, 'Data'); - $this->assertInstanceOf('Guzzle\\Http\\Message\\EntityEnclosingRequest', $request); - $this->assertEquals('PUT', $request->getMethod()); - $this->assertEquals('http', $request->getScheme()); - $this->assertEquals('http://www.google.com/path?q=1&v=2', $request->getUrl()); - $this->assertEquals('www.google.com', $request->getHost()); - $this->assertEquals('/path', $request->getPath()); - $this->assertEquals('/path?q=1&v=2', $request->getResource()); - $this->assertInstanceOf('Guzzle\\Http\\EntityBody', $request->getBody()); - $this->assertEquals('Data', (string) $request->getBody()); - unset($request); - - // Test using an EntityBody - $request = RequestFactory::getInstance()->create('PUT', 'http://www.google.com/path?q=1&v=2', null, EntityBody::factory('Data')); - $this->assertInstanceOf('Guzzle\\Http\\Message\\EntityEnclosingRequest', $request); - $this->assertEquals('Data', (string) $request->getBody()); - - // Test using a resource - $resource = fopen('php://temp', 'w+'); - fwrite($resource, 'Data'); - $request = RequestFactory::getInstance()->create('PUT', 'http://www.google.com/path?q=1&v=2', null, $resource); - $this->assertInstanceOf('Guzzle\\Http\\Message\\EntityEnclosingRequest', $request); - $this->assertEquals('Data', (string) $request->getBody()); - - // Test using an object that can be cast as a string - $request = RequestFactory::getInstance()->create('PUT', 'http://www.google.com/path?q=1&v=2', null, Url::factory('http://www.example.com/')); - $this->assertInstanceOf('Guzzle\\Http\\Message\\EntityEnclosingRequest', $request); - $this->assertEquals('http://www.example.com/', (string) $request->getBody()); - } - - public function testCreatesHeadAndDeleteRequests() - { - $request = RequestFactory::getInstance()->create('DELETE', 'http://www.test.com/'); - $this->assertEquals('DELETE', $request->getMethod()); - $request = RequestFactory::getInstance()->create('HEAD', 'http://www.test.com/'); - $this->assertEquals('HEAD', $request->getMethod()); - } - - public function testCreatesOptionsRequests() - { - $request = RequestFactory::getInstance()->create('OPTIONS', 'http://www.example.com/'); - $this->assertEquals('OPTIONS', $request->getMethod()); - $this->assertInstanceOf('Guzzle\\Http\\Message\\EntityEnclosingRequest', $request); - } - - public function testCreatesNewPutRequestWithBody() - { - $request = RequestFactory::getInstance()->create('PUT', 'http://www.google.com/path?q=1&v=2', null, 'Data'); - $this->assertEquals('Data', (string) $request->getBody()); - } - - public function testCreatesNewPostRequestWithFields() - { - // Use an array - $request = RequestFactory::getInstance()->create('POST', 'http://www.google.com/path?q=1&v=2', null, array( - 'a' => 'b' - )); - $this->assertEquals(array('a' => 'b'), $request->getPostFields()->getAll()); - unset($request); - - // Use a collection - $request = RequestFactory::getInstance()->create('POST', 'http://www.google.com/path?q=1&v=2', null, new Collection(array( - 'a' => 'b' - ))); - $this->assertEquals(array('a' => 'b'), $request->getPostFields()->getAll()); - - // Use a QueryString - $request = RequestFactory::getInstance()->create('POST', 'http://www.google.com/path?q=1&v=2', null, new QueryString(array( - 'a' => 'b' - ))); - $this->assertEquals(array('a' => 'b'), $request->getPostFields()->getAll()); - - $request = RequestFactory::getInstance()->create('POST', 'http://www.test.com/', null, array( - 'a' => 'b', - 'file' => '@' . __FILE__ - )); - - $this->assertEquals(array( - 'a' => 'b' - ), $request->getPostFields()->getAll()); - - $files = $request->getPostFiles(); - $this->assertInstanceOf('Guzzle\Http\Message\PostFile', $files['file'][0]); - } - - public function testCreatesFromParts() - { - $parts = parse_url('http://michael:123@www.google.com:8080/path?q=1&v=2'); - - $request = RequestFactory::getInstance()->fromParts('PUT', $parts, null, 'Data'); - $this->assertInstanceOf('Guzzle\\Http\\Message\\EntityEnclosingRequest', $request); - $this->assertEquals('PUT', $request->getMethod()); - $this->assertEquals('http', $request->getScheme()); - $this->assertEquals('http://www.google.com:8080/path?q=1&v=2', $request->getUrl()); - $this->assertEquals('www.google.com', $request->getHost()); - $this->assertEquals('www.google.com:8080', $request->getHeader('Host')); - $this->assertEquals('/path', $request->getPath()); - $this->assertEquals('/path?q=1&v=2', $request->getResource()); - $this->assertInstanceOf('Guzzle\\Http\\EntityBody', $request->getBody()); - $this->assertEquals('Data', (string) $request->getBody()); - $this->assertEquals('michael', $request->getUsername()); - $this->assertEquals('123', $request->getPassword()); - $this->assertEquals('8080', $request->getPort()); - $this->assertEquals(array( - 'scheme' => 'http', - 'host' => 'www.google.com', - 'port' => 8080, - 'path' => '/path', - 'query' => 'q=1&v=2', - ), parse_url($request->getUrl())); - } - - public function testCreatesFromMessage() - { - $auth = base64_encode('michael:123'); - $message = "PUT /path?q=1&v=2 HTTP/1.1\r\nHost: www.google.com:8080\r\nContent-Length: 4\r\nAuthorization: Basic {$auth}\r\n\r\nData"; - $request = RequestFactory::getInstance()->fromMessage($message); - $this->assertInstanceOf('Guzzle\\Http\\Message\\EntityEnclosingRequest', $request); - $this->assertEquals('PUT', $request->getMethod()); - $this->assertEquals('http', $request->getScheme()); - $this->assertEquals('http://www.google.com:8080/path?q=1&v=2', $request->getUrl()); - $this->assertEquals('www.google.com', $request->getHost()); - $this->assertEquals('www.google.com:8080', $request->getHeader('Host')); - $this->assertEquals('/path', $request->getPath()); - $this->assertEquals('/path?q=1&v=2', $request->getResource()); - $this->assertInstanceOf('Guzzle\\Http\\EntityBody', $request->getBody()); - $this->assertEquals('Data', (string) $request->getBody()); - $this->assertEquals("Basic {$auth}", (string) $request->getHeader('Authorization')); - $this->assertEquals('8080', $request->getPort()); - - // Test passing a blank message returns false - $this->assertFalse($request = RequestFactory::getInstance()->fromMessage('')); - - // Test passing a url with no port - $message = "PUT /path?q=1&v=2 HTTP/1.1\r\nHost: www.google.com\r\nContent-Length: 4\r\nAuthorization: Basic {$auth}\r\n\r\nData"; - $request = RequestFactory::getInstance()->fromMessage($message); - $this->assertInstanceOf('Guzzle\\Http\\Message\\EntityEnclosingRequest', $request); - $this->assertEquals('PUT', $request->getMethod()); - $this->assertEquals('http', $request->getScheme()); - $this->assertEquals('http://www.google.com/path?q=1&v=2', $request->getUrl()); - $this->assertEquals('www.google.com', $request->getHost()); - $this->assertEquals('/path', $request->getPath()); - $this->assertEquals('/path?q=1&v=2', $request->getResource()); - $this->assertInstanceOf('Guzzle\\Http\\EntityBody', $request->getBody()); - $this->assertEquals('Data', (string) $request->getBody()); - $this->assertEquals("Basic {$auth}", (string) $request->getHeader('Authorization')); - $this->assertEquals(80, $request->getPort()); - } - - public function testCreatesNewTraceRequest() - { - $request = RequestFactory::getInstance()->create('TRACE', 'http://www.google.com/'); - $this->assertFalse($request instanceof \Guzzle\Http\Message\EntityEnclosingRequest); - $this->assertEquals('TRACE', $request->getMethod()); - } - - public function testCreatesProperTransferEncodingRequests() - { - $request = RequestFactory::getInstance()->create('PUT', 'http://www.google.com/', array( - 'Transfer-Encoding' => 'chunked' - ), 'hello'); - $this->assertEquals('chunked', $request->getHeader('Transfer-Encoding')); - $this->assertFalse($request->hasHeader('Content-Length')); - } - - public function testProperlyDealsWithDuplicateHeaders() - { - $parser = new MessageParser(); - - $message = "POST / http/1.1\r\n" - . "DATE:Mon, 09 Sep 2011 23:36:00 GMT\r\n" - . "host:host.foo.com\r\n" - . "ZOO:abc\r\n" - . "ZOO:123\r\n" - . "ZOO:HI\r\n" - . "zoo:456\r\n\r\n"; - - $parts = $parser->parseRequest($message); - $this->assertEquals(array ( - 'DATE' => 'Mon, 09 Sep 2011 23:36:00 GMT', - 'host' => 'host.foo.com', - 'ZOO' => array('abc', '123', 'HI'), - 'zoo' => '456', - ), $parts['headers']); - - $request = RequestFactory::getInstance()->fromMessage($message); - - $this->assertEquals(array( - 'abc', '123', 'HI', '456' - ), $request->getHeader('zoo')->toArray()); - } - - public function testCreatesHttpMessagesWithBodiesAndNormalizesLineEndings() - { - $message = "POST / http/1.1\r\n" - . "Content-Type:application/x-www-form-urlencoded; charset=utf8\r\n" - . "Date:Mon, 09 Sep 2011 23:36:00 GMT\r\n" - . "Host:host.foo.com\r\n\r\n" - . "foo=bar"; - - $request = RequestFactory::getInstance()->fromMessage($message); - $this->assertEquals('application/x-www-form-urlencoded; charset=utf8', (string) $request->getHeader('Content-Type')); - $this->assertEquals('foo=bar', (string) $request->getBody()); - - $message = "POST / http/1.1\n" - . "Content-Type:application/x-www-form-urlencoded; charset=utf8\n" - . "Date:Mon, 09 Sep 2011 23:36:00 GMT\n" - . "Host:host.foo.com\n\n" - . "foo=bar"; - $request = RequestFactory::getInstance()->fromMessage($message); - $this->assertEquals('foo=bar', (string) $request->getBody()); - - $message = "PUT / HTTP/1.1\r\nContent-Length: 0\r\n\r\n"; - $request = RequestFactory::getInstance()->fromMessage($message); - $this->assertTrue($request->hasHeader('Content-Length')); - $this->assertEquals(0, (string) $request->getHeader('Content-Length')); - } - - public function testBugPathIncorrectlyHandled() - { - $message = "POST /foo\r\n\r\nBODY"; - $request = RequestFactory::getInstance()->fromMessage($message); - $this->assertSame('POST', $request->getMethod()); - $this->assertSame('/foo', $request->getPath()); - $this->assertSame('BODY', (string) $request->getBody()); - } - - public function testHandlesChunkedTransferEncoding() - { - $request = RequestFactory::getInstance()->create('PUT', 'http://www.foo.com/', array( - 'Transfer-Encoding' => 'chunked' - ), 'Test'); - $this->assertFalse($request->hasHeader('Content-Length')); - $this->assertEquals('chunked', $request->getHeader('Transfer-Encoding')); - - $request = RequestFactory::getInstance()->create('POST', 'http://www.foo.com/', array( - 'transfer-encoding' => 'chunked' - ), array( - 'foo' => 'bar' - )); - - $this->assertFalse($request->hasHeader('Content-Length')); - $this->assertEquals('chunked', $request->getHeader('Transfer-Encoding')); - } - - public function testClonesRequestsWithMethodWithoutClient() - { - $f = RequestFactory::getInstance(); - $request = $f->create('GET', 'http://www.test.com', array('X-Foo' => 'Bar')); - $request->getParams()->replace(array('test' => '123')); - $request->getCurlOptions()->set('foo', 'bar'); - $cloned = $f->cloneRequestWithMethod($request, 'PUT'); - $this->assertEquals('PUT', $cloned->getMethod()); - $this->assertEquals('Bar', (string) $cloned->getHeader('X-Foo')); - $this->assertEquals('http://www.test.com', $cloned->getUrl()); - // Ensure params are cloned and cleaned up - $this->assertEquals(1, count($cloned->getParams()->getAll())); - $this->assertEquals('123', $cloned->getParams()->get('test')); - // Ensure curl options are cloned - $this->assertEquals('bar', $cloned->getCurlOptions()->get('foo')); - // Ensure event dispatcher is cloned - $this->assertNotSame($request->getEventDispatcher(), $cloned->getEventDispatcher()); - } - - public function testClonesRequestsWithMethodWithClient() - { - $f = RequestFactory::getInstance(); - $client = new Client(); - $request = $client->put('http://www.test.com', array('Content-Length' => 4), 'test'); - $cloned = $f->cloneRequestWithMethod($request, 'GET'); - $this->assertEquals('GET', $cloned->getMethod()); - $this->assertNull($cloned->getHeader('Content-Length')); - $this->assertEquals('http://www.test.com', $cloned->getUrl()); - $this->assertSame($request->getClient(), $cloned->getClient()); - } - - public function testClonesRequestsWithMethodWithClientWithEntityEnclosingChange() - { - $f = RequestFactory::getInstance(); - $client = new Client(); - $request = $client->put('http://www.test.com', array('Content-Length' => 4), 'test'); - $cloned = $f->cloneRequestWithMethod($request, 'POST'); - $this->assertEquals('POST', $cloned->getMethod()); - $this->assertEquals('test', (string) $cloned->getBody()); - } - - public function testCanDisableRedirects() - { - $this->getServer()->enqueue(array( - "HTTP/1.1 307\r\nLocation: " . $this->getServer()->getUrl() . "\r\nContent-Length: 0\r\n\r\n" - )); - $client = new Client($this->getServer()->getUrl()); - $response = $client->get('/', array(), array('allow_redirects' => false))->send(); - $this->assertEquals(307, $response->getStatusCode()); - } - - public function testCanAddCookies() - { - $client = new Client($this->getServer()->getUrl()); - $request = $client->get('/', array(), array('cookies' => array('Foo' => 'Bar'))); - $this->assertEquals('Bar', $request->getCookie('Foo')); - } - - public function testCanAddQueryString() - { - $request = RequestFactory::getInstance()->create('GET', 'http://foo.com', array(), null, array( - 'query' => array('Foo' => 'Bar') - )); - $this->assertEquals('Bar', $request->getQuery()->get('Foo')); - } - - public function testCanSetDefaultQueryString() - { - $request = new Request('GET', 'http://www.foo.com?test=abc'); - RequestFactory::getInstance()->applyOptions($request, array( - 'query' => array('test' => '123', 'other' => 't123') - ), RequestFactory::OPTIONS_AS_DEFAULTS); - $this->assertEquals('abc', $request->getQuery()->get('test')); - $this->assertEquals('t123', $request->getQuery()->get('other')); - } - - public function testCanAddBasicAuth() - { - $request = RequestFactory::getInstance()->create('GET', 'http://foo.com', array(), null, array( - 'auth' => array('michael', 'test') - )); - $this->assertEquals('michael', $request->getUsername()); - $this->assertEquals('test', $request->getPassword()); - } - - public function testCanAddDigestAuth() - { - $request = RequestFactory::getInstance()->create('GET', 'http://foo.com', array(), null, array( - 'auth' => array('michael', 'test', 'digest') - )); - $this->assertEquals(CURLAUTH_DIGEST, $request->getCurlOptions()->get(CURLOPT_HTTPAUTH)); - $this->assertEquals('michael', $request->getUsername()); - $this->assertEquals('test', $request->getPassword()); - } - - public function testCanAddEvents() - { - $foo = null; - $client = new Client(); - $client->addSubscriber(new MockPlugin(array(new Response(200)))); - $request = $client->get($this->getServer()->getUrl(), array(), array( - 'events' => array( - 'request.before_send' => function () use (&$foo) { $foo = true; } - ) - )); - $request->send(); - $this->assertTrue($foo); - } - - public function testCanAddEventsWithPriority() - { - $foo = null; - $client = new Client(); - $client->addSubscriber(new MockPlugin(array(new Response(200)))); - $request = $client->get($this->getServer()->getUrl(), array(), array( - 'events' => array( - 'request.before_send' => array(function () use (&$foo) { $foo = true; }, 100) - ) - )); - $request->send(); - $this->assertTrue($foo); - } - - public function testCanAddPlugins() - { - $mock = new MockPlugin(array( - new Response(200), - new Response(200) - )); - $client = new Client(); - $client->addSubscriber($mock); - $request = $client->get('/', array(), array( - 'plugins' => array($mock) - )); - $request->send(); - } - - public function testCanDisableExceptions() - { - $client = new Client(); - $request = $client->get('/', array(), array( - 'plugins' => array(new MockPlugin(array(new Response(500)))), - 'exceptions' => false - )); - $this->assertEquals(500, $request->send()->getStatusCode()); - } - - public function testCanDisableExceptionsWithErrorListener() - { - $client = new Client(); - $client->getEventDispatcher()->addListener('request.error', function () {}); - $request = $client->get('/', array(), array( - 'plugins' => array(new MockPlugin(array(new Response(500)))), - 'exceptions' => false - )); - $this->assertEquals(500, $request->send()->getStatusCode()); - } - - public function testCanChangeSaveToLocation() - { - $r = EntityBody::factory(); - $client = new Client(); - $request = $client->get('/', array(), array( - 'plugins' => array(new MockPlugin(array(new Response(200, array(), 'testing')))), - 'save_to' => $r - )); - $request->send(); - $this->assertEquals('testing', (string) $r); - } - - public function testCanSetProxy() - { - $client = new Client(); - $request = $client->get('/', array(), array('proxy' => '192.168.16.121')); - $this->assertEquals('192.168.16.121', $request->getCurlOptions()->get(CURLOPT_PROXY)); - } - - public function testCanSetHeadersOption() - { - $client = new Client(); - $request = $client->get('/', array(), array('headers' => array('Foo' => 'Bar'))); - $this->assertEquals('Bar', (string) $request->getHeader('Foo')); - } - - public function testCanSetDefaultHeadersOptions() - { - $request = new Request('GET', 'http://www.foo.com', array('Foo' => 'Bar')); - RequestFactory::getInstance()->applyOptions($request, array( - 'headers' => array('Foo' => 'Baz', 'Bam' => 't123') - ), RequestFactory::OPTIONS_AS_DEFAULTS); - $this->assertEquals('Bar', (string) $request->getHeader('Foo')); - $this->assertEquals('t123', (string) $request->getHeader('Bam')); - } - - public function testCanSetBodyOption() - { - $client = new Client(); - $request = $client->put('/', array(), null, array('body' => 'test')); - $this->assertEquals('test', (string) $request->getBody()); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testValidatesBodyOption() - { - $client = new Client(); - $client->get('/', array(), array('body' => 'test')); - } - - public function testCanSetTimeoutOption() - { - $client = new Client(); - $request = $client->get('/', array(), array('timeout' => 1.5)); - $this->assertEquals(1500, $request->getCurlOptions()->get(CURLOPT_TIMEOUT_MS)); - } - - public function testCanSetConnectTimeoutOption() - { - $client = new Client(); - $request = $client->get('/', array(), array('connect_timeout' => 1.5)); - $this->assertEquals(1500, $request->getCurlOptions()->get(CURLOPT_CONNECTTIMEOUT_MS)); - } - - public function testCanSetDebug() - { - $client = new Client(); - $request = $client->get('/', array(), array('debug' => true)); - $this->assertTrue($request->getCurlOptions()->get(CURLOPT_VERBOSE)); - } - - public function testCanSetVerifyToOff() - { - $client = new Client(); - $request = $client->get('/', array(), array('verify' => false)); - $this->assertNull($request->getCurlOptions()->get(CURLOPT_CAINFO)); - $this->assertSame(0, $request->getCurlOptions()->get(CURLOPT_SSL_VERIFYHOST)); - $this->assertFalse($request->getCurlOptions()->get(CURLOPT_SSL_VERIFYPEER)); - } - - public function testCanSetVerifyToOn() - { - $client = new Client(); - $request = $client->get('/', array(), array('verify' => true)); - $this->assertNotNull($request->getCurlOptions()->get(CURLOPT_CAINFO)); - $this->assertSame(2, $request->getCurlOptions()->get(CURLOPT_SSL_VERIFYHOST)); - $this->assertTrue($request->getCurlOptions()->get(CURLOPT_SSL_VERIFYPEER)); - } - - public function testCanSetVerifyToPath() - { - $client = new Client(); - $request = $client->get('/', array(), array('verify' => '/foo.pem')); - $this->assertEquals('/foo.pem', $request->getCurlOptions()->get(CURLOPT_CAINFO)); - $this->assertSame(2, $request->getCurlOptions()->get(CURLOPT_SSL_VERIFYHOST)); - $this->assertTrue($request->getCurlOptions()->get(CURLOPT_SSL_VERIFYPEER)); - } - - public function inputValidation() - { - return array_map(function ($option) { return array($option); }, array( - 'headers', 'query', 'cookies', 'auth', 'events', 'plugins', 'params' - )); - } - - /** - * @dataProvider inputValidation - * @expectedException \Guzzle\Common\Exception\InvalidArgumentException - */ - public function testValidatesInput($option) - { - $client = new Client(); - $client->get('/', array(), array($option => 'foo')); - } - - public function testCanAddRequestParams() - { - $client = new Client(); - $request = $client->put('/', array(), null, array('params' => array('foo' => 'test'))); - $this->assertEquals('test', $request->getParams()->get('foo')); - } - - public function testCanAddSslKey() - { - $client = new Client(); - $request = $client->get('/', array(), array('ssl_key' => '/foo.pem')); - $this->assertEquals('/foo.pem', $request->getCurlOptions()->get(CURLOPT_SSLKEY)); - } - - public function testCanAddSslKeyPassword() - { - $client = new Client(); - $request = $client->get('/', array(), array('ssl_key' => array('/foo.pem', 'bar'))); - $this->assertEquals('/foo.pem', $request->getCurlOptions()->get(CURLOPT_SSLKEY)); - $this->assertEquals('bar', $request->getCurlOptions()->get(CURLOPT_SSLKEYPASSWD)); - } - - public function testCanAddSslCert() - { - $client = new Client(); - $request = $client->get('/', array(), array('cert' => '/foo.pem')); - $this->assertEquals('/foo.pem', $request->getCurlOptions()->get(CURLOPT_SSLCERT)); - } - - public function testCanAddSslCertPassword() - { - $client = new Client(); - $request = $client->get('/', array(), array('cert' => array('/foo.pem', 'bar'))); - $this->assertEquals('/foo.pem', $request->getCurlOptions()->get(CURLOPT_SSLCERT)); - $this->assertEquals('bar', $request->getCurlOptions()->get(CURLOPT_SSLCERTPASSWD)); - } - - public function testCreatesBodyWithoutZeroString() - { - $request = RequestFactory::getInstance()->create('PUT', 'http://test.com', array(), '0'); - $this->assertSame('0', (string) $request->getBody()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/RequestTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/RequestTest.php deleted file mode 100644 index 5bf624829..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/RequestTest.php +++ /dev/null @@ -1,639 +0,0 @@ -client = new Client($this->getServer()->getUrl()); - $this->request = $this->client->get(); - } - - public function tearDown() - { - unset($this->request); - unset($this->client); - } - - public function testConstructorBuildsRequestWithArrayHeaders() - { - // Test passing an array of headers - $request = new Request('GET', 'http://www.guzzle-project.com/', array( - 'foo' => 'bar' - )); - - $this->assertEquals('GET', $request->getMethod()); - $this->assertEquals('http://www.guzzle-project.com/', $request->getUrl()); - $this->assertEquals('bar', $request->getHeader('foo')); - } - - public function testDescribesEvents() - { - $this->assertInternalType('array', Request::getAllEvents()); - } - - public function testConstructorBuildsRequestWithCollectionHeaders() - { - $request = new Request('GET', 'http://www.guzzle-project.com/', new Collection(array( - 'foo' => 'bar' - ))); - $this->assertEquals('bar', $request->getHeader('foo')); - } - - public function testConstructorBuildsRequestWithNoHeaders() - { - $request = new Request('GET', 'http://www.guzzle-project.com/', null); - $this->assertFalse($request->hasHeader('foo')); - } - - public function testConstructorHandlesNonBasicAuth() - { - $request = new Request('GET', 'http://www.guzzle-project.com/', array( - 'Authorization' => 'Foo bar' - )); - $this->assertNull($request->getUserName()); - $this->assertNull($request->getPassword()); - $this->assertEquals('Foo bar', (string) $request->getHeader('Authorization')); - } - - public function testRequestsCanBeConvertedToRawMessageStrings() - { - $auth = base64_encode('michael:123'); - $message = "PUT /path?q=1&v=2 HTTP/1.1\r\n" - . "Host: www.google.com\r\n" - . "Authorization: Basic {$auth}\r\n" - . "Content-Length: 4\r\n\r\nData"; - - $request = RequestFactory::getInstance()->create('PUT', 'http://www.google.com/path?q=1&v=2', array( - 'Authorization' => 'Basic ' . $auth - ), 'Data'); - - $this->assertEquals($message, $request->__toString()); - } - - /** - * Add authorization after the fact and see that it was put in the message - */ - public function testRequestStringsIncludeAuth() - { - $auth = base64_encode('michael:123'); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $request = RequestFactory::getInstance()->create('PUT', $this->getServer()->getUrl(), null, 'Data') - ->setClient($this->client) - ->setAuth('michael', '123', CURLAUTH_BASIC); - $request->send(); - - $this->assertContains('Authorization: Basic ' . $auth, (string) $request); - } - - public function testGetEventDispatcher() - { - $d = $this->request->getEventDispatcher(); - $this->assertInstanceOf('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface', $d); - $this->assertEquals($d, $this->request->getEventDispatcher()); - } - - public function testRequestsManageClients() - { - $request = new Request('GET', 'http://test.com'); - $this->assertNull($request->getClient()); - $request->setClient($this->client); - $this->assertSame($this->client, $request->getClient()); - } - - /** - * @expectedException \RuntimeException - * @expectedExceptionMessage A client must be set on the request - */ - public function testRequestsRequireClients() - { - $request = new Request('GET', 'http://test.com'); - $request->send(); - } - - public function testSend() - { - $response = new Response(200, array( - 'Content-Length' => 3 - ), 'abc'); - $this->request->setResponse($response, true); - $r = $this->request->send(); - - $this->assertSame($response, $r); - $this->assertInstanceOf('Guzzle\\Http\\Message\\Response', $this->request->getResponse()); - $this->assertSame($r, $this->request->getResponse()); - $this->assertEquals('complete', $this->request->getState()); - } - - public function testGetResponse() - { - $this->assertNull($this->request->getResponse()); - $response = new Response(200, array('Content-Length' => 3), 'abc'); - - $this->request->setResponse($response); - $this->assertEquals($response, $this->request->getResponse()); - - $client = new Client('http://www.google.com'); - $request = $client->get('http://www.google.com/'); - $request->setResponse($response, true); - $request->send(); - $requestResponse = $request->getResponse(); - $this->assertSame($response, $requestResponse); - - // Try again, making sure it's still the same response - $this->assertSame($requestResponse, $request->getResponse()); - - $response = new Response(204); - $request = $client->get(); - $request->setResponse($response, true); - $request->send(); - $requestResponse = $request->getResponse(); - $this->assertSame($response, $requestResponse); - $this->assertInstanceOf('Guzzle\\Http\\EntityBody', $response->getBody()); - } - - public function testRequestThrowsExceptionOnBadResponse() - { - try { - $this->request->setResponse(new Response(404, array('Content-Length' => 3), 'abc'), true); - $this->request->send(); - $this->fail('Expected exception not thrown'); - } catch (BadResponseException $e) { - $this->assertInstanceOf('Guzzle\\Http\\Message\\RequestInterface', $e->getRequest()); - $this->assertInstanceOf('Guzzle\\Http\\Message\\Response', $e->getResponse()); - $this->assertContains('Client error response', $e->getMessage()); - } - } - - public function testManagesQuery() - { - $this->assertInstanceOf('Guzzle\\Http\\QueryString', $this->request->getQuery()); - $this->request->getQuery()->set('test', '123'); - $this->assertEquals('test=123', $this->request->getQuery(true)); - } - - public function testRequestHasMethod() - { - $this->assertEquals('GET', $this->request->getMethod()); - } - - public function testRequestHasScheme() - { - $this->assertEquals('http', $this->request->getScheme()); - $this->assertEquals($this->request, $this->request->setScheme('https')); - $this->assertEquals('https', $this->request->getScheme()); - } - - public function testRequestHasHost() - { - $this->assertEquals('127.0.0.1', $this->request->getHost()); - $this->assertEquals('127.0.0.1:8124', (string) $this->request->getHeader('Host')); - - $this->assertSame($this->request, $this->request->setHost('www2.google.com')); - $this->assertEquals('www2.google.com', $this->request->getHost()); - $this->assertEquals('www2.google.com:8124', (string) $this->request->getHeader('Host')); - - $this->assertSame($this->request, $this->request->setHost('www.test.com:8081')); - $this->assertEquals('www.test.com', $this->request->getHost()); - $this->assertEquals(8081, $this->request->getPort()); - } - - public function testRequestHasProtocol() - { - $this->assertEquals('1.1', $this->request->getProtocolVersion()); - $this->assertEquals($this->request, $this->request->setProtocolVersion('1.1')); - $this->assertEquals('1.1', $this->request->getProtocolVersion()); - $this->assertEquals($this->request, $this->request->setProtocolVersion('1.0')); - $this->assertEquals('1.0', $this->request->getProtocolVersion()); - } - - public function testRequestHasPath() - { - $this->assertEquals('/', $this->request->getPath()); - $this->assertEquals($this->request, $this->request->setPath('/index.html')); - $this->assertEquals('/index.html', $this->request->getPath()); - $this->assertEquals($this->request, $this->request->setPath('index.html')); - $this->assertEquals('/index.html', $this->request->getPath()); - } - - public function testPermitsFalsyComponents() - { - $request = new Request('GET', 'http://0/0?0'); - $this->assertSame('0', $request->getHost()); - $this->assertSame('/0', $request->getPath()); - $this->assertSame('0', $request->getQuery(true)); - - $request = new Request('GET', '0'); - $this->assertEquals('/0', $request->getPath()); - } - - public function testRequestHasPort() - { - $this->assertEquals(8124, $this->request->getPort()); - $this->assertEquals('127.0.0.1:8124', $this->request->getHeader('Host')); - - $this->assertEquals($this->request, $this->request->setPort('8080')); - $this->assertEquals('8080', $this->request->getPort()); - $this->assertEquals('127.0.0.1:8080', $this->request->getHeader('Host')); - - $this->request->setPort(80); - $this->assertEquals('127.0.0.1', $this->request->getHeader('Host')); - } - - public function testRequestHandlesAuthorization() - { - // Uninitialized auth - $this->assertEquals(null, $this->request->getUsername()); - $this->assertEquals(null, $this->request->getPassword()); - - // Set an auth - $this->assertSame($this->request, $this->request->setAuth('michael', '123')); - $this->assertEquals('michael', $this->request->getUsername()); - $this->assertEquals('123', $this->request->getPassword()); - - // Set an auth with blank password - $this->assertSame($this->request, $this->request->setAuth('michael', '')); - $this->assertEquals('michael', $this->request->getUsername()); - $this->assertEquals('', $this->request->getPassword()); - - // Remove the auth - $this->request->setAuth(false); - $this->assertEquals(null, $this->request->getUsername()); - $this->assertEquals(null, $this->request->getPassword()); - - // Make sure that the cURL based auth works too - $request = new Request('GET', $this->getServer()->getUrl()); - $request->setAuth('michael', 'password', CURLAUTH_DIGEST); - $this->assertEquals('michael:password', $request->getCurlOptions()->get(CURLOPT_USERPWD)); - $this->assertEquals(CURLAUTH_DIGEST, $request->getCurlOptions()->get(CURLOPT_HTTPAUTH)); - } - - /** - * @expectedException \Guzzle\Common\Exception\InvalidArgumentException - */ - public function testValidatesAuth() - { - $this->request->setAuth('foo', 'bar', 'bam'); - } - - public function testGetResourceUri() - { - $this->assertEquals('/', $this->request->getResource()); - $this->request->setPath('/index.html'); - $this->assertEquals('/index.html', $this->request->getResource()); - $this->request->getQuery()->add('v', '1'); - $this->assertEquals('/index.html?v=1', $this->request->getResource()); - } - - public function testRequestHasMutableUrl() - { - $url = 'http://www.test.com:8081/path?q=123#fragment'; - $u = Url::factory($url); - $this->assertSame($this->request, $this->request->setUrl($url)); - $this->assertEquals($url, $this->request->getUrl()); - - $this->assertSame($this->request, $this->request->setUrl($u)); - $this->assertEquals($url, $this->request->getUrl()); - } - - public function testRequestHasState() - { - $this->assertEquals(RequestInterface::STATE_NEW, $this->request->getState()); - $this->request->setState(RequestInterface::STATE_TRANSFER); - $this->assertEquals(RequestInterface::STATE_TRANSFER, $this->request->getState()); - } - - public function testSetManualResponse() - { - $response = new Response(200, array( - 'Date' => 'Sat, 16 Oct 2010 17:27:14 GMT', - 'Expires' => '-1', - 'Cache-Control' => 'private, max-age=0', - 'Content-Type' => 'text/html; charset=ISO-8859-1', - ), 'response body'); - - $this->assertSame($this->request, $this->request->setResponse($response), '-> setResponse() must use a fluent interface'); - $this->assertEquals('complete', $this->request->getState(), '-> setResponse() must change the state of the request to complete'); - $this->assertSame($response, $this->request->getResponse(), '-> setResponse() must set the exact same response that was passed in to it'); - } - - public function testRequestCanHaveManuallySetResponseBody() - { - $file = __DIR__ . '/../../TestData/temp.out'; - if (file_exists($file)) { - unlink($file); - } - - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\ndata"); - $request = RequestFactory::getInstance()->create('GET', $this->getServer()->getUrl()); - $request->setClient($this->client); - $entityBody = EntityBody::factory(fopen($file, 'w+')); - $request->setResponseBody($entityBody); - $response = $request->send(); - $this->assertSame($entityBody, $response->getBody()); - - $this->assertTrue(file_exists($file)); - $this->assertEquals('data', file_get_contents($file)); - unlink($file); - - $this->assertEquals('data', $response->getBody(true)); - } - - public function testHoldsCookies() - { - $this->assertNull($this->request->getCookie('test')); - - // Set a cookie - $this->assertSame($this->request, $this->request->addCookie('test', 'abc')); - $this->assertEquals('abc', $this->request->getCookie('test')); - - // Multiple cookies by setting the Cookie header - $this->request->setHeader('Cookie', '__utma=1.638370270.1344367610.1374365610.1944450276.2; __utmz=1.1346368610.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); hl=de; PHPSESSID=ak93pqashi5uubuoq8fjv60897'); - $this->assertEquals('1.638370270.1344367610.1374365610.1944450276.2', $this->request->getCookie('__utma')); - $this->assertEquals('1.1346368610.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)', $this->request->getCookie('__utmz')); - $this->assertEquals('de', $this->request->getCookie('hl')); - $this->assertEquals('ak93pqashi5uubuoq8fjv60897', $this->request->getCookie('PHPSESSID')); - - // Unset the cookies by setting the Cookie header to null - $this->request->setHeader('Cookie', null); - $this->assertNull($this->request->getCookie('test')); - $this->request->removeHeader('Cookie'); - - // Set and remove a cookie - $this->assertSame($this->request, $this->request->addCookie('test', 'abc')); - $this->assertEquals('abc', $this->request->getCookie('test')); - $this->assertSame($this->request, $this->request->removeCookie('test')); - $this->assertNull($this->request->getCookie('test')); - - // Remove the cookie header - $this->assertSame($this->request, $this->request->addCookie('test', 'abc')); - $this->request->removeHeader('Cookie'); - $this->assertEquals('', (string) $this->request->getHeader('Cookie')); - - // Remove a cookie value - $this->request->addCookie('foo', 'bar')->addCookie('baz', 'boo'); - $this->request->removeCookie('foo'); - $this->assertEquals(array( - 'baz' => 'boo' - ), $this->request->getCookies()); - - $this->request->addCookie('foo', 'bar'); - $this->assertEquals('baz=boo; foo=bar', (string) $this->request->getHeader('Cookie')); - } - - /** - * @expectedException \Guzzle\Http\Exception\RequestException - * @expectedExceptionMessage Error completing request - */ - public function testRequestThrowsExceptionWhenSetToCompleteWithNoResponse() - { - $this->request->setState(RequestInterface::STATE_COMPLETE); - } - - public function testClonedRequestsUseNewInternalState() - { - $p = new AsyncPlugin(); - $this->request->getEventDispatcher()->addSubscriber($p); - $h = $this->request->getHeader('Host'); - - $r = clone $this->request; - $this->assertEquals(RequestInterface::STATE_NEW, $r->getState()); - $this->assertNotSame($r->getQuery(), $this->request->getQuery()); - $this->assertNotSame($r->getCurlOptions(), $this->request->getCurlOptions()); - $this->assertNotSame($r->getEventDispatcher(), $this->request->getEventDispatcher()); - $this->assertEquals($r->getHeaders(), $this->request->getHeaders()); - $this->assertNotSame($h, $r->getHeader('Host')); - $this->assertNotSame($r->getParams(), $this->request->getParams()); - $this->assertTrue($this->request->getEventDispatcher()->hasListeners('request.sent')); - } - - public function testRecognizesBasicAuthCredentialsInUrls() - { - $this->request->setUrl('http://michael:test@test.com/'); - $this->assertEquals('michael', $this->request->getUsername()); - $this->assertEquals('test', $this->request->getPassword()); - } - - public function testRequestCanBeSentUsingCurl() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 200 OK\r\nContent-Length: 4\r\nExpires: Thu, 01 Dec 1994 16:00:00 GMT\r\nConnection: close\r\n\r\ndata", - "HTTP/1.1 200 OK\r\nContent-Length: 4\r\nExpires: Thu, 01 Dec 1994 16:00:00 GMT\r\nConnection: close\r\n\r\ndata", - "HTTP/1.1 404 Not Found\r\nContent-Encoding: application/xml\r\nContent-Length: 48\r\n\r\nFile not found" - )); - - $request = RequestFactory::getInstance()->create('GET', $this->getServer()->getUrl()); - $request->setClient($this->client); - $response = $request->send(); - - $this->assertEquals('data', $response->getBody(true)); - $this->assertEquals(200, (int) $response->getStatusCode()); - $this->assertEquals('OK', $response->getReasonPhrase()); - $this->assertEquals(4, $response->getContentLength()); - $this->assertEquals('Thu, 01 Dec 1994 16:00:00 GMT', $response->getExpires()); - - // Test that the same handle can be sent twice without setting state to new - $response2 = $request->send(); - $this->assertNotSame($response, $response2); - - try { - $request = RequestFactory::getInstance()->create('GET', $this->getServer()->getUrl() . 'index.html'); - $request->setClient($this->client); - $response = $request->send(); - $this->fail('Request did not receive a 404 response'); - } catch (BadResponseException $e) { - } - - $requests = $this->getServer()->getReceivedRequests(true); - $messages = $this->getServer()->getReceivedRequests(false); - $port = $this->getServer()->getPort(); - - $userAgent = $this->client->getDefaultUserAgent(); - - $this->assertEquals('127.0.0.1:' . $port, $requests[0]->getHeader('Host')); - $this->assertEquals('127.0.0.1:' . $port, $requests[1]->getHeader('Host')); - $this->assertEquals('127.0.0.1:' . $port, $requests[2]->getHeader('Host')); - - $this->assertEquals('/', $requests[0]->getPath()); - $this->assertEquals('/', $requests[1]->getPath()); - $this->assertEquals('/index.html', $requests[2]->getPath()); - - $parts = explode("\r\n", $messages[0]); - $this->assertEquals('GET / HTTP/1.1', $parts[0]); - - $parts = explode("\r\n", $messages[1]); - $this->assertEquals('GET / HTTP/1.1', $parts[0]); - - $parts = explode("\r\n", $messages[2]); - $this->assertEquals('GET /index.html HTTP/1.1', $parts[0]); - } - - public function testThrowsExceptionsWhenUnsuccessfulResponseIsReceivedByDefault() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 404 Not found\r\nContent-Length: 0\r\n\r\n"); - - try { - $request = $this->client->get('/index.html'); - $response = $request->send(); - $this->fail('Request did not receive a 404 response'); - } catch (BadResponseException $e) { - $this->assertContains('Client error response', $e->getMessage()); - $this->assertContains('[status code] 404', $e->getMessage()); - $this->assertContains('[reason phrase] Not found', $e->getMessage()); - } - } - - public function testCanShortCircuitErrorHandling() - { - $request = $this->request; - $response = new Response(404); - $request->setResponse($response, true); - $out = ''; - $that = $this; - $request->getEventDispatcher()->addListener('request.error', function($event) use (&$out, $that) { - $out .= $event['request'] . "\n" . $event['response'] . "\n"; - $event->stopPropagation(); - }); - $request->send(); - $this->assertContains((string) $request, $out); - $this->assertContains((string) $request->getResponse(), $out); - $this->assertSame($response, $request->getResponse()); - } - - public function testCanOverrideUnsuccessfulResponses() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 404 NOT FOUND\r\n" . - "Content-Length: 0\r\n" . - "\r\n", - "HTTP/1.1 200 OK\r\n" . - "Content-Length: 0\r\n" . - "\r\n" - )); - - $newResponse = null; - - $request = $this->request; - $request->getEventDispatcher()->addListener('request.error', function($event) use (&$newResponse) { - if ($event['response']->getStatusCode() == 404) { - $newRequest = clone $event['request']; - $newResponse = $newRequest->send(); - // Override the original response and bypass additional response processing - $event['response'] = $newResponse; - // Call $event['request']->setResponse($newResponse); to re-apply events - $event->stopPropagation(); - } - }); - - $request->send(); - - $this->assertEquals(200, $request->getResponse()->getStatusCode()); - $this->assertSame($newResponse, $request->getResponse()); - $this->assertEquals(2, count($this->getServer()->getReceivedRequests())); - } - - public function testCanRetrieveUrlObject() - { - $request = new Request('GET', 'http://www.example.com/foo?abc=d'); - $this->assertInstanceOf('Guzzle\Http\Url', $request->getUrl(true)); - $this->assertEquals('http://www.example.com/foo?abc=d', $request->getUrl()); - $this->assertEquals('http://www.example.com/foo?abc=d', (string) $request->getUrl(true)); - } - - public function testUnresolvedRedirectsReturnResponse() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 303 SEE OTHER\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 301 Foo\r\nLocation: /foo\r\nContent-Length: 0\r\n\r\n" - )); - $request = $this->request; - $this->assertEquals(303, $request->send()->getStatusCode()); - $request->getParams()->set(RedirectPlugin::DISABLE, true); - $this->assertEquals(301, $request->send()->getStatusCode()); - } - - public function testCanSendCustomRequests() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $request = $this->client->createRequest('PROPFIND', $this->getServer()->getUrl(), array( - 'Content-Type' => 'text/plain' - ), 'foo'); - $response = $request->send(); - $requests = $this->getServer()->getReceivedRequests(true); - $this->assertEquals('PROPFIND', $requests[0]->getMethod()); - $this->assertEquals(3, (string) $requests[0]->getHeader('Content-Length')); - $this->assertEquals('foo', (string) $requests[0]->getBody()); - } - - /** - * @expectedException \PHPUnit_Framework_Error_Warning - */ - public function testEnsuresFileCanBeCreated() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\ntest"); - $this->client->get('/')->setResponseBody('/wefwefefefefwewefwe/wefwefwefefwe/wefwefewfw.txt')->send(); - } - - public function testAllowsFilenameForDownloadingContent() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\ntest"); - $name = sys_get_temp_dir() . '/foo.txt'; - $this->client->get('/')->setResponseBody($name)->send(); - $this->assertEquals('test', file_get_contents($name)); - unlink($name); - } - - public function testUsesCustomResponseBodyWhenItIsCustom() - { - $en = EntityBody::factory(); - $request = $this->client->get(); - $request->setResponseBody($en); - $request->setResponse(new Response(200, array(), 'foo')); - $this->assertEquals('foo', (string) $en); - } - - public function testCanChangePortThroughScheme() - { - $request = new Request('GET', 'http://foo.com'); - $request->setScheme('https'); - $this->assertEquals('https://foo.com', (string) $request->getUrl()); - $this->assertEquals('foo.com', $request->getHost()); - $request->setScheme('http'); - $this->assertEquals('http://foo.com', (string) $request->getUrl()); - $this->assertEquals('foo.com', $request->getHost()); - $request->setPort(null); - $this->assertEquals('http://foo.com', (string) $request->getUrl()); - $this->assertEquals('foo.com', $request->getHost()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/ResponseTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/ResponseTest.php deleted file mode 100644 index 08b4df878..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Message/ResponseTest.php +++ /dev/null @@ -1,677 +0,0 @@ -response = new Response(200, new Collection(array( - 'Accept-Ranges' => 'bytes', - 'Age' => '12', - 'Allow' => 'GET, HEAD', - 'Cache-Control' => 'no-cache', - 'Content-Encoding' => 'gzip', - 'Content-Language' => 'da', - 'Content-Length' => '348', - 'Content-Location' => '/index.htm', - 'Content-Disposition' => 'attachment; filename=fname.ext', - 'Content-MD5' => 'Q2hlY2sgSW50ZWdyaXR5IQ==', - 'Content-Range' => 'bytes 21010-47021/47022', - 'Content-Type' => 'text/html; charset=utf-8', - 'Date' => 'Tue, 15 Nov 1994 08:12:31 GMT', - 'ETag' => '737060cd8c284d8af7ad3082f209582d', - 'Expires' => 'Thu, 01 Dec 1994 16:00:00 GMT', - 'Last-Modified' => 'Tue, 15 Nov 1994 12:45:26 GMT', - 'Location' => 'http://www.w3.org/pub/WWW/People.html', - 'Pragma' => 'no-cache', - 'Proxy-Authenticate' => 'Basic', - 'Retry-After' => '120', - 'Server' => 'Apache/1.3.27 (Unix) (Red-Hat/Linux)', - 'Set-Cookie' => 'UserID=JohnDoe; Max-Age=3600; Version=1', - 'Trailer' => 'Max-Forwards', - 'Transfer-Encoding' => 'chunked', - 'Vary' => '*', - 'Via' => '1.0 fred, 1.1 nowhere.com (Apache/1.1)', - 'Warning' => '199 Miscellaneous warning', - 'WWW-Authenticate' => 'Basic' - )), 'body'); - } - - public function tearDown() - { - unset($this->response); - } - - public function testConstructor() - { - $params = new Collection(); - $body = EntityBody::factory(''); - $response = new Response(200, $params, $body); - $this->assertEquals(200, $response->getStatusCode()); - $this->assertEquals($body, $response->getBody()); - $this->assertEquals('OK', $response->getReasonPhrase()); - $this->assertEquals("HTTP/1.1 200 OK\r\n\r\n", $response->getRawHeaders()); - - // Make sure Content-Length is set automatically - $response = new Response(200, $params); - $this->assertEquals("HTTP/1.1 200 OK\r\n\r\n", $response->getRawHeaders()); - - // Pass bodies to the response - $response = new Response(200, null, 'data'); - $this->assertInstanceOf('Guzzle\\Http\\EntityBody', $response->getBody()); - $response = new Response(200, null, EntityBody::factory('data')); - $this->assertInstanceOf('Guzzle\\Http\\EntityBody', $response->getBody()); - $this->assertEquals('data', $response->getBody(true)); - $response = new Response(200, null, '0'); - $this->assertSame('0', $response->getBody(true), 'getBody(true) should return "0" if response body is "0".'); - - // Make sure the proper exception is thrown - try { - //$response = new Response(200, null, array('foo' => 'bar')); - //$this->fail('Response did not throw exception when passing invalid body'); - } catch (HttpException $e) { - } - - // Ensure custom codes can be set - $response = new Response(2); - $this->assertEquals(2, $response->getStatusCode()); - $this->assertEquals('', $response->getReasonPhrase()); - - // Make sure the proper exception is thrown when sending invalid headers - try { - $response = new Response(200, 'adidas'); - $this->fail('Response did not throw exception when passing invalid $headers'); - } catch (BadResponseException $e) { - } - } - - public function test__toString() - { - $response = new Response(200); - $this->assertEquals("HTTP/1.1 200 OK\r\n\r\n", (string) $response); - - // Add another header - $response = new Response(200, array( - 'X-Test' => 'Guzzle' - )); - $this->assertEquals("HTTP/1.1 200 OK\r\nX-Test: Guzzle\r\n\r\n", (string) $response); - - $response = new Response(200, array( - 'Content-Length' => 4 - ), 'test'); - $this->assertEquals("HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\ntest", (string) $response); - } - - public function testFactory() - { - $response = Response::fromMessage("HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\ntest"); - $this->assertEquals(200, $response->getStatusCode()); - $this->assertEquals('OK', $response->getReasonPhrase()); - $this->assertEquals(4, (string) $response->getContentLength()); - $this->assertEquals('test', $response->getBody(true)); - - // Make sure that automatic Content-Length works - $response = Response::fromMessage("HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\ntest"); - $this->assertEquals(4, (string) $response->getContentLength()); - $this->assertEquals('test', $response->getBody(true)); - } - - public function testFactoryCanCreateHeadResponses() - { - $response = Response::fromMessage("HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\n"); - $this->assertEquals(200, $response->getStatusCode()); - $this->assertEquals('OK', $response->getReasonPhrase()); - $this->assertEquals(4, (string) $response->getContentLength()); - $this->assertEquals('', $response->getBody(true)); - } - - public function testFactoryRequiresMessage() - { - $this->assertFalse(Response::fromMessage('')); - } - - public function testGetBody() - { - $body = EntityBody::factory(''); - $response = new Response(403, new Collection(), $body); - $this->assertEquals($body, $response->getBody()); - $response->setBody('foo'); - $this->assertEquals('foo', $response->getBody(true)); - } - - public function testManagesStatusCode() - { - $response = new Response(403); - $this->assertEquals(403, $response->getStatusCode()); - } - - public function testGetMessage() - { - $response = new Response(200, new Collection(array( - 'Content-Length' => 4 - )), 'body'); - - $this->assertEquals("HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\nbody", $response->getMessage()); - } - - public function testGetRawHeaders() - { - $response = new Response(200, new Collection(array( - 'Keep-Alive' => 155, - 'User-Agent' => 'Guzzle', - 'Content-Length' => 4 - )), 'body'); - - $this->assertEquals("HTTP/1.1 200 OK\r\nKeep-Alive: 155\r\nUser-Agent: Guzzle\r\nContent-Length: 4\r\n\r\n", $response->getRawHeaders()); - } - - public function testHandlesStatusAndStatusCodes() - { - $response = new Response(200, new Collection(), 'body'); - $this->assertEquals('OK', $response->getReasonPhrase()); - - $this->assertSame($response, $response->setStatus(204)); - $this->assertEquals('No Content', $response->getReasonPhrase()); - $this->assertEquals(204, $response->getStatusCode()); - - $this->assertSame($response, $response->setStatus(204, 'Testing!')); - $this->assertEquals('Testing!', $response->getReasonPhrase()); - $this->assertEquals(204, $response->getStatusCode()); - - $response->setStatus(2000); - $this->assertEquals(2000, $response->getStatusCode()); - $this->assertEquals('', $response->getReasonPhrase()); - - $response->setStatus(200, 'Foo'); - $this->assertEquals(200, $response->getStatusCode()); - $this->assertEquals('Foo', $response->getReasonPhrase()); - } - - public function testIsClientError() - { - $response = new Response(403); - $this->assertTrue($response->isClientError()); - $response = new Response(200); - $this->assertFalse($response->isClientError()); - } - - public function testIsError() - { - $response = new Response(403); - $this->assertTrue($response->isError()); - $response = new Response(200); - $this->assertFalse($response->isError()); - $response = new Response(500); - $this->assertTrue($response->isError()); - } - - public function testIsInformational() - { - $response = new Response(100); - $this->assertTrue($response->isInformational()); - $response = new Response(200); - $this->assertFalse($response->isInformational()); - } - - public function testIsRedirect() - { - $response = new Response(301); - $this->assertTrue($response->isRedirect()); - $response = new Response(200); - $this->assertFalse($response->isRedirect()); - } - - public function testIsServerError() - { - $response = new Response(500); - $this->assertTrue($response->isServerError()); - $response = new Response(400); - $this->assertFalse($response->isServerError()); - } - - public function testIsSuccessful() - { - $response = new Response(200); - $this->assertTrue($response->isSuccessful()); - $response = new Response(403); - $this->assertFalse($response->isSuccessful()); - } - - public function testGetAcceptRanges() - { - $this->assertEquals('bytes', $this->response->getAcceptRanges()); - } - - public function testCalculatesAge() - { - $this->assertEquals(12, $this->response->calculateAge()); - - $this->response->removeHeader('Age'); - $this->response->removeHeader('Date'); - $this->assertNull($this->response->calculateAge()); - - $this->response->setHeader('Date', gmdate(ClientInterface::HTTP_DATE, strtotime('-1 minute'))); - // If the test runs slowly, still pass with a +5 second allowance - $this->assertTrue($this->response->getAge() - 60 <= 5); - } - - public function testGetAllow() - { - $this->assertEquals('GET, HEAD', $this->response->getAllow()); - } - - public function testGetCacheControl() - { - $this->assertEquals('no-cache', $this->response->getCacheControl()); - } - - public function testGetContentEncoding() - { - $this->assertEquals('gzip', $this->response->getContentEncoding()); - } - - public function testGetContentLanguage() - { - $this->assertEquals('da', $this->response->getContentLanguage()); - } - - public function testGetContentLength() - { - $this->assertEquals('348', $this->response->getContentLength()); - } - - public function testGetContentLocation() - { - $this->assertEquals('/index.htm', $this->response->getContentLocation()); - } - - public function testGetContentDisposition() - { - $this->assertEquals('attachment; filename=fname.ext', $this->response->getContentDisposition()); - } - - public function testGetContentMd5() - { - $this->assertEquals('Q2hlY2sgSW50ZWdyaXR5IQ==', $this->response->getContentMd5()); - } - - public function testGetContentRange() - { - $this->assertEquals('bytes 21010-47021/47022', $this->response->getContentRange()); - } - - public function testGetContentType() - { - $this->assertEquals('text/html; charset=utf-8', $this->response->getContentType()); - } - - public function testGetDate() - { - $this->assertEquals('Tue, 15 Nov 1994 08:12:31 GMT', $this->response->getDate()); - } - - public function testGetEtag() - { - $this->assertEquals('737060cd8c284d8af7ad3082f209582d', $this->response->getEtag()); - } - - public function testGetExpires() - { - $this->assertEquals('Thu, 01 Dec 1994 16:00:00 GMT', $this->response->getExpires()); - } - - public function testGetLastModified() - { - $this->assertEquals('Tue, 15 Nov 1994 12:45:26 GMT', $this->response->getLastModified()); - } - - public function testGetLocation() - { - $this->assertEquals('http://www.w3.org/pub/WWW/People.html', $this->response->getLocation()); - } - - public function testGetPragma() - { - $this->assertEquals('no-cache', $this->response->getPragma()); - } - - public function testGetProxyAuthenticate() - { - $this->assertEquals('Basic', $this->response->getProxyAuthenticate()); - } - - public function testGetServer() - { - $this->assertEquals('Apache/1.3.27 (Unix) (Red-Hat/Linux)', $this->response->getServer()); - } - - public function testGetSetCookie() - { - $this->assertEquals('UserID=JohnDoe; Max-Age=3600; Version=1', $this->response->getSetCookie()); - } - - public function testGetMultipleSetCookie() - { - $this->response->addHeader('Set-Cookie', 'UserID=Mike; Max-Age=200'); - $this->assertEquals(array( - 'UserID=JohnDoe; Max-Age=3600; Version=1', - 'UserID=Mike; Max-Age=200', - ), $this->response->getHeader('Set-Cookie')->toArray()); - } - - public function testGetSetCookieNormalizesHeaders() - { - $this->response->addHeaders(array( - 'Set-Cooke' => 'boo', - 'set-cookie' => 'foo' - )); - - $this->assertEquals(array( - 'UserID=JohnDoe; Max-Age=3600; Version=1', - 'foo' - ), $this->response->getHeader('Set-Cookie')->toArray()); - - $this->response->addHeaders(array( - 'set-cookie' => 'fubu' - )); - $this->assertEquals( - array('UserID=JohnDoe; Max-Age=3600; Version=1', 'foo', 'fubu'), - $this->response->getHeader('Set-Cookie')->toArray() - ); - } - - public function testGetTrailer() - { - $this->assertEquals('Max-Forwards', $this->response->getTrailer()); - } - - public function testGetTransferEncoding() - { - $this->assertEquals('chunked', $this->response->getTransferEncoding()); - } - - public function testGetVary() - { - $this->assertEquals('*', $this->response->getVary()); - } - - public function testReturnsViaHeader() - { - $this->assertEquals('1.0 fred, 1.1 nowhere.com (Apache/1.1)', $this->response->getVia()); - } - public function testGetWarning() - { - $this->assertEquals('199 Miscellaneous warning', $this->response->getWarning()); - } - - public function testReturnsWwwAuthenticateHeader() - { - $this->assertEquals('Basic', $this->response->getWwwAuthenticate()); - } - - public function testReturnsConnectionHeader() - { - $this->assertEquals(null, $this->response->getConnection()); - $this->response->setHeader('Connection', 'close'); - $this->assertEquals('close', $this->response->getConnection()); - } - - public function testReturnsHeaders() - { - $this->assertEquals('Basic', $this->response->getHeader('WWW-Authenticate', null, true)); - $this->assertEquals('chunked', $this->response->getHeader('Transfer-Encoding', null, false)); - } - - public function testHasTransferInfo() - { - $stats = array ( - 'url' => 'http://www.google.com/', - 'content_type' => 'text/html; charset=ISO-8859-1', - 'http_code' => 200, - 'header_size' => 606, - 'request_size' => 53, - 'filetime' => -1, - 'ssl_verify_result' => 0, - 'redirect_count' => 0, - 'total_time' => 0.093284, - 'namelookup_time' => 0.001349, - 'connect_time' => 0.01635, - 'pretransfer_time' => 0.016358, - 'size_upload' => 0, - 'size_download' => 10330, - 'speed_download' => 110737, - 'speed_upload' => 0, - 'download_content_length' => -1, - 'upload_content_length' => 0, - 'starttransfer_time' => 0.07066, - 'redirect_time' => 0, - ); - - // Uninitialized state - $this->assertNull($this->response->getInfo('url')); - $this->assertEquals(array(), $this->response->getInfo()); - - // Set the stats - $this->response->setInfo($stats); - $this->assertEquals($stats, $this->response->getInfo()); - $this->assertEquals(606, $this->response->getInfo('header_size')); - $this->assertNull($this->response->getInfo('does_not_exist')); - } - - /** - * @return Response - */ - private function getResponse($code, array $headers = null, EntityBody $body = null) - { - return new Response($code, $headers, $body); - } - - public function testDeterminesIfItCanBeCached() - { - $this->assertTrue($this->getResponse(200)->canCache()); - $this->assertTrue($this->getResponse(410)->canCache()); - $this->assertFalse($this->getResponse(404)->canCache()); - $this->assertTrue($this->getResponse(200, array( - 'Cache-Control' => 'public' - ))->canCache()); - - // This has the no-store directive - $this->assertFalse($this->getResponse(200, array( - 'Cache-Control' => 'private, no-store' - ))->canCache()); - - // The body cannot be read, so it cannot be cached - $tmp = tempnam('/tmp', 'not-readable'); - $resource = fopen($tmp, 'w'); - $this->assertFalse($this->getResponse(200, array( - 'Transfer-Encoding' => 'chunked' - ), EntityBody::factory($resource, 10))->canCache()); - unlink($tmp); - - // The body is 0 length, cannot be read, so it can be cached - $tmp = tempnam('/tmp', 'not-readable'); - $resource = fopen($tmp, 'w'); - $this->assertTrue($this->getResponse(200, array(array( - 'Content-Length' => 0 - )), EntityBody::factory($resource, 0))->canCache()); - unlink($tmp); - } - - public function testDeterminesResponseMaxAge() - { - $this->assertEquals(null, $this->getResponse(200)->getMaxAge()); - - // Uses the response's s-maxage - $this->assertEquals(140, $this->getResponse(200, array( - 'Cache-Control' => 's-maxage=140' - ))->getMaxAge()); - - // Uses the response's max-age - $this->assertEquals(120, $this->getResponse(200, array( - 'Cache-Control' => 'max-age=120' - ))->getMaxAge()); - - // Uses the response's max-age - $this->assertEquals(120, $this->getResponse(200, array( - 'Cache-Control' => 'max-age=120', - 'Expires' => gmdate(ClientInterface::HTTP_DATE, strtotime('+1 day')) - ))->getMaxAge()); - - // Uses the Expires date - $this->assertGreaterThanOrEqual(82400, $this->getResponse(200, array( - 'Expires' => gmdate(ClientInterface::HTTP_DATE, strtotime('+1 day')) - ))->getMaxAge()); - - // Uses the Expires date - $this->assertGreaterThanOrEqual(82400, $this->getResponse(200, array( - 'Expires' => gmdate(ClientInterface::HTTP_DATE, strtotime('+1 day')) - ))->getMaxAge()); - } - - public function testDeterminesIfItCanValidate() - { - $response = new Response(200); - $this->assertFalse($response->canValidate()); - $response->setHeader('ETag', '123'); - $this->assertTrue($response->canValidate()); - $response->removeHeader('ETag'); - $this->assertFalse($response->canValidate()); - $response->setHeader('Last-Modified', '123'); - $this->assertTrue($response->canValidate()); - } - - public function testCalculatesFreshness() - { - $response = new Response(200); - $this->assertNull($response->isFresh()); - $this->assertNull($response->getFreshness()); - - $response->setHeader('Cache-Control', 'max-age=120'); - $response->setHeader('Age', 100); - $this->assertEquals(20, $response->getFreshness()); - $this->assertTrue($response->isFresh()); - - $response->setHeader('Age', 120); - $this->assertEquals(0, $response->getFreshness()); - $this->assertTrue($response->isFresh()); - - $response->setHeader('Age', 150); - $this->assertEquals(-30, $response->getFreshness()); - $this->assertFalse($response->isFresh()); - } - - public function testHandlesProtocols() - { - $this->assertSame($this->response, $this->response->setProtocol('HTTP', '1.0')); - $this->assertEquals('HTTP', $this->response->getProtocol()); - $this->assertEquals('1.0', $this->response->getProtocolVersion()); - } - - public function testComparesContentType() - { - $response = new Response(200, array( - 'Content-Type' => 'text/html; charset=ISO-8859-4' - )); - - $this->assertTrue($response->isContentType('text/html')); - $this->assertTrue($response->isContentType('TExT/html')); - $this->assertTrue($response->isContentType('charset=ISO-8859-4')); - $this->assertFalse($response->isContentType('application/xml')); - } - - public function testResponseDeterminesIfMethodIsAllowedBaseOnAllowHeader() - { - $response = new Response(200, array( - 'Allow' => 'OPTIONS, POST, deletE,GET' - )); - - $this->assertTrue($response->isMethodAllowed('get')); - $this->assertTrue($response->isMethodAllowed('GET')); - $this->assertTrue($response->isMethodAllowed('options')); - $this->assertTrue($response->isMethodAllowed('post')); - $this->assertTrue($response->isMethodAllowed('Delete')); - $this->assertFalse($response->isMethodAllowed('put')); - $this->assertFalse($response->isMethodAllowed('PUT')); - - $response = new Response(200); - $this->assertFalse($response->isMethodAllowed('get')); - } - - public function testParsesJsonResponses() - { - $response = new Response(200, array(), '{"foo": "bar"}'); - $this->assertEquals(array('foo' => 'bar'), $response->json()); - // Return array when null is a service response - $response = new Response(200); - $this->assertEquals(array(), $response->json()); - } - - /** - * @expectedException \Guzzle\Common\Exception\RuntimeException - * @expectedExceptionMessage Unable to parse response body into JSON: 4 - */ - public function testThrowsExceptionWhenFailsToParseJsonResponse() - { - $response = new Response(200, array(), '{"foo": "'); - $response->json(); - } - - public function testParsesXmlResponses() - { - $response = new Response(200, array(), 'bar'); - $this->assertEquals('bar', (string) $response->xml()->foo); - // Always return a SimpleXMLElement from the xml method - $response = new Response(200); - $this->assertEmpty((string) $response->xml()->foo); - } - - /** - * @expectedException \Guzzle\Common\Exception\RuntimeException - * @expectedExceptionMessage Unable to parse response body into XML: String could not be parsed as XML - */ - public function testThrowsExceptionWhenFailsToParseXmlResponse() - { - $response = new Response(200, array(), 'xml(); - } - - public function testResponseIsSerializable() - { - $response = new Response(200, array('Foo' => 'bar'), 'test'); - $r = unserialize(serialize($response)); - $this->assertEquals(200, $r->getStatusCode()); - $this->assertEquals('bar', (string) $r->getHeader('Foo')); - $this->assertEquals('test', (string) $r->getBody()); - } - - public function testPreventsComplexExternalEntities() - { - $xml = ']>&test;'; - $response = new Response(200, array(), $xml); - - $oldCwd = getcwd(); - chdir(__DIR__); - try { - $xml = $response->xml(); - chdir($oldCwd); - $this->markTestIncomplete('Did not throw the expected exception! XML resolved as: ' . $xml->asXML()); - } catch (\Exception $e) { - chdir($oldCwd); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/MimetypesTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/MimetypesTest.php deleted file mode 100644 index 722845340..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/MimetypesTest.php +++ /dev/null @@ -1,31 +0,0 @@ -assertEquals('text/x-php', Mimetypes::getInstance()->fromExtension('php')); - } - - public function testGetsFromFilename() - { - $this->assertEquals('text/x-php', Mimetypes::getInstance()->fromFilename(__FILE__)); - } - - public function testGetsFromCaseInsensitiveFilename() - { - $this->assertEquals('text/x-php', Mimetypes::getInstance()->fromFilename(strtoupper(__FILE__))); - } - - public function testReturnsNullWhenNoMatchFound() - { - $this->assertNull(Mimetypes::getInstance()->fromExtension('foobar')); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/QueryAggregator/CommaAggregatorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/QueryAggregator/CommaAggregatorTest.php deleted file mode 100644 index 549d3edd9..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/QueryAggregator/CommaAggregatorTest.php +++ /dev/null @@ -1,30 +0,0 @@ -aggregate($key, $value, $query); - $this->assertEquals(array('test%20123' => 'foo%20123,baz,bar'), $result); - } - - public function testEncodes() - { - $query = new QueryString(); - $query->useUrlEncoding(false); - $a = new Ag(); - $key = 'test 123'; - $value = array('foo 123', 'baz', 'bar'); - $result = $a->aggregate($key, $value, $query); - $this->assertEquals(array('test 123' => 'foo 123,baz,bar'), $result); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/QueryAggregator/DuplicateAggregatorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/QueryAggregator/DuplicateAggregatorTest.php deleted file mode 100644 index 6a4d9d95b..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/QueryAggregator/DuplicateAggregatorTest.php +++ /dev/null @@ -1,30 +0,0 @@ -aggregate($key, $value, $query); - $this->assertEquals(array('facet%201' => array('size%20a', 'width%20b')), $result); - } - - public function testEncodes() - { - $query = new QueryString(); - $query->useUrlEncoding(false); - $a = new Ag(); - $key = 'facet 1'; - $value = array('size a', 'width b'); - $result = $a->aggregate($key, $value, $query); - $this->assertEquals(array('facet 1' => array('size a', 'width b')), $result); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/QueryAggregator/PhpAggregatorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/QueryAggregator/PhpAggregatorTest.php deleted file mode 100644 index 1e7f0c27a..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/QueryAggregator/PhpAggregatorTest.php +++ /dev/null @@ -1,32 +0,0 @@ -useUrlEncoding(false); - $a = new Ag(); - $key = 't'; - $value = array( - 'v1' => 'a', - 'v2' => 'b', - 'v3' => array( - 'v4' => 'c', - 'v5' => 'd', - ) - ); - $result = $a->aggregate($key, $value, $query); - $this->assertEquals(array( - 't[v1]' => 'a', - 't[v2]' => 'b', - 't[v3][v4]' => 'c', - 't[v3][v5]' => 'd', - ), $result); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/QueryStringTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/QueryStringTest.php deleted file mode 100644 index 948db442d..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/QueryStringTest.php +++ /dev/null @@ -1,233 +0,0 @@ -q = new QueryString(); - } - - public function testGetFieldSeparator() - { - $this->assertEquals('&', $this->q->getFieldSeparator()); - } - - public function testGetValueSeparator() - { - $this->assertEquals('=', $this->q->getValueSeparator()); - } - - public function testIsUrlEncoding() - { - $this->assertEquals('RFC 3986', $this->q->getUrlEncoding()); - $this->assertTrue($this->q->isUrlEncoding()); - $this->assertEquals('foo%20bar', $this->q->encodeValue('foo bar')); - - $this->q->useUrlEncoding(QueryString::FORM_URLENCODED); - $this->assertTrue($this->q->isUrlEncoding()); - $this->assertEquals(QueryString::FORM_URLENCODED, $this->q->getUrlEncoding()); - $this->assertEquals('foo+bar', $this->q->encodeValue('foo bar')); - - $this->assertSame($this->q, $this->q->useUrlEncoding(false)); - $this->assertFalse($this->q->isUrlEncoding()); - $this->assertFalse($this->q->isUrlEncoding()); - } - - public function testSetFieldSeparator() - { - $this->assertEquals($this->q, $this->q->setFieldSeparator('/')); - $this->assertEquals('/', $this->q->getFieldSeparator()); - } - - public function testSetValueSeparator() - { - $this->assertEquals($this->q, $this->q->setValueSeparator('/')); - $this->assertEquals('/', $this->q->getValueSeparator()); - } - - public function testUrlEncode() - { - $params = array( - 'test' => 'value', - 'test 2' => 'this is a test?', - 'test3' => array('v1', 'v2', 'v3'), - 'ሴ' => 'bar' - ); - $encoded = array( - 'test' => 'value', - 'test%202' => rawurlencode('this is a test?'), - 'test3%5B0%5D' => 'v1', - 'test3%5B1%5D' => 'v2', - 'test3%5B2%5D' => 'v3', - '%E1%88%B4' => 'bar' - ); - $this->q->replace($params); - $this->assertEquals($encoded, $this->q->urlEncode()); - - // Disable encoding - $testData = array('test 2' => 'this is a test'); - $this->q->replace($testData); - $this->q->useUrlEncoding(false); - $this->assertEquals($testData, $this->q->urlEncode()); - } - - public function testToString() - { - // Check with no parameters - $this->assertEquals('', $this->q->__toString()); - - $params = array( - 'test' => 'value', - 'test 2' => 'this is a test?', - 'test3' => array('v1', 'v2', 'v3'), - 'test4' => null, - ); - $this->q->replace($params); - $this->assertEquals('test=value&test%202=this%20is%20a%20test%3F&test3%5B0%5D=v1&test3%5B1%5D=v2&test3%5B2%5D=v3&test4', $this->q->__toString()); - $this->q->useUrlEncoding(false); - $this->assertEquals('test=value&test 2=this is a test?&test3[0]=v1&test3[1]=v2&test3[2]=v3&test4', $this->q->__toString()); - - // Use an alternative aggregator - $this->q->setAggregator(new CommaAggregator()); - $this->assertEquals('test=value&test 2=this is a test?&test3=v1,v2,v3&test4', $this->q->__toString()); - } - - public function testAllowsMultipleValuesPerKey() - { - $q = new QueryString(); - $q->add('facet', 'size'); - $q->add('facet', 'width'); - $q->add('facet.field', 'foo'); - // Use the duplicate aggregator - $q->setAggregator(new DuplicateAggregator()); - $this->assertEquals('facet=size&facet=width&facet.field=foo', $q->__toString()); - } - - public function testAllowsNestedQueryData() - { - $this->q->replace(array( - 'test' => 'value', - 't' => array( - 'v1' => 'a', - 'v2' => 'b', - 'v3' => array( - 'v4' => 'c', - 'v5' => 'd', - ) - ) - )); - - $this->q->useUrlEncoding(false); - $this->assertEquals('test=value&t[v1]=a&t[v2]=b&t[v3][v4]=c&t[v3][v5]=d', $this->q->__toString()); - } - - public function parseQueryProvider() - { - return array( - // Ensure that multiple query string values are allowed per value - array('q=a&q=b', array('q' => array('a', 'b'))), - // Ensure that PHP array style query string values are parsed - array('q[]=a&q[]=b', array('q' => array('a', 'b'))), - // Ensure that a single PHP array style query string value is parsed into an array - array('q[]=a', array('q' => array('a'))), - // Ensure that decimals are allowed in query strings - array('q.a=a&q.b=b', array( - 'q.a' => 'a', - 'q.b' => 'b' - )), - // Ensure that query string values are percent decoded - array('q%20a=a%20b', array('q a' => 'a b')), - // Ensure null values can be added - array('q&a', array('q' => false, 'a' => false)), - ); - } - - /** - * @dataProvider parseQueryProvider - */ - public function testParsesQueryStrings($query, $data) - { - $query = QueryString::fromString($query); - $this->assertEquals($data, $query->getAll()); - } - - public function testProperlyDealsWithDuplicateQueryStringValues() - { - $query = QueryString::fromString('foo=a&foo=b&?µ=c'); - $this->assertEquals(array('a', 'b'), $query->get('foo')); - $this->assertEquals('c', $query->get('?µ')); - } - - public function testAllowsBlankQueryStringValues() - { - $query = QueryString::fromString('foo'); - $this->assertEquals('foo', (string) $query); - $query->set('foo', QueryString::BLANK); - $this->assertEquals('foo', (string) $query); - } - - public function testAllowsFalsyQueryStringValues() - { - $query = QueryString::fromString('0'); - $this->assertEquals('0', (string) $query); - $query->set('0', QueryString::BLANK); - $this->assertSame('0', (string) $query); - } - - public function testFromStringIgnoresQuestionMark() - { - $query = QueryString::fromString('foo=baz&bar=boo'); - $this->assertEquals('foo=baz&bar=boo', (string) $query); - } - - public function testConvertsPlusSymbolsToSpaces() - { - $query = QueryString::fromString('var=foo+bar'); - $this->assertEquals('foo bar', $query->get('var')); - } - - public function testFromStringDoesntMangleZeroes() - { - $query = QueryString::fromString('var=0'); - $this->assertSame('0', $query->get('var')); - } - - public function testAllowsZeroValues() - { - $query = new QueryString(array( - 'foo' => 0, - 'baz' => '0', - 'bar' => null, - 'boo' => false, - 'bam' => '' - )); - $this->assertEquals('foo=0&baz=0&bar&boo&bam=', (string) $query); - } - - public function testFromStringDoesntStripTrailingEquals() - { - $query = QueryString::fromString('data=mF0b3IiLCJUZWFtIERldiJdfX0='); - $this->assertEquals('mF0b3IiLCJUZWFtIERldiJdfX0=', $query->get('data')); - } - - public function testGuessesIfDuplicateAggregatorShouldBeUsed() - { - $query = QueryString::fromString('test=a&test=b'); - $this->assertEquals('test=a&test=b', (string) $query); - } - - public function testGuessesIfDuplicateAggregatorShouldBeUsedAndChecksForPhpStyle() - { - $query = QueryString::fromString('test[]=a&test[]=b'); - $this->assertEquals('test%5B0%5D=a&test%5B1%5D=b', (string) $query); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/ReadLimitEntityBodyTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/ReadLimitEntityBodyTest.php deleted file mode 100644 index 6bb3fed18..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/ReadLimitEntityBodyTest.php +++ /dev/null @@ -1,81 +0,0 @@ -decorated = EntityBody::factory(fopen(__FILE__, 'r')); - $this->body = new ReadLimitEntityBody($this->decorated, 10, 3); - } - - public function testReturnsSubsetWhenCastToString() - { - $body = EntityBody::factory('foo_baz_bar'); - $limited = new ReadLimitEntityBody($body, 3, 4); - $this->assertEquals('baz', (string) $limited); - } - - public function testReturnsSubsetOfEmptyBodyWhenCastToString() - { - $body = EntityBody::factory(''); - $limited = new ReadLimitEntityBody($body, 0, 10); - $this->assertEquals('', (string) $limited); - } - - public function testSeeksWhenConstructed() - { - $this->assertEquals(3, $this->body->ftell()); - } - - public function testAllowsBoundedSeek() - { - $this->body->seek(100); - $this->assertEquals(13, $this->body->ftell()); - $this->body->seek(0); - $this->assertEquals(3, $this->body->ftell()); - $this->assertEquals(false, $this->body->seek(1000, SEEK_END)); - } - - public function testReadsOnlySubsetOfData() - { - $data = $this->body->read(100); - $this->assertEquals(10, strlen($data)); - $this->assertFalse($this->body->read(1000)); - - $this->body->setOffset(10); - $newData = $this->body->read(100); - $this->assertEquals(10, strlen($newData)); - $this->assertNotSame($data, $newData); - } - - public function testClaimsConsumedWhenReadLimitIsReached() - { - $this->assertFalse($this->body->isConsumed()); - $this->body->read(1000); - $this->assertTrue($this->body->isConsumed()); - } - - public function testContentLengthIsBounded() - { - $this->assertEquals(10, $this->body->getContentLength()); - } - - public function testContentMd5IsBasedOnSubsection() - { - $this->assertNotSame($this->body->getContentMd5(), $this->decorated->getContentMd5()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/RedirectPluginTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/RedirectPluginTest.php deleted file mode 100755 index 886236ddd..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/RedirectPluginTest.php +++ /dev/null @@ -1,277 +0,0 @@ -getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 301 Moved Permanently\r\nLocation: /redirect1\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 301 Moved Permanently\r\nLocation: /redirect2\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n", - )); - - // Create a client that uses the default redirect behavior - $client = new Client($this->getServer()->getUrl()); - $history = new HistoryPlugin(); - $client->addSubscriber($history); - - $request = $client->get('/foo'); - $response = $request->send(); - $this->assertEquals(200, $response->getStatusCode()); - $this->assertContains('/redirect2', $response->getEffectiveUrl()); - - // Ensure that two requests were sent - $requests = $this->getServer()->getReceivedRequests(true); - $this->assertEquals('/foo', $requests[0]->getResource()); - $this->assertEquals('GET', $requests[0]->getMethod()); - $this->assertEquals('/redirect1', $requests[1]->getResource()); - $this->assertEquals('GET', $requests[1]->getMethod()); - $this->assertEquals('/redirect2', $requests[2]->getResource()); - $this->assertEquals('GET', $requests[2]->getMethod()); - - // Ensure that the redirect count was incremented - $this->assertEquals(2, $request->getParams()->get(RedirectPlugin::REDIRECT_COUNT)); - $this->assertCount(3, $history); - $requestHistory = $history->getAll(); - - $this->assertEquals(301, $requestHistory[0]['response']->getStatusCode()); - $this->assertEquals('/redirect1', (string) $requestHistory[0]['response']->getHeader('Location')); - $this->assertEquals(301, $requestHistory[1]['response']->getStatusCode()); - $this->assertEquals('/redirect2', (string) $requestHistory[1]['response']->getHeader('Location')); - $this->assertEquals(200, $requestHistory[2]['response']->getStatusCode()); - } - - public function testCanLimitNumberOfRedirects() - { - // Flush the server and queue up a redirect followed by a successful response - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 301 Moved Permanently\r\nLocation: /redirect1\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 301 Moved Permanently\r\nLocation: /redirect2\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 301 Moved Permanently\r\nLocation: /redirect3\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 301 Moved Permanently\r\nLocation: /redirect4\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 301 Moved Permanently\r\nLocation: /redirect5\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 301 Moved Permanently\r\nLocation: /redirect6\r\nContent-Length: 0\r\n\r\n" - )); - - try { - $client = new Client($this->getServer()->getUrl()); - $client->get('/foo')->send(); - $this->fail('Did not throw expected exception'); - } catch (TooManyRedirectsException $e) { - $this->assertContains( - "5 redirects were issued for this request:\nGET /foo HTTP/1.1\r\n", - $e->getMessage() - ); - } - } - - public function testDefaultBehaviorIsToRedirectWithGetForEntityEnclosingRequests() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 301 Moved Permanently\r\nLocation: /redirect\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 301 Moved Permanently\r\nLocation: /redirect\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n", - )); - - $client = new Client($this->getServer()->getUrl()); - $client->post('/foo', array('X-Baz' => 'bar'), 'testing')->send(); - - $requests = $this->getServer()->getReceivedRequests(true); - $this->assertEquals('POST', $requests[0]->getMethod()); - $this->assertEquals('GET', $requests[1]->getMethod()); - $this->assertEquals('bar', (string) $requests[1]->getHeader('X-Baz')); - $this->assertEquals('GET', $requests[2]->getMethod()); - } - - public function testCanRedirectWithStrictRfcCompliance() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 301 Moved Permanently\r\nLocation: /redirect\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 301 Moved Permanently\r\nLocation: /redirect\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n", - )); - - $client = new Client($this->getServer()->getUrl()); - $request = $client->post('/foo', array('X-Baz' => 'bar'), 'testing'); - $request->getParams()->set(RedirectPlugin::STRICT_REDIRECTS, true); - $request->send(); - - $requests = $this->getServer()->getReceivedRequests(true); - $this->assertEquals('POST', $requests[0]->getMethod()); - $this->assertEquals('POST', $requests[1]->getMethod()); - $this->assertEquals('bar', (string) $requests[1]->getHeader('X-Baz')); - $this->assertEquals('POST', $requests[2]->getMethod()); - } - - public function testRedirect303WithGet() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 303 Moved Permanently\r\nLocation: /redirect\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n", - )); - - $client = new Client($this->getServer()->getUrl()); - $request = $client->post('/foo'); - $request->send(); - - $requests = $this->getServer()->getReceivedRequests(true); - $this->assertEquals('POST', $requests[0]->getMethod()); - $this->assertEquals('GET', $requests[1]->getMethod()); - } - - public function testRedirect303WithGetWithStrictRfcCompliance() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 303 Moved Permanently\r\nLocation: /redirect\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n", - )); - - $client = new Client($this->getServer()->getUrl()); - $request = $client->post('/foo'); - $request->getParams()->set(RedirectPlugin::STRICT_REDIRECTS, true); - $request->send(); - - $requests = $this->getServer()->getReceivedRequests(true); - $this->assertEquals('POST', $requests[0]->getMethod()); - $this->assertEquals('GET', $requests[1]->getMethod()); - } - - public function testRewindsStreamWhenRedirectingIfNeeded() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 301 Moved Permanently\r\nLocation: /redirect\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n", - )); - - $client = new Client($this->getServer()->getUrl()); - $request = $client->put(); - $request->configureRedirects(true); - $body = EntityBody::factory('foo'); - $body->read(1); - $request->setBody($body); - $request->send(); - $requests = $this->getServer()->getReceivedRequests(true); - $this->assertEquals('foo', (string) $requests[0]->getBody()); - } - - /** - * @expectedException \Guzzle\Http\Exception\CouldNotRewindStreamException - */ - public function testThrowsExceptionWhenStreamCannotBeRewound() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\nhi", - "HTTP/1.1 301 Moved Permanently\r\nLocation: /redirect\r\nContent-Length: 0\r\n\r\n" - )); - - $client = new Client($this->getServer()->getUrl()); - $request = $client->put(); - $request->configureRedirects(true); - $body = EntityBody::factory(fopen($this->getServer()->getUrl(), 'r')); - $body->read(1); - $request->setBody($body)->send(); - } - - public function testRedirectsCanBeDisabledPerRequest() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array("HTTP/1.1 301 Foo\r\nLocation: /foo\r\nContent-Length: 0\r\n\r\n")); - $client = new Client($this->getServer()->getUrl()); - $request = $client->put(); - $request->configureRedirects(false, 0); - $this->assertEquals(301, $request->send()->getStatusCode()); - } - - public function testCanRedirectWithNoLeadingSlashAndQuery() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 301 Moved Permanently\r\nLocation: redirect?foo=bar\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n", - )); - $client = new Client($this->getServer()->getUrl()); - $request = $client->get('?foo=bar'); - $request->send(); - $requests = $this->getServer()->getReceivedRequests(true); - $this->assertEquals($this->getServer()->getUrl() . '?foo=bar', $requests[0]->getUrl()); - $this->assertEquals($this->getServer()->getUrl() . 'redirect?foo=bar', $requests[1]->getUrl()); - // Ensure that the history on the actual request is correct - $this->assertEquals($this->getServer()->getUrl() . '?foo=bar', $request->getUrl()); - } - - public function testRedirectWithStrictRfc386Compliance() - { - // Flush the server and queue up a redirect followed by a successful response - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 301 Moved Permanently\r\nLocation: redirect\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n" - )); - $client = new Client($this->getServer()->getUrl()); - $request = $client->get('/foo'); - $request->send(); - $requests = $this->getServer()->getReceivedRequests(true); - $this->assertEquals('/redirect', $requests[1]->getResource()); - } - - public function testResetsHistoryEachSend() - { - // Flush the server and queue up a redirect followed by a successful response - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 301 Moved Permanently\r\nLocation: /redirect1\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 301 Moved Permanently\r\nLocation: /redirect2\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n" - )); - - // Create a client that uses the default redirect behavior - $client = new Client($this->getServer()->getUrl()); - $history = new HistoryPlugin(); - $client->addSubscriber($history); - - $request = $client->get('/foo'); - $response = $request->send(); - $this->assertEquals(3, count($history)); - $this->assertTrue($request->getParams()->hasKey('redirect.count')); - $this->assertContains('/redirect2', $response->getEffectiveUrl()); - - $request->send(); - $this->assertFalse($request->getParams()->hasKey('redirect.count')); - } - - public function testHandlesRedirectsWithSpacesProperly() - { - // Flush the server and queue up a redirect followed by a successful response - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 301 Moved Permanently\r\nLocation: /redirect 1\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n" - )); - $client = new Client($this->getServer()->getUrl()); - $request = $client->get('/foo'); - $request->send(); - $reqs = $this->getServer()->getReceivedRequests(true); - $this->assertEquals('/redirect%201', $reqs[1]->getResource()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Server.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Server.php deleted file mode 100644 index 94eb59a4d..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/Server.php +++ /dev/null @@ -1,191 +0,0 @@ -port = $port ?: self::DEFAULT_PORT; - $this->client = new Client($this->getUrl()); - register_shutdown_function(array($this, 'stop')); - } - - /** - * Flush the received requests from the server - * @throws RuntimeException - */ - public function flush() - { - $this->client->delete('guzzle-server/requests')->send(); - } - - /** - * Queue an array of responses or a single response on the server. - * - * Any currently queued responses will be overwritten. Subsequent requests - * on the server will return queued responses in FIFO order. - * - * @param array|Response $responses A single or array of Responses to queue - * @throws BadResponseException - */ - public function enqueue($responses) - { - $data = array(); - foreach ((array) $responses as $response) { - - // Create the response object from a string - if (is_string($response)) { - $response = Response::fromMessage($response); - } elseif (!($response instanceof Response)) { - throw new BadResponseException('Responses must be strings or implement Response'); - } - - $data[] = array( - 'statusCode' => $response->getStatusCode(), - 'reasonPhrase' => $response->getReasonPhrase(), - 'headers' => $response->getHeaders()->toArray(), - 'body' => $response->getBody(true) - ); - } - - $request = $this->client->put('guzzle-server/responses', null, json_encode($data)); - $request->send(); - } - - /** - * Check if the server is running - * - * @return bool - */ - public function isRunning() - { - if ($this->running) { - return true; - } - - try { - $this->client->get('guzzle-server/perf', array(), array('timeout' => 5))->send(); - $this->running = true; - return true; - } catch (\Exception $e) { - return false; - } - } - - /** - * Get the URL to the server - * - * @return string - */ - public function getUrl() - { - return 'http://127.0.0.1:' . $this->getPort() . '/'; - } - - /** - * Get the port that the server is listening on - * - * @return int - */ - public function getPort() - { - return $this->port; - } - - /** - * Get all of the received requests - * - * @param bool $hydrate Set to TRUE to turn the messages into - * actual {@see RequestInterface} objects. If $hydrate is FALSE, - * requests will be returned as strings. - * - * @return array - * @throws RuntimeException - */ - public function getReceivedRequests($hydrate = false) - { - $response = $this->client->get('guzzle-server/requests')->send(); - $data = array_filter(explode(self::REQUEST_DELIMITER, $response->getBody(true))); - if ($hydrate) { - $data = array_map(function($message) { - return RequestFactory::getInstance()->fromMessage($message); - }, $data); - } - - return $data; - } - - /** - * Start running the node.js server in the background - */ - public function start() - { - if (!$this->isRunning()) { - exec('node ' . __DIR__ . \DIRECTORY_SEPARATOR - . 'server.js ' . $this->port - . ' >> /tmp/server.log 2>&1 &'); - // Wait at most 5 seconds for the server the setup before - // proceeding. - $start = time(); - while (!$this->isRunning() && time() - $start < 5); - if (!$this->running) { - throw new RuntimeException( - 'Unable to contact server.js. Have you installed node.js v0.5.0+? node must be in your path.' - ); - } - } - } - - /** - * Stop running the node.js server - */ - public function stop() - { - if (!$this->isRunning()) { - return false; - } - - $this->running = false; - $this->client->delete('guzzle-server')->send(); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/StaticClientTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/StaticClientTest.php deleted file mode 100644 index 091314bb7..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/StaticClientTest.php +++ /dev/null @@ -1,67 +0,0 @@ -assertTrue(class_exists('FooBazBar')); - $this->assertSame($client, $this->readAttribute('Guzzle\Http\StaticClient', 'client')); - } - - public function requestProvider() - { - return array_map( - function ($m) { return array($m); }, - array('GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS') - ); - } - - /** - * @dataProvider requestProvider - */ - public function testSendsRequests($method) - { - $mock = new MockPlugin(array(new Response(200))); - call_user_func('Guzzle\Http\StaticClient::' . $method, 'http://foo.com', array( - 'plugins' => array($mock) - )); - $requests = $mock->getReceivedRequests(); - $this->assertCount(1, $requests); - $this->assertEquals($method, $requests[0]->getMethod()); - } - - public function testCanCreateStreamsUsingDefaultFactory() - { - $this->getServer()->enqueue(array("HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\ntest")); - $stream = StaticClient::get($this->getServer()->getUrl(), array('stream' => true)); - $this->assertInstanceOf('Guzzle\Stream\StreamInterface', $stream); - $this->assertEquals('test', (string) $stream); - } - - public function testCanCreateStreamsUsingCustomFactory() - { - $stream = $this->getMockBuilder('Guzzle\Stream\StreamRequestFactoryInterface') - ->setMethods(array('fromRequest')) - ->getMockForAbstractClass(); - $resource = new Stream(fopen('php://temp', 'r+')); - $stream->expects($this->once()) - ->method('fromRequest') - ->will($this->returnValue($resource)); - $this->getServer()->enqueue(array("HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\ntest")); - $result = StaticClient::get($this->getServer()->getUrl(), array('stream' => $stream)); - $this->assertSame($resource, $result); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/UrlTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/UrlTest.php deleted file mode 100644 index 28f26718b..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/UrlTest.php +++ /dev/null @@ -1,303 +0,0 @@ -assertEquals('', (string) $url); - } - - public function testPortIsDeterminedFromScheme() - { - $this->assertEquals(80, Url::factory('http://www.test.com/')->getPort()); - $this->assertEquals(443, Url::factory('https://www.test.com/')->getPort()); - $this->assertEquals(null, Url::factory('ftp://www.test.com/')->getPort()); - $this->assertEquals(8192, Url::factory('http://www.test.com:8192/')->getPort()); - } - - public function testCloneCreatesNewInternalObjects() - { - $u1 = Url::factory('http://www.test.com/'); - $u2 = clone $u1; - $this->assertNotSame($u1->getQuery(), $u2->getQuery()); - } - - public function testValidatesUrlPartsInFactory() - { - $url = Url::factory('/index.php'); - $this->assertEquals('/index.php', (string) $url); - $this->assertFalse($url->isAbsolute()); - - $url = 'http://michael:test@test.com:80/path/123?q=abc#test'; - $u = Url::factory($url); - $this->assertEquals('http://michael:test@test.com/path/123?q=abc#test', (string) $u); - $this->assertTrue($u->isAbsolute()); - } - - public function testAllowsFalsyUrlParts() - { - $url = Url::factory('http://0:50/0?0#0'); - $this->assertSame('0', $url->getHost()); - $this->assertEquals(50, $url->getPort()); - $this->assertSame('/0', $url->getPath()); - $this->assertEquals('0', (string) $url->getQuery()); - $this->assertSame('0', $url->getFragment()); - $this->assertEquals('http://0:50/0?0#0', (string) $url); - - $url = Url::factory(''); - $this->assertSame('', (string) $url); - - $url = Url::factory('0'); - $this->assertSame('0', (string) $url); - } - - public function testBuildsRelativeUrlsWithFalsyParts() - { - $url = Url::buildUrl(array( - 'host' => '0', - 'path' => '0', - )); - - $this->assertSame('//0/0', $url); - - $url = Url::buildUrl(array( - 'path' => '0', - )); - $this->assertSame('0', $url); - } - - public function testUrlStoresParts() - { - $url = Url::factory('http://test:pass@www.test.com:8081/path/path2/?a=1&b=2#fragment'); - $this->assertEquals('http', $url->getScheme()); - $this->assertEquals('test', $url->getUsername()); - $this->assertEquals('pass', $url->getPassword()); - $this->assertEquals('www.test.com', $url->getHost()); - $this->assertEquals(8081, $url->getPort()); - $this->assertEquals('/path/path2/', $url->getPath()); - $this->assertEquals('fragment', $url->getFragment()); - $this->assertEquals('a=1&b=2', (string) $url->getQuery()); - - $this->assertEquals(array( - 'fragment' => 'fragment', - 'host' => 'www.test.com', - 'pass' => 'pass', - 'path' => '/path/path2/', - 'port' => 8081, - 'query' => 'a=1&b=2', - 'scheme' => 'http', - 'user' => 'test' - ), $url->getParts()); - } - - public function testHandlesPathsCorrectly() - { - $url = Url::factory('http://www.test.com'); - $this->assertEquals('', $url->getPath()); - $url->setPath('test'); - $this->assertEquals('test', $url->getPath()); - - $url->setPath('/test/123/abc'); - $this->assertEquals(array('test', '123', 'abc'), $url->getPathSegments()); - - $parts = parse_url('http://www.test.com/test'); - $parts['path'] = ''; - $this->assertEquals('http://www.test.com', Url::buildUrl($parts)); - $parts['path'] = 'test'; - $this->assertEquals('http://www.test.com/test', Url::buildUrl($parts)); - } - - public function testAddsQueryStringIfPresent() - { - $this->assertEquals('?foo=bar', Url::buildUrl(array( - 'query' => 'foo=bar' - ))); - } - - public function testAddsToPath() - { - // Does nothing here - $this->assertEquals('http://e.com/base?a=1', (string) Url::factory('http://e.com/base?a=1')->addPath(false)); - $this->assertEquals('http://e.com/base?a=1', (string) Url::factory('http://e.com/base?a=1')->addPath(null)); - $this->assertEquals('http://e.com/base?a=1', (string) Url::factory('http://e.com/base?a=1')->addPath(array())); - $this->assertEquals('http://e.com/base?a=1', (string) Url::factory('http://e.com/base?a=1')->addPath(new \stdClass())); - $this->assertEquals('http://e.com/base?a=1', (string) Url::factory('http://e.com/base?a=1')->addPath('')); - $this->assertEquals('http://e.com/base?a=1', (string) Url::factory('http://e.com/base?a=1')->addPath('/')); - $this->assertEquals('http://e.com/baz/foo', (string) Url::factory('http://e.com/baz/')->addPath('foo')); - $this->assertEquals('http://e.com/base/relative?a=1', (string) Url::factory('http://e.com/base?a=1')->addPath('relative')); - $this->assertEquals('http://e.com/base/relative?a=1', (string) Url::factory('http://e.com/base?a=1')->addPath('/relative')); - $this->assertEquals('http://e.com/base/0', (string) Url::factory('http://e.com/base')->addPath('0')); - $this->assertEquals('http://e.com/base/0/1', (string) Url::factory('http://e.com/base')->addPath('0')->addPath('1')); - } - - /** - * URL combination data provider - * - * @return array - */ - public function urlCombineDataProvider() - { - return array( - array('http://www.example.com/', 'http://www.example.com/', 'http://www.example.com/'), - array('http://www.example.com/path', '/absolute', 'http://www.example.com/absolute'), - array('http://www.example.com/path', '/absolute?q=2', 'http://www.example.com/absolute?q=2'), - array('http://www.example.com/path', 'more', 'http://www.example.com/path/more'), - array('http://www.example.com/path', 'more?q=1', 'http://www.example.com/path/more?q=1'), - array('http://www.example.com/', '?q=1', 'http://www.example.com/?q=1'), - array('http://www.example.com/path', 'http://test.com', 'http://test.com'), - array('http://www.example.com:8080/path', 'http://test.com', 'http://test.com'), - array('http://www.example.com:8080/path', '?q=2#abc', 'http://www.example.com:8080/path?q=2#abc'), - array('http://u:a@www.example.com/path', 'test', 'http://u:a@www.example.com/path/test'), - array('http://www.example.com/path', 'http://u:a@www.example.com/', 'http://u:a@www.example.com/'), - array('/path?q=2', 'http://www.test.com/', 'http://www.test.com/path?q=2'), - array('http://api.flickr.com/services/', 'http://www.flickr.com/services/oauth/access_token', 'http://www.flickr.com/services/oauth/access_token'), - array('http://www.example.com/?foo=bar', 'some/path', 'http://www.example.com/some/path?foo=bar'), - array('http://www.example.com/?foo=bar', 'some/path?boo=moo', 'http://www.example.com/some/path?boo=moo&foo=bar'), - array('http://www.example.com/some/', 'path?foo=bar&foo=baz', 'http://www.example.com/some/path?foo=bar&foo=baz'), - ); - } - - /** - * @dataProvider urlCombineDataProvider - */ - public function testCombinesUrls($a, $b, $c) - { - $this->assertEquals($c, (string) Url::factory($a)->combine($b)); - } - - public function testHasGettersAndSetters() - { - $url = Url::factory('http://www.test.com/'); - $this->assertEquals('example.com', $url->setHost('example.com')->getHost()); - $this->assertEquals('8080', $url->setPort(8080)->getPort()); - $this->assertEquals('/foo/bar', $url->setPath(array('foo', 'bar'))->getPath()); - $this->assertEquals('a', $url->setPassword('a')->getPassword()); - $this->assertEquals('b', $url->setUsername('b')->getUsername()); - $this->assertEquals('abc', $url->setFragment('abc')->getFragment()); - $this->assertEquals('https', $url->setScheme('https')->getScheme()); - $this->assertEquals('a=123', (string) $url->setQuery('a=123')->getQuery()); - $this->assertEquals('https://b:a@example.com:8080/foo/bar?a=123#abc', (string) $url); - $this->assertEquals('b=boo', (string) $url->setQuery(new QueryString(array( - 'b' => 'boo' - )))->getQuery()); - $this->assertEquals('https://b:a@example.com:8080/foo/bar?b=boo#abc', (string) $url); - } - - public function testSetQueryAcceptsArray() - { - $url = Url::factory('http://www.test.com'); - $url->setQuery(array('a' => 'b')); - $this->assertEquals('http://www.test.com?a=b', (string) $url); - } - - public function urlProvider() - { - return array( - array('/foo/..', '/'), - array('//foo//..', '/'), - array('/foo/../..', '/'), - array('/foo/../.', '/'), - array('/./foo/..', '/'), - array('/./foo', '/foo'), - array('/./foo/', '/foo/'), - array('/./foo/bar/baz/pho/../..', '/foo/bar'), - array('*', '*'), - array('/foo', '/foo'), - array('/abc/123/../foo/', '/abc/foo/'), - array('/a/b/c/./../../g', '/a/g'), - array('/b/c/./../../g', '/g'), - array('/b/c/./../../g', '/g'), - array('/c/./../../g', '/g'), - array('/./../../g', '/g'), - ); - } - - /** - * @dataProvider urlProvider - */ - public function testNormalizesPaths($path, $result) - { - $url = Url::factory('http://www.example.com/'); - $url->setPath($path)->normalizePath(); - $this->assertEquals($result, $url->getPath()); - } - - public function testSettingHostWithPortModifiesPort() - { - $url = Url::factory('http://www.example.com'); - $url->setHost('foo:8983'); - $this->assertEquals('foo', $url->getHost()); - $this->assertEquals(8983, $url->getPort()); - } - - /** - * @expectedException \Guzzle\Common\Exception\InvalidArgumentException - */ - public function testValidatesUrlCanBeParsed() - { - Url::factory('foo:////'); - } - - public function testConvertsSpecialCharsInPathWhenCastingToString() - { - $url = Url::factory('http://foo.com/baz bar?a=b'); - $url->addPath('?'); - $this->assertEquals('http://foo.com/baz%20bar/%3F?a=b', (string) $url); - } - - /** - * @link http://tools.ietf.org/html/rfc3986#section-5.4.1 - */ - public function rfc3986UrlProvider() - { - $result = array( - array('g', 'http://a/b/c/g'), - array('./g', 'http://a/b/c/g'), - array('g/', 'http://a/b/c/g/'), - array('/g', 'http://a/g'), - array('?y', 'http://a/b/c/d;p?y'), - array('g?y', 'http://a/b/c/g?y'), - array('#s', 'http://a/b/c/d;p?q#s'), - array('g#s', 'http://a/b/c/g#s'), - array('g?y#s', 'http://a/b/c/g?y#s'), - array(';x', 'http://a/b/c/;x'), - array('g;x', 'http://a/b/c/g;x'), - array('g;x?y#s', 'http://a/b/c/g;x?y#s'), - array('', 'http://a/b/c/d;p?q'), - array('.', 'http://a/b/c'), - array('./', 'http://a/b/c/'), - array('..', 'http://a/b'), - array('../', 'http://a/b/'), - array('../g', 'http://a/b/g'), - array('../..', 'http://a/'), - array('../../', 'http://a/'), - array('../../g', 'http://a/g') - ); - - // This support was added in PHP 5.4.7: https://bugs.php.net/bug.php?id=62844 - if (version_compare(PHP_VERSION, '5.4.7', '>=')) { - $result[] = array('//g', 'http://g'); - } - - return $result; - } - - /** - * @dataProvider rfc3986UrlProvider - */ - public function testCombinesUrlsUsingRfc3986($relative, $result) - { - $a = Url::factory('http://a/b/c/d;p?q'); - $b = Url::factory($relative); - $this->assertEquals($result, trim((string) $a->combine($b, true), '=')); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/server.js b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/server.js deleted file mode 100644 index 4156f1aad..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Http/server.js +++ /dev/null @@ -1,146 +0,0 @@ -/** - * Guzzle node.js test server to return queued responses to HTTP requests and - * expose a RESTful API for enqueueing responses and retrieving the requests - * that have been received. - * - * - Delete all requests that have been received: - * DELETE /guzzle-server/requests - * Host: 127.0.0.1:8124 - * - * - Enqueue responses - * PUT /guzzle-server/responses - * Host: 127.0.0.1:8124 - * - * [{ "statusCode": 200, "reasonPhrase": "OK", "headers": {}, "body": "" }] - * - * - Get the received requests - * GET /guzzle-server/requests - * Host: 127.0.0.1:8124 - * - * - Shutdown the server - * DELETE /guzzle-server - * Host: 127.0.0.1:8124 - * - * @package Guzzle PHP - * @license See the LICENSE file that was distributed with this source code. - */ - -var http = require("http"); - -/** - * Guzzle node.js server - * @class - */ -var GuzzleServer = function(port, log) { - - this.port = port; - this.log = log; - this.responses = []; - this.requests = []; - var that = this; - - var controlRequest = function(request, req, res) { - if (req.url == '/guzzle-server/perf') { - res.writeHead(200, "OK", {"Content-Length": 16}); - res.end("Body of response"); - } else if (req.method == "DELETE") { - if (req.url == "/guzzle-server/requests") { - // Clear the received requests - that.requests = []; - res.writeHead(200, "OK", { "Content-Length": 0 }); - res.end(); - if (this.log) { - console.log("Flushing requests"); - } - } else if (req.url == "/guzzle-server") { - // Shutdown the server - res.writeHead(200, "OK", { "Content-Length": 0, "Connection": "close" }); - res.end(); - if (this.log) { - console.log("Shutting down"); - } - that.server.close(); - } - } else if (req.method == "GET") { - if (req.url === "/guzzle-server/requests") { - // Get received requests - var data = that.requests.join("\n----[request]\n"); - res.writeHead(200, "OK", { "Content-Length": data.length }); - res.end(data); - if (that.log) { - console.log("Sending receiving requests"); - } - } - } else if (req.method == "PUT") { - if (req.url == "/guzzle-server/responses") { - if (that.log) { - console.log("Adding responses..."); - } - // Received response to queue - var data = request.split("\r\n\r\n")[1]; - if (!data) { - if (that.log) { - console.log("No response data was provided"); - } - res.writeHead(400, "NO RESPONSES IN REQUEST", { "Content-Length": 0 }); - } else { - that.responses = eval("(" + data + ")"); - if (that.log) { - console.log(that.responses); - } - res.writeHead(200, "OK", { "Content-Length": 0 }); - } - res.end(); - } - } - }; - - var receivedRequest = function(request, req, res) { - if (req.url.indexOf("/guzzle-server") === 0) { - controlRequest(request, req, res); - } else if (req.url.indexOf("/guzzle-server") == -1 && !that.responses.length) { - res.writeHead(500); - res.end("No responses in queue"); - } else { - var response = that.responses.shift(); - res.writeHead(response.statusCode, response.reasonPhrase, response.headers); - res.end(response.body); - that.requests.push(request); - } - }; - - this.start = function() { - - that.server = http.createServer(function(req, res) { - - var request = req.method + " " + req.url + " HTTP/" + req.httpVersion + "\r\n"; - for (var i in req.headers) { - request += i + ": " + req.headers[i] + "\r\n"; - } - request += "\r\n"; - - // Receive each chunk of the request body - req.addListener("data", function(chunk) { - request += chunk; - }); - - // Called when the request completes - req.addListener("end", function() { - receivedRequest(request, req, res); - }); - }); - that.server.listen(port, "127.0.0.1"); - - if (this.log) { - console.log("Server running at http://127.0.0.1:8124/"); - } - }; -}; - -// Get the port from the arguments -port = process.argv.length >= 3 ? process.argv[2] : 8124; -log = process.argv.length >= 4 ? process.argv[3] : false; - -// Start the server -server = new GuzzleServer(port, log); -server.start(); diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Inflection/InflectorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Inflection/InflectorTest.php deleted file mode 100644 index 990c0af66..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Inflection/InflectorTest.php +++ /dev/null @@ -1,37 +0,0 @@ -assertSame(Inflector::getDefault(), Inflector::getDefault()); - } - - public function testSnake() - { - $this->assertEquals('camel_case', Inflector::getDefault()->snake('camelCase')); - $this->assertEquals('camel_case', Inflector::getDefault()->snake('CamelCase')); - $this->assertEquals('camel_case_words', Inflector::getDefault()->snake('CamelCaseWords')); - $this->assertEquals('camel_case_words', Inflector::getDefault()->snake('CamelCase_words')); - $this->assertEquals('test', Inflector::getDefault()->snake('test')); - $this->assertEquals('test', Inflector::getDefault()->snake('test')); - $this->assertEquals('expect100_continue', Inflector::getDefault()->snake('Expect100Continue')); - } - - public function testCamel() - { - $this->assertEquals('CamelCase', Inflector::getDefault()->camel('camel_case')); - $this->assertEquals('CamelCaseWords', Inflector::getDefault()->camel('camel_case_words')); - $this->assertEquals('Test', Inflector::getDefault()->camel('test')); - $this->assertEquals('Expect100Continue', ucfirst(Inflector::getDefault()->camel('expect100_continue'))); - // Get from cache - $this->assertEquals('Test', Inflector::getDefault()->camel('test', false)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Inflection/MemoizingInflectorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Inflection/MemoizingInflectorTest.php deleted file mode 100644 index f00b7fad8..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Inflection/MemoizingInflectorTest.php +++ /dev/null @@ -1,46 +0,0 @@ -getMock('Guzzle\Inflection\Inflector', array('snake', 'camel')); - $mock->expects($this->once())->method('snake')->will($this->returnValue('foo_bar')); - $mock->expects($this->once())->method('camel')->will($this->returnValue('FooBar')); - - $inflector = new MemoizingInflector($mock); - $this->assertEquals('foo_bar', $inflector->snake('FooBar')); - $this->assertEquals('foo_bar', $inflector->snake('FooBar')); - $this->assertEquals('FooBar', $inflector->camel('foo_bar')); - $this->assertEquals('FooBar', $inflector->camel('foo_bar')); - } - - public function testProtectsAgainstCacheOverflow() - { - $inflector = new MemoizingInflector(new Inflector(), 10); - for ($i = 1; $i < 11; $i++) { - $inflector->camel('foo_' . $i); - $inflector->snake('Foo' . $i); - } - - $cache = $this->readAttribute($inflector, 'cache'); - $this->assertEquals(10, count($cache['snake'])); - $this->assertEquals(10, count($cache['camel'])); - - $inflector->camel('baz!'); - $inflector->snake('baz!'); - - // Now ensure that 20% of the cache was removed (2), then the item was added - $cache = $this->readAttribute($inflector, 'cache'); - $this->assertEquals(9, count($cache['snake'])); - $this->assertEquals(9, count($cache['camel'])); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Inflection/PreComputedInflectorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Inflection/PreComputedInflectorTest.php deleted file mode 100644 index ff2654cf6..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Inflection/PreComputedInflectorTest.php +++ /dev/null @@ -1,45 +0,0 @@ -getMock('Guzzle\Inflection\Inflector', array('snake', 'camel')); - $mock->expects($this->once())->method('snake')->with('Test')->will($this->returnValue('test')); - $mock->expects($this->once())->method('camel')->with('Test')->will($this->returnValue('Test')); - $inflector = new PreComputedInflector($mock, array('FooBar' => 'foo_bar'), array('foo_bar' => 'FooBar')); - $this->assertEquals('FooBar', $inflector->camel('foo_bar')); - $this->assertEquals('foo_bar', $inflector->snake('FooBar')); - $this->assertEquals('Test', $inflector->camel('Test')); - $this->assertEquals('test', $inflector->snake('Test')); - } - - public function testMirrorsPrecomputedValues() - { - $mock = $this->getMock('Guzzle\Inflection\Inflector', array('snake', 'camel')); - $mock->expects($this->never())->method('snake'); - $mock->expects($this->never())->method('camel'); - $inflector = new PreComputedInflector($mock, array('Zeep' => 'zeep'), array(), true); - $this->assertEquals('Zeep', $inflector->camel('zeep')); - $this->assertEquals('zeep', $inflector->snake('Zeep')); - } - - public function testMirrorsPrecomputedValuesByMerging() - { - $mock = $this->getMock('Guzzle\Inflection\Inflector', array('snake', 'camel')); - $mock->expects($this->never())->method('snake'); - $mock->expects($this->never())->method('camel'); - $inflector = new PreComputedInflector($mock, array('Zeep' => 'zeep'), array('foo' => 'Foo'), true); - $this->assertEquals('Zeep', $inflector->camel('zeep')); - $this->assertEquals('zeep', $inflector->snake('Zeep')); - $this->assertEquals('Foo', $inflector->camel('foo')); - $this->assertEquals('foo', $inflector->snake('Foo')); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/AppendIteratorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/AppendIteratorTest.php deleted file mode 100644 index 8d6ae845a..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/AppendIteratorTest.php +++ /dev/null @@ -1,29 +0,0 @@ - 1, - 'b' => 2 - )); - $b = new \ArrayIterator(array()); - $c = new \ArrayIterator(array( - 'c' => 3, - 'd' => 4 - )); - $i = new AppendIterator(); - $i->append($a); - $i->append($b); - $i->append($c); - $this->assertEquals(array(1, 2, 3, 4), iterator_to_array($i, false)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/ChunkedIteratorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/ChunkedIteratorTest.php deleted file mode 100644 index ec4c1294c..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/ChunkedIteratorTest.php +++ /dev/null @@ -1,52 +0,0 @@ -assertEquals(11, count($chunks)); - foreach ($chunks as $j => $chunk) { - $this->assertEquals(range($j * 10, min(100, $j * 10 + 9)), $chunk); - } - } - - public function testChunksIteratorWithOddValues() - { - $chunked = new ChunkedIterator(new \ArrayIterator(array(1, 2, 3, 4, 5)), 2); - $chunks = iterator_to_array($chunked, false); - $this->assertEquals(3, count($chunks)); - $this->assertEquals(array(1, 2), $chunks[0]); - $this->assertEquals(array(3, 4), $chunks[1]); - $this->assertEquals(array(5), $chunks[2]); - } - - public function testMustNotTerminateWithTraversable() - { - $traversable = simplexml_load_string('')->foo; - $chunked = new ChunkedIterator($traversable, 2); - $actual = iterator_to_array($chunked, false); - $this->assertCount(2, $actual); - } - - public function testSizeOfZeroMakesIteratorInvalid() { - $chunked = new ChunkedIterator(new \ArrayIterator(range(1, 5)), 0); - $chunked->rewind(); - $this->assertFalse($chunked->valid()); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testSizeLowerZeroThrowsException() { - new ChunkedIterator(new \ArrayIterator(range(1, 5)), -1); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/FilterIteratorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/FilterIteratorTest.php deleted file mode 100644 index 73b4f6987..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/FilterIteratorTest.php +++ /dev/null @@ -1,28 +0,0 @@ -assertEquals(range(1, 99, 2), iterator_to_array($i, false)); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testValidatesCallable() - { - $i = new FilterIterator(new \ArrayIterator(), new \stdClass()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/MapIteratorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/MapIteratorTest.php deleted file mode 100644 index 4de4a6bc1..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/MapIteratorTest.php +++ /dev/null @@ -1,28 +0,0 @@ -assertEquals(range(0, 1000, 10), iterator_to_array($i, false)); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testValidatesCallable() - { - $i = new MapIterator(new \ArrayIterator(), new \stdClass()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/MethodProxyIteratorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/MethodProxyIteratorTest.php deleted file mode 100644 index 5bcf06fb0..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Iterator/MethodProxyIteratorTest.php +++ /dev/null @@ -1,28 +0,0 @@ -append('a'); - $proxy->append('b'); - $this->assertEquals(array('a', 'b'), $i->getArrayCopy()); - $this->assertEquals(array('a', 'b'), $proxy->getArrayCopy()); - } - - public function testUsesInnerIterator() - { - $i = new MethodProxyIterator(new ChunkedIterator(new \ArrayIterator(array(1, 2, 3, 4, 5)), 2)); - $this->assertEquals(3, count(iterator_to_array($i, false))); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/ArrayLogAdapterTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/ArrayLogAdapterTest.php deleted file mode 100644 index a66882f6f..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/ArrayLogAdapterTest.php +++ /dev/null @@ -1,23 +0,0 @@ -log('test', \LOG_NOTICE, '127.0.0.1'); - $this->assertEquals(array(array('message' => 'test', 'priority' => \LOG_NOTICE, 'extras' => '127.0.0.1')), $adapter->getLogs()); - } - - public function testClearLog() - { - $adapter = new ArrayLogAdapter(); - $adapter->log('test', \LOG_NOTICE, '127.0.0.1'); - $adapter->clearLogs(); - $this->assertEquals(array(), $adapter->getLogs()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/ClosureLogAdapterTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/ClosureLogAdapterTest.php deleted file mode 100644 index 0177dc071..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/ClosureLogAdapterTest.php +++ /dev/null @@ -1,30 +0,0 @@ -adapter = new ClosureLogAdapter(function($message, $priority, $extras = null) use ($that, &$modified) { - $modified = array($message, $priority, $extras); - }); - $this->adapter->log('test', LOG_NOTICE, '127.0.0.1'); - $this->assertEquals(array('test', LOG_NOTICE, '127.0.0.1'), $modified); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testThrowsExceptionWhenNotCallable() - { - $this->adapter = new ClosureLogAdapter(123); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/MessageFormatterTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/MessageFormatterTest.php deleted file mode 100644 index 3ff4b0737..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/MessageFormatterTest.php +++ /dev/null @@ -1,143 +0,0 @@ -request = new EntityEnclosingRequest('POST', 'http://foo.com?q=test', array( - 'X-Foo' => 'bar', - 'Authorization' => 'Baz' - )); - $this->request->setBody(EntityBody::factory('Hello')); - - $this->response = new Response(200, array( - 'X-Test' => 'Abc' - ), 'Foo'); - - $this->handle = $this->getMockBuilder('Guzzle\Http\Curl\CurlHandle') - ->disableOriginalConstructor() - ->setMethods(array('getError', 'getErrorNo', 'getStderr', 'getInfo')) - ->getMock(); - - $this->handle->expects($this->any()) - ->method('getError') - ->will($this->returnValue('e')); - - $this->handle->expects($this->any()) - ->method('getErrorNo') - ->will($this->returnValue('123')); - - $this->handle->expects($this->any()) - ->method('getStderr') - ->will($this->returnValue('testing')); - - $this->handle->expects($this->any()) - ->method('getInfo') - ->will($this->returnValueMap(array( - array(CURLINFO_CONNECT_TIME, '123'), - array(CURLINFO_TOTAL_TIME, '456') - ))); - } - - public function logProvider() - { - return array( - // Uses the cache for the second time - array('{method} - {method}', 'POST - POST'), - array('{url}', 'http://foo.com?q=test'), - array('{port}', '80'), - array('{resource}', '/?q=test'), - array('{host}', 'foo.com'), - array('{hostname}', gethostname()), - array('{protocol}/{version}', 'HTTP/1.1'), - array('{code} {phrase}', '200 OK'), - array('{req_header_Foo}', ''), - array('{req_header_X-Foo}', 'bar'), - array('{req_header_Authorization}', 'Baz'), - array('{res_header_foo}', ''), - array('{res_header_X-Test}', 'Abc'), - array('{req_body}', 'Hello'), - array('{res_body}', 'Foo'), - array('{curl_stderr}', 'testing'), - array('{curl_error}', 'e'), - array('{curl_code}', '123'), - array('{connect_time}', '123'), - array('{total_time}', '456') - ); - } - - /** - * @dataProvider logProvider - */ - public function testFormatsMessages($template, $output) - { - $formatter = new MessageFormatter($template); - $this->assertEquals($output, $formatter->format($this->request, $this->response, $this->handle)); - } - - public function testFormatsRequestsAndResponses() - { - $formatter = new MessageFormatter(); - $formatter->setTemplate('{request}{response}'); - $this->assertEquals($this->request . $this->response, $formatter->format($this->request, $this->response)); - } - - public function testAddsTimestamp() - { - $formatter = new MessageFormatter('{ts}'); - $this->assertNotEmpty($formatter->format($this->request, $this->response)); - } - - public function testUsesResponseWhenNoHandleAndGettingCurlInformation() - { - $formatter = new MessageFormatter('{connect_time}/{total_time}'); - $response = $this->getMockBuilder('Guzzle\Http\Message\Response') - ->setConstructorArgs(array(200)) - ->setMethods(array('getInfo')) - ->getMock(); - $response->expects($this->exactly(2)) - ->method('getInfo') - ->will($this->returnValueMap(array( - array('connect_time', '1'), - array('total_time', '2'), - ))); - $this->assertEquals('1/2', $formatter->format($this->request, $response)); - } - - public function testUsesEmptyStringWhenNoHandleAndNoResponse() - { - $formatter = new MessageFormatter('{connect_time}/{total_time}'); - $this->assertEquals('/', $formatter->format($this->request)); - } - - public function testInjectsTotalTime() - { - $out = ''; - $formatter = new MessageFormatter('{connect_time}/{total_time}'); - $adapter = new ClosureLogAdapter(function ($m) use (&$out) { $out .= $m; }); - $log = new LogPlugin($adapter, $formatter); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\nHI"); - $client = new Client($this->getServer()->getUrl()); - $client->addSubscriber($log); - $client->get('/')->send(); - $this->assertNotEquals('/', $out); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/PsrLogAdapterTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/PsrLogAdapterTest.php deleted file mode 100644 index 7b72dd6a0..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/PsrLogAdapterTest.php +++ /dev/null @@ -1,25 +0,0 @@ -pushHandler($handler); - $adapter = new PsrLogAdapter($log); - $adapter->log('test!', LOG_INFO); - $this->assertTrue($handler->hasInfoRecords()); - $this->assertSame($log, $adapter->getLogObject()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/Zf2LogAdapterTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/Zf2LogAdapterTest.php deleted file mode 100644 index 1b6128365..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Log/Zf2LogAdapterTest.php +++ /dev/null @@ -1,51 +0,0 @@ -stream = fopen('php://temp', 'r+'); - $this->log = new Logger(); - $this->log->addWriter(new Stream($this->stream)); - $this->adapter = new Zf2LogAdapter($this->log); - - } - - public function testLogsMessagesToAdaptedObject() - { - // Test without a priority - $this->adapter->log('Zend_Test!', \LOG_NOTICE); - rewind($this->stream); - $contents = stream_get_contents($this->stream); - $this->assertEquals(1, substr_count($contents, 'Zend_Test!')); - - // Test with a priority - $this->adapter->log('Zend_Test!', \LOG_ALERT); - rewind($this->stream); - $contents = stream_get_contents($this->stream); - $this->assertEquals(2, substr_count($contents, 'Zend_Test!')); - } - - public function testExposesAdaptedLogObject() - { - $this->assertEquals($this->log, $this->adapter->getLogObject()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Mock/CustomResponseModel.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Mock/CustomResponseModel.php deleted file mode 100644 index 3fb6527be..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Mock/CustomResponseModel.php +++ /dev/null @@ -1,21 +0,0 @@ -command = $command; - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Mock/ErrorResponseMock.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Mock/ErrorResponseMock.php deleted file mode 100644 index aabb15f9c..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Mock/ErrorResponseMock.php +++ /dev/null @@ -1,25 +0,0 @@ -command = $command; - $this->response = $response; - $this->message = 'Error from ' . $response; - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Mock/ExceptionMock.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Mock/ExceptionMock.php deleted file mode 100644 index 97a197487..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Mock/ExceptionMock.php +++ /dev/null @@ -1,11 +0,0 @@ -multiHandle; - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Mock/MockObserver.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Mock/MockObserver.php deleted file mode 100644 index 11e22eb46..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Mock/MockObserver.php +++ /dev/null @@ -1,65 +0,0 @@ -events as $event) { - if ($event->getName() == $eventName) { - return true; - } - } - - return false; - } - - public function getLastEvent() - { - return end($this->events); - } - - public function count() - { - return count($this->events); - } - - public function getGrouped() - { - $events = array(); - foreach ($this->events as $event) { - if (!isset($events[$event->getName()])) { - $events[$event->getName()] = array(); - } - $events[$event->getName()][] = $event; - } - - return $events; - } - - public function getData($event, $key, $occurrence = 0) - { - $grouped = $this->getGrouped(); - if (isset($grouped[$event])) { - return $grouped[$event][$occurrence][$key]; - } - - return null; - } - - public function update(Event $event) - { - $this->events[] = $event; - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Mock/MockSubject.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Mock/MockSubject.php deleted file mode 100644 index e011959bb..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Mock/MockSubject.php +++ /dev/null @@ -1,7 +0,0 @@ - 'allseeing-i.com', - 'path' => '/', - 'data' => array( - 'PHPSESSID' => '6c951590e7a9359bcedde25cda73e43c' - ), - 'max_age' => NULL, - 'expires' => 'Sat, 26-Jul-2008 17:00:42 GMT', - 'version' => NULL, - 'secure' => NULL, - 'discard' => NULL, - 'port' => NULL, - 'cookies' => array( - 'ASIHTTPRequestTestCookie' => 'This+is+the+value' - ), - 'comment' => null, - 'comment_url' => null, - 'http_only' => false - ) - ), - array('', false), - array('foo', false), - // Test setting a blank value for a cookie - array(array( - 'foo=', 'foo =', 'foo =;', 'foo= ;', 'foo =', 'foo= '), - array( - 'cookies' => array( - 'foo' => '' - ), - 'data' => array(), - 'discard' => null, - 'domain' => null, - 'expires' => null, - 'max_age' => null, - 'path' => '/', - 'port' => null, - 'secure' => null, - 'version' => null, - 'comment' => null, - 'comment_url' => null, - 'http_only' => false - ) - ), - // Test setting a value and removing quotes - array(array( - 'foo=1', 'foo =1', 'foo =1;', 'foo=1 ;', 'foo =1', 'foo= 1', 'foo = 1 ;', 'foo="1"', 'foo="1";', 'foo= "1";'), - array( - 'cookies' => array( - 'foo' => '1' - ), - 'data' => array(), - 'discard' => null, - 'domain' => null, - 'expires' => null, - 'max_age' => null, - 'path' => '/', - 'port' => null, - 'secure' => null, - 'version' => null, - 'comment' => null, - 'comment_url' => null, - 'http_only' => false - ) - ), - // Test setting multiple values - array(array( - 'foo=1; bar=2;', 'foo =1; bar = "2"', 'foo=1; bar=2'), - array( - 'cookies' => array( - 'foo' => '1', - 'bar' => '2', - ), - 'data' => array(), - 'discard' => null, - 'domain' => null, - 'expires' => null, - 'max_age' => null, - 'path' => '/', - 'port' => null, - 'secure' => null, - 'version' => null, - 'comment' => null, - 'comment_url' => null, - 'http_only' => false - ) - ), - // Tests getting the domain and path from a reference request - array(array( - 'foo=1; port="80,8081"; httponly', 'foo=1; port="80,8081"; domain=www.test.com; HttpOnly;', 'foo=1; ; domain=www.test.com; path=/path; port="80,8081"; HttpOnly;'), - array( - 'cookies' => array( - 'foo' => 1 - ), - 'data' => array(), - 'discard' => null, - 'domain' => 'www.test.com', - 'expires' => null, - 'max_age' => null, - 'path' => '/path', - 'port' => array('80', '8081'), - 'secure' => null, - 'version' => null, - 'comment' => null, - 'comment_url' => null, - 'http_only' => true - ), - 'http://www.test.com/path/' - ), - // Some of the following tests are based on http://framework.zend.com/svn/framework/standard/trunk/tests/Zend/Http/CookieTest.php - array( - 'justacookie=foo; domain=example.com', - array( - 'cookies' => array( - 'justacookie' => 'foo' - ), - 'domain' => 'example.com', - 'data' => array(), - 'discard' => null, - 'expires' => null, - 'max_age' => null, - 'path' => '/', - 'port' => null, - 'secure' => null, - 'version' => null, - 'comment' => null, - 'comment_url' => null, - 'http_only' => false - ) - ), - array( - 'expires=tomorrow; secure; path=/Space Out/; expires=Tue, 21-Nov-2006 08:33:44 GMT; domain=.example.com', - array( - 'cookies' => array( - 'expires' => 'tomorrow' - ), - 'domain' => '.example.com', - 'path' => '/Space Out/', - 'expires' => 'Tue, 21-Nov-2006 08:33:44 GMT', - 'data' => array(), - 'discard' => null, - 'port' => null, - 'secure' => true, - 'version' => null, - 'max_age' => null, - 'comment' => null, - 'comment_url' => null, - 'http_only' => false - ) - ), - array( - 'domain=unittests; expires=Tue, 21-Nov-2006 08:33:44 GMT; domain=example.com; path=/some value/', - array( - 'cookies' => array( - 'domain' => 'unittests' - ), - 'domain' => 'example.com', - 'path' => '/some value/', - 'expires' => 'Tue, 21-Nov-2006 08:33:44 GMT', - 'secure' => false, - 'data' => array(), - 'discard' => null, - 'max_age' => null, - 'port' => null, - 'version' => null, - 'comment' => null, - 'comment_url' => null, - 'http_only' => false - ) - ), - array( - 'path=indexAction; path=/; domain=.foo.com; expires=Tue, 21-Nov-2006 08:33:44 GMT', - array( - 'cookies' => array( - 'path' => 'indexAction' - ), - 'domain' => '.foo.com', - 'path' => '/', - 'expires' => 'Tue, 21-Nov-2006 08:33:44 GMT', - 'secure' => false, - 'data' => array(), - 'discard' => null, - 'max_age' => null, - 'port' => null, - 'version' => null, - 'comment' => null, - 'comment_url' => null, - 'http_only' => false - ) - ), - array( - 'secure=sha1; secure; SECURE; domain=some.really.deep.domain.com; version=1; Max-Age=86400', - array( - 'cookies' => array( - 'secure' => 'sha1' - ), - 'domain' => 'some.really.deep.domain.com', - 'path' => '/', - 'secure' => true, - 'data' => array(), - 'discard' => null, - 'expires' => time() + 86400, - 'max_age' => 86400, - 'port' => null, - 'version' => 1, - 'comment' => null, - 'comment_url' => null, - 'http_only' => false - ) - ), - array( - 'PHPSESSID=123456789+abcd%2Cef; secure; discard; domain=.localdomain; path=/foo/baz; expires=Tue, 21-Nov-2006 08:33:44 GMT;', - array( - 'cookies' => array( - 'PHPSESSID' => '123456789+abcd%2Cef' - ), - 'domain' => '.localdomain', - 'path' => '/foo/baz', - 'expires' => 'Tue, 21-Nov-2006 08:33:44 GMT', - 'secure' => true, - 'data' => array(), - 'discard' => true, - 'max_age' => null, - 'port' => null, - 'version' => null, - 'comment' => null, - 'comment_url' => null, - 'http_only' => false - ) - ), - // rfc6265#section-5.1.4 - array( - 'cookie=value', - array( - 'cookies' => array( - 'cookie' => 'value' - ), - 'domain' => 'example.com', - 'data' => array(), - 'discard' => null, - 'expires' => null, - 'max_age' => null, - 'path' => '/some/path', - 'port' => null, - 'secure' => null, - 'version' => null, - 'comment' => null, - 'comment_url' => null, - 'http_only' => false - ), - 'http://example.com/some/path/test.html' - ), - array( - 'empty=path', - array( - 'cookies' => array( - 'empty' => 'path' - ), - 'domain' => 'example.com', - 'data' => array(), - 'discard' => null, - 'expires' => null, - 'max_age' => null, - 'path' => '/', - 'port' => null, - 'secure' => null, - 'version' => null, - 'comment' => null, - 'comment_url' => null, - 'http_only' => false - ), - 'http://example.com/test.html' - ), - array( - 'baz=qux', - array( - 'cookies' => array( - 'baz' => 'qux' - ), - 'domain' => 'example.com', - 'data' => array(), - 'discard' => null, - 'expires' => null, - 'max_age' => null, - 'path' => '/', - 'port' => null, - 'secure' => null, - 'version' => null, - 'comment' => null, - 'comment_url' => null, - 'http_only' => false - ), - 'http://example.com?query=here' - ), - array( - 'test=noSlashPath; path=someString', - array( - 'cookies' => array( - 'test' => 'noSlashPath' - ), - 'domain' => 'example.com', - 'data' => array(), - 'discard' => null, - 'expires' => null, - 'max_age' => null, - 'path' => '/real/path', - 'port' => null, - 'secure' => null, - 'version' => null, - 'comment' => null, - 'comment_url' => null, - 'http_only' => false - ), - 'http://example.com/real/path/' - ), - ); - } - - /** - * @dataProvider cookieParserDataProvider - */ - public function testParseCookie($cookie, $parsed, $url = null) - { - $c = $this->cookieParserClass; - $parser = new $c(); - - $request = null; - if ($url) { - $url = Url::factory($url); - $host = $url->getHost(); - $path = $url->getPath(); - } else { - $host = ''; - $path = ''; - } - - foreach ((array) $cookie as $c) { - $p = $parser->parseCookie($c, $host, $path); - - // Remove expires values from the assertion if they are relatively equal by allowing a 5 minute difference - if ($p['expires'] != $parsed['expires']) { - if (abs($p['expires'] - $parsed['expires']) < 300) { - unset($p['expires']); - unset($parsed['expires']); - } - } - - if (is_array($parsed)) { - foreach ($parsed as $key => $value) { - $this->assertEquals($parsed[$key], $p[$key], 'Comparing ' . $key . ' ' . var_export($value, true) . ' : ' . var_export($parsed, true) . ' | ' . var_export($p, true)); - } - - foreach ($p as $key => $value) { - $this->assertEquals($p[$key], $parsed[$key], 'Comparing ' . $key . ' ' . var_export($value, true) . ' : ' . var_export($parsed, true) . ' | ' . var_export($p, true)); - } - } else { - $this->assertEquals($parsed, $p); - } - } - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/Cookie/CookieParserTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/Cookie/CookieParserTest.php deleted file mode 100644 index 75d336fa5..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/Cookie/CookieParserTest.php +++ /dev/null @@ -1,22 +0,0 @@ -parseCookie('foo=baz+bar', null, null, true); - $this->assertEquals(array( - 'foo' => 'baz bar' - ), $result['cookies']); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/Message/MessageParserProvider.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/Message/MessageParserProvider.php deleted file mode 100644 index da58bb465..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/Message/MessageParserProvider.php +++ /dev/null @@ -1,225 +0,0 @@ - 'GET', - 'protocol' => 'HTTP', - 'version' => '1.1', - 'request_url' => array( - 'scheme' => 'http', - 'host' => '', - 'port' => '', - 'path' => '/', - 'query' => '' - ), - 'headers' => array(), - 'body' => '' - )), - // Path and query string, multiple header values per header and case sensitive storage - array("HEAD /path?query=foo HTTP/1.0\r\nHost: example.com\r\nX-Foo: foo\r\nx-foo: Bar\r\nX-Foo: foo\r\nX-Foo: Baz\r\n\r\n", array( - 'method' => 'HEAD', - 'protocol' => 'HTTP', - 'version' => '1.0', - 'request_url' => array( - 'scheme' => 'http', - 'host' => 'example.com', - 'port' => '', - 'path' => '/path', - 'query' => 'query=foo' - ), - 'headers' => array( - 'Host' => 'example.com', - 'X-Foo' => array('foo', 'foo', 'Baz'), - 'x-foo' => 'Bar' - ), - 'body' => '' - )), - // Includes a body - array("PUT / HTTP/1.0\r\nhost: example.com:443\r\nContent-Length: 4\r\n\r\ntest", array( - 'method' => 'PUT', - 'protocol' => 'HTTP', - 'version' => '1.0', - 'request_url' => array( - 'scheme' => 'https', - 'host' => 'example.com', - 'port' => '443', - 'path' => '/', - 'query' => '' - ), - 'headers' => array( - 'host' => 'example.com:443', - 'Content-Length' => '4' - ), - 'body' => 'test' - )), - // Includes Authorization headers - array("GET / HTTP/1.1\r\nHost: example.com:8080\r\nAuthorization: Basic {$auth}\r\n\r\n", array( - 'method' => 'GET', - 'protocol' => 'HTTP', - 'version' => '1.1', - 'request_url' => array( - 'scheme' => 'http', - 'host' => 'example.com', - 'port' => '8080', - 'path' => '/', - 'query' => '' - ), - 'headers' => array( - 'Host' => 'example.com:8080', - 'Authorization' => "Basic {$auth}" - ), - 'body' => '' - )), - // Include authorization header - array("GET / HTTP/1.1\r\nHost: example.com:8080\r\nauthorization: Basic {$auth}\r\n\r\n", array( - 'method' => 'GET', - 'protocol' => 'HTTP', - 'version' => '1.1', - 'request_url' => array( - 'scheme' => 'http', - 'host' => 'example.com', - 'port' => '8080', - 'path' => '/', - 'query' => '' - ), - 'headers' => array( - 'Host' => 'example.com:8080', - 'authorization' => "Basic {$auth}" - ), - 'body' => '' - )), - ); - } - - public function responseProvider() - { - return array( - // Empty request - array('', false), - - array("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n", array( - 'protocol' => 'HTTP', - 'version' => '1.1', - 'code' => '200', - 'reason_phrase' => 'OK', - 'headers' => array( - 'Content-Length' => 0 - ), - 'body' => '' - )), - array("HTTP/1.0 400 Bad Request\r\nContent-Length: 0\r\n\r\n", array( - 'protocol' => 'HTTP', - 'version' => '1.0', - 'code' => '400', - 'reason_phrase' => 'Bad Request', - 'headers' => array( - 'Content-Length' => 0 - ), - 'body' => '' - )), - array("HTTP/1.0 100 Continue\r\n\r\n", array( - 'protocol' => 'HTTP', - 'version' => '1.0', - 'code' => '100', - 'reason_phrase' => 'Continue', - 'headers' => array(), - 'body' => '' - )), - array("HTTP/1.1 204 No Content\r\nX-Foo: foo\r\nx-foo: Bar\r\nX-Foo: foo\r\n\r\n", array( - 'protocol' => 'HTTP', - 'version' => '1.1', - 'code' => '204', - 'reason_phrase' => 'No Content', - 'headers' => array( - 'X-Foo' => array('foo', 'foo'), - 'x-foo' => 'Bar' - ), - 'body' => '' - )), - array("HTTP/1.1 200 Ok that is great!\r\nContent-Length: 4\r\n\r\nTest", array( - 'protocol' => 'HTTP', - 'version' => '1.1', - 'code' => '200', - 'reason_phrase' => 'Ok that is great!', - 'headers' => array( - 'Content-Length' => 4 - ), - 'body' => 'Test' - )), - ); - } - - public function compareRequestResults($result, $expected) - { - if (!$result) { - $this->assertFalse($expected); - return; - } - - $this->assertEquals($result['method'], $expected['method']); - $this->assertEquals($result['protocol'], $expected['protocol']); - $this->assertEquals($result['version'], $expected['version']); - $this->assertEquals($result['request_url'], $expected['request_url']); - $this->assertEquals($result['body'], $expected['body']); - $this->compareHttpHeaders($result['headers'], $expected['headers']); - } - - public function compareResponseResults($result, $expected) - { - if (!$result) { - $this->assertFalse($expected); - return; - } - - $this->assertEquals($result['protocol'], $expected['protocol']); - $this->assertEquals($result['version'], $expected['version']); - $this->assertEquals($result['code'], $expected['code']); - $this->assertEquals($result['reason_phrase'], $expected['reason_phrase']); - $this->assertEquals($result['body'], $expected['body']); - $this->compareHttpHeaders($result['headers'], $expected['headers']); - } - - protected function normalizeHeaders($headers) - { - $normalized = array(); - foreach ($headers as $key => $value) { - $key = strtolower($key); - if (!isset($normalized[$key])) { - $normalized[$key] = $value; - } elseif (!is_array($normalized[$key])) { - $normalized[$key] = array($value); - } else { - $normalized[$key][] = $value; - } - } - - foreach ($normalized as $key => &$value) { - if (is_array($value)) { - sort($value); - } - } - - return $normalized; - } - - public function compareHttpHeaders($result, $expected) - { - // Aggregate all headers case-insensitively - $result = $this->normalizeHeaders($result); - $expected = $this->normalizeHeaders($expected); - $this->assertEquals($result, $expected); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/Message/MessageParserTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/Message/MessageParserTest.php deleted file mode 100644 index 2f5222893..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/Message/MessageParserTest.php +++ /dev/null @@ -1,58 +0,0 @@ -compareRequestResults($parts, $parser->parseRequest($message)); - } - - /** - * @dataProvider responseProvider - */ - public function testParsesResponses($message, $parts) - { - $parser = new MessageParser(); - $this->compareResponseResults($parts, $parser->parseResponse($message)); - } - - public function testParsesRequestsWithMissingProtocol() - { - $parser = new MessageParser(); - $parts = $parser->parseRequest("GET /\r\nHost: Foo.com\r\n\r\n"); - $this->assertEquals('GET', $parts['method']); - $this->assertEquals('HTTP', $parts['protocol']); - $this->assertEquals('1.1', $parts['version']); - } - - public function testParsesRequestsWithMissingVersion() - { - $parser = new MessageParser(); - $parts = $parser->parseRequest("GET / HTTP\r\nHost: Foo.com\r\n\r\n"); - $this->assertEquals('GET', $parts['method']); - $this->assertEquals('HTTP', $parts['protocol']); - $this->assertEquals('1.1', $parts['version']); - } - - public function testParsesResponsesWithMissingReasonPhrase() - { - $parser = new MessageParser(); - $parts = $parser->parseResponse("HTTP/1.1 200\r\n\r\n"); - $this->assertEquals('200', $parts['code']); - $this->assertEquals('', $parts['reason_phrase']); - $this->assertEquals('HTTP', $parts['protocol']); - $this->assertEquals('1.1', $parts['version']); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/Message/PeclHttpMessageParserTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/Message/PeclHttpMessageParserTest.php deleted file mode 100644 index 6706e2063..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/Message/PeclHttpMessageParserTest.php +++ /dev/null @@ -1,36 +0,0 @@ -markTestSkipped('pecl_http is not available.'); - } - } - - /** - * @dataProvider requestProvider - */ - public function testParsesRequests($message, $parts) - { - $parser = new PeclHttpMessageParser(); - $this->compareRequestResults($parts, $parser->parseRequest($message)); - } - - /** - * @dataProvider responseProvider - */ - public function testParsesResponses($message, $parts) - { - $parser = new PeclHttpMessageParser(); - $this->compareResponseResults($parts, $parser->parseResponse($message)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/ParserRegistryTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/ParserRegistryTest.php deleted file mode 100644 index 7675efb96..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/ParserRegistryTest.php +++ /dev/null @@ -1,33 +0,0 @@ -registerParser('foo', $c); - $this->assertSame($c, $r->getParser('foo')); - } - - public function testReturnsNullWhenNotFound() - { - $r = new ParserRegistry(); - $this->assertNull($r->getParser('FOO')); - } - - public function testReturnsLazyLoadedDefault() - { - $r = new ParserRegistry(); - $c = $r->getParser('cookie'); - $this->assertInstanceOf('Guzzle\Parser\Cookie\CookieParser', $c); - $this->assertSame($c, $r->getParser('cookie')); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/UriTemplate/AbstractUriTemplateTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/UriTemplate/AbstractUriTemplateTest.php deleted file mode 100644 index a05fc2e4d..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/UriTemplate/AbstractUriTemplateTest.php +++ /dev/null @@ -1,113 +0,0 @@ - 'value', - 'hello' => 'Hello World!', - 'empty' => '', - 'path' => '/foo/bar', - 'x' => '1024', - 'y' => '768', - 'null' => null, - 'list' => array('red', 'green', 'blue'), - 'keys' => array( - "semi" => ';', - "dot" => '.', - "comma" => ',' - ), - 'empty_keys' => array(), - ); - - return array_map(function($t) use ($params) { - $t[] = $params; - return $t; - }, array( - array('foo', 'foo'), - array('{var}', 'value'), - array('{hello}', 'Hello%20World%21'), - array('{+var}', 'value'), - array('{+hello}', 'Hello%20World!'), - array('{+path}/here', '/foo/bar/here'), - array('here?ref={+path}', 'here?ref=/foo/bar'), - array('X{#var}', 'X#value'), - array('X{#hello}', 'X#Hello%20World!'), - array('map?{x,y}', 'map?1024,768'), - array('{x,hello,y}', '1024,Hello%20World%21,768'), - array('{+x,hello,y}', '1024,Hello%20World!,768'), - array('{+path,x}/here', '/foo/bar,1024/here'), - array('{#x,hello,y}', '#1024,Hello%20World!,768'), - array('{#path,x}/here', '#/foo/bar,1024/here'), - array('X{.var}', 'X.value'), - array('X{.x,y}', 'X.1024.768'), - array('{/var}', '/value'), - array('{/var,x}/here', '/value/1024/here'), - array('{;x,y}', ';x=1024;y=768'), - array('{;x,y,empty}', ';x=1024;y=768;empty'), - array('{?x,y}', '?x=1024&y=768'), - array('{?x,y,empty}', '?x=1024&y=768&empty='), - array('?fixed=yes{&x}', '?fixed=yes&x=1024'), - array('{&x,y,empty}', '&x=1024&y=768&empty='), - array('{var:3}', 'val'), - array('{var:30}', 'value'), - array('{list}', 'red,green,blue'), - array('{list*}', 'red,green,blue'), - array('{keys}', 'semi,%3B,dot,.,comma,%2C'), - array('{keys*}', 'semi=%3B,dot=.,comma=%2C'), - array('{+path:6}/here', '/foo/b/here'), - array('{+list}', 'red,green,blue'), - array('{+list*}', 'red,green,blue'), - array('{+keys}', 'semi,;,dot,.,comma,,'), - array('{+keys*}', 'semi=;,dot=.,comma=,'), - array('{#path:6}/here', '#/foo/b/here'), - array('{#list}', '#red,green,blue'), - array('{#list*}', '#red,green,blue'), - array('{#keys}', '#semi,;,dot,.,comma,,'), - array('{#keys*}', '#semi=;,dot=.,comma=,'), - array('X{.var:3}', 'X.val'), - array('X{.list}', 'X.red,green,blue'), - array('X{.list*}', 'X.red.green.blue'), - array('X{.keys}', 'X.semi,%3B,dot,.,comma,%2C'), - array('X{.keys*}', 'X.semi=%3B.dot=..comma=%2C'), - array('{/var:1,var}', '/v/value'), - array('{/list}', '/red,green,blue'), - array('{/list*}', '/red/green/blue'), - array('{/list*,path:4}', '/red/green/blue/%2Ffoo'), - array('{/keys}', '/semi,%3B,dot,.,comma,%2C'), - array('{/keys*}', '/semi=%3B/dot=./comma=%2C'), - array('{;hello:5}', ';hello=Hello'), - array('{;list}', ';list=red,green,blue'), - array('{;list*}', ';list=red;list=green;list=blue'), - array('{;keys}', ';keys=semi,%3B,dot,.,comma,%2C'), - array('{;keys*}', ';semi=%3B;dot=.;comma=%2C'), - array('{?var:3}', '?var=val'), - array('{?list}', '?list=red,green,blue'), - array('{?list*}', '?list=red&list=green&list=blue'), - array('{?keys}', '?keys=semi,%3B,dot,.,comma,%2C'), - array('{?keys*}', '?semi=%3B&dot=.&comma=%2C'), - array('{&var:3}', '&var=val'), - array('{&list}', '&list=red,green,blue'), - array('{&list*}', '&list=red&list=green&list=blue'), - array('{&keys}', '&keys=semi,%3B,dot,.,comma,%2C'), - array('{&keys*}', '&semi=%3B&dot=.&comma=%2C'), - array('{.null}', ''), - array('{.null,var}', '.value'), - array('X{.empty_keys*}', 'X'), - array('X{.empty_keys}', 'X'), - // Test that missing expansions are skipped - array('test{&missing*}', 'test'), - // Test that multiple expansions can be set - array('http://{var}/{var:2}{?keys*}', 'http://value/va?semi=%3B&dot=.&comma=%2C'), - // Test more complex query string stuff - array('http://www.test.com{+path}{?var,keys*}', 'http://www.test.com/foo/bar?var=value&semi=%3B&dot=.&comma=%2C') - )); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/UriTemplate/PeclUriTemplateTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/UriTemplate/PeclUriTemplateTest.php deleted file mode 100644 index 633c5d539..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/UriTemplate/PeclUriTemplateTest.php +++ /dev/null @@ -1,27 +0,0 @@ -markTestSkipped('uri_template PECL extension must be installed to test PeclUriTemplate'); - } - } - - /** - * @dataProvider templateProvider - */ - public function testExpandsUriTemplates($template, $expansion, $params) - { - $uri = new PeclUriTemplate($template); - $this->assertEquals($expansion, $uri->expand($template, $params)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/UriTemplate/UriTemplateTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/UriTemplate/UriTemplateTest.php deleted file mode 100644 index 5130d6f4b..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Parser/UriTemplate/UriTemplateTest.php +++ /dev/null @@ -1,106 +0,0 @@ -assertEquals($expansion, $uri->expand($template, $params)); - } - - public function expressionProvider() - { - return array( - array( - '{+var*}', array( - 'operator' => '+', - 'values' => array( - array('value' => 'var', 'modifier' => '*') - ) - ), - ), - array( - '{?keys,var,val}', array( - 'operator' => '?', - 'values' => array( - array('value' => 'keys', 'modifier' => ''), - array('value' => 'var', 'modifier' => ''), - array('value' => 'val', 'modifier' => '') - ) - ), - ), - array( - '{+x,hello,y}', array( - 'operator' => '+', - 'values' => array( - array('value' => 'x', 'modifier' => ''), - array('value' => 'hello', 'modifier' => ''), - array('value' => 'y', 'modifier' => '') - ) - ) - ) - ); - } - - /** - * @dataProvider expressionProvider - */ - public function testParsesExpressions($exp, $data) - { - $template = new UriTemplate($exp); - - // Access the config object - $class = new \ReflectionClass($template); - $method = $class->getMethod('parseExpression'); - $method->setAccessible(true); - - $exp = substr($exp, 1, -1); - $this->assertEquals($data, $method->invokeArgs($template, array($exp))); - } - - /** - * @ticket https://github.com/guzzle/guzzle/issues/90 - */ - public function testAllowsNestedArrayExpansion() - { - $template = new UriTemplate(); - - $result = $template->expand('http://example.com{+path}{/segments}{?query,data*,foo*}', array( - 'path' => '/foo/bar', - 'segments' => array('one', 'two'), - 'query' => 'test', - 'data' => array( - 'more' => array('fun', 'ice cream') - ), - 'foo' => array( - 'baz' => array( - 'bar' => 'fizz', - 'test' => 'buzz' - ), - 'bam' => 'boo' - ) - )); - - $this->assertEquals('http://example.com/foo/bar/one,two?query=test&more%5B0%5D=fun&more%5B1%5D=ice%20cream&baz%5Bbar%5D=fizz&baz%5Btest%5D=buzz&bam=boo', $result); - } - - /** - * @ticket https://github.com/guzzle/guzzle/issues/426 - */ - public function testSetRegex() - { - $template = new UriTemplate(); - $template->setRegex('/\<\$(.+)\>/'); - $this->assertSame('/foo', $template->expand('/<$a>', array('a' => 'foo'))); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Async/AsyncPluginTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Async/AsyncPluginTest.php deleted file mode 100644 index 16990a5a8..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Async/AsyncPluginTest.php +++ /dev/null @@ -1,93 +0,0 @@ -assertArrayHasKey('request.before_send', $events); - $this->assertArrayHasKey('request.exception', $events); - $this->assertArrayHasKey('curl.callback.progress', $events); - } - - public function testEnablesProgressCallbacks() - { - $p = new AsyncPlugin(); - $request = RequestFactory::getInstance()->create('PUT', 'http://www.example.com'); - $event = new Event(array( - 'request' => $request - )); - $p->onBeforeSend($event); - $this->assertEquals(true, $request->getCurlOptions()->get('progress')); - } - - public function testAddsTimesOutAfterSending() - { - $p = new AsyncPlugin(); - $request = RequestFactory::getInstance()->create('PUT', 'http://www.example.com'); - $handle = CurlHandle::factory($request); - $event = new Event(array( - 'request' => $request, - 'handle' => $handle->getHandle(), - 'uploaded' => 10, - 'upload_size' => 10, - 'downloaded' => 0 - )); - $p->onCurlProgress($event); - } - - public function testEnsuresRequestIsSet() - { - $p = new AsyncPlugin(); - $event = new Event(array( - 'uploaded' => 10, - 'upload_size' => 10, - 'downloaded' => 0 - )); - $p->onCurlProgress($event); - } - - public function testMasksCurlExceptions() - { - $p = new AsyncPlugin(); - $request = RequestFactory::getInstance()->create('PUT', 'http://www.example.com'); - $e = new CurlException('Error'); - $event = new Event(array( - 'request' => $request, - 'exception' => $e - )); - $p->onRequestTimeout($event); - $this->assertEquals(RequestInterface::STATE_COMPLETE, $request->getState()); - $this->assertEquals(200, $request->getResponse()->getStatusCode()); - $this->assertTrue($request->getResponse()->hasHeader('X-Guzzle-Async')); - } - - public function testEnsuresIntegration() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 204 FOO\r\nContent-Length: 4\r\n\r\ntest"); - $client = new Client($this->getServer()->getUrl()); - $request = $client->post('/', null, array( - 'foo' => 'bar' - )); - $request->getEventDispatcher()->addSubscriber(new AsyncPlugin()); - $request->send(); - $this->assertEquals('', $request->getResponse()->getBody(true)); - $this->assertTrue($request->getResponse()->hasHeader('X-Guzzle-Async')); - $received = $this->getServer()->getReceivedRequests(true); - $this->assertEquals('POST', $received[0]->getMethod()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/AbstractBackoffStrategyTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/AbstractBackoffStrategyTest.php deleted file mode 100644 index 72af26308..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/AbstractBackoffStrategyTest.php +++ /dev/null @@ -1,86 +0,0 @@ -getMockBuilder('Guzzle\Plugin\Backoff\AbstractBackoffStrategy') - ->setMethods(array('getDelay', 'makesDecision')) - ->getMockForAbstractClass(); - } - - public function testReturnsZeroWhenNoNextAndGotNull() - { - $request = new Request('GET', 'http://www.foo.com'); - $mock = $this->getMockStrategy(); - $mock->expects($this->atLeastOnce())->method('getDelay')->will($this->returnValue(null)); - $this->assertEquals(0, $mock->getBackoffPeriod(0, $request)); - } - - public function testReturnsFalse() - { - $request = new Request('GET', 'http://www.foo.com'); - $mock = $this->getMockStrategy(); - $mock->expects($this->atLeastOnce())->method('getDelay')->will($this->returnValue(false)); - $this->assertEquals(false, $mock->getBackoffPeriod(0, $request)); - } - - public function testReturnsNextValueWhenNullOrTrue() - { - $request = new Request('GET', 'http://www.foo.com'); - $mock = $this->getMockStrategy(); - $mock->expects($this->atLeastOnce())->method('getDelay')->will($this->returnValue(null)); - $mock->expects($this->any())->method('makesDecision')->will($this->returnValue(false)); - - $mock2 = $this->getMockStrategy(); - $mock2->expects($this->atLeastOnce())->method('getDelay')->will($this->returnValue(10)); - $mock2->expects($this->atLeastOnce())->method('makesDecision')->will($this->returnValue(true)); - $mock->setNext($mock2); - - $this->assertEquals(10, $mock->getBackoffPeriod(0, $request)); - } - - public function testReturnsFalseWhenNullAndNoNext() - { - $request = new Request('GET', 'http://www.foo.com'); - $s = new TruncatedBackoffStrategy(2); - $this->assertFalse($s->getBackoffPeriod(0, $request)); - } - - public function testHasNext() - { - $a = new TruncatedBackoffStrategy(2); - $b = new TruncatedBackoffStrategy(2); - $a->setNext($b); - $this->assertSame($b, $a->getNext()); - } - - public function testSkipsOtherDecisionsInChainWhenOneReturnsTrue() - { - $a = new CallbackBackoffStrategy(function () { return null; }, true); - $b = new CallbackBackoffStrategy(function () { return true; }, true); - $c = new CallbackBackoffStrategy(function () { return null; }, true); - $d = new CallbackBackoffStrategy(function () { return 10; }, false); - $a->setNext($b); - $b->setNext($c); - $c->setNext($d); - $this->assertEquals(10, $a->getBackoffPeriod(2, new Request('GET', 'http://www.foo.com'))); - } - - public function testReturnsZeroWhenDecisionMakerReturnsTrueButNoFurtherStrategiesAreInTheChain() - { - $a = new CallbackBackoffStrategy(function () { return null; }, true); - $b = new CallbackBackoffStrategy(function () { return true; }, true); - $a->setNext($b); - $this->assertSame(0, $a->getBackoffPeriod(2, new Request('GET', 'http://www.foo.com'))); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/BackoffLoggerTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/BackoffLoggerTest.php deleted file mode 100644 index a64dd826e..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/BackoffLoggerTest.php +++ /dev/null @@ -1,110 +0,0 @@ -message = ''; - } - - public function testHasEventList() - { - $this->assertEquals(1, count(BackoffLogger::getSubscribedEvents())); - } - - public function testLogsEvents() - { - list($logPlugin, $request, $response) = $this->getMocks(); - - $response = $this->getMockBuilder('Guzzle\Http\Message\Response') - ->setConstructorArgs(array(503)) - ->setMethods(array('getInfo')) - ->getMock(); - - $response->expects($this->any()) - ->method('getInfo') - ->will($this->returnValue(2)); - - $handle = $this->getMockHandle(); - - $event = new Event(array( - 'request' => $request, - 'response' => $response, - 'retries' => 1, - 'delay' => 3, - 'handle' => $handle - )); - - $logPlugin->onRequestRetry($event); - $this->assertContains( - '] PUT http://www.example.com - 503 Service Unavailable - Retries: 1, Delay: 3, Time: 2, 2, cURL: 30 Foo', - $this->message - ); - } - - public function testCanSetTemplate() - { - $l = new BackoffLogger(new ClosureLogAdapter(function () {})); - $l->setTemplate('foo'); - $t = $this->readAttribute($l, 'formatter'); - $this->assertEquals('foo', $this->readAttribute($t, 'template')); - } - - /** - * @return array - */ - protected function getMocks() - { - $that = $this; - $logger = new ClosureLogAdapter(function ($message) use ($that) { - $that->message .= $message . "\n"; - }); - $logPlugin = new BackoffLogger($logger); - $response = new Response(503); - $request = RequestFactory::getInstance()->create('PUT', 'http://www.example.com', array( - 'Content-Length' => 3, - 'Foo' => 'Bar' - )); - - return array($logPlugin, $request, $response); - } - - /** - * @return CurlHandle - */ - protected function getMockHandle() - { - $handle = $this->getMockBuilder('Guzzle\Http\Curl\CurlHandle') - ->disableOriginalConstructor() - ->setMethods(array('getError', 'getErrorNo', 'getInfo')) - ->getMock(); - - $handle->expects($this->once()) - ->method('getError') - ->will($this->returnValue('Foo')); - - $handle->expects($this->once()) - ->method('getErrorNo') - ->will($this->returnValue(30)); - - $handle->expects($this->any()) - ->method('getInfo') - ->will($this->returnValue(2)); - - return $handle; - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/BackoffPluginTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/BackoffPluginTest.php deleted file mode 100644 index 496e49eb2..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/BackoffPluginTest.php +++ /dev/null @@ -1,297 +0,0 @@ -retried = false; - } - - public static function getSubscribedEvents() - { - return array(BackoffPlugin::RETRY_EVENT => 'onRequestRetry'); - } - - public function onRequestRetry(Event $event) - { - $this->retried = $event; - } - - public function testHasEventList() - { - $this->assertEquals(1, count(BackoffPlugin::getAllEvents())); - } - - public function testCreatesDefaultExponentialBackoffPlugin() - { - $plugin = BackoffPlugin::getExponentialBackoff(3, array(204), array(10)); - $this->assertInstanceOf('Guzzle\Plugin\Backoff\BackoffPlugin', $plugin); - $strategy = $this->readAttribute($plugin, 'strategy'); - $this->assertInstanceOf('Guzzle\Plugin\Backoff\TruncatedBackoffStrategy', $strategy); - $this->assertEquals(3, $this->readAttribute($strategy, 'max')); - $strategy = $this->readAttribute($strategy, 'next'); - $this->assertInstanceOf('Guzzle\Plugin\Backoff\HttpBackoffStrategy', $strategy); - $this->assertEquals(array(204 => true), $this->readAttribute($strategy, 'errorCodes')); - $strategy = $this->readAttribute($strategy, 'next'); - $this->assertInstanceOf('Guzzle\Plugin\Backoff\CurlBackoffStrategy', $strategy); - $this->assertEquals(array(10 => true), $this->readAttribute($strategy, 'errorCodes')); - $strategy = $this->readAttribute($strategy, 'next'); - $this->assertInstanceOf('Guzzle\Plugin\Backoff\ExponentialBackoffStrategy', $strategy); - } - - public function testDoesNotRetryUnlessStrategyReturnsNumber() - { - $request = new Request('GET', 'http://www.example.com'); - $request->setState('transfer'); - - $mock = $this->getMockBuilder('Guzzle\Plugin\Backoff\BackoffStrategyInterface') - ->setMethods(array('getBackoffPeriod')) - ->getMockForAbstractClass(); - - $mock->expects($this->once()) - ->method('getBackoffPeriod') - ->will($this->returnValue(false)); - - $plugin = new BackoffPlugin($mock); - $plugin->addSubscriber($this); - $plugin->onRequestSent(new Event(array('request' => $request))); - $this->assertFalse($this->retried); - } - - public function testUpdatesRequestForRetry() - { - $request = new Request('GET', 'http://www.example.com'); - $request->setState('transfer'); - $response = new Response(500); - $handle = $this->getMockBuilder('Guzzle\Http\Curl\CurlHandle')->disableOriginalConstructor()->getMock(); - $e = new CurlException(); - $e->setCurlHandle($handle); - - $plugin = new BackoffPlugin(new ConstantBackoffStrategy(10)); - $plugin->addSubscriber($this); - - $event = new Event(array( - 'request' => $request, - 'response' => $response, - 'exception' => $e - )); - - $plugin->onRequestSent($event); - $this->assertEquals(array( - 'request' => $request, - 'response' => $response, - 'handle' => $handle, - 'retries' => 1, - 'delay' => 10 - ), $this->readAttribute($this->retried, 'context')); - - $plugin->onRequestSent($event); - $this->assertEquals(array( - 'request' => $request, - 'response' => $response, - 'handle' => $handle, - 'retries' => 2, - 'delay' => 10 - ), $this->readAttribute($this->retried, 'context')); - } - - public function testDoesNothingWhenNotRetryingAndPollingRequest() - { - $request = new Request('GET', 'http://www.foo.com'); - $plugin = new BackoffPlugin(new ConstantBackoffStrategy(10)); - $plugin->onRequestPoll(new Event(array('request' => $request))); - } - - public function testRetriesRequests() - { - // Create a script to return several 500 and 503 response codes - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\ndata" - )); - - $plugin = new BackoffPlugin( - new TruncatedBackoffStrategy(3, - new HttpBackoffStrategy(null, - new CurlBackoffStrategy(null, - new ConstantBackoffStrategy(0.05) - ) - ) - ) - ); - - $client = new Client($this->getServer()->getUrl()); - $client->getEventDispatcher()->addSubscriber($plugin); - $request = $client->get(); - $request->send(); - - // Make sure it eventually completed successfully - $this->assertEquals(200, $request->getResponse()->getStatusCode()); - $this->assertEquals('data', $request->getResponse()->getBody(true)); - - // Check that three requests were made to retry this request - $this->assertEquals(3, count($this->getServer()->getReceivedRequests(false))); - $this->assertEquals(2, $request->getParams()->get(BackoffPlugin::RETRY_PARAM)); - } - - /** - * @expectedException \Guzzle\Http\Exception\ServerErrorResponseException - */ - public function testFailsOnTruncation() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\n\r\n" - )); - - $plugin = new BackoffPlugin( - new TruncatedBackoffStrategy(2, - new HttpBackoffStrategy(null, - new ConstantBackoffStrategy(0.05) - ) - ) - ); - - $client = new Client($this->getServer()->getUrl()); - $client->addSubscriber($plugin); - $client->get()->send(); - } - - public function testRetriesRequestsWhenInParallel() - { - // Create a script to return several 500 and 503 response codes - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\ndata", - "HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\ndata", - "HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\ndata", - "HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\ndata", - "HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\ndata" - )); - - $plugin = new BackoffPlugin( - new HttpBackoffStrategy(null, - new TruncatedBackoffStrategy(3, - new CurlBackoffStrategy(null, - new ConstantBackoffStrategy(0.1) - ) - ) - ) - ); - $client = new Client($this->getServer()->getUrl()); - $client->getEventDispatcher()->addSubscriber($plugin); - $requests = array(); - for ($i = 0; $i < 5; $i++) { - $requests[] = $client->get(); - } - $client->send($requests); - - $this->assertEquals(15, count($this->getServer()->getReceivedRequests(false))); - } - - /** - * @covers Guzzle\Plugin\Backoff\BackoffPlugin - * @covers Guzzle\Http\Curl\CurlMulti - */ - public function testRetriesPooledRequestsUsingDelayAndPollingEvent() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 500 Internal Server Error\r\nContent-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\ndata" - )); - // Need to sleep for some time ensure that the polling works correctly in the observer - $plugin = new BackoffPlugin(new HttpBackoffStrategy(null, - new TruncatedBackoffStrategy(1, - new ConstantBackoffStrategy(0.5)))); - - $client = new Client($this->getServer()->getUrl()); - $client->getEventDispatcher()->addSubscriber($plugin); - $request = $client->get(); - $request->send(); - // Make sure it eventually completed successfully - $this->assertEquals('data', $request->getResponse()->getBody(true)); - // Check that two requests were made to retry this request - $this->assertEquals(2, count($this->getServer()->getReceivedRequests(false))); - } - - public function testSeeksToBeginningOfRequestBodyWhenRetrying() - { - // Create a request with a body - $request = new EntityEnclosingRequest('PUT', 'http://www.example.com'); - $request->setBody('abc'); - // Set the retry time to be something that will be retried always - $request->getParams()->set(BackoffPlugin::DELAY_PARAM, 2); - // Seek to the end of the stream - $request->getBody()->seek(3); - $this->assertEquals('', $request->getBody()->read(1)); - // Create a plugin that does not delay when retrying - $plugin = new BackoffPlugin(new ConstantBackoffStrategy(0)); - $plugin->onRequestPoll($this->getMockEvent($request)); - // Ensure that the stream was seeked to 0 - $this->assertEquals('a', $request->getBody()->read(1)); - } - - public function testDoesNotSeekOnRequestsWithNoBodyWhenRetrying() - { - // Create a request with a body - $request = new EntityEnclosingRequest('PUT', 'http://www.example.com'); - $request->getParams()->set(BackoffPlugin::DELAY_PARAM, 2); - $plugin = new BackoffPlugin(new ConstantBackoffStrategy(0)); - $plugin->onRequestPoll($this->getMockEvent($request)); - } - - protected function getMockEvent(RequestInterface $request) - { - // Create a mock curl multi object - $multi = $this->getMockBuilder('Guzzle\Http\Curl\CurlMulti') - ->setMethods(array('remove', 'add')) - ->getMock(); - - // Create an event that is expected for the Poll event - $event = new Event(array( - 'request' => $request, - 'curl_multi' => $multi - )); - $event->setName(CurlMultiInterface::POLLING_REQUEST); - - return $event; - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/CallbackBackoffStrategyTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/CallbackBackoffStrategyTest.php deleted file mode 100644 index c0ce10d5c..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/CallbackBackoffStrategyTest.php +++ /dev/null @@ -1,31 +0,0 @@ -getMock('Guzzle\Http\Message\Request', array(), array(), '', false); - $strategy = new CallbackBackoffStrategy(function () { return 10; }, true); - $this->assertTrue($strategy->makesDecision()); - $this->assertEquals(10, $strategy->getBackoffPeriod(0, $request)); - // Ensure it chains correctly when null is returned - $strategy = new CallbackBackoffStrategy(function () { return null; }, false); - $this->assertFalse($strategy->makesDecision()); - $this->assertFalse($strategy->getBackoffPeriod(0, $request)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/ConstantBackoffStrategyTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/ConstantBackoffStrategyTest.php deleted file mode 100644 index 703eb4a22..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/ConstantBackoffStrategyTest.php +++ /dev/null @@ -1,20 +0,0 @@ -assertFalse($strategy->makesDecision()); - $request = $this->getMock('Guzzle\Http\Message\Request', array(), array(), '', false); - $this->assertEquals(3.5, $strategy->getBackoffPeriod(0, $request)); - $this->assertEquals(3.5, $strategy->getBackoffPeriod(1, $request)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/CurlBackoffStrategyTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/CurlBackoffStrategyTest.php deleted file mode 100644 index 0a5c3e28d..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/CurlBackoffStrategyTest.php +++ /dev/null @@ -1,36 +0,0 @@ -assertNotEmpty(CurlBackoffStrategy::getDefaultFailureCodes()); - $strategy = new CurlBackoffStrategy(); - $this->assertTrue($strategy->makesDecision()); - $request = $this->getMock('Guzzle\Http\Message\Request', array(), array(), '', false); - $e = new CurlException(); - $e->setError('foo', CURLE_BAD_CALLING_ORDER); - $this->assertEquals(false, $strategy->getBackoffPeriod(0, $request, null, $e)); - - foreach (CurlBackoffStrategy::getDefaultFailureCodes() as $code) { - $this->assertEquals(0, $strategy->getBackoffPeriod(0, $request, null, $e->setError('foo', $code))); - } - } - - public function testIgnoresNonErrors() - { - $strategy = new CurlBackoffStrategy(); - $request = $this->getMock('Guzzle\Http\Message\Request', array(), array(), '', false); - $this->assertEquals(false, $strategy->getBackoffPeriod(0, $request, new Response(200))); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/ExponentialBackoffStrategyTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/ExponentialBackoffStrategyTest.php deleted file mode 100644 index 09965bcbf..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/ExponentialBackoffStrategyTest.php +++ /dev/null @@ -1,23 +0,0 @@ -assertFalse($strategy->makesDecision()); - $request = $this->getMock('Guzzle\Http\Message\Request', array(), array(), '', false); - $this->assertEquals(1, $strategy->getBackoffPeriod(0, $request)); - $this->assertEquals(2, $strategy->getBackoffPeriod(1, $request)); - $this->assertEquals(4, $strategy->getBackoffPeriod(2, $request)); - $this->assertEquals(8, $strategy->getBackoffPeriod(3, $request)); - $this->assertEquals(16, $strategy->getBackoffPeriod(4, $request)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/HttpBackoffStrategyTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/HttpBackoffStrategyTest.php deleted file mode 100644 index ae68a4eb8..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/HttpBackoffStrategyTest.php +++ /dev/null @@ -1,47 +0,0 @@ -assertNotEmpty(HttpBackoffStrategy::getDefaultFailureCodes()); - $strategy = new HttpBackoffStrategy(); - $this->assertTrue($strategy->makesDecision()); - $request = $this->getMock('Guzzle\Http\Message\Request', array(), array(), '', false); - - $response = new Response(200); - $this->assertEquals(false, $strategy->getBackoffPeriod(0, $request, $response)); - $response->setStatus(400); - $this->assertEquals(false, $strategy->getBackoffPeriod(0, $request, $response)); - - foreach (HttpBackoffStrategy::getDefaultFailureCodes() as $code) { - $this->assertEquals(0, $strategy->getBackoffPeriod(0, $request, $response->setStatus($code))); - } - } - - public function testAllowsCustomCodes() - { - $strategy = new HttpBackoffStrategy(array(204)); - $request = $this->getMock('Guzzle\Http\Message\Request', array(), array(), '', false); - $response = new Response(204); - $this->assertEquals(0, $strategy->getBackoffPeriod(0, $request, $response)); - $response->setStatus(500); - $this->assertEquals(false, $strategy->getBackoffPeriod(0, $request, $response)); - } - - public function testIgnoresNonErrors() - { - $strategy = new HttpBackoffStrategy(); - $request = $this->getMock('Guzzle\Http\Message\Request', array(), array(), '', false); - $this->assertEquals(false, $strategy->getBackoffPeriod(0, $request)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/LinearBackoffStrategyTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/LinearBackoffStrategyTest.php deleted file mode 100644 index b4ce8e4af..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/LinearBackoffStrategyTest.php +++ /dev/null @@ -1,21 +0,0 @@ -assertFalse($strategy->makesDecision()); - $request = $this->getMock('Guzzle\Http\Message\Request', array(), array(), '', false); - $this->assertEquals(0, $strategy->getBackoffPeriod(0, $request)); - $this->assertEquals(5, $strategy->getBackoffPeriod(1, $request)); - $this->assertEquals(10, $strategy->getBackoffPeriod(2, $request)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/ReasonPhraseBackoffStrategyTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/ReasonPhraseBackoffStrategyTest.php deleted file mode 100644 index dea5a6878..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/ReasonPhraseBackoffStrategyTest.php +++ /dev/null @@ -1,32 +0,0 @@ -assertEmpty(ReasonPhraseBackoffStrategy::getDefaultFailureCodes()); - $strategy = new ReasonPhraseBackoffStrategy(array('Foo', 'Internal Server Error')); - $this->assertTrue($strategy->makesDecision()); - $request = $this->getMock('Guzzle\Http\Message\Request', array(), array(), '', false); - $response = new Response(200); - $this->assertEquals(false, $strategy->getBackoffPeriod(0, $request, $response)); - $response->setStatus(200, 'Foo'); - $this->assertEquals(0, $strategy->getBackoffPeriod(0, $request, $response)); - } - - public function testIgnoresNonErrors() - { - $strategy = new ReasonPhraseBackoffStrategy(); - $request = $this->getMock('Guzzle\Http\Message\Request', array(), array(), '', false); - $this->assertEquals(false, $strategy->getBackoffPeriod(0, $request)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/TruncatedBackoffStrategyTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/TruncatedBackoffStrategyTest.php deleted file mode 100644 index 5590dfb1c..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Backoff/TruncatedBackoffStrategyTest.php +++ /dev/null @@ -1,30 +0,0 @@ -assertTrue($strategy->makesDecision()); - $request = $this->getMock('Guzzle\Http\Message\Request', array(), array(), '', false); - $this->assertFalse($strategy->getBackoffPeriod(0, $request)); - $this->assertFalse($strategy->getBackoffPeriod(1, $request)); - $this->assertFalse($strategy->getBackoffPeriod(2, $request)); - - $response = new Response(500); - $strategy->setNext(new HttpBackoffStrategy(null, new ConstantBackoffStrategy(10))); - $this->assertEquals(10, $strategy->getBackoffPeriod(0, $request, $response)); - $this->assertEquals(10, $strategy->getBackoffPeriod(1, $request, $response)); - $this->assertFalse($strategy->getBackoffPeriod(2, $request, $response)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/CachePluginTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/CachePluginTest.php deleted file mode 100644 index 69da60a93..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/CachePluginTest.php +++ /dev/null @@ -1,441 +0,0 @@ -assertInstanceOf('Guzzle\Plugin\Cache\CacheStorageInterface', $this->readAttribute($plugin, 'storage')); - } - - public function testAddsDefaultCollaborators() - { - $this->assertNotEmpty(CachePlugin::getSubscribedEvents()); - $plugin = new CachePlugin(array( - 'storage' => $this->getMockBuilder('Guzzle\Plugin\Cache\CacheStorageInterface')->getMockForAbstractClass() - )); - $this->assertInstanceOf('Guzzle\Plugin\Cache\CacheStorageInterface', $this->readAttribute($plugin, 'storage')); - $this->assertInstanceOf( - 'Guzzle\Plugin\Cache\CanCacheStrategyInterface', - $this->readAttribute($plugin, 'canCache') - ); - $this->assertInstanceOf( - 'Guzzle\Plugin\Cache\RevalidationInterface', - $this->readAttribute($plugin, 'revalidation') - ); - } - - public function testAddsCallbackCollaborators() - { - $this->assertNotEmpty(CachePlugin::getSubscribedEvents()); - $plugin = new CachePlugin(array('can_cache' => function () {})); - $this->assertInstanceOf( - 'Guzzle\Plugin\Cache\CallbackCanCacheStrategy', - $this->readAttribute($plugin, 'canCache') - ); - } - - public function testCanPassCacheAsOnlyArgumentToConstructor() - { - $p = new CachePlugin(new DoctrineCacheAdapter(new ArrayCache())); - $p = new CachePlugin(new DefaultCacheStorage(new DoctrineCacheAdapter(new ArrayCache()))); - } - - public function testUsesCreatedCacheStorage() - { - $plugin = new CachePlugin(array( - 'adapter' => $this->getMockBuilder('Guzzle\Cache\CacheAdapterInterface')->getMockForAbstractClass() - )); - $this->assertInstanceOf('Guzzle\Plugin\Cache\CacheStorageInterface', $this->readAttribute($plugin, 'storage')); - } - - public function testUsesProvidedOptions() - { - $can = $this->getMockBuilder('Guzzle\Plugin\Cache\CanCacheStrategyInterface')->getMockForAbstractClass(); - $revalidate = $this->getMockBuilder('Guzzle\Plugin\Cache\RevalidationInterface')->getMockForAbstractClass(); - $plugin = new CachePlugin(array( - 'storage' => $this->getMockBuilder('Guzzle\Plugin\Cache\CacheStorageInterface')->getMockForAbstractClass(), - 'can_cache' => $can, - 'revalidation' => $revalidate - )); - $this->assertSame($can, $this->readAttribute($plugin, 'canCache')); - $this->assertSame($revalidate, $this->readAttribute($plugin, 'revalidation')); - } - - public function satisfyProvider() - { - $req1 = new Request('GET', 'http://foo.com', array('Cache-Control' => 'no-cache')); - - return array( - // The response is too old to satisfy the request - array(new Request('GET', 'http://foo.com', array('Cache-Control' => 'max-age=20')), new Response(200, array('Age' => 100)), false, false), - // The response cannot satisfy the request because it is stale - array(new Request('GET', 'http://foo.com'), new Response(200, array('Cache-Control' => 'max-age=10', 'Age' => 100)), false, false), - // Allows the expired response to satisfy the request because of the max-stale - array(new Request('GET', 'http://foo.com', array('Cache-Control' => 'max-stale=15')), new Response(200, array('Cache-Control' => 'max-age=90', 'Age' => 100)), true, false), - // Max stale is > than the allowed staleness - array(new Request('GET', 'http://foo.com', array('Cache-Control' => 'max-stale=5')), new Response(200, array('Cache-Control' => 'max-age=90', 'Age' => 100)), false, false), - // Performs cache revalidation - array($req1, new Response(200), true, true), - // Performs revalidation due to ETag on the response and no cache-control on the request - array(new Request('GET', 'http://foo.com'), new Response(200, array( - 'ETag' => 'ABC', - 'Expires' => date('c', strtotime('+1 year')) - )), true, true), - ); - } - - /** - * @dataProvider satisfyProvider - */ - public function testChecksIfResponseCanSatisfyRequest($request, $response, $can, $revalidates) - { - $didRevalidate = false; - $storage = $this->getMockBuilder('Guzzle\Plugin\Cache\CacheStorageInterface')->getMockForAbstractClass(); - $revalidate = $this->getMockBuilder('Guzzle\Plugin\Cache\DefaultRevalidation') - ->setMethods(array('revalidate')) - ->setConstructorArgs(array($storage)) - ->getMockForAbstractClass(); - - $revalidate->expects($this->any()) - ->method('revalidate') - ->will($this->returnCallback(function () use (&$didRevalidate) { - $didRevalidate = true; - return true; - })); - - $plugin = new CachePlugin(array( - 'storage' => $storage, - 'revalidation' => $revalidate - )); - - $this->assertEquals($can, $plugin->canResponseSatisfyRequest($request, $response)); - $this->assertEquals($didRevalidate, $revalidates); - } - - public function satisfyFailedProvider() - { - return array( - // Neither has stale-if-error - array(new Request('GET', 'http://foo.com', array()), new Response(200, array('Age' => 100)), false), - // Request has stale-if-error - array(new Request('GET', 'http://foo.com', array('Cache-Control' => 'stale-if-error')), new Response(200, array('Age' => 100, 'Cache-Control' => 'max-age=50')), true), - // Request has valid stale-if-error - array(new Request('GET', 'http://foo.com', array('Cache-Control' => 'stale-if-error=50')), new Response(200, array('Age' => 100, 'Cache-Control' => 'max-age=50')), true), - // Request has expired stale-if-error - array(new Request('GET', 'http://foo.com', array('Cache-Control' => 'stale-if-error=20')), new Response(200, array('Age' => 100, 'Cache-Control' => 'max-age=50')), false), - // Response has permanent stale-if-error - array(new Request('GET', 'http://foo.com', array()), new Response(200, array('Age' => 100, 'Cache-Control' => 'max-age=50, stale-if-error', )), true), - // Response has valid stale-if-error - array(new Request('GET', 'http://foo.com', array()), new Response(200, array('Age' => 100, 'Cache-Control' => 'max-age=50, stale-if-error=50')), true), - // Response has expired stale-if-error - array(new Request('GET', 'http://foo.com', array()), new Response(200, array('Age' => 100, 'Cache-Control' => 'max-age=50, stale-if-error=20')), false), - // Request has valid stale-if-error but response does not - array(new Request('GET', 'http://foo.com', array('Cache-Control' => 'stale-if-error=50')), new Response(200, array('Age' => 100, 'Cache-Control' => 'max-age=50, stale-if-error=20')), false), - // Response has valid stale-if-error but request does not - array(new Request('GET', 'http://foo.com', array('Cache-Control' => 'stale-if-error=20')), new Response(200, array('Age' => 100, 'Cache-Control' => 'max-age=50, stale-if-error=50')), false), - ); - } - - /** - * @dataProvider satisfyFailedProvider - */ - public function testChecksIfResponseCanSatisfyFailedRequest($request, $response, $can) - { - $plugin = new CachePlugin(); - - $this->assertEquals($can, $plugin->canResponseSatisfyFailedRequest($request, $response)); - } - - public function testDoesNothingWhenRequestIsNotCacheable() - { - $storage = $this->getMockBuilder('Guzzle\Plugin\Cache\CacheStorageInterface') - ->setMethods(array('fetch')) - ->getMockForAbstractClass(); - $storage->expects($this->never())->method('fetch'); - - $plugin = new CachePlugin(array( - 'storage' => $storage, - 'can_cache' => new CallbackCanCacheStrategy(function () { return false; }) - )); - - $plugin->onRequestBeforeSend(new Event(array( - 'request' => new Request('GET', 'http://foo.com') - ))); - } - - public function satisfiableProvider() - { - $date = new \DateTime('-10 seconds'); - - return array( - // Fresh response - array(new Response(200, array(), 'foo')), - // Stale response - array(new Response(200, array('Date' => $date->format('c'), 'Cache-Control' => 'max-age=5'), 'foo')) - ); - } - - /** - * @dataProvider satisfiableProvider - */ - public function testInjectsSatisfiableResponses($response) - { - $storage = $this->getMockBuilder('Guzzle\Plugin\Cache\CacheStorageInterface') - ->setMethods(array('fetch')) - ->getMockForAbstractClass(); - - $storage->expects($this->once())->method('fetch')->will($this->returnValue($response)); - $plugin = new CachePlugin(array('storage' => $storage)); - $request = new Request('GET', 'http://foo.com', array('Cache-Control' => 'max-stale')); - $plugin->onRequestBeforeSend(new Event(array('request' => $request))); - $plugin->onRequestSent(new Event(array('request' => $request, 'response' => $request->getResponse()))); - $this->assertEquals($response->getStatusCode(), $request->getResponse()->getStatusCode()); - $this->assertEquals((string) $response->getBody(), (string) $request->getResponse()->getBody()); - $this->assertTrue($request->getResponse()->hasHeader('Age')); - if ($request->getResponse()->isFresh() === false) { - $this->assertContains('110', (string) $request->getResponse()->getHeader('Warning')); - } - $this->assertSame( - sprintf('%s GuzzleCache/%s', $request->getProtocolVersion(), Version::VERSION), - (string) $request->getHeader('Via') - ); - $this->assertSame( - sprintf('%s GuzzleCache/%s',$request->getProtocolVersion(), Version::VERSION), - (string) $request->getResponse()->getHeader('Via') - ); - $this->assertTrue($request->getParams()->get('cache.lookup')); - $this->assertTrue($request->getParams()->get('cache.hit')); - $this->assertTrue($request->getResponse()->hasHeader('X-Cache-Lookup')); - $this->assertTrue($request->getResponse()->hasHeader('X-Cache')); - $this->assertEquals('HIT from GuzzleCache', (string) $request->getResponse()->getHeader('X-Cache')); - $this->assertEquals('HIT from GuzzleCache', (string) $request->getResponse()->getHeader('X-Cache-Lookup')); - } - - public function satisfiableOnErrorProvider() - { - $date = new \DateTime('-10 seconds'); - return array( - array( - new Response(200, array( - 'Date' => $date->format('c'), - 'Cache-Control' => 'max-age=5, stale-if-error' - ), 'foo'), - ) - ); - } - - /** - * @dataProvider satisfiableOnErrorProvider - */ - public function testInjectsSatisfiableResponsesOnError($cacheResponse) - { - $storage = $this->getMockBuilder('Guzzle\Plugin\Cache\CacheStorageInterface') - ->setMethods(array('fetch')) - ->getMockForAbstractClass(); - $storage->expects($this->exactly(2))->method('fetch')->will($this->returnValue($cacheResponse)); - $plugin = new CachePlugin(array('storage' => $storage)); - $request = new Request('GET', 'http://foo.com', array('Cache-Control' => 'max-stale')); - $plugin->onRequestBeforeSend(new Event(array('request' => $request))); - $plugin->onRequestError( - $event = new Event(array( - 'request' => $request, - 'response' => $request->getResponse(), - )) - ); - $response = $event['response']; - $this->assertEquals($cacheResponse->getStatusCode(), $response->getStatusCode()); - $this->assertEquals((string) $cacheResponse->getBody(), (string) $response->getBody()); - $this->assertTrue($response->hasHeader('Age')); - if ($response->isFresh() === false) { - $this->assertContains('110', (string) $response->getHeader('Warning')); - } - $this->assertSame(sprintf('%s GuzzleCache/%s', $request->getProtocolVersion(), Version::VERSION), (string) $request->getHeader('Via')); - $this->assertSame(sprintf('%s GuzzleCache/%s', $request->getProtocolVersion(), Version::VERSION), (string) $response->getHeader('Via')); - $this->assertTrue($request->getParams()->get('cache.lookup')); - $this->assertSame('error', $request->getParams()->get('cache.hit')); - $this->assertTrue($response->hasHeader('X-Cache-Lookup')); - $this->assertTrue($response->hasHeader('X-Cache')); - $this->assertEquals('HIT from GuzzleCache', (string) $response->getHeader('X-Cache-Lookup')); - $this->assertEquals('HIT_ERROR from GuzzleCache', (string) $response->getHeader('X-Cache')); - } - - /** - * @dataProvider satisfiableOnErrorProvider - */ - public function testInjectsSatisfiableResponsesOnException($cacheResponse) - { - $storage = $this->getMockBuilder('Guzzle\Plugin\Cache\CacheStorageInterface') - ->setMethods(array('fetch')) - ->getMockForAbstractClass(); - $storage->expects($this->exactly(2))->method('fetch')->will($this->returnValue($cacheResponse)); - $plugin = new CachePlugin(array('storage' => $storage)); - $request = new Request('GET', 'http://foo.com', array('Cache-Control' => 'max-stale')); - $plugin->onRequestBeforeSend(new Event(array( - 'request' => $request - ))); - $plugin->onRequestException( - new Event(array( - 'request' => $request, - 'response' => $request->getResponse(), - 'exception' => $this->getMock('Guzzle\Http\Exception\CurlException'), - )) - ); - $plugin->onRequestSent( - new Event(array( - 'request' => $request, - 'response' => $response = $request->getResponse(), - )) - ); - $this->assertEquals($cacheResponse->getStatusCode(), $response->getStatusCode()); - $this->assertEquals((string) $cacheResponse->getBody(), (string) $response->getBody()); - $this->assertTrue($response->hasHeader('Age')); - if ($response->isFresh() === false) { - $this->assertContains('110', (string) $response->getHeader('Warning')); - } - $this->assertSame(sprintf('%s GuzzleCache/%s', $request->getProtocolVersion(), Version::VERSION), (string) $request->getHeader('Via')); - $this->assertSame(sprintf('%s GuzzleCache/%s', $request->getProtocolVersion(), Version::VERSION), (string) $response->getHeader('Via')); - $this->assertTrue($request->getParams()->get('cache.lookup')); - $this->assertSame('error', $request->getParams()->get('cache.hit')); - $this->assertTrue($response->hasHeader('X-Cache-Lookup')); - $this->assertTrue($response->hasHeader('X-Cache')); - $this->assertEquals('HIT from GuzzleCache', (string) $response->getHeader('X-Cache-Lookup')); - $this->assertEquals('HIT_ERROR from GuzzleCache', (string) $response->getHeader('X-Cache')); - } - - public function unsatisfiableOnErrorProvider() - { - $date = new \DateTime('-10 seconds'); - - return array( - // no-store on request - array( - false, - array('Cache-Control' => 'no-store'), - new Response(200, array('Date' => $date->format('D, d M Y H:i:s T'), 'Cache-Control' => 'max-age=5, stale-if-error'), 'foo'), - ), - // request expired - array( - true, - array('Cache-Control' => 'stale-if-error=4'), - new Response(200, array('Date' => $date->format('D, d M Y H:i:s T'), 'Cache-Control' => 'max-age=5, stale-if-error'), 'foo'), - ), - // response expired - array( - true, - array('Cache-Control' => 'stale-if-error'), - new Response(200, array('Date' => $date->format('D, d M Y H:i:s T'), 'Cache-Control' => 'max-age=5, stale-if-error=4'), 'foo'), - ), - ); - } - - /** - * @dataProvider unsatisfiableOnErrorProvider - */ - public function testDoesNotInjectUnsatisfiableResponsesOnError($requestCanCache, $requestHeaders, $cacheResponse) - { - $storage = $this->getMockBuilder('Guzzle\Plugin\Cache\CacheStorageInterface') - ->setMethods(array('fetch')) - ->getMockForAbstractClass(); - $storage->expects($this->exactly($requestCanCache ? 2 : 0))->method('fetch')->will($this->returnValue($cacheResponse)); - $plugin = new CachePlugin(array('storage' => $storage)); - $request = new Request('GET', 'http://foo.com', $requestHeaders); - $plugin->onRequestBeforeSend(new Event(array( - 'request' => $request - ))); - $plugin->onRequestError( - $event = new Event(array( - 'request' => $request, - 'response' => $response = $request->getResponse(), - )) - ); - - $this->assertSame($response, $event['response']); - } - - /** - * @dataProvider unsatisfiableOnErrorProvider - */ - public function testDoesNotInjectUnsatisfiableResponsesOnException($requestCanCache, $requestHeaders, $responseParts) - { - $storage = $this->getMockBuilder('Guzzle\Plugin\Cache\CacheStorageInterface') - ->setMethods(array('fetch')) - ->getMockForAbstractClass(); - $storage->expects($this->exactly($requestCanCache ? 2 : 0))->method('fetch')->will($this->returnValue($responseParts)); - $plugin = new CachePlugin(array('storage' => $storage)); - $request = new Request('GET', 'http://foo.com', $requestHeaders); - $plugin->onRequestBeforeSend(new Event(array( - 'request' => $request - ))); - $plugin->onRequestException( - $event = new Event(array( - 'request' => $request, - 'response' => $response = $request->getResponse(), - 'exception' => $this->getMock('Guzzle\Http\Exception\CurlException'), - )) - ); - - $this->assertSame($response, $request->getResponse()); - } - - public function testCachesResponsesWhenCacheable() - { - $cache = new ArrayCache(); - $plugin = new CachePlugin($cache); - - $request = new Request('GET', 'http://foo.com'); - $response = new Response(200, array(), 'Foo'); - $plugin->onRequestBeforeSend(new Event(array( - 'request' => $request - ))); - $plugin->onRequestSent(new Event(array( - 'request' => $request, - 'response' => $response - ))); - $data = $this->readAttribute($cache, 'data'); - $this->assertNotEmpty($data); - } - - public function testPurgesRequests() - { - $storage = $this->getMockBuilder('Guzzle\Plugin\Cache\CacheStorageInterface') - ->setMethods(array('purge')) - ->getMockForAbstractClass(); - $storage->expects($this->atLeastOnce())->method('purge'); - $plugin = new CachePlugin(array('storage' => $storage)); - $request = new Request('GET', 'http://foo.com', array('X-Foo' => 'Bar')); - $plugin->purge($request); - } - - public function testAutoPurgesRequests() - { - $storage = $this->getMockBuilder('Guzzle\Plugin\Cache\CacheStorageInterface') - ->setMethods(array('purge')) - ->getMockForAbstractClass(); - $storage->expects($this->atLeastOnce())->method('purge'); - $plugin = new CachePlugin(array('storage' => $storage, 'auto_purge' => true)); - $client = new Client(); - $request = $client->put('http://foo.com', array('X-Foo' => 'Bar')); - $request->addSubscriber($plugin); - $request->setResponse(new Response(200), true); - $request->send(); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/CallbackCanCacheStrategyTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/CallbackCanCacheStrategyTest.php deleted file mode 100644 index f3d9bafe2..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/CallbackCanCacheStrategyTest.php +++ /dev/null @@ -1,72 +0,0 @@ -assertTrue($c->canCacheRequest(new Request('DELETE', 'http://www.foo.com'))); - } - - /** - * The following is a bit of an integration test to ensure that the CachePlugin honors a - * custom can cache strategy. - */ - public function testIntegrationWithCachePlugin() - { - $c = new CallbackCanCacheStrategy( - function ($request) { return true; }, - function ($response) { return true; } - ); - - // Make a request and response that have no business being cached - $request = new Request('DELETE', 'http://www.foo.com'); - $response = Response::fromMessage( - "HTTP/1.1 200 OK\r\n" - . "Expires: Mon, 26 Jul 1997 05:00:00 GMT\r\n" - . "Last-Modified: Wed, 09 Jan 2013 08:48:53 GMT\r\n" - . "Content-Length: 2\r\n" - . "Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0\r\n\r\n" - . "hi" - ); - - $this->assertTrue($c->canCacheRequest($request)); - $this->assertTrue($c->canCacheResponse($response)); - - $s = $this->getMockBuilder('Guzzle\Plugin\Cache\DefaultCacheStorage') - ->setConstructorArgs(array(new DoctrineCacheAdapter(new ArrayCache()))) - ->setMethods(array('fetch')) - ->getMockForAbstractClass(); - - $s->expects($this->once()) - ->method('fetch') - ->will($this->returnValue($response)); - - $plugin = new CachePlugin(array('can_cache' => $c, 'storage' => $s)); - $plugin->onRequestBeforeSend(new Event(array('request' => $request))); - - $this->assertEquals(200, $request->getResponse()->getStatusCode()); - $this->assertEquals('hi', $request->getResponse()->getBody(true)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/DefaultCacheStorageTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/DefaultCacheStorageTest.php deleted file mode 100644 index 701a0155f..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/DefaultCacheStorageTest.php +++ /dev/null @@ -1,193 +0,0 @@ - 'application/json')); - $response = new Response(200, array( - 'Content-Type' => 'application/json', - 'Connection' => 'close', - 'X-Foo' => 'Bar', - 'Vary' => 'Accept' - ), 'test'); - $s->cache($request, $response); - $data = $this->readAttribute($a, 'data'); - - return array( - 'cache' => $a, - 'adapter' => $c, - 'storage' => $s, - 'request' => $request, - 'response' => $response, - 'serialized' => end($data) - ); - } - - public function testReturnsNullForCacheMiss() - { - $cache = $this->getCache(); - $this->assertNull($cache['storage']->fetch(new Request('GET', 'http://test.com'))); - } - - public function testCachesRequests() - { - $cache = $this->getCache(); - $foundRequest = $foundBody = $bodyKey = false; - foreach ($this->readAttribute($cache['cache'], 'data') as $key => $v) { - if (strpos($v, 'foo.com')) { - $foundRequest = true; - $data = unserialize($v); - $bodyKey = $data[0][3]; - $this->assertInternalType('integer', $data[0][4]); - $this->assertFalse(isset($data[0][0]['connection'])); - $this->assertEquals('foo.com', $data[0][0]['host']); - } elseif ($v == 'test') { - $foundBody = $key; - } - } - $this->assertContains($bodyKey, $foundBody); - $this->assertTrue($foundRequest); - } - - public function testFetchesResponse() - { - $cache = $this->getCache(); - $response = $cache['storage']->fetch($cache['request']); - $this->assertEquals(200, $response->getStatusCode()); - $this->assertFalse($response->hasHeader('Connection')); - $this->assertEquals('Bar', (string) $response->getHeader('X-Foo')); - $this->assertEquals('test', (string) $response->getBody()); - $this->assertTrue(in_array($cache['serialized'], $this->readAttribute($cache['cache'], 'data'))); - } - - public function testDeletesRequestItemsAndBody() - { - $cache = $this->getCache(); - $cache['storage']->delete($cache['request']); - $this->assertFalse(in_array('test', $this->readAttribute($cache['cache'], 'data'))); - $this->assertFalse(in_array($cache['serialized'], $this->readAttribute($cache['cache'], 'data'))); - } - - public function testCachesMultipleRequestsWithVary() - { - $cache = $this->getCache(); - $cache['request']->setHeader('Accept', 'application/xml'); - $response = $cache['response']->setHeader('Content-Type', 'application/xml'); - $response->setBody('123'); - $cache['storage']->cache($cache['request'], $response); - $data = $this->readAttribute($cache['cache'], 'data'); - foreach ($data as $v) { - if (strpos($v, 'foo.com')) { - $u = unserialize($v); - $this->assertEquals(2, count($u)); - $this->assertEquals($u[0][0]['accept'], 'application/xml'); - $this->assertEquals($u[0][1]['content-type'], 'application/xml'); - $this->assertEquals($u[1][0]['accept'], 'application/json'); - $this->assertEquals($u[1][1]['content-type'], 'application/json'); - $this->assertNotSame($u[0][3], $u[1][3]); - break; - } - } - } - - public function testPurgeRemovesAllMethodCaches() - { - $cache = $this->getCache(); - foreach (array('HEAD', 'POST', 'PUT', 'DELETE') as $method) { - $request = RequestFactory::getInstance()->cloneRequestWithMethod($cache['request'], $method); - $cache['storage']->cache($request, $cache['response']); - } - $cache['storage']->purge('http://foo.com'); - $this->assertFalse(in_array('test', $this->readAttribute($cache['cache'], 'data'))); - $this->assertFalse(in_array($cache['serialized'], $this->readAttribute($cache['cache'], 'data'))); - $this->assertEquals( - array('DoctrineNamespaceCacheKey[]'), - array_keys($this->readAttribute($cache['cache'], 'data')) - ); - } - - public function testRemovesExpiredResponses() - { - $cache = $this->getCache(); - $request = new Request('GET', 'http://xyz.com'); - $response = new Response(200, array('Age' => 1000, 'Cache-Control' => 'max-age=-10000')); - $cache['storage']->cache($request, $response); - $this->assertNull($cache['storage']->fetch($request)); - $data = $this->readAttribute($cache['cache'], 'data'); - $this->assertFalse(in_array('xyz.com', $data)); - $this->assertTrue(in_array($cache['serialized'], $data)); - } - - public function testUsesVaryToDetermineResult() - { - $cache = $this->getCache(); - $this->assertInstanceOf('Guzzle\Http\Message\Response', $cache['storage']->fetch($cache['request'])); - $request = new Request('GET', 'http://foo.com', array('Accept' => 'application/xml')); - $this->assertNull($cache['storage']->fetch($request)); - } - - public function testEnsuresResponseIsStillPresent() - { - $cache = $this->getCache(); - $data = $this->readAttribute($cache['cache'], 'data'); - $key = array_search('test', $data); - $cache['cache']->delete(substr($key, 1, -4)); - $this->assertNull($cache['storage']->fetch($cache['request'])); - } - - public function staleProvider() - { - return array( - array( - new Request('GET', 'http://foo.com', array('Accept' => 'foo')), - new Response(200, array('Cache-Control' => 'stale-if-error=100', 'Vary' => 'Accept')) - ), - array( - new Request('GET', 'http://foo.com', array('Accept' => 'foo')), - new Response(200, array('Cache-Control' => 'stale-if-error', 'Vary' => 'Accept')) - ) - ); - } - - /** - * @dataProvider staleProvider - */ - public function testUsesStaleTimeDirectiveForTtd($request, $response) - { - $cache = $this->getCache(); - $cache['storage']->cache($request, $response); - $data = $this->readAttribute($cache['cache'], 'data'); - foreach ($data as $v) { - if (strpos($v, 'foo.com')) { - $u = unserialize($v); - $this->assertGreaterThan($u[1][4], $u[0][4]); - break; - } - } - } - - public function testCanFilterCacheKeys() - { - $cache = $this->getCache(); - $cache['request']->getQuery()->set('auth', 'foo'); - $this->assertNull($cache['storage']->fetch($cache['request'])); - $cache['request']->getParams()->set('cache.key_filter', 'auth'); - $this->assertNotNull($cache['storage']->fetch($cache['request'])); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/DefaultCanCacheStrategyTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/DefaultCanCacheStrategyTest.php deleted file mode 100644 index de4d182a2..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/DefaultCanCacheStrategyTest.php +++ /dev/null @@ -1,40 +0,0 @@ -assertTrue($strategy->canCacheRequest($request)); - } - - public function testDoesNotCacheNoStore() - { - $strategy = new DefaultCanCacheStrategy(); - $request = new Request('GET', 'http://foo.com', array('cache-control' => 'no-store')); - $this->assertFalse($strategy->canCacheRequest($request)); - } - - public function testCanCacheResponse() - { - $response = $this->getMockBuilder('Guzzle\Http\Message\Response') - ->setMethods(array('canCache')) - ->setConstructorArgs(array(200)) - ->getMock(); - $response->expects($this->once()) - ->method('canCache') - ->will($this->returnValue(true)); - $strategy = new DefaultCanCacheStrategy(); - $this->assertTrue($strategy->canCacheResponse($response)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/DefaultRevalidationTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/DefaultRevalidationTest.php deleted file mode 100644 index 0699cb266..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/DefaultRevalidationTest.php +++ /dev/null @@ -1,248 +0,0 @@ -getHttpDate('-100 hours') . "\r\nContent-Length: 4\r\n\r\nData", - "HTTP/1.1 304 NOT MODIFIED\r\nCache-Control: max-age=2000000\r\nContent-Length: 0\r\n\r\n", - ), - // Forces revalidation that overwrites what is in cache - array( - false, - "\r\n", - "HTTP/1.1 200 OK\r\nCache-Control: must-revalidate, no-cache\r\nDate: " . $this->getHttpDate('-10 hours') . "\r\nContent-Length: 4\r\n\r\nData", - "HTTP/1.1 200 OK\r\nContent-Length: 5\r\n\r\nDatas", - "HTTP/1.1 200 OK\r\nContent-Length: 5\r\nDate: " . $this->getHttpDate('now') . "\r\n\r\nDatas" - ), - // Throws an exception during revalidation - array( - false, - "\r\n", - "HTTP/1.1 200 OK\r\nCache-Control: no-cache\r\nDate: " . $this->getHttpDate('-3 hours') . "\r\n\r\nData", - "HTTP/1.1 500 INTERNAL SERVER ERROR\r\nContent-Length: 0\r\n\r\n" - ), - // ETag mismatch - array( - false, - "\r\n", - "HTTP/1.1 200 OK\r\nCache-Control: no-cache\r\nETag: \"123\"\r\nDate: " . $this->getHttpDate('-10 hours') . "\r\n\r\nData", - "HTTP/1.1 304 NOT MODIFIED\r\nETag: \"123456\"\r\n\r\n", - ), - ); - } - - /** - * @dataProvider cacheRevalidationDataProvider - */ - public function testRevalidatesResponsesAgainstOriginServer($can, $request, $response, $validate = null, $result = null) - { - // Send some responses to the test server for cache validation - $server = $this->getServer(); - $server->flush(); - - if ($validate) { - $server->enqueue($validate); - } - - $request = RequestFactory::getInstance()->fromMessage("GET / HTTP/1.1\r\nHost: 127.0.0.1:" . $server->getPort() . "\r\n" . $request); - $response = Response::fromMessage($response); - $request->setClient(new Client()); - - $plugin = new CachePlugin(new DoctrineCacheAdapter(new ArrayCache())); - $this->assertEquals( - $can, - $plugin->canResponseSatisfyRequest($request, $response), - '-> ' . $request . "\n" . $response - ); - - if ($result) { - $result = Response::fromMessage($result); - $result->removeHeader('Date'); - $request->getResponse()->removeHeader('Date'); - $request->getResponse()->removeHeader('Connection'); - // Get rid of dates - $this->assertEquals((string) $result, (string) $request->getResponse()); - } - - if ($validate) { - $this->assertEquals(1, count($server->getReceivedRequests())); - } - } - - public function testHandles404RevalidationResponses() - { - $request = new Request('GET', 'http://foo.com'); - $request->setClient(new Client()); - $badResponse = new Response(404, array(), 'Oh no!'); - $badRequest = clone $request; - $badRequest->setResponse($badResponse, true); - $response = new Response(200, array(), 'foo'); - - // Seed the cache - $s = new DefaultCacheStorage(new DoctrineCacheAdapter(new ArrayCache())); - $s->cache($request, $response); - $this->assertNotNull($s->fetch($request)); - - $rev = $this->getMockBuilder('Guzzle\Plugin\Cache\DefaultRevalidation') - ->setConstructorArgs(array($s)) - ->setMethods(array('createRevalidationRequest')) - ->getMock(); - - $rev->expects($this->once()) - ->method('createRevalidationRequest') - ->will($this->returnValue($badRequest)); - - try { - $rev->revalidate($request, $response); - $this->fail('Should have thrown an exception'); - } catch (BadResponseException $e) { - $this->assertSame($badResponse, $e->getResponse()); - $this->assertNull($s->fetch($request)); - } - } - - public function testCanRevalidateWithPlugin() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 200 OK\r\n" . - "Date: Mon, 12 Nov 2012 03:06:37 GMT\r\n" . - "Cache-Control: private, s-maxage=0, max-age=0, must-revalidate\r\n" . - "Last-Modified: Mon, 12 Nov 2012 02:53:38 GMT\r\n" . - "Content-Length: 2\r\n\r\nhi", - "HTTP/1.0 304 Not Modified\r\n" . - "Date: Mon, 12 Nov 2012 03:06:38 GMT\r\n" . - "Content-Type: text/html; charset=UTF-8\r\n" . - "Last-Modified: Mon, 12 Nov 2012 02:53:38 GMT\r\n" . - "Age: 6302\r\n\r\n", - "HTTP/1.0 304 Not Modified\r\n" . - "Date: Mon, 12 Nov 2012 03:06:38 GMT\r\n" . - "Content-Type: text/html; charset=UTF-8\r\n" . - "Last-Modified: Mon, 12 Nov 2012 02:53:38 GMT\r\n" . - "Age: 6302\r\n\r\n", - )); - $client = new Client($this->getServer()->getUrl()); - $client->addSubscriber(new CachePlugin()); - $this->assertEquals(200, $client->get()->send()->getStatusCode()); - $this->assertEquals(200, $client->get()->send()->getStatusCode()); - $this->assertEquals(200, $client->get()->send()->getStatusCode()); - $this->assertEquals(3, count($this->getServer()->getReceivedRequests())); - } - - public function testCanHandleRevalidationFailures() - { - $client = new Client($this->getServer()->getUrl()); - $lm = gmdate('c', time() - 60); - $mock = new MockPlugin(array( - new Response(200, array( - 'Date' => $lm, - 'Cache-Control' => 'max-age=100, must-revalidate, stale-if-error=9999', - 'Last-Modified' => $lm, - 'Content-Length' => 2 - ), 'hi'), - new CurlException('Bleh'), - new CurlException('Bleh') - )); - $client->addSubscriber(new CachePlugin()); - $client->addSubscriber($mock); - $client->get()->send(); - $response = $client->get()->send(); - $this->assertEquals(200, $response->getStatusCode()); - $this->assertEquals('hi', $response->getBody(true)); - $this->assertEquals(3, count($mock->getReceivedRequests())); - $this->assertEquals(0, count($mock->getQueue())); - } - - public function testCanHandleStaleIfErrorWhenRevalidating() - { - $lm = gmdate('c', time() - 60); - $mock = new MockPlugin(array( - new Response(200, array( - 'Date' => $lm, - 'Cache-Control' => 'must-revalidate, max-age=0, stale-if-error=1200', - 'Last-Modified' => $lm, - 'Content-Length' => 2 - ), 'hi'), - new CurlException('Oh no!'), - new CurlException('Oh no!') - )); - $cache = new CachePlugin(); - $client = new Client('http://www.example.com'); - $client->addSubscriber($cache); - $client->addSubscriber($mock); - $this->assertEquals(200, $client->get()->send()->getStatusCode()); - $response = $client->get()->send(); - $this->assertEquals(200, $response->getStatusCode()); - $this->assertCount(0, $mock); - $this->assertEquals('HIT from GuzzleCache', (string) $response->getHeader('X-Cache-Lookup')); - $this->assertEquals('HIT_ERROR from GuzzleCache', (string) $response->getHeader('X-Cache')); - } - - /** - * @group issue-437 - */ - public function testDoesNotTouchClosureListeners() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 200 OK\r\n" . - "Date: Mon, 12 Nov 2012 03:06:37 GMT\r\n" . - "Cache-Control: private, s-maxage=0, max-age=0, must-revalidate\r\n" . - "Last-Modified: Mon, 12 Nov 2012 02:53:38 GMT\r\n" . - "Content-Length: 2\r\n\r\nhi", - "HTTP/1.0 304 Not Modified\r\n" . - "Date: Mon, 12 Nov 2012 03:06:38 GMT\r\n" . - "Content-Type: text/html; charset=UTF-8\r\n" . - "Last-Modified: Mon, 12 Nov 2012 02:53:38 GMT\r\n" . - "Age: 6302\r\n\r\n", - "HTTP/1.0 304 Not Modified\r\n" . - "Date: Mon, 12 Nov 2012 03:06:38 GMT\r\n" . - "Content-Type: text/html; charset=UTF-8\r\n" . - "Last-Modified: Mon, 12 Nov 2012 02:53:38 GMT\r\n" . - "Age: 6302\r\n\r\n", - )); - $client = new Client($this->getServer()->getUrl()); - $client->addSubscriber(new CachePlugin()); - $client->getEventDispatcher()->addListener('command.after_send', function(){}); - $this->assertEquals(200, $client->get()->send()->getStatusCode()); - $this->assertEquals(200, $client->get()->send()->getStatusCode()); - $this->assertEquals(200, $client->get()->send()->getStatusCode()); - } - -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/DenyRevalidationTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/DenyRevalidationTest.php deleted file mode 100644 index 9af80f255..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/DenyRevalidationTest.php +++ /dev/null @@ -1,19 +0,0 @@ -assertFalse($deny->revalidate(new Request('GET', 'http://foo.com'), new Response(200))); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/SkipRevalidationTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/SkipRevalidationTest.php deleted file mode 100644 index 4bcc04bfa..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cache/SkipRevalidationTest.php +++ /dev/null @@ -1,19 +0,0 @@ -assertTrue($skip->revalidate(new Request('GET', 'http://foo.com'), new Response(200))); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cookie/CookieJar/ArrayCookieJarTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cookie/CookieJar/ArrayCookieJarTest.php deleted file mode 100644 index 5d0f668a6..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cookie/CookieJar/ArrayCookieJarTest.php +++ /dev/null @@ -1,385 +0,0 @@ -jar = new ArrayCookieJar(); - } - - protected function getTestCookies() - { - return array( - new Cookie(array('name' => 'foo', 'value' => 'bar', 'domain' => 'foo.com', 'path' => '/', 'discard' => true)), - new Cookie(array('name' => 'test', 'value' => '123', 'domain' => 'baz.com', 'path' => '/foo', 'expires' => 2)), - new Cookie(array('name' => 'you', 'value' => '123', 'domain' => 'bar.com', 'path' => '/boo', 'expires' => time() + 1000)) - ); - } - - /** - * Provides test data for cookie cookieJar retrieval - */ - public function getCookiesDataProvider() - { - return array( - array(array('foo', 'baz', 'test', 'muppet', 'googoo'), '', '', '', false), - array(array('foo', 'baz', 'muppet', 'googoo'), '', '', '', true), - array(array('googoo'), 'www.example.com', '', '', false), - array(array('muppet', 'googoo'), 'test.y.example.com', '', '', false), - array(array('foo', 'baz'), 'example.com', '', '', false), - array(array('muppet'), 'x.y.example.com', '/acme/', '', false), - array(array('muppet'), 'x.y.example.com', '/acme/test/', '', false), - array(array('googoo'), 'x.y.example.com', '/test/acme/test/', '', false), - array(array('foo', 'baz'), 'example.com', '', '', false), - array(array('baz'), 'example.com', '', 'baz', false), - ); - } - - public function testStoresAndRetrievesCookies() - { - $cookies = $this->getTestCookies(); - foreach ($cookies as $cookie) { - $this->assertTrue($this->jar->add($cookie)); - } - - $this->assertEquals(3, count($this->jar)); - $this->assertEquals(3, count($this->jar->getIterator())); - $this->assertEquals($cookies, $this->jar->all(null, null, null, false, false)); - } - - public function testRemovesExpiredCookies() - { - $cookies = $this->getTestCookies(); - foreach ($this->getTestCookies() as $cookie) { - $this->jar->add($cookie); - } - $this->jar->removeExpired(); - $this->assertEquals(array($cookies[0], $cookies[2]), $this->jar->all()); - } - - public function testRemovesTemporaryCookies() - { - $cookies = $this->getTestCookies(); - foreach ($this->getTestCookies() as $cookie) { - $this->jar->add($cookie); - } - $this->jar->removeTemporary(); - $this->assertEquals(array($cookies[2]), $this->jar->all()); - } - - public function testIsSerializable() - { - $this->assertEquals('[]', $this->jar->serialize()); - $this->jar->unserialize('[]'); - $this->assertEquals(array(), $this->jar->all()); - - $cookies = $this->getTestCookies(); - foreach ($this->getTestCookies() as $cookie) { - $this->jar->add($cookie); - } - - // Remove discard and expired cookies - $serialized = $this->jar->serialize(); - $data = json_decode($serialized, true); - $this->assertEquals(1, count($data)); - - $a = new ArrayCookieJar(); - $a->unserialize($serialized); - $this->assertEquals(1, count($a)); - } - - public function testRemovesSelectively() - { - $cookies = $this->getTestCookies(); - foreach ($this->getTestCookies() as $cookie) { - $this->jar->add($cookie); - } - - // Remove foo.com cookies - $this->jar->remove('foo.com'); - $this->assertEquals(2, count($this->jar)); - // Try again, removing no further cookies - $this->jar->remove('foo.com'); - $this->assertEquals(2, count($this->jar)); - - // Remove bar.com cookies with path of /boo - $this->jar->remove('bar.com', '/boo'); - $this->assertEquals(1, count($this->jar)); - - // Remove cookie by name - $this->jar->remove(null, null, 'test'); - $this->assertEquals(0, count($this->jar)); - } - - public function testDoesNotAddIncompleteCookies() - { - $this->assertEquals(false, $this->jar->add(new Cookie())); - $this->assertFalse($this->jar->add(new Cookie(array( - 'name' => 'foo' - )))); - $this->assertFalse($this->jar->add(new Cookie(array( - 'name' => false - )))); - $this->assertFalse($this->jar->add(new Cookie(array( - 'name' => true - )))); - $this->assertFalse($this->jar->add(new Cookie(array( - 'name' => 'foo', - 'domain' => 'foo.com' - )))); - } - - public function testDoesAddValidCookies() - { - $this->assertTrue($this->jar->add(new Cookie(array( - 'name' => 'foo', - 'domain' => 'foo.com', - 'value' => 0 - )))); - $this->assertTrue($this->jar->add(new Cookie(array( - 'name' => 'foo', - 'domain' => 'foo.com', - 'value' => 0.0 - )))); - $this->assertTrue($this->jar->add(new Cookie(array( - 'name' => 'foo', - 'domain' => 'foo.com', - 'value' => '0' - )))); - } - - public function testOverwritesCookiesThatAreOlderOrDiscardable() - { - $t = time() + 1000; - $data = array( - 'name' => 'foo', - 'value' => 'bar', - 'domain' => '.example.com', - 'path' => '/', - 'max_age' => '86400', - 'port' => array(80, 8080), - 'version' => '1', - 'secure' => true, - 'discard' => true, - 'expires' => $t - ); - - // Make sure that the discard cookie is overridden with the non-discard - $this->assertTrue($this->jar->add(new Cookie($data))); - - unset($data['discard']); - $this->assertTrue($this->jar->add(new Cookie($data))); - $this->assertEquals(1, count($this->jar)); - - $c = $this->jar->all(); - $this->assertEquals(false, $c[0]->getDiscard()); - - // Make sure it doesn't duplicate the cookie - $this->jar->add(new Cookie($data)); - $this->assertEquals(1, count($this->jar)); - - // Make sure the more future-ful expiration date supersede the other - $data['expires'] = time() + 2000; - $this->assertTrue($this->jar->add(new Cookie($data))); - $this->assertEquals(1, count($this->jar)); - $c = $this->jar->all(); - $this->assertNotEquals($t, $c[0]->getExpires()); - } - - public function testOverwritesCookiesThatHaveChanged() - { - $t = time() + 1000; - $data = array( - 'name' => 'foo', - 'value' => 'bar', - 'domain' => '.example.com', - 'path' => '/', - 'max_age' => '86400', - 'port' => array(80, 8080), - 'version' => '1', - 'secure' => true, - 'discard' => true, - 'expires' => $t - ); - - // Make sure that the discard cookie is overridden with the non-discard - $this->assertTrue($this->jar->add(new Cookie($data))); - - $data['value'] = 'boo'; - $this->assertTrue($this->jar->add(new Cookie($data))); - $this->assertEquals(1, count($this->jar)); - - // Changing the value plus a parameter also must overwrite the existing one - $data['value'] = 'zoo'; - $data['secure'] = false; - $this->assertTrue($this->jar->add(new Cookie($data))); - $this->assertEquals(1, count($this->jar)); - - $c = $this->jar->all(); - $this->assertEquals('zoo', $c[0]->getValue()); - } - - public function testAddsCookiesFromResponseWithNoRequest() - { - $response = new Response(200, array( - 'Set-Cookie' => array( - "fpc=d=.Hm.yh4.1XmJWjJfs4orLQzKzPImxklQoxXSHOZATHUSEFciRueW_7704iYUtsXNEXq0M92Px2glMdWypmJ7HIQl6XIUvrZimWjQ3vIdeuRbI.FNQMAfcxu_XN1zSx7l.AcPdKL6guHc2V7hIQFhnjRW0rxm2oHY1P4bGQxFNz7f.tHm12ZD3DbdMDiDy7TBXsuP4DM-&v=2; expires=Fri, 02-Mar-2019 02:17:40 GMT; path=/; domain=127.0.0.1", - "FPCK3=AgBNbvoQAGpGEABZLRAAbFsQAF1tEABkDhAAeO0=; expires=Sat, 02-Apr-2019 02:17:40 GMT; path=/; domain=127.0.0.1", - "CH=deleted; expires=Wed, 03-Mar-2010 02:17:39 GMT; path=/; domain=127.0.0.1", - "CH=AgBNbvoQAAEcEAApuhAAMJcQADQvEAAvGxAALe0QAD6uEAATwhAAC1AQAC8t; expires=Sat, 02-Apr-2019 02:17:40 GMT; path=/; domain=127.0.0.1" - ) - )); - - $this->jar->addCookiesFromResponse($response); - $this->assertEquals(3, count($this->jar)); - $this->assertEquals(1, count($this->jar->all(null, null, 'fpc'))); - $this->assertEquals(1, count($this->jar->all(null, null, 'FPCK3'))); - $this->assertEquals(1, count($this->jar->all(null, null, 'CH'))); - } - - public function testAddsCookiesFromResponseWithRequest() - { - $response = new Response(200, array( - 'Set-Cookie' => "fpc=d=.Hm.yh4.1XmJWjJfs4orLQzKzPImxklQoxXSHOZATHUSEFciRueW_7704iYUtsXNEXq0M92Px2glMdWypmJ7HIQl6XIUvrZimWjQ3vIdeuRbI.FNQMAfcxu_XN1zSx7l.AcPdKL6guHc2V7hIQFhnjRW0rxm2oHY1P4bGQxFNz7f.tHm12ZD3DbdMDiDy7TBXsuP4DM-&v=2; expires=Fri, 02-Mar-2019 02:17:40 GMT;" - )); - $request = new Request('GET', 'http://www.example.com'); - $this->jar->addCookiesFromResponse($response, $request); - $this->assertEquals(1, count($this->jar)); - } - - public function getMatchingCookiesDataProvider() - { - return array( - array('https://example.com', array(0)), - array('http://example.com', array()), - array('https://example.com:8912', array()), - array('https://foo.example.com', array(0)), - array('http://foo.example.com/test/acme/', array(4)) - ); - } - - /** - * @dataProvider getMatchingCookiesDataProvider - */ - public function testReturnsCookiesMatchingRequests($url, $cookies) - { - $bag = array( - new Cookie(array( - 'name' => 'foo', - 'value' => 'bar', - 'domain' => 'example.com', - 'path' => '/', - 'max_age' => '86400', - 'port' => array(443, 8080), - 'version' => '1', - 'secure' => true - )), - new Cookie(array( - 'name' => 'baz', - 'value' => 'foobar', - 'domain' => 'example.com', - 'path' => '/', - 'max_age' => '86400', - 'port' => array(80, 8080), - 'version' => '1', - 'secure' => true - )), - new Cookie(array( - 'name' => 'test', - 'value' => '123', - 'domain' => 'www.foobar.com', - 'path' => '/path/', - 'discard' => true - )), - new Cookie(array( - 'name' => 'muppet', - 'value' => 'cookie_monster', - 'domain' => '.y.example.com', - 'path' => '/acme/', - 'comment' => 'Comment goes here...', - 'expires' => time() + 86400 - )), - new Cookie(array( - 'name' => 'googoo', - 'value' => 'gaga', - 'domain' => '.example.com', - 'path' => '/test/acme/', - 'max_age' => 1500, - 'version' => 2 - )) - ); - - foreach ($bag as $cookie) { - $this->jar->add($cookie); - } - - $request = new Request('GET', $url); - $results = $this->jar->getMatchingCookies($request); - $this->assertEquals(count($cookies), count($results)); - foreach ($cookies as $i) { - $this->assertContains($bag[$i], $results); - } - } - - /** - * @expectedException \Guzzle\Plugin\Cookie\Exception\InvalidCookieException - * @expectedExceptionMessage The cookie name must not contain invalid characters: abc:@123 - */ - public function testThrowsExceptionWithStrictMode() - { - $a = new ArrayCookieJar(); - $a->setStrictMode(true); - $a->add(new Cookie(array( - 'name' => 'abc:@123', - 'value' => 'foo', - 'domain' => 'bar' - ))); - } - - public function testRemoveExistingCookieIfEmpty() - { - // Add a cookie that should not be affected - $a = new Cookie(array( - 'name' => 'foo', - 'value' => 'nope', - 'domain' => 'foo.com', - 'path' => '/abc' - )); - $this->jar->add($a); - - $data = array( - 'name' => 'foo', - 'value' => 'bar', - 'domain' => 'foo.com', - 'path' => '/' - ); - - $b = new Cookie($data); - $this->assertTrue($this->jar->add($b)); - $this->assertEquals(2, count($this->jar)); - - // Try to re-set the same cookie with no value: assert that cookie is not added - $data['value'] = null; - $this->assertFalse($this->jar->add(new Cookie($data))); - // assert that original cookie has been deleted - $cookies = $this->jar->all('foo.com'); - $this->assertTrue(in_array($a, $cookies, true)); - $this->assertFalse(in_array($b, $cookies, true)); - $this->assertEquals(1, count($this->jar)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cookie/CookieJar/FileCookieJarTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cookie/CookieJar/FileCookieJarTest.php deleted file mode 100644 index ac9471fd8..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cookie/CookieJar/FileCookieJarTest.php +++ /dev/null @@ -1,63 +0,0 @@ -file = tempnam('/tmp', 'file-cookies'); - } - - public function testLoadsFromFileFile() - { - $jar = new FileCookieJar($this->file); - $this->assertEquals(array(), $jar->all()); - unlink($this->file); - } - - public function testPersistsToFileFile() - { - $jar = new FileCookieJar($this->file); - $jar->add(new Cookie(array( - 'name' => 'foo', - 'value' => 'bar', - 'domain' => 'foo.com', - 'expires' => time() + 1000 - ))); - $jar->add(new Cookie(array( - 'name' => 'baz', - 'value' => 'bar', - 'domain' => 'foo.com', - 'expires' => time() + 1000 - ))); - $jar->add(new Cookie(array( - 'name' => 'boo', - 'value' => 'bar', - 'domain' => 'foo.com', - ))); - - $this->assertEquals(3, count($jar)); - unset($jar); - - // Make sure it wrote to the file - $contents = file_get_contents($this->file); - $this->assertNotEmpty($contents); - - // Load the cookieJar from the file - $jar = new FileCookieJar($this->file); - - // Weeds out temporary and session cookies - $this->assertEquals(2, count($jar)); - unset($jar); - unlink($this->file); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cookie/CookiePluginTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cookie/CookiePluginTest.php deleted file mode 100644 index f8c175cce..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cookie/CookiePluginTest.php +++ /dev/null @@ -1,134 +0,0 @@ -getMockBuilder('Guzzle\Plugin\Cookie\CookieJar\ArrayCookieJar') - ->setMethods(array('addCookiesFromResponse')) - ->getMock(); - - $mock->expects($this->exactly(1)) - ->method('addCookiesFromResponse') - ->with($response); - - $plugin = new CookiePlugin($mock); - $plugin->onRequestSent(new Event(array( - 'response' => $response - ))); - } - - public function testAddsCookiesToRequests() - { - $cookie = new Cookie(array( - 'name' => 'foo', - 'value' => 'bar' - )); - - $mock = $this->getMockBuilder('Guzzle\Plugin\Cookie\CookieJar\ArrayCookieJar') - ->setMethods(array('getMatchingCookies')) - ->getMock(); - - $mock->expects($this->once()) - ->method('getMatchingCookies') - ->will($this->returnValue(array($cookie))); - - $plugin = new CookiePlugin($mock); - - $client = new Client(); - $client->getEventDispatcher()->addSubscriber($plugin); - - $request = $client->get('http://www.example.com'); - $plugin->onRequestBeforeSend(new Event(array( - 'request' => $request - ))); - - $this->assertEquals('bar', $request->getCookie('foo')); - } - - public function testCookiesAreExtractedFromRedirectResponses() - { - $plugin = new CookiePlugin(new ArrayCookieJar()); - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 302 Moved Temporarily\r\n" . - "Set-Cookie: test=583551; expires=Wednesday, 23-Mar-2050 19:49:45 GMT; path=/\r\n" . - "Location: /redirect\r\n\r\n", - "HTTP/1.1 200 OK\r\n" . - "Content-Length: 0\r\n\r\n", - "HTTP/1.1 200 OK\r\n" . - "Content-Length: 0\r\n\r\n" - )); - - $client = new Client($this->getServer()->getUrl()); - $client->getEventDispatcher()->addSubscriber($plugin); - - $client->get()->send(); - $request = $client->get(); - $request->send(); - $this->assertEquals('test=583551', $request->getHeader('Cookie')); - - $requests = $this->getServer()->getReceivedRequests(true); - // Confirm subsequent requests have the cookie. - $this->assertEquals('test=583551', $requests[2]->getHeader('Cookie')); - // Confirm the redirected request has the cookie. - $this->assertEquals('test=583551', $requests[1]->getHeader('Cookie')); - } - - public function testCookiesAreNotAddedWhenParamIsSet() - { - $jar = new ArrayCookieJar(); - $plugin = new CookiePlugin($jar); - - $jar->add(new Cookie(array( - 'domain' => 'example.com', - 'path' => '/', - 'name' => 'test', - 'value' => 'hi', - 'expires' => time() + 3600 - ))); - - $client = new Client('http://example.com'); - $client->getEventDispatcher()->addSubscriber($plugin); - - // Ensure that it is normally added - $request = $client->get(); - $request->setResponse(new Response(200), true); - $request->send(); - $this->assertEquals('hi', $request->getCookie('test')); - - // Now ensure that it is not added - $request = $client->get(); - $request->getParams()->set('cookies.disable', true); - $request->setResponse(new Response(200), true); - $request->send(); - $this->assertNull($request->getCookie('test')); - } - - public function testProvidesCookieJar() - { - $jar = new ArrayCookieJar(); - $plugin = new CookiePlugin($jar); - $this->assertSame($jar, $plugin->getCookieJar()); - } - - public function testEscapesCookieDomains() - { - $cookie = new Cookie(array('domain' => '/foo/^$[A-Z]+/')); - $this->assertFalse($cookie->matchesDomain('foo')); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cookie/CookieTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cookie/CookieTest.php deleted file mode 100644 index 9fb0b4310..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Cookie/CookieTest.php +++ /dev/null @@ -1,223 +0,0 @@ -assertEquals('/', $cookie->getPath()); - $this->assertEquals(array(), $cookie->getPorts()); - } - - public function testConvertsDateTimeMaxAgeToUnixTimestamp() - { - $cookie = new Cookie(array( - 'expires' => 'November 20, 1984' - )); - $this->assertTrue(is_numeric($cookie->getExpires())); - } - - public function testAddsExpiresBasedOnMaxAge() - { - $t = time(); - $cookie = new Cookie(array( - 'max_age' => 100 - )); - $this->assertEquals($t + 100, $cookie->getExpires()); - } - - public function testHoldsValues() - { - $t = time(); - $data = array( - 'name' => 'foo', - 'value' => 'baz', - 'path' => '/bar', - 'domain' => 'baz.com', - 'expires' => $t, - 'max_age' => 100, - 'comment' => 'Hi', - 'comment_url' => 'foo.com', - 'port' => array(1, 2), - 'version' => 2, - 'secure' => true, - 'discard' => true, - 'http_only' => true, - 'data' => array( - 'foo' => 'baz', - 'bar' => 'bam' - ) - ); - - $cookie = new Cookie($data); - $this->assertEquals($data, $cookie->toArray()); - - $this->assertEquals('foo', $cookie->getName()); - $this->assertEquals('baz', $cookie->getValue()); - $this->assertEquals('baz.com', $cookie->getDomain()); - $this->assertEquals('/bar', $cookie->getPath()); - $this->assertEquals($t, $cookie->getExpires()); - $this->assertEquals(100, $cookie->getMaxAge()); - $this->assertEquals('Hi', $cookie->getComment()); - $this->assertEquals('foo.com', $cookie->getCommentUrl()); - $this->assertEquals(array(1, 2), $cookie->getPorts()); - $this->assertEquals(2, $cookie->getVersion()); - $this->assertTrue($cookie->getSecure()); - $this->assertTrue($cookie->getDiscard()); - $this->assertTrue($cookie->getHttpOnly()); - $this->assertEquals('baz', $cookie->getAttribute('foo')); - $this->assertEquals('bam', $cookie->getAttribute('bar')); - $this->assertEquals(array( - 'foo' => 'baz', - 'bar' => 'bam' - ), $cookie->getAttributes()); - - $cookie->setName('a') - ->setValue('b') - ->setPath('c') - ->setDomain('bar.com') - ->setExpires(10) - ->setMaxAge(200) - ->setComment('e') - ->setCommentUrl('f') - ->setPorts(array(80)) - ->setVersion(3) - ->setSecure(false) - ->setHttpOnly(false) - ->setDiscard(false) - ->setAttribute('snoop', 'dog'); - - $this->assertEquals('a', $cookie->getName()); - $this->assertEquals('b', $cookie->getValue()); - $this->assertEquals('c', $cookie->getPath()); - $this->assertEquals('bar.com', $cookie->getDomain()); - $this->assertEquals(10, $cookie->getExpires()); - $this->assertEquals(200, $cookie->getMaxAge()); - $this->assertEquals('e', $cookie->getComment()); - $this->assertEquals('f', $cookie->getCommentUrl()); - $this->assertEquals(array(80), $cookie->getPorts()); - $this->assertEquals(3, $cookie->getVersion()); - $this->assertFalse($cookie->getSecure()); - $this->assertFalse($cookie->getDiscard()); - $this->assertFalse($cookie->getHttpOnly()); - $this->assertEquals('dog', $cookie->getAttribute('snoop')); - } - - public function testDeterminesIfExpired() - { - $c = new Cookie(); - $c->setExpires(10); - $this->assertTrue($c->isExpired()); - $c->setExpires(time() + 10000); - $this->assertFalse($c->isExpired()); - } - - public function testMatchesPorts() - { - $cookie = new Cookie(); - // Always matches when nothing is set - $this->assertTrue($cookie->matchesPort(2)); - - $cookie->setPorts(array(1, 2)); - $this->assertTrue($cookie->matchesPort(2)); - $this->assertFalse($cookie->matchesPort(100)); - } - - public function testMatchesDomain() - { - $cookie = new Cookie(); - $this->assertTrue($cookie->matchesDomain('baz.com')); - - $cookie->setDomain('baz.com'); - $this->assertTrue($cookie->matchesDomain('baz.com')); - $this->assertFalse($cookie->matchesDomain('bar.com')); - - $cookie->setDomain('.baz.com'); - $this->assertTrue($cookie->matchesDomain('.baz.com')); - $this->assertTrue($cookie->matchesDomain('foo.baz.com')); - $this->assertFalse($cookie->matchesDomain('baz.bar.com')); - $this->assertTrue($cookie->matchesDomain('baz.com')); - - $cookie->setDomain('.127.0.0.1'); - $this->assertTrue($cookie->matchesDomain('127.0.0.1')); - - $cookie->setDomain('127.0.0.1'); - $this->assertTrue($cookie->matchesDomain('127.0.0.1')); - - $cookie->setDomain('.com.'); - $this->assertFalse($cookie->matchesDomain('baz.com')); - - $cookie->setDomain('.local'); - $this->assertTrue($cookie->matchesDomain('example.local')); - } - - public function testMatchesPath() - { - $cookie = new Cookie(); - $this->assertTrue($cookie->matchesPath('/foo')); - - $cookie->setPath('/foo'); - - // o The cookie-path and the request-path are identical. - $this->assertTrue($cookie->matchesPath('/foo')); - $this->assertFalse($cookie->matchesPath('/bar')); - - // o The cookie-path is a prefix of the request-path, and the first - // character of the request-path that is not included in the cookie- - // path is a %x2F ("/") character. - $this->assertTrue($cookie->matchesPath('/foo/bar')); - $this->assertFalse($cookie->matchesPath('/fooBar')); - - // o The cookie-path is a prefix of the request-path, and the last - // character of the cookie-path is %x2F ("/"). - $cookie->setPath('/foo/'); - $this->assertTrue($cookie->matchesPath('/foo/bar')); - $this->assertFalse($cookie->matchesPath('/fooBaz')); - $this->assertFalse($cookie->matchesPath('/foo')); - - } - - public function cookieValidateProvider() - { - return array( - array('foo', 'baz', 'bar', true), - array('0', '0', '0', true), - array('', 'baz', 'bar', 'The cookie name must not be empty'), - array('foo', '', 'bar', 'The cookie value must not be empty'), - array('foo', 'baz', '', 'The cookie domain must not be empty'), - array('foo\\', 'baz', '0', 'The cookie name must not contain invalid characters: foo\\'), - ); - } - - /** - * @dataProvider cookieValidateProvider - */ - public function testValidatesCookies($name, $value, $domain, $result) - { - $cookie = new Cookie(array( - 'name' => $name, - 'value' => $value, - 'domain' => $domain - )); - $this->assertSame($result, $cookie->validate()); - } - - public function testCreatesInvalidCharacterString() - { - $m = new \ReflectionMethod('Guzzle\Plugin\Cookie\Cookie', 'getInvalidCharacters'); - $m->setAccessible(true); - $p = new \ReflectionProperty('Guzzle\Plugin\Cookie\Cookie', 'invalidCharString'); - $p->setAccessible(true); - $p->setValue(''); - // Expects a string containing 51 invalid characters - $this->assertEquals(51, strlen($m->invoke($m))); - $this->assertContains('@', $m->invoke($m)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/CurlAuth/CurlAuthPluginTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/CurlAuth/CurlAuthPluginTest.php deleted file mode 100644 index 2a4b49eb6..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/CurlAuth/CurlAuthPluginTest.php +++ /dev/null @@ -1,39 +0,0 @@ -getEventDispatcher()->addSubscriber($plugin); - $request = $client->get('/'); - $this->assertEquals('michael', $request->getUsername()); - $this->assertEquals('test', $request->getPassword()); - Version::$emitWarnings = true; - } - - public function testAddsDigestAuthentication() - { - Version::$emitWarnings = false; - $plugin = new CurlAuthPlugin('julian', 'test', CURLAUTH_DIGEST); - $client = new Client('http://www.test.com/'); - $client->getEventDispatcher()->addSubscriber($plugin); - $request = $client->get('/'); - $this->assertEquals('julian', $request->getUsername()); - $this->assertEquals('test', $request->getPassword()); - $this->assertEquals('julian:test', $request->getCurlOptions()->get(CURLOPT_USERPWD)); - $this->assertEquals(CURLAUTH_DIGEST, $request->getCurlOptions()->get(CURLOPT_HTTPAUTH)); - Version::$emitWarnings = true; - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/ErrorResponse/ErrorResponsePluginTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/ErrorResponse/ErrorResponsePluginTest.php deleted file mode 100644 index 6f94186b5..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/ErrorResponse/ErrorResponsePluginTest.php +++ /dev/null @@ -1,137 +0,0 @@ -flush(); - } - - public function setUp() - { - $mockError = 'Guzzle\Tests\Mock\ErrorResponseMock'; - $description = ServiceDescription::factory(array( - 'operations' => array( - 'works' => array( - 'httpMethod' => 'GET', - 'errorResponses' => array( - array('code' => 500, 'class' => $mockError), - array('code' => 503, 'reason' => 'foo', 'class' => $mockError), - array('code' => 200, 'reason' => 'Error!', 'class' => $mockError) - ) - ), - 'bad_class' => array( - 'httpMethod' => 'GET', - 'errorResponses' => array( - array('code' => 500, 'class' => 'Does\\Not\\Exist') - ) - ), - 'does_not_implement' => array( - 'httpMethod' => 'GET', - 'errorResponses' => array( - array('code' => 500, 'class' => __CLASS__) - ) - ), - 'no_errors' => array('httpMethod' => 'GET'), - 'no_class' => array( - 'httpMethod' => 'GET', - 'errorResponses' => array( - array('code' => 500) - ) - ), - ) - )); - $this->client = new Client($this->getServer()->getUrl()); - $this->client->setDescription($description); - } - - /** - * @expectedException \Guzzle\Http\Exception\ServerErrorResponseException - */ - public function testSkipsWhenErrorResponsesIsNotSet() - { - $this->getServer()->enqueue("HTTP/1.1 500 Foo\r\nContent-Length: 0\r\n\r\n"); - $this->client->addSubscriber(new ErrorResponsePlugin()); - $this->client->getCommand('no_errors')->execute(); - } - - public function testSkipsWhenErrorResponsesIsNotSetAndAllowsSuccess() - { - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $this->client->addSubscriber(new ErrorResponsePlugin()); - $this->client->getCommand('no_errors')->execute(); - } - - /** - * @expectedException \Guzzle\Plugin\ErrorResponse\Exception\ErrorResponseException - * @expectedExceptionMessage Does\Not\Exist does not exist - */ - public function testEnsuresErrorResponseExists() - { - $this->getServer()->enqueue("HTTP/1.1 500 Foo\r\nContent-Length: 0\r\n\r\n"); - $this->client->addSubscriber(new ErrorResponsePlugin()); - $this->client->getCommand('bad_class')->execute(); - } - - /** - * @expectedException \Guzzle\Plugin\ErrorResponse\Exception\ErrorResponseException - * @expectedExceptionMessage must implement Guzzle\Plugin\ErrorResponse\ErrorResponseExceptionInterface - */ - public function testEnsuresErrorResponseImplementsInterface() - { - $this->getServer()->enqueue("HTTP/1.1 500 Foo\r\nContent-Length: 0\r\n\r\n"); - $this->client->addSubscriber(new ErrorResponsePlugin()); - $this->client->getCommand('does_not_implement')->execute(); - } - - public function testThrowsSpecificErrorResponseOnMatch() - { - try { - $this->getServer()->enqueue("HTTP/1.1 500 Foo\r\nContent-Length: 0\r\n\r\n"); - $this->client->addSubscriber(new ErrorResponsePlugin()); - $command = $this->client->getCommand('works'); - $command->execute(); - $this->fail('Exception not thrown'); - } catch (ErrorResponseMock $e) { - $this->assertSame($command, $e->command); - $this->assertEquals(500, $e->response->getStatusCode()); - } - } - - /** - * @expectedException \Guzzle\Tests\Mock\ErrorResponseMock - */ - public function testThrowsWhenCodeAndPhraseMatch() - { - $this->getServer()->enqueue("HTTP/1.1 200 Error!\r\nContent-Length: 0\r\n\r\n"); - $this->client->addSubscriber(new ErrorResponsePlugin()); - $this->client->getCommand('works')->execute(); - } - - public function testSkipsWhenReasonDoesNotMatch() - { - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $this->client->addSubscriber(new ErrorResponsePlugin()); - $this->client->getCommand('works')->execute(); - } - - public function testSkipsWhenNoClassIsSet() - { - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $this->client->addSubscriber(new ErrorResponsePlugin()); - $this->client->getCommand('no_class')->execute(); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/History/HistoryPluginTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/History/HistoryPluginTest.php deleted file mode 100644 index 41aa673fd..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/History/HistoryPluginTest.php +++ /dev/null @@ -1,140 +0,0 @@ -get(); - $requests[$i]->setResponse(new Response(200), true); - $requests[$i]->send(); - $h->add($requests[$i]); - } - - return $requests; - } - - public function testDescribesSubscribedEvents() - { - $this->assertInternalType('array', HistoryPlugin::getSubscribedEvents()); - } - - public function testMaintainsLimitValue() - { - $h = new HistoryPlugin(); - $this->assertSame($h, $h->setLimit(10)); - $this->assertEquals(10, $h->getLimit()); - } - - public function testAddsRequests() - { - $h = new HistoryPlugin(); - $requests = $this->addRequests($h, 1); - $this->assertEquals(1, count($h)); - $i = $h->getIterator(); - $this->assertEquals(1, count($i)); - $this->assertEquals($requests[0], $i[0]); - } - - /** - * @depends testAddsRequests - */ - public function testMaintainsLimit() - { - $h = new HistoryPlugin(); - $h->setLimit(2); - $requests = $this->addRequests($h, 3); - $this->assertEquals(2, count($h)); - $i = 0; - foreach ($h as $request) { - if ($i > 0) { - $this->assertSame($requests[$i], $request); - } - } - } - - public function testReturnsLastRequest() - { - $h = new HistoryPlugin(); - $requests = $this->addRequests($h, 5); - $this->assertSame(end($requests), $h->getLastRequest()); - } - - public function testReturnsLastResponse() - { - $h = new HistoryPlugin(); - $requests = $this->addRequests($h, 5); - $this->assertSame(end($requests)->getResponse(), $h->getLastResponse()); - } - - public function testClearsHistory() - { - $h = new HistoryPlugin(); - $requests = $this->addRequests($h, 5); - $this->assertEquals(5, count($h)); - $h->clear(); - $this->assertEquals(0, count($h)); - } - - /** - * @depends testAddsRequests - */ - public function testUpdatesAddRequests() - { - $h = new HistoryPlugin(); - $client = new Client('http://127.0.0.1/'); - $client->getEventDispatcher()->addSubscriber($h); - - $request = $client->get(); - $request->setResponse(new Response(200), true); - $request->send(); - - $this->assertSame($request, $h->getLastRequest()); - } - - public function testCanCastToString() - { - $client = new Client('http://127.0.0.1/'); - $h = new HistoryPlugin(); - $client->getEventDispatcher()->addSubscriber($h); - - $mock = new MockPlugin(array( - new Response(301, array('Location' => '/redirect1', 'Content-Length' => 0)), - new Response(307, array('Location' => '/redirect2', 'Content-Length' => 0)), - new Response(200, array('Content-Length' => '2'), 'HI') - )); - - $client->getEventDispatcher()->addSubscriber($mock); - $request = $client->get(); - $request->send(); - $this->assertEquals(3, count($h)); - $this->assertEquals(3, count($mock->getReceivedRequests())); - - $h = str_replace("\r", '', $h); - $this->assertContains("> GET / HTTP/1.1\nHost: 127.0.0.1\nUser-Agent:", $h); - $this->assertContains("< HTTP/1.1 301 Moved Permanently\nLocation: /redirect1", $h); - $this->assertContains("< HTTP/1.1 307 Temporary Redirect\nLocation: /redirect2", $h); - $this->assertContains("< HTTP/1.1 200 OK\nContent-Length: 2\n\nHI", $h); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Log/LogPluginTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Log/LogPluginTest.php deleted file mode 100644 index ad663a53c..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Log/LogPluginTest.php +++ /dev/null @@ -1,95 +0,0 @@ -adapter = new ClosureLogAdapter(function ($message) { - echo $message; - }); - } - - public function testIgnoresCurlEventsWhenNotWiringBodies() - { - $p = new LogPlugin($this->adapter); - $this->assertNotEmpty($p->getSubscribedEvents()); - $event = new Event(array('request' => new Request('GET', 'http://foo.com'))); - $p->onCurlRead($event); - $p->onCurlWrite($event); - $p->onRequestBeforeSend($event); - } - - public function testLogsWhenComplete() - { - $output = ''; - $p = new LogPlugin(new ClosureLogAdapter(function ($message) use (&$output) { - $output = $message; - }), '{method} {resource} | {code} {res_body}'); - - $p->onRequestSent(new Event(array( - 'request' => new Request('GET', 'http://foo.com'), - 'response' => new Response(200, array(), 'Foo') - ))); - - $this->assertEquals('GET / | 200 Foo', $output); - } - - public function testWiresBodiesWhenNeeded() - { - $client = new Client($this->getServer()->getUrl()); - $plugin = new LogPlugin($this->adapter, '{req_body} | {res_body}', true); - $client->getEventDispatcher()->addSubscriber($plugin); - $request = $client->put(); - - // Send the response from the dummy server as the request body - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 4\r\n\r\nsend"); - $stream = fopen($this->getServer()->getUrl(), 'r'); - $request->setBody(EntityBody::factory($stream, 4)); - - $tmpFile = tempnam(sys_get_temp_dir(), 'non_repeatable'); - $request->setResponseBody(EntityBody::factory(fopen($tmpFile, 'w'))); - - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 8\r\n\r\nresponse"); - - ob_start(); - $request->send(); - $message = ob_get_clean(); - - unlink($tmpFile); - $this->assertContains("send", $message); - $this->assertContains("response", $message); - } - - public function testHasHelpfulStaticFactoryMethod() - { - $s = fopen('php://temp', 'r+'); - $client = new Client(); - $client->addSubscriber(LogPlugin::getDebugPlugin(true, $s)); - $request = $client->put('http://foo.com', array('Content-Type' => 'Foo'), 'Bar'); - $request->setresponse(new Response(200), true); - $request->send(); - rewind($s); - $contents = stream_get_contents($s); - $this->assertContains('# Request:', $contents); - $this->assertContainsIns('PUT / HTTP/1.1', $contents); - $this->assertContains('# Response:', $contents); - $this->assertContainsIns('HTTP/1.1 200 OK', $contents); - $this->assertContains('# Errors:', $contents); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Md5/CommandContentMd5PluginTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Md5/CommandContentMd5PluginTest.php deleted file mode 100644 index 4bd411113..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Md5/CommandContentMd5PluginTest.php +++ /dev/null @@ -1,97 +0,0 @@ - array( - 'test' => array( - 'httpMethod' => 'PUT', - 'parameters' => array( - 'ContentMD5' => array(), - 'Body' => array( - 'location' => 'body' - ) - ) - ) - ) - )); - - $client = new Client(); - $client->setDescription($description); - - return $client; - } - - public function testHasEvents() - { - $this->assertNotEmpty(CommandContentMd5Plugin::getSubscribedEvents()); - } - - public function testValidatesMd5WhenParamExists() - { - $client = $this->getClient(); - $command = $client->getCommand('test', array( - 'Body' => 'Foo', - 'ContentMD5' => true - )); - $event = new Event(array('command' => $command)); - $request = $command->prepare(); - $plugin = new CommandContentMd5Plugin(); - $plugin->onCommandBeforeSend($event); - $this->assertEquals('E1bGfXrRY42Ba/uCLdLCXQ==', (string) $request->getHeader('Content-MD5')); - } - - public function testDoesNothingWhenNoPayloadExists() - { - $client = $this->getClient(); - $client->getDescription()->getOperation('test')->setHttpMethod('GET'); - $command = $client->getCommand('test'); - $event = new Event(array('command' => $command)); - $request = $command->prepare(); - $plugin = new CommandContentMd5Plugin(); - $plugin->onCommandBeforeSend($event); - $this->assertNull($request->getHeader('Content-MD5')); - } - - public function testAddsValidationToResponsesOfContentMd5() - { - $client = $this->getClient(); - $client->getDescription()->getOperation('test')->setHttpMethod('GET'); - $command = $client->getCommand('test', array( - 'ValidateMD5' => true - )); - $event = new Event(array('command' => $command)); - $request = $command->prepare(); - $plugin = new CommandContentMd5Plugin(); - $plugin->onCommandBeforeSend($event); - $listeners = $request->getEventDispatcher()->getListeners('request.complete'); - $this->assertNotEmpty($listeners); - } - - public function testIgnoresValidationWhenDisabled() - { - $client = $this->getClient(); - $client->getDescription()->getOperation('test')->setHttpMethod('GET'); - $command = $client->getCommand('test', array( - 'ValidateMD5' => false - )); - $event = new Event(array('command' => $command)); - $request = $command->prepare(); - $plugin = new CommandContentMd5Plugin(); - $plugin->onCommandBeforeSend($event); - $listeners = $request->getEventDispatcher()->getListeners('request.complete'); - $this->assertEmpty($listeners); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Md5/Md5ValidatorPluginTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Md5/Md5ValidatorPluginTest.php deleted file mode 100644 index 482e92b28..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Md5/Md5ValidatorPluginTest.php +++ /dev/null @@ -1,120 +0,0 @@ -create('GET', 'http://www.test.com/'); - $request->getEventDispatcher()->addSubscriber($plugin); - - $body = 'abc'; - $hash = md5($body); - $response = new Response(200, array( - 'Content-MD5' => $hash, - 'Content-Length' => 3 - ), 'abc'); - - $request->dispatch('request.complete', array( - 'response' => $response - )); - - // Try again with no Content-MD5 - $response->removeHeader('Content-MD5'); - $request->dispatch('request.complete', array( - 'response' => $response - )); - } - - /** - * @expectedException UnexpectedValueException - */ - public function testThrowsExceptionOnInvalidMd5() - { - $plugin = new Md5ValidatorPlugin(); - $request = RequestFactory::getInstance()->create('GET', 'http://www.test.com/'); - $request->getEventDispatcher()->addSubscriber($plugin); - - $request->dispatch('request.complete', array( - 'response' => new Response(200, array( - 'Content-MD5' => 'foobar', - 'Content-Length' => 3 - ), 'abc') - )); - } - - public function testSkipsWhenContentLengthIsTooLarge() - { - $plugin = new Md5ValidatorPlugin(false, 1); - $request = RequestFactory::getInstance()->create('GET', 'http://www.test.com/'); - $request->getEventDispatcher()->addSubscriber($plugin); - - $request->dispatch('request.complete', array( - 'response' => new Response(200, array( - 'Content-MD5' => 'foobar', - 'Content-Length' => 3 - ), 'abc') - )); - } - - public function testProperlyValidatesWhenUsingContentEncoding() - { - $plugin = new Md5ValidatorPlugin(true); - $request = RequestFactory::getInstance()->create('GET', 'http://www.test.com/'); - $request->getEventDispatcher()->addSubscriber($plugin); - - // Content-MD5 is the MD5 hash of the canonical content after all - // content-encoding has been applied. Because cURL will automatically - // decompress entity bodies, we need to re-compress it to calculate. - $body = EntityBody::factory('abc'); - $body->compress(); - $hash = $body->getContentMd5(); - $body->uncompress(); - - $response = new Response(200, array( - 'Content-MD5' => $hash, - 'Content-Encoding' => 'gzip' - ), 'abc'); - $request->dispatch('request.complete', array( - 'response' => $response - )); - $this->assertEquals('abc', $response->getBody(true)); - - // Try again with an unknown encoding - $response = new Response(200, array( - 'Content-MD5' => $hash, - 'Content-Encoding' => 'foobar' - ), 'abc'); - $request->dispatch('request.complete', array( - 'response' => $response - )); - - // Try again with compress - $body->compress('bzip2.compress'); - $response = new Response(200, array( - 'Content-MD5' => $body->getContentMd5(), - 'Content-Encoding' => 'compress' - ), 'abc'); - $request->dispatch('request.complete', array( - 'response' => $response - )); - - // Try again with encoding and disabled content-encoding checks - $request->getEventDispatcher()->removeSubscriber($plugin); - $plugin = new Md5ValidatorPlugin(false); - $request->getEventDispatcher()->addSubscriber($plugin); - $request->dispatch('request.complete', array( - 'response' => $response - )); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Mock/MockPluginTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Mock/MockPluginTest.php deleted file mode 100644 index 3af8fefcc..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Mock/MockPluginTest.php +++ /dev/null @@ -1,199 +0,0 @@ -assertInternalType('array', MockPlugin::getSubscribedEvents()); - } - - public function testDescribesEvents() - { - $this->assertInternalType('array', MockPlugin::getAllEvents()); - } - - public function testCanBeTemporary() - { - $plugin = new MockPlugin(); - $this->assertFalse($plugin->isTemporary()); - $plugin = new MockPlugin(null, true); - $this->assertTrue($plugin->isTemporary()); - } - - public function testIsCountable() - { - $plugin = new MockPlugin(); - $plugin->addResponse(Response::fromMessage("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n")); - $this->assertEquals(1, count($plugin)); - } - - /** - * @depends testIsCountable - */ - public function testCanClearQueue() - { - $plugin = new MockPlugin(); - $plugin->addResponse(Response::fromMessage("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n")); - $plugin->clearQueue(); - $this->assertEquals(0, count($plugin)); - } - - public function testCanInspectQueue() - { - $plugin = new MockPlugin(); - $this->assertInternalType('array', $plugin->getQueue()); - $plugin->addResponse(Response::fromMessage("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n")); - $queue = $plugin->getQueue(); - $this->assertInternalType('array', $queue); - $this->assertEquals(1, count($queue)); - } - - public function testRetrievesResponsesFromFiles() - { - $response = MockPlugin::getMockFile(__DIR__ . '/../../TestData/mock_response'); - $this->assertInstanceOf('Guzzle\\Http\\Message\\Response', $response); - $this->assertEquals(200, $response->getStatusCode()); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testThrowsExceptionWhenResponseFileIsNotFound() - { - MockPlugin::getMockFile('missing/filename'); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testInvalidResponsesThrowAnException() - { - $p = new MockPlugin(); - $p->addResponse($this); - } - - public function testAddsResponseObjectsToQueue() - { - $p = new MockPlugin(); - $response = Response::fromMessage("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $p->addResponse($response); - $this->assertEquals(array($response), $p->getQueue()); - } - - public function testAddsResponseFilesToQueue() - { - $p = new MockPlugin(); - $p->addResponse(__DIR__ . '/../../TestData/mock_response'); - $this->assertEquals(1, count($p)); - } - - /** - * @depends testAddsResponseFilesToQueue - */ - public function testAddsMockResponseToRequestFromClient() - { - $p = new MockPlugin(); - $response = MockPlugin::getMockFile(__DIR__ . '/../../TestData/mock_response'); - $p->addResponse($response); - - $client = new Client('http://127.0.0.1:123/'); - $client->getEventDispatcher()->addSubscriber($p, 9999); - $request = $client->get(); - $request->send(); - - $this->assertSame($response, $request->getResponse()); - $this->assertEquals(0, count($p)); - } - - /** - * @depends testAddsResponseFilesToQueue - * @expectedException \OutOfBoundsException - */ - public function testUpdateThrowsExceptionWhenEmpty() - { - $p = new MockPlugin(); - $p->onRequestBeforeSend(new Event()); - } - - /** - * @depends testAddsMockResponseToRequestFromClient - */ - public function testDetachesTemporaryWhenEmpty() - { - $p = new MockPlugin(null, true); - $p->addResponse(MockPlugin::getMockFile(__DIR__ . '/../../TestData/mock_response')); - $client = new Client('http://127.0.0.1:123/'); - $client->getEventDispatcher()->addSubscriber($p, 9999); - $request = $client->get(); - $request->send(); - - $this->assertFalse($this->hasSubscriber($client, $p)); - } - - public function testLoadsResponsesFromConstructor() - { - $p = new MockPlugin(array(new Response(200))); - $this->assertEquals(1, $p->count()); - } - - public function testStoresMockedRequests() - { - $p = new MockPlugin(array(new Response(200), new Response(200))); - $client = new Client('http://127.0.0.1:123/'); - $client->getEventDispatcher()->addSubscriber($p, 9999); - - $request1 = $client->get(); - $request1->send(); - $this->assertEquals(array($request1), $p->getReceivedRequests()); - - $request2 = $client->get(); - $request2->send(); - $this->assertEquals(array($request1, $request2), $p->getReceivedRequests()); - - $p->flush(); - $this->assertEquals(array(), $p->getReceivedRequests()); - } - - public function testReadsBodiesFromMockedRequests() - { - $p = new MockPlugin(array(new Response(200))); - $p->readBodies(true); - $client = new Client('http://127.0.0.1:123/'); - $client->getEventDispatcher()->addSubscriber($p, 9999); - - $body = EntityBody::factory('foo'); - $request = $client->put(); - $request->setBody($body); - $request->send(); - $this->assertEquals(3, $body->ftell()); - } - - public function testCanMockBadRequestExceptions() - { - $client = new Client('http://127.0.0.1:123/'); - $ex = new CurlException('Foo'); - $mock = new MockPlugin(array($ex)); - $client->addSubscriber($mock); - $request = $client->get('foo'); - - try { - $request->send(); - $this->fail('Did not dequeue an exception'); - } catch (CurlException $e) { - $this->assertSame($e, $ex); - $this->assertSame($request, $ex->getRequest()); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Oauth/OauthPluginTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Oauth/OauthPluginTest.php deleted file mode 100644 index 3892fb62b..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Plugin/Oauth/OauthPluginTest.php +++ /dev/null @@ -1,345 +0,0 @@ - 'foo', - 'consumer_secret' => 'bar', - 'token' => 'count', - 'token_secret' => 'dracula' - ); - - protected function getRequest() - { - return RequestFactory::getInstance()->create('POST', 'http://www.test.com/path?a=b&c=d', null, array( - 'e' => 'f' - )); - } - - public function testSubscribesToEvents() - { - $events = OauthPlugin::getSubscribedEvents(); - $this->assertArrayHasKey('request.before_send', $events); - } - - public function testAcceptsConfigurationData() - { - $p = new OauthPlugin($this->config); - - // Access the config object - $class = new \ReflectionClass($p); - $property = $class->getProperty('config'); - $property->setAccessible(true); - $config = $property->getValue($p); - - $this->assertEquals('foo', $config['consumer_key']); - $this->assertEquals('bar', $config['consumer_secret']); - $this->assertEquals('count', $config['token']); - $this->assertEquals('dracula', $config['token_secret']); - $this->assertEquals('1.0', $config['version']); - $this->assertEquals('HMAC-SHA1', $config['signature_method']); - $this->assertEquals('header', $config['request_method']); - } - - public function testCreatesStringToSignFromPostRequest() - { - $p = new OauthPlugin($this->config); - $request = $this->getRequest(); - $signString = $p->getStringToSign($request, self::TIMESTAMP, self::NONCE); - - $this->assertContains('&e=f', rawurldecode($signString)); - - $expectedSignString = - // Method and URL - 'POST&http%3A%2F%2Fwww.test.com%2Fpath' . - // Sorted parameters from query string and body - '&a%3Db%26c%3Dd%26e%3Df%26oauth_consumer_key%3Dfoo' . - '%26oauth_nonce%3De7aa11195ca58349bec8b5ebe351d3497eb9e603%26' . - 'oauth_signature_method%3DHMAC-SHA1' . - '%26oauth_timestamp%3D' . self::TIMESTAMP . '%26oauth_token%3Dcount%26oauth_version%3D1.0'; - - $this->assertEquals($expectedSignString, $signString); - } - - public function testCreatesStringToSignIgnoringPostFields() - { - $config = $this->config; - $config['disable_post_params'] = true; - $p = new OauthPlugin($config); - $request = $this->getRequest(); - $sts = rawurldecode($p->getStringToSign($request, self::TIMESTAMP, self::NONCE)); - $this->assertNotContains('&e=f', $sts); - } - - public function testCreatesStringToSignFromPostRequestWithCustomContentType() - { - $p = new OauthPlugin($this->config); - $request = $this->getRequest(); - $request->setHeader('Content-Type', 'Foo'); - $this->assertEquals( - // Method and URL - 'POST&http%3A%2F%2Fwww.test.com%2Fpath' . - // Sorted parameters from query string and body - '&a%3Db%26c%3Dd%26oauth_consumer_key%3Dfoo' . - '%26oauth_nonce%3D'. self::NONCE .'%26' . - 'oauth_signature_method%3DHMAC-SHA1' . - '%26oauth_timestamp%3D' . self::TIMESTAMP . '%26oauth_token%3Dcount%26oauth_version%3D1.0', - $p->getStringToSign($request, self::TIMESTAMP, self::NONCE) - ); - } - - /** - * @depends testCreatesStringToSignFromPostRequest - */ - public function testConvertsBooleansToStrings() - { - $p = new OauthPlugin($this->config); - $request = $this->getRequest(); - $request->getQuery()->set('a', true); - $request->getQuery()->set('c', false); - $this->assertContains('&a%3Dtrue%26c%3Dfalse', $p->getStringToSign($request, self::TIMESTAMP, self::NONCE)); - } - - public function testCreatesStringToSignFromPostRequestWithNullValues() - { - $config = array( - 'consumer_key' => 'foo', - 'consumer_secret' => 'bar', - 'token' => null, - 'token_secret' => 'dracula' - ); - - $p = new OauthPlugin($config); - $request = $this->getRequest(); - $signString = $p->getStringToSign($request, self::TIMESTAMP, self::NONCE); - - $this->assertContains('&e=f', rawurldecode($signString)); - - $expectedSignString = // Method and URL - 'POST&http%3A%2F%2Fwww.test.com%2Fpath' . - // Sorted parameters from query string and body - '&a%3Db%26c%3Dd%26e%3Df%26oauth_consumer_key%3Dfoo' . - '%26oauth_nonce%3De7aa11195ca58349bec8b5ebe351d3497eb9e603%26' . - 'oauth_signature_method%3DHMAC-SHA1' . - '%26oauth_timestamp%3D' . self::TIMESTAMP . '%26oauth_version%3D1.0'; - - $this->assertEquals($expectedSignString, $signString); - } - - /** - * @depends testCreatesStringToSignFromPostRequest - */ - public function testMultiDimensionalArray() - { - $p = new OauthPlugin($this->config); - $request = $this->getRequest(); - $request->getQuery()->set('a', array('b' => array('e' => 'f', 'c' => 'd'))); - $this->assertContains('a%255Bb%255D%255Bc%255D%3Dd%26a%255Bb%255D%255Be%255D%3Df%26c%3Dd%26e%3Df%26', $p->getStringToSign($request, self::TIMESTAMP, self::NONCE)); - } - - /** - * @depends testMultiDimensionalArray - */ - public function testMultiDimensionalArrayWithNonDefaultQueryAggregator() - { - $p = new OauthPlugin($this->config); - $request = $this->getRequest(); - $aggregator = new CommaAggregator(); - $query = $request->getQuery()->setAggregator($aggregator) - ->set('g', array('h', 'i', 'j')) - ->set('k', array('l')) - ->set('m', array('n', 'o')); - $this->assertContains('a%3Db%26c%3Dd%26e%3Df%26g%3Dh%2Ci%2Cj%26k%3Dl%26m%3Dn%2Co', $p->getStringToSign($request, self::TIMESTAMP, self::NONCE)); - } - - /** - * @depends testCreatesStringToSignFromPostRequest - */ - public function testSignsStrings() - { - $p = new OauthPlugin(array_merge($this->config, array( - 'signature_callback' => function($string, $key) { - return "_{$string}|{$key}_"; - } - ))); - $request = $this->getRequest(); - $sig = $p->getSignature($request, self::TIMESTAMP, self::NONCE); - $this->assertEquals( - '_POST&http%3A%2F%2Fwww.test.com%2Fpath&a%3Db%26c%3Dd%26e%3Df%26oauth_consumer_key%3Dfoo' . - '%26oauth_nonce%3D'. self::NONCE .'%26oauth_signature_method%3DHMAC-SHA1' . - '%26oauth_timestamp%3D' . self::TIMESTAMP . '%26oauth_token%3Dcount%26oauth_version%3D1.0|' . - 'bar&dracula_', - base64_decode($sig) - ); - } - - /** - * Test that the Oauth is signed correctly and that extra strings haven't been added - * to the authorization header. - */ - public function testSignsOauthRequests() - { - $p = new OauthPlugin($this->config); - $event = new Event(array( - 'request' => $this->getRequest(), - 'timestamp' => self::TIMESTAMP - )); - $params = $p->onRequestBeforeSend($event); - - $this->assertTrue($event['request']->hasHeader('Authorization')); - - $authorizationHeader = (string)$event['request']->getHeader('Authorization'); - - $this->assertStringStartsWith('OAuth ', $authorizationHeader); - - $stringsToCheck = array( - 'oauth_consumer_key="foo"', - 'oauth_nonce="'.urlencode($params['oauth_nonce']).'"', - 'oauth_signature="'.urlencode($params['oauth_signature']).'"', - 'oauth_signature_method="HMAC-SHA1"', - 'oauth_timestamp="' . self::TIMESTAMP . '"', - 'oauth_token="count"', - 'oauth_version="1.0"', - ); - - $totalLength = strlen('OAuth '); - - //Separator is not used before first parameter. - $separator = ''; - - foreach ($stringsToCheck as $stringToCheck) { - $this->assertContains($stringToCheck, $authorizationHeader); - $totalLength += strlen($separator); - $totalLength += strlen($stringToCheck); - $separator = ', '; - } - - // Technically this test is not universally valid. It would be allowable to have extra \n characters - // in the Authorization header. However Guzzle does not do this, so we just perform a simple check - // on length to validate the Authorization header is composed of only the strings above. - $this->assertEquals($totalLength, strlen($authorizationHeader), 'Authorization has extra characters i.e. contains extra elements compared to stringsToCheck.'); - } - - public function testSignsOauthQueryStringRequest() - { - $config = array_merge( - $this->config, - array('request_method' => OauthPlugin::REQUEST_METHOD_QUERY) - ); - - $p = new OauthPlugin($config); - $event = new Event(array( - 'request' => $this->getRequest(), - 'timestamp' => self::TIMESTAMP - )); - $params = $p->onRequestBeforeSend($event); - - $this->assertFalse($event['request']->hasHeader('Authorization')); - - $stringsToCheck = array( - 'a=b', - 'c=d', - 'oauth_consumer_key=foo', - 'oauth_nonce='.urlencode($params['oauth_nonce']), - 'oauth_signature='.urlencode($params['oauth_signature']), - 'oauth_signature_method=HMAC-SHA1', - 'oauth_timestamp='.self::TIMESTAMP, - 'oauth_token=count', - 'oauth_version=1.0', - ); - - $queryString = (string) $event['request']->getQuery(); - - $totalLength = strlen('?'); - - //Separator is not used before first parameter. - $separator = ''; - - foreach ($stringsToCheck as $stringToCheck) { - $this->assertContains($stringToCheck, $queryString); - $totalLength += strlen($separator); - $totalLength += strlen($stringToCheck); - $separator = '&'; - } - - // Removes the last query string separator '&' - $totalLength -= 1; - - $this->assertEquals($totalLength, strlen($queryString), 'Query string has extra characters i.e. contains extra elements compared to stringsToCheck.'); - } - - /** - * @expectedException \InvalidArgumentException - */ - public function testInvalidArgumentExceptionOnMethodError() - { - $config = array_merge( - $this->config, - array('request_method' => 'FakeMethod') - ); - - $p = new OauthPlugin($config); - $event = new Event(array( - 'request' => $this->getRequest(), - 'timestamp' => self::TIMESTAMP - )); - - $p->onRequestBeforeSend($event); - } - - public function testDoesNotAddFalseyValuesToAuthorization() - { - unset($this->config['token']); - $p = new OauthPlugin($this->config); - $event = new Event(array('request' => $this->getRequest(), 'timestamp' => self::TIMESTAMP)); - $p->onRequestBeforeSend($event); - $this->assertTrue($event['request']->hasHeader('Authorization')); - $this->assertNotContains('oauth_token=', (string) $event['request']->getHeader('Authorization')); - } - - public function testOptionalOauthParametersAreNotAutomaticallyAdded() - { - // The only required Oauth parameters are the consumer key and secret. That is enough credentials - // for signing oauth requests. - $config = array( - 'consumer_key' => 'foo', - 'consumer_secret' => 'bar', - ); - - $plugin = new OauthPlugin($config); - $event = new Event(array( - 'request' => $this->getRequest(), - 'timestamp' => self::TIMESTAMP - )); - - $timestamp = $plugin->getTimestamp($event); - $request = $event['request']; - $nonce = $plugin->generateNonce($request); - - $paramsToSign = $plugin->getParamsToSign($request, $timestamp, $nonce); - - $optionalParams = array( - 'callback' => 'oauth_callback', - 'token' => 'oauth_token', - 'verifier' => 'oauth_verifier', - 'token_secret' => 'token_secret' - ); - - foreach ($optionalParams as $optionName => $oauthName) { - $this->assertArrayNotHasKey($oauthName, $paramsToSign, "Optional Oauth param '$oauthName' was not set via config variable '$optionName', but it is listed in getParamsToSign()."); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/AbstractConfigLoaderTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/AbstractConfigLoaderTest.php deleted file mode 100644 index 8b42fb839..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/AbstractConfigLoaderTest.php +++ /dev/null @@ -1,149 +0,0 @@ -loader = $this->getMockBuilder('Guzzle\Service\AbstractConfigLoader') - ->setMethods(array('build')) - ->getMockForAbstractClass(); - } - - public function tearDown() - { - foreach ($this->cleanup as $file) { - unlink($file); - } - } - - /** - * @expectedException \Guzzle\Common\Exception\InvalidArgumentException - */ - public function testOnlyLoadsSupportedTypes() - { - $this->loader->load(new \stdClass()); - } - - /** - * @expectedException \Guzzle\Common\Exception\InvalidArgumentException - * @expectedExceptionMessage Unable to open fooooooo.json - */ - public function testFileMustBeReadable() - { - $this->loader->load('fooooooo.json'); - } - - /** - * @expectedException \Guzzle\Common\Exception\InvalidArgumentException - * @expectedExceptionMessage Unknown file extension - */ - public function testMustBeSupportedExtension() - { - $this->loader->load(dirname(__DIR__) . '/TestData/FileBody.txt'); - } - - /** - * @expectedException \Guzzle\Common\Exception\RuntimeException - * @expectedExceptionMessage Error loading JSON data from - */ - public function testJsonMustBeValue() - { - $filename = tempnam(sys_get_temp_dir(), 'json') . '.json'; - file_put_contents($filename, '{/{./{}foo'); - $this->cleanup[] = $filename; - $this->loader->load($filename); - } - - /** - * @expectedException \Guzzle\Common\Exception\InvalidArgumentException - * @expectedExceptionMessage PHP files must return an array - */ - public function testPhpFilesMustReturnAnArray() - { - $filename = tempnam(sys_get_temp_dir(), 'php') . '.php'; - file_put_contents($filename, 'cleanup[] = $filename; - $this->loader->load($filename); - } - - public function testLoadsPhpFileIncludes() - { - $filename = tempnam(sys_get_temp_dir(), 'php') . '.php'; - file_put_contents($filename, ' "bar");'); - $this->cleanup[] = $filename; - $this->loader->expects($this->exactly(1))->method('build')->will($this->returnArgument(0)); - $config = $this->loader->load($filename); - $this->assertEquals(array('foo' => 'bar'), $config); - } - - public function testCanCreateFromJson() - { - $file = dirname(__DIR__) . '/TestData/services/json1.json'; - // The build method will just return the config data - $this->loader->expects($this->exactly(1))->method('build')->will($this->returnArgument(0)); - $data = $this->loader->load($file); - // Ensure that the config files were merged using the includes directives - $this->assertArrayHasKey('includes', $data); - $this->assertArrayHasKey('services', $data); - $this->assertInternalType('array', $data['services']['foo']); - $this->assertInternalType('array', $data['services']['abstract']); - $this->assertInternalType('array', $data['services']['mock']); - $this->assertEquals('bar', $data['services']['foo']['params']['baz']); - } - - public function testUsesAliases() - { - $file = dirname(__DIR__) . '/TestData/services/json1.json'; - $this->loader->addAlias('foo', $file); - // The build method will just return the config data - $this->loader->expects($this->exactly(1))->method('build')->will($this->returnArgument(0)); - $data = $this->loader->load('foo'); - $this->assertEquals('bar', $data['services']['foo']['params']['baz']); - } - - /** - * @expectedException \Guzzle\Common\Exception\InvalidArgumentException - * @expectedExceptionMessage Unable to open foo.json - */ - public function testCanRemoveAliases() - { - $file = dirname(__DIR__) . '/TestData/services/json1.json'; - $this->loader->addAlias('foo.json', $file); - $this->loader->removeAlias('foo.json'); - $this->loader->load('foo.json'); - } - - public function testCanLoadArraysWithIncludes() - { - $file = dirname(__DIR__) . '/TestData/services/json1.json'; - $config = array('includes' => array($file)); - // The build method will just return the config data - $this->loader->expects($this->exactly(1))->method('build')->will($this->returnArgument(0)); - $data = $this->loader->load($config); - $this->assertEquals('bar', $data['services']['foo']['params']['baz']); - } - - public function testDoesNotEnterInfiniteLoop() - { - $prefix = $file = dirname(__DIR__) . '/TestData/description'; - $this->loader->load("{$prefix}/baz.json"); - $this->assertCount(4, $this->readAttribute($this->loader, 'loadedFiles')); - // Ensure that the internal list of loaded files is reset - $this->loader->load("{$prefix}/../test_service2.json"); - $this->assertCount(1, $this->readAttribute($this->loader, 'loadedFiles')); - // Ensure that previously loaded files will be reloaded when starting fresh - $this->loader->load("{$prefix}/baz.json"); - $this->assertCount(4, $this->readAttribute($this->loader, 'loadedFiles')); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Builder/ServiceBuilderLoaderTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Builder/ServiceBuilderLoaderTest.php deleted file mode 100644 index f63070e38..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Builder/ServiceBuilderLoaderTest.php +++ /dev/null @@ -1,177 +0,0 @@ - array( - 'abstract' => array( - 'params' => array( - 'access_key' => 'xyz', - 'secret' => 'abc', - ), - ), - 'foo' => array( - 'extends' => 'abstract', - 'params' => array( - 'baz' => 'bar', - ), - ), - 'mock' => array( - 'extends' => 'abstract', - 'params' => array( - 'username' => 'foo', - 'password' => 'baz', - 'subdomain' => 'bar', - ) - ) - ) - ); - - $builder = $arrayFactory->load($data); - - // Ensure that services were parsed - $this->assertTrue(isset($builder['mock'])); - $this->assertTrue(isset($builder['abstract'])); - $this->assertTrue(isset($builder['foo'])); - $this->assertFalse(isset($builder['jimmy'])); - } - - /** - * @expectedException Guzzle\Service\Exception\ServiceNotFoundException - * @expectedExceptionMessage foo is trying to extend a non-existent service: abstract - */ - public function testThrowsExceptionWhenExtendingNonExistentService() - { - $arrayFactory = new ServiceBuilderLoader(); - - $data = array( - 'services' => array( - 'foo' => array( - 'extends' => 'abstract' - ) - ) - ); - - $builder = $arrayFactory->load($data); - } - - public function testAllowsGlobalParameterOverrides() - { - $arrayFactory = new ServiceBuilderLoader(); - - $data = array( - 'services' => array( - 'foo' => array( - 'params' => array( - 'foo' => 'baz', - 'bar' => 'boo' - ) - ) - ) - ); - - $builder = $arrayFactory->load($data, array( - 'bar' => 'jar', - 'far' => 'car' - )); - - $compiled = json_decode($builder->serialize(), true); - $this->assertEquals(array( - 'foo' => 'baz', - 'bar' => 'jar', - 'far' => 'car' - ), $compiled['foo']['params']); - } - - public function tstDoesNotErrorOnCircularReferences() - { - $arrayFactory = new ServiceBuilderLoader(); - $arrayFactory->load(array( - 'services' => array( - 'too' => array('extends' => 'ball'), - 'ball' => array('extends' => 'too'), - ) - )); - } - - public function configProvider() - { - $foo = array( - 'extends' => 'bar', - 'class' => 'stdClass', - 'params' => array('a' => 'test', 'b' => '456') - ); - - return array( - array( - // Does not extend the existing `foo` service but overwrites it - array( - 'services' => array( - 'foo' => $foo, - 'bar' => array('params' => array('baz' => '123')) - ) - ), - array( - 'services' => array( - 'foo' => array('class' => 'Baz') - ) - ), - array( - 'services' => array( - 'foo' => array('class' => 'Baz'), - 'bar' => array('params' => array('baz' => '123')) - ) - ) - ), - array( - // Extends the existing `foo` service - array( - 'services' => array( - 'foo' => $foo, - 'bar' => array('params' => array('baz' => '123')) - ) - ), - array( - 'services' => array( - 'foo' => array( - 'extends' => 'foo', - 'params' => array('b' => '123', 'c' => 'def') - ) - ) - ), - array( - 'services' => array( - 'foo' => array( - 'extends' => 'bar', - 'class' => 'stdClass', - 'params' => array('a' => 'test', 'b' => '123', 'c' => 'def') - ), - 'bar' => array('params' => array('baz' => '123')) - ) - ) - ) - ); - } - - /** - * @dataProvider configProvider - */ - public function testCombinesConfigs($a, $b, $c) - { - $l = new ServiceBuilderLoader(); - $m = new \ReflectionMethod($l, 'mergeData'); - $m->setAccessible(true); - $this->assertEquals($c, $m->invoke($l, $a, $b)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Builder/ServiceBuilderTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Builder/ServiceBuilderTest.php deleted file mode 100644 index e1b3a1d49..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Builder/ServiceBuilderTest.php +++ /dev/null @@ -1,317 +0,0 @@ - array( - 'class' => 'Guzzle\Tests\Service\Mock\MockClient', - 'params' => array( - 'username' => 'michael', - 'password' => 'testing123', - 'subdomain' => 'michael', - ), - ), - 'billy.mock' => array( - 'alias' => 'Hello!', - 'class' => 'Guzzle\Tests\Service\Mock\MockClient', - 'params' => array( - 'username' => 'billy', - 'password' => 'passw0rd', - 'subdomain' => 'billy', - ), - ), - 'billy.testing' => array( - 'extends' => 'billy.mock', - 'params' => array( - 'subdomain' => 'test.billy', - ), - ), - 'missing_params' => array( - 'extends' => 'billy.mock' - ) - ); - - public function testAllowsSerialization() - { - $builder = ServiceBuilder::factory($this->arrayData); - $cached = unserialize(serialize($builder)); - $this->assertEquals($cached, $builder); - } - - public function testDelegatesFactoryMethodToAbstractFactory() - { - $builder = ServiceBuilder::factory($this->arrayData); - $c = $builder->get('michael.mock'); - $this->assertInstanceOf('Guzzle\Tests\Service\Mock\MockClient', $c); - } - - /** - * @expectedException Guzzle\Service\Exception\ServiceNotFoundException - * @expectedExceptionMessage No service is registered as foobar - */ - public function testThrowsExceptionWhenGettingInvalidClient() - { - ServiceBuilder::factory($this->arrayData)->get('foobar'); - } - - public function testStoresClientCopy() - { - $builder = ServiceBuilder::factory($this->arrayData); - $client = $builder->get('michael.mock'); - $this->assertInstanceOf('Guzzle\Tests\Service\Mock\MockClient', $client); - $this->assertEquals('http://127.0.0.1:8124/v1/michael', $client->getBaseUrl()); - $this->assertEquals($client, $builder->get('michael.mock')); - - // Get another client but throw this one away - $client2 = $builder->get('billy.mock', true); - $this->assertInstanceOf('Guzzle\Tests\Service\Mock\MockClient', $client2); - $this->assertEquals('http://127.0.0.1:8124/v1/billy', $client2->getBaseUrl()); - - // Make sure the original client is still there and set - $this->assertTrue($client === $builder->get('michael.mock')); - - // Create a new billy.mock client that is stored - $client3 = $builder->get('billy.mock'); - - // Make sure that the stored billy.mock client is equal to the other stored client - $this->assertTrue($client3 === $builder->get('billy.mock')); - - // Make sure that this client is not equal to the previous throwaway client - $this->assertFalse($client2 === $builder->get('billy.mock')); - } - - public function testBuildersPassOptionsThroughToClients() - { - $s = new ServiceBuilder(array( - 'michael.mock' => array( - 'class' => 'Guzzle\Tests\Service\Mock\MockClient', - 'params' => array( - 'base_url' => 'http://www.test.com/', - 'subdomain' => 'michael', - 'password' => 'test', - 'username' => 'michael', - 'curl.curlopt_proxyport' => 8080 - ) - ) - )); - - $c = $s->get('michael.mock'); - $this->assertEquals(8080, $c->getConfig('curl.curlopt_proxyport')); - } - - public function testUsesTheDefaultBuilderWhenNoBuilderIsSpecified() - { - $s = new ServiceBuilder(array( - 'michael.mock' => array( - 'class' => 'Guzzle\Tests\Service\Mock\MockClient', - 'params' => array( - 'base_url' => 'http://www.test.com/', - 'subdomain' => 'michael', - 'password' => 'test', - 'username' => 'michael', - 'curl.curlopt_proxyport' => 8080 - ) - ) - )); - - $c = $s->get('michael.mock'); - $this->assertInstanceOf('Guzzle\Tests\Service\Mock\MockClient', $c); - } - - public function testUsedAsArray() - { - $b = ServiceBuilder::factory($this->arrayData); - $this->assertTrue($b->offsetExists('michael.mock')); - $this->assertFalse($b->offsetExists('not_there')); - $this->assertInstanceOf('Guzzle\Service\Client', $b['michael.mock']); - - unset($b['michael.mock']); - $this->assertFalse($b->offsetExists('michael.mock')); - - $b['michael.mock'] = new Client('http://www.test.com/'); - $this->assertInstanceOf('Guzzle\Service\Client', $b['michael.mock']); - } - - public function testFactoryCanCreateFromJson() - { - $tmp = sys_get_temp_dir() . '/test.js'; - file_put_contents($tmp, json_encode($this->arrayData)); - $b = ServiceBuilder::factory($tmp); - unlink($tmp); - $s = $b->get('billy.testing'); - $this->assertEquals('test.billy', $s->getConfig('subdomain')); - $this->assertEquals('billy', $s->getConfig('username')); - } - - public function testFactoryCanCreateFromArray() - { - $b = ServiceBuilder::factory($this->arrayData); - $s = $b->get('billy.testing'); - $this->assertEquals('test.billy', $s->getConfig('subdomain')); - $this->assertEquals('billy', $s->getConfig('username')); - } - - public function testFactoryDoesNotRequireParams() - { - $b = ServiceBuilder::factory($this->arrayData); - $s = $b->get('missing_params'); - $this->assertEquals('billy', $s->getConfig('username')); - } - - public function testBuilderAllowsReferencesBetweenClients() - { - $builder = ServiceBuilder::factory(array( - 'a' => array( - 'class' => 'Guzzle\Tests\Service\Mock\MockClient', - 'params' => array( - 'other_client' => '{b}', - 'username' => 'x', - 'password' => 'y', - 'subdomain' => 'z' - ) - ), - 'b' => array( - 'class' => 'Guzzle\Tests\Service\Mock\MockClient', - 'params' => array( - 'username' => '1', - 'password' => '2', - 'subdomain' => '3' - ) - ) - )); - - $client = $builder['a']; - $this->assertEquals('x', $client->getConfig('username')); - $this->assertSame($builder['b'], $client->getConfig('other_client')); - $this->assertEquals('1', $builder['b']->getConfig('username')); - } - - public function testEmitsEventsWhenClientsAreCreated() - { - // Ensure that the client signals that it emits an event - $this->assertEquals(array('service_builder.create_client'), ServiceBuilder::getAllEvents()); - - // Create a test service builder - $builder = ServiceBuilder::factory(array( - 'a' => array( - 'class' => 'Guzzle\Tests\Service\Mock\MockClient', - 'params' => array( - 'username' => 'test', - 'password' => '123', - 'subdomain' => 'z' - ) - ) - )); - - // Add an event listener to pick up client creation events - $emits = 0; - $builder->getEventDispatcher()->addListener('service_builder.create_client', function($event) use (&$emits) { - $emits++; - }); - - // Get the 'a' client by name - $client = $builder->get('a'); - - // Ensure that the event was emitted once, and that the client was present - $this->assertEquals(1, $emits); - $this->assertInstanceOf('Guzzle\Tests\Service\Mock\MockClient', $client); - } - - public function testCanAddGlobalParametersToServicesOnLoad() - { - $builder = ServiceBuilder::factory($this->arrayData, array( - 'username' => 'fred', - 'new_value' => 'test' - )); - - $data = json_decode($builder->serialize(), true); - - foreach ($data as $service) { - $this->assertEquals('fred', $service['params']['username']); - $this->assertEquals('test', $service['params']['new_value']); - } - } - - public function testAddsGlobalPlugins() - { - $b = new ServiceBuilder($this->arrayData); - $b->addGlobalPlugin(new HistoryPlugin()); - $s = $b->get('michael.mock'); - $this->assertTrue($s->getEventDispatcher()->hasListeners('request.sent')); - } - - public function testCanGetData() - { - $b = new ServiceBuilder($this->arrayData); - $this->assertEquals($this->arrayData['michael.mock'], $b->getData('michael.mock')); - $this->assertNull($b->getData('ewofweoweofe')); - } - - public function testCanGetByAlias() - { - $b = new ServiceBuilder($this->arrayData); - $this->assertSame($b->get('billy.mock'), $b->get('Hello!')); - } - - public function testCanOverwriteParametersForThrowawayClients() - { - $b = new ServiceBuilder($this->arrayData); - - $c1 = $b->get('michael.mock'); - $this->assertEquals('michael', $c1->getConfig('username')); - - $c2 = $b->get('michael.mock', array('username' => 'jeremy')); - $this->assertEquals('jeremy', $c2->getConfig('username')); - } - - public function testGettingAThrowawayClientWithParametersDoesNotAffectGettingOtherClients() - { - $b = new ServiceBuilder($this->arrayData); - - $c1 = $b->get('michael.mock', array('username' => 'jeremy')); - $this->assertEquals('jeremy', $c1->getConfig('username')); - - $c2 = $b->get('michael.mock'); - $this->assertEquals('michael', $c2->getConfig('username')); - } - - public function testCanUseArbitraryData() - { - $b = new ServiceBuilder(); - $b['a'] = 'foo'; - $this->assertTrue(isset($b['a'])); - $this->assertEquals('foo', $b['a']); - unset($b['a']); - $this->assertFalse(isset($b['a'])); - } - - public function testCanRegisterServiceData() - { - $b = new ServiceBuilder(); - $b['a'] = array( - 'class' => 'Guzzle\Tests\Service\Mock\MockClient', - 'params' => array( - 'username' => 'billy', - 'password' => 'passw0rd', - 'subdomain' => 'billy', - ) - ); - $this->assertTrue(isset($b['a'])); - $this->assertInstanceOf('Guzzle\Tests\Service\Mock\MockClient', $b['a']); - $client = $b['a']; - unset($b['a']); - $this->assertFalse(isset($b['a'])); - // Ensure that instantiated clients can be registered - $b['mock'] = $client; - $this->assertSame($client, $b['mock']); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/CachingConfigLoaderTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/CachingConfigLoaderTest.php deleted file mode 100644 index b8245ad58..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/CachingConfigLoaderTest.php +++ /dev/null @@ -1,43 +0,0 @@ -getMockBuilder('Guzzle\Service\ConfigLoaderInterface') - ->setMethods(array('load')) - ->getMockForAbstractClass(); - $data = array('foo' => 'bar'); - $loader->expects($this->once()) - ->method('load') - ->will($this->returnValue($data)); - $cache = new CachingConfigLoader($loader, $cache); - $this->assertEquals($data, $cache->load('foo')); - $this->assertEquals($data, $cache->load('foo')); - } - - public function testDoesNotCacheArrays() - { - $cache = new DoctrineCacheAdapter(new ArrayCache()); - $loader = $this->getMockBuilder('Guzzle\Service\ConfigLoaderInterface') - ->setMethods(array('load')) - ->getMockForAbstractClass(); - $data = array('foo' => 'bar'); - $loader->expects($this->exactly(2)) - ->method('load') - ->will($this->returnValue($data)); - $cache = new CachingConfigLoader($loader, $cache); - $this->assertEquals($data, $cache->load(array())); - $this->assertEquals($data, $cache->load(array())); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/ClientTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/ClientTest.php deleted file mode 100644 index aee29ed8d..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/ClientTest.php +++ /dev/null @@ -1,320 +0,0 @@ -serviceTest = new ServiceDescription(array( - 'test_command' => new Operation(array( - 'doc' => 'documentationForCommand', - 'method' => 'DELETE', - 'class' => 'Guzzle\\Tests\\Service\\Mock\\Command\\MockCommand', - 'args' => array( - 'bucket' => array( - 'required' => true - ), - 'key' => array( - 'required' => true - ) - ) - )) - )); - - $this->service = ServiceDescription::factory(__DIR__ . '/../TestData/test_service.json'); - } - - public function testAllowsCustomClientParameters() - { - $client = new Mock\MockClient(null, array( - Client::COMMAND_PARAMS => array(AbstractCommand::RESPONSE_PROCESSING => 'foo') - )); - $command = $client->getCommand('mock_command'); - $this->assertEquals('foo', $command->get(AbstractCommand::RESPONSE_PROCESSING)); - } - - public function testFactoryCreatesClient() - { - $client = Client::factory(array( - 'base_url' => 'http://www.test.com/', - 'test' => '123' - )); - - $this->assertEquals('http://www.test.com/', $client->getBaseUrl()); - $this->assertEquals('123', $client->getConfig('test')); - } - - public function testFactoryDoesNotRequireBaseUrl() - { - $client = Client::factory(); - } - - public function testDescribesEvents() - { - $this->assertInternalType('array', Client::getAllEvents()); - } - - public function testExecutesCommands() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - - $client = new Client($this->getServer()->getUrl()); - $cmd = new MockCommand(); - $client->execute($cmd); - - $this->assertInstanceOf('Guzzle\\Http\\Message\\Response', $cmd->getResponse()); - $this->assertInstanceOf('Guzzle\\Http\\Message\\Response', $cmd->getResult()); - $this->assertEquals(1, count($this->getServer()->getReceivedRequests(false))); - } - - public function testExecutesCommandsWithArray() - { - $client = new Client('http://www.test.com/'); - $client->getEventDispatcher()->addSubscriber(new MockPlugin(array( - new Response(200), - new Response(200) - ))); - - // Create a command set and a command - $set = array(new MockCommand(), new MockCommand()); - $client->execute($set); - - // Make sure it sent - $this->assertTrue($set[0]->isExecuted()); - $this->assertTrue($set[1]->isExecuted()); - } - - /** - * @expectedException Guzzle\Common\Exception\InvalidArgumentException - */ - public function testThrowsExceptionWhenInvalidCommandIsExecuted() - { - $client = new Client(); - $client->execute(new \stdClass()); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testThrowsExceptionWhenMissingCommand() - { - $client = new Client(); - - $mock = $this->getMock('Guzzle\\Service\\Command\\Factory\\FactoryInterface'); - $mock->expects($this->any()) - ->method('factory') - ->with($this->equalTo('test')) - ->will($this->returnValue(null)); - - $client->setCommandFactory($mock); - $client->getCommand('test'); - } - - public function testCreatesCommandsUsingCommandFactory() - { - $mockCommand = new MockCommand(); - - $client = new Mock\MockClient(); - $mock = $this->getMock('Guzzle\\Service\\Command\\Factory\\FactoryInterface'); - $mock->expects($this->any()) - ->method('factory') - ->with($this->equalTo('foo')) - ->will($this->returnValue($mockCommand)); - - $client->setCommandFactory($mock); - - $command = $client->getCommand('foo', array('acl' => '123')); - $this->assertSame($mockCommand, $command); - $command = $client->getCommand('foo', array('acl' => '123')); - $this->assertSame($mockCommand, $command); - $this->assertSame($client, $command->getClient()); - } - - public function testOwnsServiceDescription() - { - $client = new Mock\MockClient(); - $this->assertNull($client->getDescription()); - - $description = $this->getMock('Guzzle\\Service\\Description\\ServiceDescription'); - $this->assertSame($client, $client->setDescription($description)); - $this->assertSame($description, $client->getDescription()); - } - - public function testOwnsResourceIteratorFactory() - { - $client = new Mock\MockClient(); - - $method = new \ReflectionMethod($client, 'getResourceIteratorFactory'); - $method->setAccessible(TRUE); - $rf1 = $method->invoke($client); - - $rf = $this->readAttribute($client, 'resourceIteratorFactory'); - $this->assertInstanceOf('Guzzle\\Service\\Resource\\ResourceIteratorClassFactory', $rf); - $this->assertSame($rf1, $rf); - - $rf = new ResourceIteratorClassFactory('Guzzle\Tests\Service\Mock'); - $client->setResourceIteratorFactory($rf); - $this->assertNotSame($rf1, $rf); - } - - public function testClientResetsRequestsBeforeExecutingCommands() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\nHi", - "HTTP/1.1 200 OK\r\nContent-Length: 1\r\n\r\nI" - )); - - $client = new Mock\MockClient($this->getServer()->getUrl()); - - $command = $client->getCommand('mock_command'); - $client->execute($command); - $client->execute($command); - $this->assertEquals('I', $command->getResponse()->getBody(true)); - } - - public function testClientCreatesIterators() - { - $client = new Mock\MockClient(); - - $iterator = $client->getIterator('mock_command', array( - 'foo' => 'bar' - ), array( - 'limit' => 10 - )); - - $this->assertInstanceOf('Guzzle\Tests\Service\Mock\Model\MockCommandIterator', $iterator); - $this->assertEquals(10, $this->readAttribute($iterator, 'limit')); - - $command = $this->readAttribute($iterator, 'originalCommand'); - $this->assertEquals('bar', $command->get('foo')); - } - - public function testClientCreatesIteratorsWithNoOptions() - { - $client = new Mock\MockClient(); - $iterator = $client->getIterator('mock_command'); - $this->assertInstanceOf('Guzzle\Tests\Service\Mock\Model\MockCommandIterator', $iterator); - } - - public function testClientCreatesIteratorsWithCommands() - { - $client = new Mock\MockClient(); - $command = new MockCommand(); - $iterator = $client->getIterator($command); - $this->assertInstanceOf('Guzzle\Tests\Service\Mock\Model\MockCommandIterator', $iterator); - $iteratorCommand = $this->readAttribute($iterator, 'originalCommand'); - $this->assertSame($command, $iteratorCommand); - } - - public function testClientHoldsInflector() - { - $client = new Mock\MockClient(); - $this->assertInstanceOf('Guzzle\Inflection\MemoizingInflector', $client->getInflector()); - - $inflector = new Inflector(); - $client->setInflector($inflector); - $this->assertSame($inflector, $client->getInflector()); - } - - public function testClientAddsGlobalCommandOptions() - { - $client = new Mock\MockClient('http://www.foo.com', array( - Client::COMMAND_PARAMS => array( - 'mesa' => 'bar' - ) - )); - $command = $client->getCommand('mock_command'); - $this->assertEquals('bar', $command->get('mesa')); - } - - public function testSupportsServiceDescriptionBaseUrls() - { - $description = new ServiceDescription(array('baseUrl' => 'http://foo.com')); - $client = new Client(); - $client->setDescription($description); - $this->assertEquals('http://foo.com', $client->getBaseUrl()); - } - - public function testMergesDefaultCommandParamsCorrectly() - { - $client = new Mock\MockClient('http://www.foo.com', array( - Client::COMMAND_PARAMS => array( - 'mesa' => 'bar', - 'jar' => 'jar' - ) - )); - $command = $client->getCommand('mock_command', array('jar' => 'test')); - $this->assertEquals('bar', $command->get('mesa')); - $this->assertEquals('test', $command->get('jar')); - } - - /** - * @expectedException \Guzzle\Http\Exception\BadResponseException - */ - public function testWrapsSingleCommandExceptions() - { - $client = new Mock\MockClient('http://foobaz.com'); - $mock = new MockPlugin(array(new Response(401))); - $client->addSubscriber($mock); - $client->execute(new MockCommand()); - } - - public function testWrapsMultipleCommandExceptions() - { - $client = new Mock\MockClient('http://foobaz.com'); - $mock = new MockPlugin(array(new Response(200), new Response(200), new Response(404), new Response(500))); - $client->addSubscriber($mock); - - $cmds = array(new MockCommand(), new MockCommand(), new MockCommand(), new MockCommand()); - try { - $client->execute($cmds); - } catch (CommandTransferException $e) { - $this->assertEquals(2, count($e->getFailedRequests())); - $this->assertEquals(2, count($e->getSuccessfulRequests())); - $this->assertEquals(2, count($e->getFailedCommands())); - $this->assertEquals(2, count($e->getSuccessfulCommands())); - - foreach ($e->getSuccessfulCommands() as $c) { - $this->assertTrue($c->getResponse()->isSuccessful()); - } - - foreach ($e->getFailedCommands() as $c) { - $this->assertFalse($c->getRequest()->getResponse()->isSuccessful()); - } - } - } - - public function testGetCommandAfterTwoSetDescriptions() - { - $service1 = ServiceDescription::factory(__DIR__ . '/../TestData/test_service.json'); - $service2 = ServiceDescription::factory(__DIR__ . '/../TestData/test_service_3.json'); - - $client = new Mock\MockClient(); - - $client->setDescription($service1); - $client->getCommand('foo_bar'); - $client->setDescription($service2); - $client->getCommand('baz_qux'); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/AbstractCommandTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/AbstractCommandTest.php deleted file mode 100644 index 1004fae66..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/AbstractCommandTest.php +++ /dev/null @@ -1,16 +0,0 @@ -setDescription(ServiceDescription::factory(__DIR__ . '/../../TestData/test_service.json')); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/ClosureCommandTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/ClosureCommandTest.php deleted file mode 100644 index d76224697..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/ClosureCommandTest.php +++ /dev/null @@ -1,54 +0,0 @@ - function($command, $api) { - $command->set('testing', '123'); - $request = RequestFactory::getInstance()->create('GET', 'http://www.test.com/'); - return $request; - } - )); - - $client = $this->getServiceBuilder()->get('mock'); - $c->setClient($client)->prepare(); - $this->assertEquals('123', $c->get('testing')); - $this->assertEquals('http://www.test.com/', $c->getRequest()->getUrl()); - } - - /** - * @expectedException UnexpectedValueException - * @expectedExceptionMessage Closure command did not return a RequestInterface object - */ - public function testMustReturnRequest() - { - $c = new ClosureCommand(array( - 'closure' => function($command, $api) { - return false; - } - )); - - $client = $this->getServiceBuilder()->get('mock'); - $c->setClient($client)->prepare(); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/CommandTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/CommandTest.php deleted file mode 100644 index b7173d486..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/CommandTest.php +++ /dev/null @@ -1,445 +0,0 @@ -assertEquals('123', $command->get('test')); - $this->assertFalse($command->isPrepared()); - $this->assertFalse($command->isExecuted()); - } - - public function testDeterminesShortName() - { - $api = new Operation(array('name' => 'foobar')); - $command = new MockCommand(array(), $api); - $this->assertEquals('foobar', $command->getName()); - - $command = new MockCommand(); - $this->assertEquals('mock_command', $command->getName()); - - $command = new Sub(); - $this->assertEquals('sub.sub', $command->getName()); - } - - /** - * @expectedException RuntimeException - */ - public function testGetRequestThrowsExceptionBeforePreparation() - { - $command = new MockCommand(); - $command->getRequest(); - } - - public function testGetResponseExecutesCommandsWhenNeeded() - { - $response = new Response(200); - $client = $this->getClient(); - $this->setMockResponse($client, array($response)); - $command = new MockCommand(); - $command->setClient($client); - $this->assertSame($response, $command->getResponse()); - $this->assertSame($response, $command->getResponse()); - } - - public function testGetResultExecutesCommandsWhenNeeded() - { - $response = new Response(200); - $client = $this->getClient(); - $this->setMockResponse($client, array($response)); - $command = new MockCommand(); - $command->setClient($client); - $this->assertSame($response, $command->getResult()); - $this->assertSame($response, $command->getResult()); - } - - public function testSetClient() - { - $command = new MockCommand(); - $client = $this->getClient(); - - $command->setClient($client); - $this->assertEquals($client, $command->getClient()); - - unset($client); - unset($command); - - $command = new MockCommand(); - $client = $this->getClient(); - - $command->setClient($client)->prepare(); - $this->assertEquals($client, $command->getClient()); - $this->assertTrue($command->isPrepared()); - } - - public function testExecute() - { - $client = $this->getClient(); - $response = new Response(200, array( - 'Content-Type' => 'application/xml' - ), '123'); - $this->setMockResponse($client, array($response)); - $command = new MockCommand(); - $this->assertSame($command, $command->setClient($client)); - - // Returns the result of the command - $this->assertInstanceOf('SimpleXMLElement', $command->execute()); - - $this->assertTrue($command->isPrepared()); - $this->assertTrue($command->isExecuted()); - $this->assertSame($response, $command->getResponse()); - $this->assertInstanceOf('Guzzle\\Http\\Message\\Request', $command->getRequest()); - // Make sure that the result was automatically set to a SimpleXMLElement - $this->assertInstanceOf('SimpleXMLElement', $command->getResult()); - $this->assertEquals('123', (string) $command->getResult()->data); - } - - public function testConvertsJsonResponsesToArray() - { - $client = $this->getClient(); - $this->setMockResponse($client, array( - new \Guzzle\Http\Message\Response(200, array( - 'Content-Type' => 'application/json' - ), '{ "key": "Hi!" }' - ) - )); - $command = new MockCommand(); - $command->setClient($client); - $command->execute(); - $this->assertEquals(array( - 'key' => 'Hi!' - ), $command->getResult()); - } - - /** - * @expectedException \Guzzle\Common\Exception\RuntimeException - */ - public function testConvertsInvalidJsonResponsesToArray() - { - $json = '{ "key": "Hi!" }invalid'; - // Some implementations of php-json extension are not strict enough - // and allow to parse invalid json ignoring invalid parts - // See https://github.com/remicollet/pecl-json-c/issues/5 - if (json_decode($json) && JSON_ERROR_NONE === json_last_error()) { - $this->markTestSkipped('php-pecl-json library regression issues'); - } - - $client = $this->getClient(); - $this->setMockResponse($client, array( - new \Guzzle\Http\Message\Response(200, array( - 'Content-Type' => 'application/json' - ), $json - ) - )); - $command = new MockCommand(); - $command->setClient($client); - $command->execute(); - } - - public function testProcessResponseIsNotXml() - { - $client = $this->getClient(); - $this->setMockResponse($client, array( - new Response(200, array( - 'Content-Type' => 'application/octet-stream' - ), 'abc,def,ghi') - )); - $command = new MockCommand(); - $client->execute($command); - - // Make sure that the result was not converted to XML - $this->assertFalse($command->getResult() instanceof \SimpleXMLElement); - } - - /** - * @expectedException RuntimeException - */ - public function testExecuteThrowsExceptionWhenNoClientIsSet() - { - $command = new MockCommand(); - $command->execute(); - } - - /** - * @expectedException RuntimeException - */ - public function testPrepareThrowsExceptionWhenNoClientIsSet() - { - $command = new MockCommand(); - $command->prepare(); - } - - public function testCommandsAllowsCustomRequestHeaders() - { - $command = new MockCommand(); - $command->getRequestHeaders()->set('test', '123'); - $this->assertInstanceOf('Guzzle\Common\Collection', $command->getRequestHeaders()); - $this->assertEquals('123', $command->getRequestHeaders()->get('test')); - - $command->setClient($this->getClient())->prepare(); - $this->assertEquals('123', (string) $command->getRequest()->getHeader('test')); - } - - public function testCommandsAllowsCustomRequestHeadersAsArray() - { - $command = new MockCommand(array(AbstractCommand::HEADERS_OPTION => array('Foo' => 'Bar'))); - $this->assertInstanceOf('Guzzle\Common\Collection', $command->getRequestHeaders()); - $this->assertEquals('Bar', $command->getRequestHeaders()->get('Foo')); - } - - private function getOperation() - { - return new Operation(array( - 'name' => 'foobar', - 'httpMethod' => 'POST', - 'class' => 'Guzzle\\Tests\\Service\\Mock\\Command\\MockCommand', - 'parameters' => array( - 'test' => array( - 'default' => '123', - 'type' => 'string' - ) - ))); - } - - public function testCommandsUsesOperation() - { - $api = $this->getOperation(); - $command = new MockCommand(array(), $api); - $this->assertSame($api, $command->getOperation()); - $command->setClient($this->getClient())->prepare(); - $this->assertEquals('123', $command->get('test')); - $this->assertSame($api, $command->getOperation($api)); - } - - public function testCloneMakesNewRequest() - { - $client = $this->getClient(); - $command = new MockCommand(array(), $this->getOperation()); - $command->setClient($client); - - $command->prepare(); - $this->assertTrue($command->isPrepared()); - - $command2 = clone $command; - $this->assertFalse($command2->isPrepared()); - } - - public function testHasOnCompleteMethod() - { - $that = $this; - $called = 0; - - $testFunction = function($command) use (&$called, $that) { - $called++; - $that->assertInstanceOf('Guzzle\Service\Command\CommandInterface', $command); - }; - - $client = $this->getClient(); - $command = new MockCommand(array( - 'command.on_complete' => $testFunction - ), $this->getOperation()); - $command->setClient($client); - - $command->prepare()->setResponse(new Response(200), true); - $command->execute(); - $this->assertEquals(1, $called); - } - - /** - * @expectedException \Guzzle\Common\Exception\InvalidArgumentException - */ - public function testOnCompleteMustBeCallable() - { - $client = $this->getClient(); - $command = new MockCommand(); - $command->setOnComplete('foo'); - } - - public function testCanSetResultManually() - { - $client = $this->getClient(); - $client->getEventDispatcher()->addSubscriber(new MockPlugin(array( - new Response(200) - ))); - $command = new MockCommand(); - $client->execute($command); - $command->setResult('foo!'); - $this->assertEquals('foo!', $command->getResult()); - } - - public function testCanInitConfig() - { - $command = $this->getMockBuilder('Guzzle\\Service\\Command\\AbstractCommand') - ->setConstructorArgs(array(array( - 'foo' => 'bar' - ), new Operation(array( - 'parameters' => array( - 'baz' => new Parameter(array( - 'default' => 'baaar' - )) - ) - )))) - ->getMockForAbstractClass(); - - $this->assertEquals('bar', $command['foo']); - $this->assertEquals('baaar', $command['baz']); - } - - public function testAddsCurlOptionsToRequestsWhenPreparing() - { - $command = new MockCommand(array( - 'foo' => 'bar', - 'curl.options' => array('CURLOPT_PROXYPORT' => 8080) - )); - $client = new Client(); - $command->setClient($client); - $request = $command->prepare(); - $this->assertEquals(8080, $request->getCurlOptions()->get(CURLOPT_PROXYPORT)); - } - - public function testIsInvokable() - { - $client = $this->getClient(); - $response = new Response(200); - $this->setMockResponse($client, array($response)); - $command = new MockCommand(); - $command->setClient($client); - // Returns the result of the command - $this->assertSame($response, $command()); - } - - public function testCreatesDefaultOperation() - { - $command = $this->getMockBuilder('Guzzle\Service\Command\AbstractCommand')->getMockForAbstractClass(); - $this->assertInstanceOf('Guzzle\Service\Description\Operation', $command->getOperation()); - } - - public function testAllowsValidatorToBeInjected() - { - $command = $this->getMockBuilder('Guzzle\Service\Command\AbstractCommand')->getMockForAbstractClass(); - $v = new SchemaValidator(); - $command->setValidator($v); - $this->assertSame($v, $this->readAttribute($command, 'validator')); - } - - public function testCanDisableValidation() - { - $command = new MockCommand(); - $command->setClient(new \Guzzle\Service\Client()); - $v = $this->getMockBuilder('Guzzle\Service\Description\SchemaValidator') - ->setMethods(array('validate')) - ->getMock(); - $v->expects($this->never())->method('validate'); - $command->setValidator($v); - $command->set(AbstractCommand::DISABLE_VALIDATION, true); - $command->prepare(); - } - - public function testValidatorDoesNotUpdateNonDefaultValues() - { - $command = new MockCommand(array('test' => 123, 'foo' => 'bar')); - $command->setClient(new \Guzzle\Service\Client()); - $command->prepare(); - $this->assertEquals(123, $command->get('test')); - $this->assertEquals('bar', $command->get('foo')); - } - - public function testValidatorUpdatesDefaultValues() - { - $command = new MockCommand(); - $command->setClient(new \Guzzle\Service\Client()); - $command->prepare(); - $this->assertEquals(123, $command->get('test')); - $this->assertEquals('abc', $command->get('_internal')); - } - - /** - * @expectedException \Guzzle\Service\Exception\ValidationException - * @expectedExceptionMessage [Foo] Baz - */ - public function testValidatesCommandBeforeSending() - { - $command = new MockCommand(); - $command->setClient(new \Guzzle\Service\Client()); - $v = $this->getMockBuilder('Guzzle\Service\Description\SchemaValidator') - ->setMethods(array('validate', 'getErrors')) - ->getMock(); - $v->expects($this->any())->method('validate')->will($this->returnValue(false)); - $v->expects($this->any())->method('getErrors')->will($this->returnValue(array('[Foo] Baz', '[Bar] Boo'))); - $command->setValidator($v); - $command->prepare(); - } - - /** - * @expectedException \Guzzle\Service\Exception\ValidationException - * @expectedExceptionMessage Validation errors: [abc] must be of type string - */ - public function testValidatesAdditionalParameters() - { - $description = ServiceDescription::factory(array( - 'operations' => array( - 'foo' => array( - 'parameters' => array( - 'baz' => array('type' => 'integer') - ), - 'additionalParameters' => array( - 'type' => 'string' - ) - ) - ) - )); - - $client = new Client(); - $client->setDescription($description); - $command = $client->getCommand('foo', array( - 'abc' => false, - 'command.headers' => array('foo' => 'bar') - )); - $command->prepare(); - } - - public function testCanAccessValidationErrorsFromCommand() - { - $validationErrors = array('[Foo] Baz', '[Bar] Boo'); - $command = new MockCommand(); - $command->setClient(new \Guzzle\Service\Client()); - - $this->assertFalse($command->getValidationErrors()); - - $v = $this->getMockBuilder('Guzzle\Service\Description\SchemaValidator') - ->setMethods(array('validate', 'getErrors')) - ->getMock(); - $v->expects($this->any())->method('getErrors')->will($this->returnValue($validationErrors)); - $command->setValidator($v); - - $this->assertEquals($validationErrors, $command->getValidationErrors()); - } - - public function testCanChangeResponseBody() - { - $body = EntityBody::factory(); - $command = new MockCommand(); - $command->setClient(new \Guzzle\Service\Client()); - $command->set(AbstractCommand::RESPONSE_BODY, $body); - $request = $command->prepare(); - $this->assertSame($body, $this->readAttribute($request, 'responseBody')); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/DefaultRequestSerializerTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/DefaultRequestSerializerTest.php deleted file mode 100644 index b7a4682fc..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/DefaultRequestSerializerTest.php +++ /dev/null @@ -1,122 +0,0 @@ -serializer = DefaultRequestSerializer::getInstance(); - $this->client = new Client('http://foo.com/baz'); - $this->operation = new Operation(array('httpMethod' => 'POST')); - $this->command = $this->getMockBuilder('Guzzle\Service\Command\AbstractCommand') - ->setConstructorArgs(array(array(), $this->operation)) - ->getMockForAbstractClass(); - $this->command->setClient($this->client); - } - - public function testAllowsCustomVisitor() - { - $this->serializer->addVisitor('custom', new HeaderVisitor()); - $this->command['test'] = '123'; - $this->operation->addParam(new Parameter(array('name' => 'test', 'location' => 'custom'))); - $request = $this->serializer->prepare($this->command); - $this->assertEquals('123', (string) $request->getHeader('test')); - } - - public function testUsesRelativePath() - { - $this->operation->setUri('bar'); - $request = $this->serializer->prepare($this->command); - $this->assertEquals('http://foo.com/baz/bar', (string) $request->getUrl()); - } - - public function testUsesRelativePathWithUriLocations() - { - $this->command['test'] = '123'; - $this->operation->setUri('bar/{test}'); - $this->operation->addParam(new Parameter(array('name' => 'test', 'location' => 'uri'))); - $request = $this->serializer->prepare($this->command); - $this->assertEquals('http://foo.com/baz/bar/123', (string) $request->getUrl()); - } - - public function testAllowsCustomFactory() - { - $f = new VisitorFlyweight(); - $serializer = new DefaultRequestSerializer($f); - $this->assertSame($f, $this->readAttribute($serializer, 'factory')); - } - - public function testMixedParams() - { - $this->operation->setUri('bar{?limit,fields}'); - $this->operation->addParam(new Parameter(array( - 'name' => 'limit', - 'location' => 'uri', - 'required' => false, - ))); - $this->operation->addParam(new Parameter(array( - 'name' => 'fields', - 'location' => 'uri', - 'required' => true, - ))); - - $this->command['fields'] = array('id', 'name'); - - $request = $this->serializer->prepare($this->command); - $this->assertEquals('http://foo.com/baz/bar?fields='.urlencode('id,name'), (string) $request->getUrl()); - } - - public function testValidatesAdditionalParameters() - { - $description = ServiceDescription::factory(array( - 'operations' => array( - 'foo' => array( - 'httpMethod' => 'PUT', - 'parameters' => array( - 'bar' => array('location' => 'header') - ), - 'additionalParameters' => array( - 'location' => 'json' - ) - ) - ) - )); - - $client = new Client(); - $client->setDescription($description); - $command = $client->getCommand('foo'); - $command['bar'] = 'test'; - $command['hello'] = 'abc'; - $request = $command->prepare(); - $this->assertEquals('test', (string) $request->getHeader('bar')); - $this->assertEquals('{"hello":"abc"}', (string) $request->getBody()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/DefaultResponseParserTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/DefaultResponseParserTest.php deleted file mode 100644 index a6a02f951..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/DefaultResponseParserTest.php +++ /dev/null @@ -1,59 +0,0 @@ -setClient(new Client()); - $request = $op->prepare(); - $request->setResponse(new Response(200, array( - 'Content-Type' => 'application/xml' - ), 'Bar'), true); - $this->assertInstanceOf('SimpleXMLElement', $op->execute()); - } - - public function testParsesJsonResponses() - { - $op = new OperationCommand(array(), new Operation()); - $op->setClient(new Client()); - $request = $op->prepare(); - $request->setResponse(new Response(200, array( - 'Content-Type' => 'application/json' - ), '{"Baz":"Bar"}'), true); - $this->assertEquals(array('Baz' => 'Bar'), $op->execute()); - } - - /** - * @expectedException \Guzzle\Common\Exception\RuntimeException - */ - public function testThrowsExceptionWhenParsingJsonFails() - { - $op = new OperationCommand(array(), new Operation()); - $op->setClient(new Client()); - $request = $op->prepare(); - $request->setResponse(new Response(200, array('Content-Type' => 'application/json'), '{"Baz":ddw}'), true); - $op->execute(); - } - - public function testAddsContentTypeWhenExpectsIsSetOnCommand() - { - $op = new OperationCommand(array(), new Operation()); - $op['command.expects'] = 'application/json'; - $op->setClient(new Client()); - $request = $op->prepare(); - $request->setResponse(new Response(200, null, '{"Baz":"Bar"}'), true); - $this->assertEquals(array('Baz' => 'Bar'), $op->execute()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/AliasFactoryTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/AliasFactoryTest.php deleted file mode 100644 index ab1041ad3..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/AliasFactoryTest.php +++ /dev/null @@ -1,76 +0,0 @@ -client = new Client(); - - $map = new MapFactory(array( - 'test' => 'Guzzle\Tests\Service\Mock\Command\MockCommand', - 'test1' => 'Guzzle\Tests\Service\Mock\Command\OtherCommand' - )); - - $this->factory = new AliasFactory($this->client, array( - 'foo' => 'test', - 'bar' => 'sub', - 'sub' => 'test1', - 'krull' => 'test3', - 'krull_2' => 'krull', - 'sub_2' => 'bar', - 'bad_link' => 'jarjar' - )); - - $map2 = new MapFactory(array( - 'test3' => 'Guzzle\Tests\Service\Mock\Command\Sub\Sub' - )); - - $this->client->setCommandFactory(new CompositeFactory(array($map, $this->factory, $map2))); - } - - public function aliasProvider() - { - return array( - array('foo', 'Guzzle\Tests\Service\Mock\Command\MockCommand', false), - array('bar', 'Guzzle\Tests\Service\Mock\Command\OtherCommand', false), - array('sub', 'Guzzle\Tests\Service\Mock\Command\OtherCommand', false), - array('sub_2', 'Guzzle\Tests\Service\Mock\Command\OtherCommand', false), - array('krull', 'Guzzle\Tests\Service\Mock\Command\Sub\Sub', false), - array('krull_2', 'Guzzle\Tests\Service\Mock\Command\Sub\Sub', false), - array('missing', null, true), - array('bad_link', null, true) - ); - } - - /** - * @dataProvider aliasProvider - */ - public function testAliasesCommands($key, $result, $exception) - { - try { - $command = $this->client->getCommand($key); - if (is_null($result)) { - $this->assertNull($command); - } else { - $this->assertInstanceof($result, $command); - } - } catch (\Exception $e) { - if (!$exception) { - $this->fail('Got exception when it was not expected'); - } - } - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/CompositeFactoryTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/CompositeFactoryTest.php deleted file mode 100644 index b896dcfd6..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/CompositeFactoryTest.php +++ /dev/null @@ -1,124 +0,0 @@ -getMockBuilder($class) - ->disableOriginalConstructor() - ->getMock(); - } - - public function testIsIterable() - { - $factory = new CompositeFactory(array($this->getFactory(), $this->getFactory())); - $this->assertEquals(2, count($factory)); - $this->assertEquals(2, count(iterator_to_array($factory->getIterator()))); - } - - public function testFindsFactories() - { - $f1 = $this->getFactory(); - $f2 = $this->getFactory('Guzzle\\Service\\Command\\Factory\\CompositeFactory'); - $factory = new CompositeFactory(array($f1, $f2)); - $this->assertNull($factory->find('foo')); - $this->assertNull($factory->find($this->getFactory())); - $this->assertSame($f1, $factory->find('Guzzle\\Service\\Command\\Factory\\MapFactory')); - $this->assertSame($f2, $factory->find('Guzzle\\Service\\Command\\Factory\\CompositeFactory')); - $this->assertSame($f1, $factory->find($f1)); - $this->assertSame($f2, $factory->find($f2)); - - $this->assertFalse($factory->has('foo')); - $this->assertTrue($factory->has('Guzzle\\Service\\Command\\Factory\\MapFactory')); - $this->assertTrue($factory->has('Guzzle\\Service\\Command\\Factory\\CompositeFactory')); - } - - public function testCreatesCommands() - { - $factory = new CompositeFactory(); - $this->assertNull($factory->factory('foo')); - - $f1 = $this->getFactory(); - $mockCommand1 = $this->getMockForAbstractClass('Guzzle\\Service\\Command\\AbstractCommand'); - - $f1->expects($this->once()) - ->method('factory') - ->with($this->equalTo('foo')) - ->will($this->returnValue($mockCommand1)); - - $factory = new CompositeFactory(array($f1)); - $this->assertSame($mockCommand1, $factory->factory('foo')); - } - - public function testAllowsRemovalOfFactories() - { - $f1 = $this->getFactory(); - $f2 = $this->getFactory(); - $f3 = $this->getFactory('Guzzle\\Service\\Command\\Factory\\CompositeFactory'); - $factories = array($f1, $f2, $f3); - $factory = new CompositeFactory($factories); - - $factory->remove('foo'); - $this->assertEquals($factories, $factory->getIterator()->getArrayCopy()); - - $factory->remove($f1); - $this->assertEquals(array($f2, $f3), $factory->getIterator()->getArrayCopy()); - - $factory->remove('Guzzle\\Service\\Command\\Factory\\MapFactory'); - $this->assertEquals(array($f3), $factory->getIterator()->getArrayCopy()); - - $factory->remove('Guzzle\\Service\\Command\\Factory\\CompositeFactory'); - $this->assertEquals(array(), $factory->getIterator()->getArrayCopy()); - - $factory->remove('foo'); - $this->assertEquals(array(), $factory->getIterator()->getArrayCopy()); - } - - public function testAddsFactoriesBeforeAndAtEnd() - { - $f1 = $this->getFactory(); - $f2 = $this->getFactory(); - $f3 = $this->getFactory('Guzzle\\Service\\Command\\Factory\\CompositeFactory'); - $f4 = $this->getFactory(); - - $factory = new CompositeFactory(); - - $factory->add($f1); - $this->assertEquals(array($f1), $factory->getIterator()->getArrayCopy()); - - $factory->add($f2); - $this->assertEquals(array($f1, $f2), $factory->getIterator()->getArrayCopy()); - - $factory->add($f3, $f2); - $this->assertEquals(array($f1, $f3, $f2), $factory->getIterator()->getArrayCopy()); - - $factory->add($f4, 'Guzzle\\Service\\Command\\Factory\\CompositeFactory'); - $this->assertEquals(array($f1, $f4, $f3, $f2), $factory->getIterator()->getArrayCopy()); - } - - public function testProvidesDefaultChainForClients() - { - $client = $this->getMock('Guzzle\\Service\\Client'); - $chain = CompositeFactory::getDefaultChain($client); - $a = $chain->getIterator()->getArrayCopy(); - $this->assertEquals(1, count($a)); - $this->assertInstanceOf('Guzzle\\Service\\Command\\Factory\\ConcreteClassFactory', $a[0]); - - $description = $this->getMock('Guzzle\\Service\\Description\\ServiceDescription'); - $client->expects($this->once()) - ->method('getDescription') - ->will($this->returnValue($description)); - $chain = CompositeFactory::getDefaultChain($client); - $a = $chain->getIterator()->getArrayCopy(); - $this->assertEquals(2, count($a)); - $this->assertInstanceOf('Guzzle\\Service\\Command\\Factory\\ServiceDescriptionFactory', $a[0]); - $this->assertInstanceOf('Guzzle\\Service\\Command\\Factory\\ConcreteClassFactory', $a[1]); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/ConcreteClassFactoryTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/ConcreteClassFactoryTest.php deleted file mode 100644 index 766471822..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/ConcreteClassFactoryTest.php +++ /dev/null @@ -1,49 +0,0 @@ - $prefix - )); - } - - $factory = new ConcreteClassFactory($client); - - if (is_null($result)) { - $this->assertNull($factory->factory($key)); - } else { - $this->assertInstanceof($result, $factory->factory($key)); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/MapFactoryTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/MapFactoryTest.php deleted file mode 100644 index ee720d1e7..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/MapFactoryTest.php +++ /dev/null @@ -1,37 +0,0 @@ - 'Guzzle\Tests\Service\Mock\Command\MockCommand', - 'test1' => 'Guzzle\Tests\Service\Mock\Command\OtherCommand' - )); - - if (is_null($result)) { - $this->assertNull($factory->factory($key)); - } else { - $this->assertInstanceof($result, $factory->factory($key)); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/ServiceDescriptionFactoryTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/ServiceDescriptionFactoryTest.php deleted file mode 100644 index 337263481..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/Factory/ServiceDescriptionFactoryTest.php +++ /dev/null @@ -1,68 +0,0 @@ -getDescription(); - - $factory = new ServiceDescriptionFactory($d); - $this->assertSame($d, $factory->getServiceDescription()); - - if (is_null($result)) { - $this->assertNull($factory->factory($key)); - } else { - $this->assertInstanceof($result, $factory->factory($key)); - } - } - - public function testUsesUcFirstIfNoExactMatch() - { - $d = $this->getDescription(); - $factory = new ServiceDescriptionFactory($d, new Inflector()); - $this->assertInstanceof('Guzzle\Tests\Service\Mock\Command\OtherCommand', $factory->factory('Test')); - $this->assertInstanceof('Guzzle\Tests\Service\Mock\Command\OtherCommand', $factory->factory('test')); - } - - public function testUsesInflectionIfNoExactMatch() - { - $d = $this->getDescription(); - $factory = new ServiceDescriptionFactory($d, new Inflector()); - $this->assertInstanceof('Guzzle\Tests\Service\Mock\Command\OtherCommand', $factory->factory('Binks')); - $this->assertInstanceof('Guzzle\Tests\Service\Mock\Command\OtherCommand', $factory->factory('binks')); - $this->assertInstanceof('Guzzle\Tests\Service\Mock\Command\MockCommand', $factory->factory('JarJar')); - $this->assertInstanceof('Guzzle\Tests\Service\Mock\Command\MockCommand', $factory->factory('jar_jar')); - } - - protected function getDescription() - { - return ServiceDescription::factory(array( - 'operations' => array( - 'jar_jar' => array('class' => 'Guzzle\Tests\Service\Mock\Command\MockCommand'), - 'binks' => array('class' => 'Guzzle\Tests\Service\Mock\Command\OtherCommand'), - 'Test' => array('class' => 'Guzzle\Tests\Service\Mock\Command\OtherCommand') - ) - )); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/AbstractVisitorTestCase.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/AbstractVisitorTestCase.php deleted file mode 100644 index 46b472eb5..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/AbstractVisitorTestCase.php +++ /dev/null @@ -1,110 +0,0 @@ -command = new MockCommand(); - $this->request = new EntityEnclosingRequest('POST', 'http://www.test.com/some/path.php'); - $this->validator = new SchemaValidator(); - } - - protected function getCommand($location) - { - $command = new OperationCommand(array(), $this->getNestedCommand($location)); - $command->setClient(new MockClient()); - - return $command; - } - - protected function getNestedCommand($location) - { - return new Operation(array( - 'httpMethod' => 'POST', - 'parameters' => array( - 'foo' => new Parameter(array( - 'type' => 'object', - 'location' => $location, - 'sentAs' => 'Foo', - 'required' => true, - 'properties' => array( - 'test' => array( - 'type' => 'object', - 'required' => true, - 'properties' => array( - 'baz' => array( - 'type' => 'boolean', - 'default' => true - ), - 'jenga' => array( - 'type' => 'string', - 'default' => 'hello', - 'sentAs' => 'Jenga_Yall!', - 'filters' => array('strtoupper') - ) - ) - ), - 'bar' => array('default' => 123) - ), - 'additionalProperties' => array( - 'type' => 'string', - 'filters' => array('strtoupper'), - 'location' => $location - ) - )), - 'arr' => new Parameter(array( - 'type' => 'array', - 'location' => $location, - 'items' => array( - 'type' => 'string', - 'filters' => array('strtoupper') - ) - )), - ) - )); - } - - protected function getCommandWithArrayParamAndFilters() - { - $operation = new Operation(array( - 'httpMethod' => 'POST', - 'parameters' => array( - 'foo' => new Parameter(array( - 'type' => 'string', - 'location' => 'query', - 'sentAs' => 'Foo', - 'required' => true, - 'default' => 'bar', - 'filters' => array('strtoupper') - )), - 'arr' => new Parameter(array( - 'type' => 'array', - 'location' => 'query', - 'sentAs' => 'Arr', - 'required' => true, - 'default' => array(123, 456, 789), - 'filters' => array(array('method' => 'implode', 'args' => array(',', '@value'))) - )) - ) - )); - $command = new OperationCommand(array(), $operation); - $command->setClient(new MockClient()); - - return $command; - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/BodyVisitorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/BodyVisitorTest.php deleted file mode 100644 index 2a95c452a..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/BodyVisitorTest.php +++ /dev/null @@ -1,63 +0,0 @@ -getNestedCommand('body')->getParam('foo')->setSentAs('Foo'); - $visitor->visit($this->command, $this->request, $param, '123'); - $this->assertEquals('123', (string) $this->request->getBody()); - $this->assertNull($this->request->getHeader('Expect')); - } - - public function testAddsExpectHeaderWhenSetToTrue() - { - $visitor = new Visitor(); - $param = $this->getNestedCommand('body')->getParam('foo')->setSentAs('Foo'); - $param->setData('expect_header', true); - $visitor->visit($this->command, $this->request, $param, '123'); - $this->assertEquals('123', (string) $this->request->getBody()); - } - - public function testCanDisableExpectHeader() - { - $visitor = new Visitor(); - $param = $this->getNestedCommand('body')->getParam('foo')->setSentAs('Foo'); - $param->setData('expect_header', false); - $visitor->visit($this->command, $this->request, $param, '123'); - $this->assertNull($this->request->getHeader('Expect')); - } - - public function testCanSetExpectHeaderBasedOnSize() - { - $visitor = new Visitor(); - $param = $this->getNestedCommand('body')->getParam('foo')->setSentAs('Foo'); - // The body is less than the cutoff - $param->setData('expect_header', 5); - $visitor->visit($this->command, $this->request, $param, '123'); - $this->assertNull($this->request->getHeader('Expect')); - // Now check when the body is greater than the cutoff - $param->setData('expect_header', 2); - $visitor->visit($this->command, $this->request, $param, '123'); - $this->assertEquals('100-Continue', (string) $this->request->getHeader('Expect')); - } - - public function testAddsContentEncodingWhenSetOnBody() - { - $visitor = new Visitor(); - $param = $this->getNestedCommand('body')->getParam('foo')->setSentAs('Foo'); - $body = EntityBody::factory('foo'); - $body->compress(); - $visitor->visit($this->command, $this->request, $param, $body); - $this->assertEquals('gzip', (string) $this->request->getHeader('Content-Encoding')); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/HeaderVisitorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/HeaderVisitorTest.php deleted file mode 100644 index 7ea1ae913..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/HeaderVisitorTest.php +++ /dev/null @@ -1,48 +0,0 @@ -getNestedCommand('header')->getParam('foo')->setSentAs('test'); - $param->setAdditionalProperties(new Parameter(array())); - $visitor->visit($this->command, $this->request, $param, 'test'); - } - - public function testVisitsLocation() - { - $visitor = new Visitor(); - $param = $this->getNestedCommand('header')->getParam('foo')->setSentAs('test'); - $param->setAdditionalProperties(false); - $visitor->visit($this->command, $this->request, $param, '123'); - $this->assertEquals('123', (string) $this->request->getHeader('test')); - } - - public function testVisitsMappedPrefixHeaders() - { - $visitor = new Visitor(); - $param = $this->getNestedCommand('header')->getParam('foo')->setSentAs('test'); - $param->setSentAs('x-foo-'); - $param->setAdditionalProperties(new Parameter(array( - 'type' => 'string' - ))); - $visitor->visit($this->command, $this->request, $param, array( - 'bar' => 'test', - 'baz' => '123' - )); - $this->assertEquals('test', (string) $this->request->getHeader('x-foo-bar')); - $this->assertEquals('123', (string) $this->request->getHeader('x-foo-baz')); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/JsonVisitorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/JsonVisitorTest.php deleted file mode 100644 index ea6782f53..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/JsonVisitorTest.php +++ /dev/null @@ -1,60 +0,0 @@ -after($this->command, $this->request); - - $param = $this->getNestedCommand('json')->getParam('foo'); - $visitor->visit($this->command, $this->request, $param->setSentAs('test'), '123'); - $visitor->visit($this->command, $this->request, $param->setSentAs('test2'), 'abc'); - $visitor->after($this->command, $this->request); - $this->assertEquals('{"test":"123","test2":"abc"}', (string) $this->request->getBody()); - } - - public function testAddsJsonHeader() - { - $visitor = new Visitor(); - $visitor->setContentTypeHeader('application/json-foo'); - $param = $this->getNestedCommand('json')->getParam('foo'); - $visitor->visit($this->command, $this->request, $param->setSentAs('test'), '123'); - $visitor->after($this->command, $this->request); - $this->assertEquals('application/json-foo', (string) $this->request->getHeader('Content-Type')); - } - - public function testRecursivelyBuildsJsonBodies() - { - $command = $this->getCommand('json'); - $request = $command->prepare(); - $this->assertEquals('{"Foo":{"test":{"baz":true,"Jenga_Yall!":"HELLO"},"bar":123}}', (string) $request->getBody()); - } - - public function testAppliesFiltersToAdditionalProperties() - { - $command = $this->getCommand('json'); - $command->set('foo', array('not_set' => 'abc')); - $request = $command->prepare(); - $result = json_decode($request->getBody(), true); - $this->assertEquals('ABC', $result['Foo']['not_set']); - } - - public function testAppliesFiltersToArrayItemValues() - { - $command = $this->getCommand('json'); - $command->set('arr', array('a', 'b')); - $request = $command->prepare(); - $result = json_decode($request->getBody(), true); - $this->assertEquals(array('A', 'B'), $result['arr']); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/PostFieldVisitorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/PostFieldVisitorTest.php deleted file mode 100644 index 540b41087..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/PostFieldVisitorTest.php +++ /dev/null @@ -1,33 +0,0 @@ -getNestedCommand('postField')->getParam('foo'); - $visitor->visit($this->command, $this->request, $param->setSentAs('test'), '123'); - $this->assertEquals('123', (string) $this->request->getPostField('test')); - } - - public function testRecursivelyBuildsPostFields() - { - $command = $this->getCommand('postField'); - $request = $command->prepare(); - $visitor = new Visitor(); - $param = $command->getOperation()->getParam('foo'); - $visitor->visit($command, $request, $param, $command['foo']); - $visitor->after($command, $request); - $this->assertEquals( - 'Foo[test][baz]=1&Foo[test][Jenga_Yall!]=HELLO&Foo[bar]=123', - rawurldecode((string) $request->getPostFields()) - ); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/PostFileVisitorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/PostFileVisitorTest.php deleted file mode 100644 index 21e3cec33..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/PostFileVisitorTest.php +++ /dev/null @@ -1,54 +0,0 @@ -getNestedCommand('postFile')->getParam('foo'); - - // Test using a path to a file - $visitor->visit($this->command, $this->request, $param->setSentAs('test_3'), __FILE__); - $this->assertInternalType('array', $this->request->getPostFile('test_3')); - - // Test with a PostFile - $visitor->visit($this->command, $this->request, $param->setSentAs(null), new PostFile('baz', __FILE__)); - $this->assertInternalType('array', $this->request->getPostFile('baz')); - } - - public function testVisitsLocationWithMultipleFiles() - { - $description = ServiceDescription::factory(array( - 'operations' => array( - 'DoPost' => array( - 'httpMethod' => 'POST', - 'parameters' => array( - 'foo' => array( - 'location' => 'postFile', - 'type' => array('string', 'array') - ) - ) - ) - ) - )); - $this->getServer()->flush(); - $this->getServer()->enqueue(array("HTTP/1.1 200 OK\r\nContent-Length:0\r\n\r\n")); - $client = new Client($this->getServer()->getUrl()); - $client->setDescription($description); - $command = $client->getCommand('DoPost', array('foo' => array(__FILE__, __FILE__))); - $command->execute(); - $received = $this->getServer()->getReceivedRequests(); - $this->assertContains('name="foo[0]";', $received[0]); - $this->assertContains('name="foo[1]";', $received[0]); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/QueryVisitorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/QueryVisitorTest.php deleted file mode 100644 index 607af7603..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/QueryVisitorTest.php +++ /dev/null @@ -1,48 +0,0 @@ -getNestedCommand('query')->getParam('foo')->setSentAs('test'); - $visitor->visit($this->command, $this->request, $param, '123'); - $this->assertEquals('123', $this->request->getQuery()->get('test')); - } - - /** - * @covers Guzzle\Service\Command\LocationVisitor\Request\QueryVisitor - * @covers Guzzle\Service\Command\LocationVisitor\Request\AbstractRequestVisitor::resolveRecursively - */ - public function testRecursivelyBuildsQueryStrings() - { - $command = $this->getCommand('query'); - $command->getOperation()->getParam('foo')->setSentAs('Foo'); - $request = $command->prepare(); - $this->assertEquals( - 'Foo[test][baz]=1&Foo[test][Jenga_Yall!]=HELLO&Foo[bar]=123', - rawurldecode($request->getQuery()) - ); - } - - /** - * @covers Guzzle\Service\Command\LocationVisitor\Request\AbstractRequestVisitor::resolveRecursively - */ - public function testFiltersAreAppliedToArrayParamType() - { - $command = $this->getCommandWithArrayParamAndFilters(); - $request = $command->prepare(); - $query = $request->getQuery(); - // param type 'string' - $this->assertEquals('BAR', $query->get('Foo')); - // param type 'array' - $this->assertEquals('123,456,789', $query->get('Arr')); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/ResponseBodyVisitorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/ResponseBodyVisitorTest.php deleted file mode 100644 index ff8cec599..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/ResponseBodyVisitorTest.php +++ /dev/null @@ -1,20 +0,0 @@ -getNestedCommand('response_body')->getParam('foo'); - $visitor->visit($this->command, $this->request, $param, sys_get_temp_dir() . '/foo.txt'); - $body = $this->readAttribute($this->request, 'responseBody'); - $this->assertContains('/foo.txt', $body->getUri()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/XmlVisitorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/XmlVisitorTest.php deleted file mode 100644 index beb58b00a..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Request/XmlVisitorTest.php +++ /dev/null @@ -1,558 +0,0 @@ - array( - 'xmlRoot' => array( - 'name' => 'test', - 'namespaces' => 'http://foo.com' - ) - ), - 'parameters' => array( - 'Foo' => array('location' => 'xml', 'type' => 'string'), - 'Baz' => array('location' => 'xml', 'type' => 'string') - ) - ), - array('Foo' => 'test', 'Baz' => 'bar'), - 'testbar' - ), - // Ensure that the content-type is not added - array(array('parameters' => array('Foo' => array('location' => 'xml', 'type' => 'string'))), array(), ''), - // Test with adding attributes and no namespace - array( - array( - 'data' => array( - 'xmlRoot' => array( - 'name' => 'test' - ) - ), - 'parameters' => array( - 'Foo' => array('location' => 'xml', 'type' => 'string', 'data' => array('xmlAttribute' => true)) - ) - ), - array('Foo' => 'test', 'Baz' => 'bar'), - '' - ), - // Test adding with an array - array( - array( - 'parameters' => array( - 'Foo' => array('location' => 'xml', 'type' => 'string'), - 'Baz' => array( - 'type' => 'array', - 'location' => 'xml', - 'items' => array( - 'type' => 'numeric', - 'sentAs' => 'Bar' - ) - ) - ) - ), - array('Foo' => 'test', 'Baz' => array(1, 2)), - 'test12' - ), - // Test adding an object - array( - array( - 'parameters' => array( - 'Foo' => array('location' => 'xml', 'type' => 'string'), - 'Baz' => array( - 'type' => 'object', - 'location' => 'xml', - 'properties' => array( - 'Bar' => array('type' => 'string'), - 'Bam' => array() - ) - ) - ) - ), - array('Foo' => 'test', 'Baz' => array('Bar' => 'abc', 'Bam' => 'foo')), - 'testabcfoo' - ), - // Add an array that contains an object - array( - array( - 'parameters' => array( - 'Baz' => array( - 'type' => 'array', - 'location' => 'xml', - 'items' => array( - 'type' => 'object', - 'sentAs' => 'Bar', - 'properties' => array('A' => array(), 'B' => array()) - ) - ) - ) - ), - array('Baz' => array( - array('A' => '1', 'B' => '2'), - array('A' => '3', 'B' => '4') - )), - '1234' - ), - // Add an object of attributes - array( - array( - 'parameters' => array( - 'Foo' => array('location' => 'xml', 'type' => 'string'), - 'Baz' => array( - 'type' => 'object', - 'location' => 'xml', - 'properties' => array( - 'Bar' => array('type' => 'string', 'data' => array('xmlAttribute' => true)), - 'Bam' => array() - ) - ) - ) - ), - array('Foo' => 'test', 'Baz' => array('Bar' => 'abc', 'Bam' => 'foo')), - 'testfoo' - ), - // Check order doesn't matter - array( - array( - 'parameters' => array( - 'Foo' => array('location' => 'xml', 'type' => 'string'), - 'Baz' => array( - 'type' => 'object', - 'location' => 'xml', - 'properties' => array( - 'Bar' => array('type' => 'string', 'data' => array('xmlAttribute' => true)), - 'Bam' => array() - ) - ) - ) - ), - array('Foo' => 'test', 'Baz' => array('Bam' => 'foo', 'Bar' => 'abc')), - 'testfoo' - ), - // Add values with custom namespaces - array( - array( - 'parameters' => array( - 'Foo' => array( - 'location' => 'xml', - 'type' => 'string', - 'data' => array( - 'xmlNamespace' => 'http://foo.com' - ) - ) - ) - ), - array('Foo' => 'test'), - 'test' - ), - // Add attributes with custom namespace prefix - array( - array( - 'parameters' => array( - 'Wrap' => array( - 'type' => 'object', - 'location' => 'xml', - 'properties' => array( - 'Foo' => array( - 'type' => 'string', - 'sentAs' => 'xsi:baz', - 'data' => array( - 'xmlNamespace' => 'http://foo.com', - 'xmlAttribute' => true - ) - ) - ) - ), - ) - ), - array('Wrap' => array( - 'Foo' => 'test' - )), - '' - ), - // Add nodes with custom namespace prefix - array( - array( - 'parameters' => array( - 'Wrap' => array( - 'type' => 'object', - 'location' => 'xml', - 'properties' => array( - 'Foo' => array( - 'type' => 'string', - 'sentAs' => 'xsi:Foo', - 'data' => array( - 'xmlNamespace' => 'http://foobar.com' - ) - ) - ) - ), - ) - ), - array('Wrap' => array( - 'Foo' => 'test' - )), - 'test' - ), - array( - array( - 'parameters' => array( - 'Foo' => array( - 'location' => 'xml', - 'type' => 'string', - 'data' => array( - 'xmlNamespace' => 'http://foo.com' - ) - ) - ) - ), - array('Foo' => '

    This is a title

    '), - 'This is a title]]>' - ), - // Flat array at top level - array( - array( - 'parameters' => array( - 'Bars' => array( - 'type' => 'array', - 'data' => array('xmlFlattened' => true), - 'location' => 'xml', - 'items' => array( - 'type' => 'object', - 'sentAs' => 'Bar', - 'properties' => array( - 'A' => array(), - 'B' => array() - ) - ) - ), - 'Boos' => array( - 'type' => 'array', - 'data' => array('xmlFlattened' => true), - 'location' => 'xml', - 'items' => array( - 'sentAs' => 'Boo', - 'type' => 'string' - ) - ) - ) - ), - array( - 'Bars' => array( - array('A' => '1', 'B' => '2'), - array('A' => '3', 'B' => '4') - ), - 'Boos' => array('test', '123') - ), - '1234test123' - ), - // Nested flat arrays - array( - array( - 'parameters' => array( - 'Delete' => array( - 'type' => 'object', - 'location' => 'xml', - 'properties' => array( - 'Items' => array( - 'type' => 'array', - 'data' => array('xmlFlattened' => true), - 'items' => array( - 'type' => 'object', - 'sentAs' => 'Item', - 'properties' => array( - 'A' => array(), - 'B' => array() - ) - ) - ) - ) - ) - ) - ), - array( - 'Delete' => array( - 'Items' => array( - array('A' => '1', 'B' => '2'), - array('A' => '3', 'B' => '4') - ) - ) - ), - '1234' - ) - ); - } - - /** - * @dataProvider xmlProvider - */ - public function testSerializesXml(array $operation, array $input, $xml) - { - $operation = new Operation($operation); - $command = $this->getMockBuilder('Guzzle\Service\Command\OperationCommand') - ->setConstructorArgs(array($input, $operation)) - ->getMockForAbstractClass(); - $command->setClient(new Client('http://www.test.com/some/path.php')); - $request = $command->prepare(); - if (!empty($input)) { - $this->assertEquals('application/xml', (string) $request->getHeader('Content-Type')); - } else { - $this->assertNull($request->getHeader('Content-Type')); - } - $body = str_replace(array("\n", ""), '', (string) $request->getBody()); - $this->assertEquals($xml, $body); - } - - public function testAddsContentTypeAndTopLevelValues() - { - $operation = new Operation(array( - 'data' => array( - 'xmlRoot' => array( - 'name' => 'test', - 'namespaces' => array( - 'xsi' => 'http://foo.com' - ) - ) - ), - 'parameters' => array( - 'Foo' => array('location' => 'xml', 'type' => 'string'), - 'Baz' => array('location' => 'xml', 'type' => 'string') - ) - )); - - $command = $this->getMockBuilder('Guzzle\Service\Command\OperationCommand') - ->setConstructorArgs(array(array( - 'Foo' => 'test', - 'Baz' => 'bar' - ), $operation)) - ->getMockForAbstractClass(); - - $command->setClient(new Client()); - $request = $command->prepare(); - $this->assertEquals('application/xml', (string) $request->getHeader('Content-Type')); - $this->assertEquals( - '' . "\n" - . 'testbar' . "\n", - (string) $request->getBody() - ); - } - - public function testCanChangeContentType() - { - $visitor = new XmlVisitor(); - $visitor->setContentTypeHeader('application/foo'); - $this->assertEquals('application/foo', $this->readAttribute($visitor, 'contentType')); - } - - public function testCanAddArrayOfSimpleTypes() - { - $request = new EntityEnclosingRequest('POST', 'http://foo.com'); - $visitor = new XmlVisitor(); - $param = new Parameter(array( - 'type' => 'object', - 'location' => 'xml', - 'name' => 'Out', - 'properties' => array( - 'Nodes' => array( - 'required' => true, - 'type' => 'array', - 'min' => 1, - 'items' => array('type' => 'string', 'sentAs' => 'Node') - ) - ) - )); - - $param->setParent(new Operation(array( - 'data' => array( - 'xmlRoot' => array( - 'name' => 'Test', - 'namespaces' => array( - 'https://foo/' - ) - ) - ) - ))); - - $value = array('Nodes' => array('foo', 'baz')); - $this->assertTrue($this->validator->validate($param, $value)); - $visitor->visit($this->command, $request, $param, $value); - $visitor->after($this->command, $request); - - $this->assertEquals( - "\n" - . "foobaz\n", - (string) $request->getBody() - ); - } - - public function testCanAddMultipleNamespacesToRoot() - { - $operation = new Operation(array( - 'data' => array( - 'xmlRoot' => array( - 'name' => 'Hi', - 'namespaces' => array( - 'xsi' => 'http://foo.com', - 'foo' => 'http://foobar.com' - ) - ) - ), - 'parameters' => array( - 'Foo' => array('location' => 'xml', 'type' => 'string') - ) - )); - - $command = $this->getMockBuilder('Guzzle\Service\Command\OperationCommand') - ->setConstructorArgs(array(array( - 'Foo' => 'test' - ), $operation)) - ->getMockForAbstractClass(); - - $command->setClient(new Client()); - $request = $command->prepare(); - $this->assertEquals('application/xml', (string) $request->getHeader('Content-Type')); - $this->assertEquals( - '' . "\n" - . 'test' . "\n", - (string) $request->getBody() - ); - } - - public function testValuesAreFiltered() - { - $operation = new Operation(array( - 'parameters' => array( - 'Foo' => array( - 'location' => 'xml', - 'type' => 'string', - 'filters' => array('strtoupper') - ), - 'Bar' => array( - 'location' => 'xml', - 'type' => 'object', - 'properties' => array( - 'Baz' => array( - 'filters' => array('strtoupper') - ) - ) - ) - ) - )); - - $command = $this->getMockBuilder('Guzzle\Service\Command\OperationCommand') - ->setConstructorArgs(array(array( - 'Foo' => 'test', - 'Bar' => array( - 'Baz' => 'abc' - ) - ), $operation)) - ->getMockForAbstractClass(); - - $command->setClient(new Client()); - $request = $command->prepare(); - $this->assertEquals( - '' . "\n" - . 'TESTABC' . "\n", - (string) $request->getBody() - ); - } - - public function testSkipsNullValues() - { - $operation = new Operation(array( - 'parameters' => array( - 'Foo' => array( - 'location' => 'xml', - 'type' => 'string' - ), - 'Bar' => array( - 'location' => 'xml', - 'type' => 'object', - 'properties' => array( - 'Baz' => array(), - 'Bam' => array(), - ) - ), - 'Arr' => array( - 'type' => 'array', - 'items' => array( - 'type' => 'string' - ) - ) - ) - )); - - $command = $this->getMockBuilder('Guzzle\Service\Command\OperationCommand') - ->setConstructorArgs(array(array( - 'Foo' => null, - 'Bar' => array( - 'Bar' => null, - 'Bam' => 'test' - ), - 'Arr' => array(null) - ), $operation)) - ->getMockForAbstractClass(); - - $command->setClient(new Client()); - $request = $command->prepare(); - $this->assertEquals( - '' . "\n" - . 'test' . "\n", - (string) $request->getBody() - ); - } - - public function testAllowsXmlEncoding() - { - $operation = new Operation(array( - 'data' => array( - 'xmlEncoding' => 'UTF-8' - ), - 'parameters' => array( - 'Foo' => array('location' => 'xml') - ) - )); - $command = $this->getMockBuilder('Guzzle\Service\Command\OperationCommand') - ->setConstructorArgs(array(array('Foo' => 'test'), $operation)) - ->getMockForAbstractClass(); - $command->setClient(new Client()); - $request = $command->prepare(); - $this->assertEquals( - '' . "\n" - . 'test' . "\n", - (string) $request->getBody() - ); - } - - public function testAllowsSendingXmlPayloadIfNoXmlParamsWereSet() - { - $operation = new Operation(array( - 'httpMethod' => 'POST', - 'data' => array('xmlAllowEmpty' => true), - 'parameters' => array('Foo' => array('location' => 'xml')) - )); - $command = $this->getMockBuilder('Guzzle\Service\Command\OperationCommand') - ->setConstructorArgs(array(array(), $operation)) - ->getMockForAbstractClass(); - $command->setClient(new Client('http://foo.com')); - $request = $command->prepare(); - $this->assertEquals( - '' . "\n" - . '' . "\n", - (string) $request->getBody() - ); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/AbstractResponseVisitorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/AbstractResponseVisitorTest.php deleted file mode 100644 index 7b8600342..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/AbstractResponseVisitorTest.php +++ /dev/null @@ -1,29 +0,0 @@ -value = array(); - $this->command = new MockCommand(); - $this->response = new Response(200, array( - 'X-Foo' => 'bar', - 'Content-Length' => 3, - 'Content-Type' => 'text/plain' - ), 'Foo'); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/BodyVisitorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/BodyVisitorTest.php deleted file mode 100644 index 932e39bff..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/BodyVisitorTest.php +++ /dev/null @@ -1,21 +0,0 @@ - 'body', 'name' => 'foo')); - $visitor->visit($this->command, $this->response, $param, $this->value); - $this->assertEquals('Foo', (string) $this->value['foo']); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/HeaderVisitorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/HeaderVisitorTest.php deleted file mode 100644 index db54b1abb..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/HeaderVisitorTest.php +++ /dev/null @@ -1,98 +0,0 @@ - 'header', - 'name' => 'ContentType', - 'sentAs' => 'Content-Type' - )); - $visitor->visit($this->command, $this->response, $param, $this->value); - $this->assertEquals('text/plain', $this->value['ContentType']); - } - - public function testVisitsLocationWithFilters() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'location' => 'header', - 'name' => 'Content-Type', - 'filters' => array('strtoupper') - )); - $visitor->visit($this->command, $this->response, $param, $this->value); - $this->assertEquals('TEXT/PLAIN', $this->value['Content-Type']); - } - - public function testVisitsMappedPrefixHeaders() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'location' => 'header', - 'name' => 'Metadata', - 'sentAs' => 'X-Baz-', - 'type' => 'object', - 'additionalProperties' => array( - 'type' => 'string' - ) - )); - $response = new Response(200, array( - 'X-Baz-Test' => 'ABC', - 'X-Baz-Bar' => array('123', '456'), - 'Content-Length' => 3 - ), 'Foo'); - $visitor->visit($this->command, $response, $param, $this->value); - $this->assertEquals(array( - 'Metadata' => array( - 'Test' => 'ABC', - 'Bar' => array('123', '456') - ) - ), $this->value); - } - - /** - * @group issue-399 - * @link https://github.com/guzzle/guzzle/issues/399 - */ - public function testDiscardingUnknownHeaders() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'location' => 'header', - 'name' => 'Content-Type', - 'additionalParameters' => false - )); - $visitor->visit($this->command, $this->response, $param, $this->value); - $this->assertEquals('text/plain', $this->value['Content-Type']); - $this->assertArrayNotHasKey('X-Foo', $this->value); - } - - /** - * @group issue-399 - * @link https://github.com/guzzle/guzzle/issues/399 - */ - public function testDiscardingUnknownPropertiesWithAliasing() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'location' => 'header', - 'name' => 'ContentType', - 'sentAs' => 'Content-Type', - 'additionalParameters' => false - )); - $visitor->visit($this->command, $this->response, $param, $this->value); - $this->assertEquals('text/plain', $this->value['ContentType']); - $this->assertArrayNotHasKey('X-Foo', $this->value); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/JsonVisitorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/JsonVisitorTest.php deleted file mode 100644 index 4f8d30b1e..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/JsonVisitorTest.php +++ /dev/null @@ -1,157 +0,0 @@ -getMockBuilder('Guzzle\Service\Command\AbstractCommand') - ->setMethods(array('getResponse')) - ->getMockForAbstractClass(); - $command->expects($this->once()) - ->method('getResponse') - ->will($this->returnValue(new Response(200, null, '{"foo":"bar"}'))); - $result = array(); - $visitor->before($command, $result); - $this->assertEquals(array('foo' => 'bar'), $result); - } - - public function testVisitsLocation() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'name' => 'foo', - 'type' => 'array', - 'items' => array( - 'filters' => 'strtoupper', - 'type' => 'string' - ) - )); - $this->value = array('foo' => array('a', 'b', 'c')); - $visitor->visit($this->command, $this->response, $param, $this->value); - $this->assertEquals(array('A', 'B', 'C'), $this->value['foo']); - } - - public function testRenamesTopLevelValues() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'name' => 'foo', - 'sentAs' => 'Baz', - 'type' => 'string', - )); - $this->value = array('Baz' => 'test'); - $visitor->visit($this->command, $this->response, $param, $this->value); - $this->assertEquals(array('foo' => 'test'), $this->value); - } - - public function testRenamesDoesNotFailForNonExistentKey() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'name' => 'foo', - 'type' => 'object', - 'properties' => array( - 'bar' => array( - 'name' => 'bar', - 'sentAs' => 'baz', - ), - ), - )); - $this->value = array('foo' => array('unknown' => 'Unknown')); - $visitor->visit($this->command, $this->response, $param, $this->value); - $this->assertEquals(array('foo' => array('unknown' => 'Unknown')), $this->value); - } - - public function testTraversesObjectsAndAppliesFilters() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'name' => 'foo', - 'type' => 'object', - 'properties' => array( - 'foo' => array('filters' => 'strtoupper'), - 'bar' => array('filters' => 'strtolower') - ) - )); - $this->value = array('foo' => array('foo' => 'hello', 'bar' => 'THERE')); - $visitor->visit($this->command, $this->response, $param, $this->value); - $this->assertEquals(array('foo' => 'HELLO', 'bar' => 'there'), $this->value['foo']); - } - - /** - * @group issue-399 - * @link https://github.com/guzzle/guzzle/issues/399 - */ - public function testDiscardingUnknownProperties() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'name' => 'foo', - 'type' => 'object', - 'additionalProperties' => false, - 'properties' => array( - 'bar' => array( - 'type' => 'string', - 'name' => 'bar', - ), - ), - )); - $this->value = array('foo' => array('bar' => 15, 'unknown' => 'Unknown')); - $visitor->visit($this->command, $this->response, $param, $this->value); - $this->assertEquals(array('foo' => array('bar' => 15)), $this->value); - } - - /** - * @group issue-399 - * @link https://github.com/guzzle/guzzle/issues/399 - */ - public function testDiscardingUnknownPropertiesWithAliasing() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'name' => 'foo', - 'type' => 'object', - 'additionalProperties' => false, - 'properties' => array( - 'bar' => array( - 'name' => 'bar', - 'sentAs' => 'baz', - ), - ), - )); - $this->value = array('foo' => array('baz' => 15, 'unknown' => 'Unknown')); - $visitor->visit($this->command, $this->response, $param, $this->value); - $this->assertEquals(array('foo' => array('bar' => 15)), $this->value); - } - - public function testWalksAdditionalProperties() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'name' => 'foo', - 'type' => 'object', - 'additionalProperties' => array( - 'type' => 'object', - 'properties' => array( - 'bar' => array( - 'type' => 'string', - 'filters' => array('base64_decode') - ) - ), - ), - )); - $this->value = array('foo' => array('baz' => array('bar' => 'Zm9v'))); - $visitor->visit($this->command, $this->response, $param, $this->value); - $this->assertEquals('foo', $this->value['foo']['baz']['bar']); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/ReasonPhraseVisitorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/ReasonPhraseVisitorTest.php deleted file mode 100644 index 23cd40fed..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/ReasonPhraseVisitorTest.php +++ /dev/null @@ -1,21 +0,0 @@ - 'reasonPhrase', 'name' => 'phrase')); - $visitor->visit($this->command, $this->response, $param, $this->value); - $this->assertEquals('OK', $this->value['phrase']); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/StatusCodeVisitorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/StatusCodeVisitorTest.php deleted file mode 100644 index 7211a5801..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/StatusCodeVisitorTest.php +++ /dev/null @@ -1,21 +0,0 @@ - 'statusCode', 'name' => 'code')); - $visitor->visit($this->command, $this->response, $param, $this->value); - $this->assertEquals(200, $this->value['code']); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/XmlVisitorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/XmlVisitorTest.php deleted file mode 100644 index f87cec7cd..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/Response/XmlVisitorTest.php +++ /dev/null @@ -1,431 +0,0 @@ -getMockBuilder('Guzzle\Service\Command\AbstractCommand') - ->setMethods(array('getResponse')) - ->getMockForAbstractClass(); - $command->expects($this->once()) - ->method('getResponse') - ->will($this->returnValue(new Response(200, null, 'test'))); - $result = array(); - $visitor->before($command, $result); - $this->assertEquals(array('Bar' => 'test'), $result); - } - - public function testBeforeMethodParsesXmlWithNamespace() - { - $this->markTestSkipped("Response/XmlVisitor cannot accept 'xmlns' in response, see #368 (http://git.io/USa1mA)."); - - $visitor = new Visitor(); - $command = $this->getMockBuilder('Guzzle\Service\Command\AbstractCommand') - ->setMethods(array('getResponse')) - ->getMockForAbstractClass(); - $command->expects($this->once()) - ->method('getResponse') - ->will($this->returnValue(new Response(200, null, 'test'))); - $result = array(); - $visitor->before($command, $result); - $this->assertEquals(array('Bar' => 'test'), $result); - } - - public function testBeforeMethodParsesNestedXml() - { - $visitor = new Visitor(); - $command = $this->getMockBuilder('Guzzle\Service\Command\AbstractCommand') - ->setMethods(array('getResponse')) - ->getMockForAbstractClass(); - $command->expects($this->once()) - ->method('getResponse') - ->will($this->returnValue(new Response(200, null, 'test'))); - $result = array(); - $visitor->before($command, $result); - $this->assertEquals(array('Items' => array('Bar' => 'test')), $result); - } - - public function testCanExtractAndRenameTopLevelXmlValues() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'location' => 'xml', - 'name' => 'foo', - 'sentAs' => 'Bar' - )); - $value = array('Bar' => 'test'); - $visitor->visit($this->command, $this->response, $param, $value); - $this->assertArrayHasKey('foo', $value); - $this->assertEquals('test', $value['foo']); - } - - public function testEnsuresRepeatedArraysAreInCorrectLocations() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'location' => 'xml', - 'name' => 'foo', - 'sentAs' => 'Foo', - 'type' => 'array', - 'items' => array( - 'type' => 'object', - 'properties' => array( - 'Bar' => array('type' => 'string'), - 'Baz' => array('type' => 'string'), - 'Bam' => array('type' => 'string') - ) - ) - )); - - $xml = new \SimpleXMLElement('12'); - $value = json_decode(json_encode($xml), true); - $visitor->visit($this->command, $this->response, $param, $value); - $this->assertEquals(array( - 'foo' => array( - array ( - 'Bar' => '1', - 'Baz' => '2' - ) - ) - ), $value); - } - - public function testEnsuresFlatArraysAreFlat() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'location' => 'xml', - 'name' => 'foo', - 'type' => 'array', - 'items' => array('type' => 'string') - )); - - $value = array('foo' => array('bar', 'baz')); - $visitor->visit($this->command, $this->response, $param, $value); - $this->assertEquals(array('foo' => array('bar', 'baz')), $value); - - $value = array('foo' => 'bar'); - $visitor->visit($this->command, $this->response, $param, $value); - $this->assertEquals(array('foo' => array('bar')), $value); - } - - public function xmlDataProvider() - { - $param = new Parameter(array( - 'location' => 'xml', - 'name' => 'Items', - 'type' => 'array', - 'items' => array( - 'type' => 'object', - 'name' => 'Item', - 'properties' => array( - 'Bar' => array('type' => 'string'), - 'Baz' => array('type' => 'string') - ) - ) - )); - - return array( - array($param, '12', array( - 'Items' => array( - array('Bar' => 1), - array('Bar' => 2) - ) - )), - array($param, '1', array( - 'Items' => array( - array('Bar' => 1) - ) - )), - array($param, '', array( - 'Items' => array() - )) - ); - } - - /** - * @dataProvider xmlDataProvider - */ - public function testEnsuresWrappedArraysAreInCorrectLocations($param, $xml, $result) - { - $visitor = new Visitor(); - $xml = new \SimpleXMLElement($xml); - $value = json_decode(json_encode($xml), true); - $visitor->visit($this->command, $this->response, $param, $value); - $this->assertEquals($result, $value); - } - - public function testCanRenameValues() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'name' => 'TerminatingInstances', - 'type' => 'array', - 'location' => 'xml', - 'sentAs' => 'instancesSet', - 'items' => array( - 'name' => 'item', - 'type' => 'object', - 'sentAs' => 'item', - 'properties' => array( - 'InstanceId' => array( - 'type' => 'string', - 'sentAs' => 'instanceId', - ), - 'CurrentState' => array( - 'type' => 'object', - 'sentAs' => 'currentState', - 'properties' => array( - 'Code' => array( - 'type' => 'numeric', - 'sentAs' => 'code', - ), - 'Name' => array( - 'type' => 'string', - 'sentAs' => 'name', - ), - ), - ), - 'PreviousState' => array( - 'type' => 'object', - 'sentAs' => 'previousState', - 'properties' => array( - 'Code' => array( - 'type' => 'numeric', - 'sentAs' => 'code', - ), - 'Name' => array( - 'type' => 'string', - 'sentAs' => 'name', - ), - ), - ), - ), - ) - )); - - $value = array( - 'instancesSet' => array ( - 'item' => array ( - 'instanceId' => 'i-3ea74257', - 'currentState' => array( - 'code' => '32', - 'name' => 'shutting-down', - ), - 'previousState' => array( - 'code' => '16', - 'name' => 'running', - ), - ), - ) - ); - - $visitor->visit($this->command, $this->response, $param, $value); - - $this->assertEquals(array( - 'TerminatingInstances' => array( - array( - 'InstanceId' => 'i-3ea74257', - 'CurrentState' => array( - 'Code' => '32', - 'Name' => 'shutting-down', - ), - 'PreviousState' => array( - 'Code' => '16', - 'Name' => 'running', - ) - ) - ) - ), $value); - } - - public function testCanRenameAttributes() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'name' => 'RunningQueues', - 'type' => 'array', - 'location' => 'xml', - 'items' => array( - 'type' => 'object', - 'sentAs' => 'item', - 'properties' => array( - 'QueueId' => array( - 'type' => 'string', - 'sentAs' => 'queue_id', - 'data' => array( - 'xmlAttribute' => true, - ), - ), - 'CurrentState' => array( - 'type' => 'object', - 'properties' => array( - 'Code' => array( - 'type' => 'numeric', - 'sentAs' => 'code', - 'data' => array( - 'xmlAttribute' => true, - ), - ), - 'Name' => array( - 'sentAs' => 'name', - 'data' => array( - 'xmlAttribute' => true, - ), - ), - ), - ), - 'PreviousState' => array( - 'type' => 'object', - 'properties' => array( - 'Code' => array( - 'type' => 'numeric', - 'sentAs' => 'code', - 'data' => array( - 'xmlAttribute' => true, - ), - ), - 'Name' => array( - 'sentAs' => 'name', - 'data' => array( - 'xmlAttribute' => true, - ), - ), - ), - ), - ), - ) - )); - - $xml = ''; - $value = json_decode(json_encode(new \SimpleXMLElement($xml)), true); - $visitor->visit($this->command, $this->response, $param, $value); - - $this->assertEquals(array( - 'RunningQueues' => array( - array( - 'QueueId' => 'q-3ea74257', - 'CurrentState' => array( - 'Code' => '32', - 'Name' => 'processing', - ), - 'PreviousState' => array( - 'Code' => '16', - 'Name' => 'wait', - ), - ), - ) - ), $value); - } - - public function testAddsEmptyArraysWhenValueIsMissing() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'name' => 'Foo', - 'type' => 'array', - 'location' => 'xml', - 'items' => array( - 'type' => 'object', - 'properties' => array( - 'Baz' => array('type' => 'array'), - 'Bar' => array( - 'type' => 'object', - 'properties' => array( - 'Baz' => array('type' => 'array'), - ) - ) - ) - ) - )); - - $value = array(); - $visitor->visit($this->command, $this->response, $param, $value); - - $value = array( - 'Foo' => array( - 'Bar' => array() - ) - ); - $visitor->visit($this->command, $this->response, $param, $value); - $this->assertEquals(array( - 'Foo' => array( - array( - 'Bar' => array() - ) - ) - ), $value); - } - - /** - * @group issue-399 - * @link https://github.com/guzzle/guzzle/issues/399 - */ - public function testDiscardingUnknownProperties() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'name' => 'foo', - 'type' => 'object', - 'additionalProperties' => false, - 'properties' => array( - 'bar' => array( - 'type' => 'string', - 'name' => 'bar', - ), - ), - )); - $this->value = array('foo' => array('bar' => 15, 'unknown' => 'Unknown')); - $visitor->visit($this->command, $this->response, $param, $this->value); - $this->assertEquals(array('foo' => array('bar' => 15)), $this->value); - } - - /** - * @group issue-399 - * @link https://github.com/guzzle/guzzle/issues/399 - */ - public function testDiscardingUnknownPropertiesWithAliasing() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'name' => 'foo', - 'type' => 'object', - 'additionalProperties' => false, - 'properties' => array( - 'bar' => array( - 'name' => 'bar', - 'sentAs' => 'baz', - ), - ), - )); - $this->value = array('foo' => array('baz' => 15, 'unknown' => 'Unknown')); - $visitor->visit($this->command, $this->response, $param, $this->value); - $this->assertEquals(array('foo' => array('bar' => 15)), $this->value); - } - - public function testProperlyHandlesEmptyStringValues() - { - $visitor = new Visitor(); - $param = new Parameter(array( - 'name' => 'foo', - 'type' => 'object', - 'properties' => array( - 'bar' => array('type' => 'string') - ), - )); - $xml = ''; - $value = json_decode(json_encode(new \SimpleXMLElement($xml)), true); - $visitor->visit($this->command, $this->response, $param, $value); - $this->assertEquals(array('foo' => array('bar' => '')), $value); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/VisitorFlyweightTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/VisitorFlyweightTest.php deleted file mode 100644 index a252ffe60..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/LocationVisitor/VisitorFlyweightTest.php +++ /dev/null @@ -1,53 +0,0 @@ -assertInstanceOf('Guzzle\Service\Command\LocationVisitor\Request\JsonVisitor', $f->getRequestVisitor('json')); - $this->assertInstanceOf('Guzzle\Service\Command\LocationVisitor\Response\JsonVisitor', $f->getResponseVisitor('json')); - } - - public function testCanUseCustomMappings() - { - $f = new VisitorFlyweight(array()); - $this->assertEquals(array(), $this->readAttribute($f, 'mappings')); - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage No request visitor has been mapped for foo - */ - public function testThrowsExceptionWhenRetrievingUnknownVisitor() - { - VisitorFlyweight::getInstance()->getRequestVisitor('foo'); - } - - public function testCachesVisitors() - { - $f = new VisitorFlyweight(); - $v1 = $f->getRequestVisitor('json'); - $this->assertSame($v1, $f->getRequestVisitor('json')); - } - - public function testAllowsAddingVisitors() - { - $f = new VisitorFlyweight(); - $j1 = new JsonRequestVisitor(); - $j2 = new JsonResponseVisitor(); - $f->addRequestVisitor('json', $j1); - $f->addResponseVisitor('json', $j2); - $this->assertSame($j1, $f->getRequestVisitor('json')); - $this->assertSame($j2, $f->getResponseVisitor('json')); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/OperationCommandTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/OperationCommandTest.php deleted file mode 100644 index 95fb533af..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/OperationCommandTest.php +++ /dev/null @@ -1,102 +0,0 @@ -getRequestSerializer(); - $b = new DefaultRequestSerializer(VisitorFlyweight::getInstance()); - $operation->setRequestSerializer($b); - $this->assertNotSame($a, $operation->getRequestSerializer()); - } - - public function testPreparesRequestUsingSerializer() - { - $op = new OperationCommand(array(), new Operation()); - $op->setClient(new Client()); - $s = $this->getMockBuilder('Guzzle\Service\Command\RequestSerializerInterface') - ->setMethods(array('prepare')) - ->getMockForAbstractClass(); - $s->expects($this->once()) - ->method('prepare') - ->will($this->returnValue(new EntityEnclosingRequest('POST', 'http://foo.com'))); - $op->setRequestSerializer($s); - $op->prepare(); - } - - public function testParsesResponsesWithResponseParser() - { - $op = new OperationCommand(array(), new Operation()); - $p = $this->getMockBuilder('Guzzle\Service\Command\ResponseParserInterface') - ->setMethods(array('parse')) - ->getMockForAbstractClass(); - $p->expects($this->once()) - ->method('parse') - ->will($this->returnValue(array('foo' => 'bar'))); - $op->setResponseParser($p); - $op->setClient(new Client()); - $request = $op->prepare(); - $request->setResponse(new Response(200), true); - $this->assertEquals(array('foo' => 'bar'), $op->execute()); - } - - public function testParsesResponsesUsingModelParserWhenMatchingModelIsFound() - { - $description = ServiceDescription::factory(array( - 'operations' => array( - 'foo' => array('responseClass' => 'bar', 'responseType' => 'model') - ), - 'models' => array( - 'bar' => array( - 'type' => 'object', - 'properties' => array( - 'Baz' => array('type' => 'string', 'location' => 'xml') - ) - ) - ) - )); - - $op = new OperationCommand(array(), $description->getOperation('foo')); - $op->setClient(new Client()); - $request = $op->prepare(); - $request->setResponse(new Response(200, array( - 'Content-Type' => 'application/xml' - ), 'Bar'), true); - $result = $op->execute(); - $this->assertEquals(new Model(array('Baz' => 'Bar')), $result); - } - - public function testAllowsRawResponses() - { - $description = new ServiceDescription(array( - 'operations' => array('foo' => array('responseClass' => 'bar', 'responseType' => 'model')), - 'models' => array('bar' => array()) - )); - $op = new OperationCommand(array( - OperationCommand::RESPONSE_PROCESSING => OperationCommand::TYPE_RAW - ), $description->getOperation('foo')); - $op->setClient(new Client()); - $request = $op->prepare(); - $response = new Response(200, array( - 'Content-Type' => 'application/xml' - ), 'Bar'); - $request->setResponse($response, true); - $this->assertSame($response, $op->execute()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/OperationResponseParserTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/OperationResponseParserTest.php deleted file mode 100644 index 69ba1fcea..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Command/OperationResponseParserTest.php +++ /dev/null @@ -1,335 +0,0 @@ -addVisitor('foo', $visitor); - $this->assertSame($visitor, $this->readAttribute($p, 'factory')->getResponseVisitor('foo')); - } - - public function testUsesParentParser() - { - $p = new OperationResponseParser(new VisitorFlyweight()); - $operation = new Operation(); - $operation->setServiceDescription(new ServiceDescription()); - $op = new OperationCommand(array(), $operation); - $op->setResponseParser($p)->setClient(new Client()); - $op->prepare()->setResponse(new Response(200, array('Content-Type' => 'application/xml'), 'C'), true); - $this->assertInstanceOf('SimpleXMLElement', $op->execute()); - } - - public function testVisitsLocations() - { - $parser = new OperationResponseParser(new VisitorFlyweight(array())); - $parser->addVisitor('statusCode', new StatusCodeVisitor()); - $parser->addVisitor('reasonPhrase', new ReasonPhraseVisitor()); - $parser->addVisitor('json', new JsonVisitor()); - $op = new OperationCommand(array(), $this->getDescription()->getOperation('test')); - $op->setResponseParser($parser)->setClient(new Client()); - $op->prepare()->setResponse(new Response(201), true); - $result = $op->execute(); - $this->assertEquals(201, $result['code']); - $this->assertEquals('Created', $result['phrase']); - } - - public function testVisitsLocationsForJsonResponse() - { - $parser = OperationResponseParser::getInstance(); - $operation = $this->getDescription()->getOperation('test'); - $op = new OperationCommand(array(), $operation); - $op->setResponseParser($parser)->setClient(new Client()); - $op->prepare()->setResponse(new Response(200, array( - 'Content-Type' => 'application/json' - ), '{"baz":"bar","enigma":"123"}'), true); - $result = $op->execute(); - $this->assertEquals(array( - 'baz' => 'bar', - 'enigma' => '123', - 'code' => 200, - 'phrase' => 'OK' - ), $result->toArray()); - } - - public function testSkipsUnkownModels() - { - $parser = OperationResponseParser::getInstance(); - $operation = $this->getDescription()->getOperation('test'); - $operation->setResponseClass('Baz')->setResponseType('model'); - $op = new OperationCommand(array(), $operation); - $op->setResponseParser($parser)->setClient(new Client()); - $op->prepare()->setResponse(new Response(201), true); - $this->assertInstanceOf('Guzzle\Http\Message\Response', $op->execute()); - } - - public function testAllowsModelProcessingToBeDisabled() - { - $parser = OperationResponseParser::getInstance(); - $operation = $this->getDescription()->getOperation('test'); - $op = new OperationCommand(array('command.response_processing' => 'native'), $operation); - $op->setResponseParser($parser)->setClient(new Client()); - $op->prepare()->setResponse(new Response(200, array( - 'Content-Type' => 'application/json' - ), '{"baz":"bar","enigma":"123"}'), true); - $result = $op->execute(); - $this->assertInstanceOf('Guzzle\Service\Resource\Model', $result); - $this->assertEquals(array( - 'baz' => 'bar', - 'enigma' => '123' - ), $result->toArray()); - } - - public function testCanInjectModelSchemaIntoModels() - { - $parser = new OperationResponseParser(VisitorFlyweight::getInstance(), true); - $desc = $this->getDescription(); - $operation = $desc->getOperation('test'); - $op = new OperationCommand(array(), $operation); - $op->setResponseParser($parser)->setClient(new Client()); - $op->prepare()->setResponse(new Response(200, array( - 'Content-Type' => 'application/json' - ), '{"baz":"bar","enigma":"123"}'), true); - $result = $op->execute(); - $this->assertSame($result->getStructure(), $desc->getModel('Foo')); - } - - public function testDoesNotParseXmlWhenNotUsingXmlVisitor() - { - $parser = OperationResponseParser::getInstance(); - $description = ServiceDescription::factory(array( - 'operations' => array('test' => array('responseClass' => 'Foo')), - 'models' => array( - 'Foo' => array( - 'type' => 'object', - 'properties' => array('baz' => array('location' => 'body')) - ) - ) - )); - $operation = $description->getOperation('test'); - $op = new OperationCommand(array(), $operation); - $op->setResponseParser($parser)->setClient(new Client()); - $brokenXml = '<><><>>>>'; - $op->prepare()->setResponse(new Response(200, array( - 'Content-Type' => 'application/xml' - ), $brokenXml), true); - $result = $op->execute(); - $this->assertEquals(array('baz'), $result->getKeys()); - $this->assertEquals($brokenXml, (string) $result['baz']); - } - - public function testVisitsAdditionalProperties() - { - $parser = OperationResponseParser::getInstance(); - $description = ServiceDescription::factory(array( - 'operations' => array('test' => array('responseClass' => 'Foo')), - 'models' => array( - 'Foo' => array( - 'type' => 'object', - 'properties' => array( - 'code' => array('location' => 'statusCode') - ), - 'additionalProperties' => array( - 'location' => 'json', - 'type' => 'object', - 'properties' => array( - 'a' => array( - 'type' => 'string', - 'filters' => 'strtoupper' - ) - ) - ) - ) - ) - )); - - $operation = $description->getOperation('test'); - $op = new OperationCommand(array(), $operation); - $op->setResponseParser($parser)->setClient(new Client()); - $json = '[{"a":"test"},{"a":"baz"}]'; - $op->prepare()->setResponse(new Response(200, array('Content-Type' => 'application/json'), $json), true); - $result = $op->execute()->toArray(); - $this->assertEquals(array( - 'code' => 200, - array('a' => 'TEST'), - array('a' => 'BAZ') - ), $result); - } - - /** - * @group issue-399 - * @link https://github.com/guzzle/guzzle/issues/399 - */ - public function testAdditionalPropertiesDisabledDiscardsData() - { - $parser = OperationResponseParser::getInstance(); - $description = ServiceDescription::factory(array( - 'operations' => array('test' => array('responseClass' => 'Foo')), - 'models' => array( - 'Foo' => array( - 'type' => 'object', - 'additionalProperties' => false, - 'properties' => array( - 'name' => array( - 'location' => 'json', - 'type' => 'string', - ), - 'nested' => array( - 'location' => 'json', - 'type' => 'object', - 'additionalProperties' => false, - 'properties' => array( - 'width' => array( - 'type' => 'integer' - ) - ), - ), - 'code' => array('location' => 'statusCode') - ), - - ) - ) - )); - - $operation = $description->getOperation('test'); - $op = new OperationCommand(array(), $operation); - $op->setResponseParser($parser)->setClient(new Client()); - $json = '{"name":"test", "volume":2.0, "nested":{"width":10,"bogus":1}}'; - $op->prepare()->setResponse(new Response(200, array('Content-Type' => 'application/json'), $json), true); - $result = $op->execute()->toArray(); - $this->assertEquals(array( - 'name' => 'test', - 'nested' => array( - 'width' => 10, - ), - 'code' => 200 - ), $result); - } - - public function testCreatesCustomResponseClassInterface() - { - $parser = OperationResponseParser::getInstance(); - $description = ServiceDescription::factory(array( - 'operations' => array('test' => array('responseClass' => 'Guzzle\Tests\Mock\CustomResponseModel')) - )); - $operation = $description->getOperation('test'); - $op = new OperationCommand(array(), $operation); - $op->setResponseParser($parser)->setClient(new Client()); - $op->prepare()->setResponse(new Response(200, array('Content-Type' => 'application/json'), 'hi!'), true); - $result = $op->execute(); - $this->assertInstanceOf('Guzzle\Tests\Mock\CustomResponseModel', $result); - $this->assertSame($op, $result->command); - } - - /** - * @expectedException \Guzzle\Service\Exception\ResponseClassException - * @expectedExceptionMessage must exist - */ - public function testEnsuresResponseClassExists() - { - $parser = OperationResponseParser::getInstance(); - $description = ServiceDescription::factory(array( - 'operations' => array('test' => array('responseClass' => 'Foo\Baz\Bar')) - )); - $operation = $description->getOperation('test'); - $op = new OperationCommand(array(), $operation); - $op->setResponseParser($parser)->setClient(new Client()); - $op->prepare()->setResponse(new Response(200, array('Content-Type' => 'application/json'), 'hi!'), true); - $op->execute(); - } - - /** - * @expectedException \Guzzle\Service\Exception\ResponseClassException - * @expectedExceptionMessage and implement - */ - public function testEnsuresResponseClassImplementsResponseClassInterface() - { - $parser = OperationResponseParser::getInstance(); - $description = ServiceDescription::factory(array( - 'operations' => array('test' => array('responseClass' => __CLASS__)) - )); - $operation = $description->getOperation('test'); - $op = new OperationCommand(array(), $operation); - $op->setResponseParser($parser)->setClient(new Client()); - $op->prepare()->setResponse(new Response(200, array('Content-Type' => 'application/json'), 'hi!'), true); - $op->execute(); - } - - protected function getDescription() - { - return ServiceDescription::factory(array( - 'operations' => array('test' => array('responseClass' => 'Foo')), - 'models' => array( - 'Foo' => array( - 'type' => 'object', - 'properties' => array( - 'baz' => array('type' => 'string', 'location' => 'json'), - 'code' => array('location' => 'statusCode'), - 'phrase' => array('location' => 'reasonPhrase'), - ) - ) - ) - )); - } - - public function testCanAddListenerToParseDomainObjects() - { - $client = new Client(); - $client->setDescription(ServiceDescription::factory(array( - 'operations' => array('test' => array('responseClass' => 'FooBazBar')) - ))); - $foo = new \stdClass(); - $client->getEventDispatcher()->addListener('command.parse_response', function ($e) use ($foo) { - $e['result'] = $foo; - }); - $command = $client->getCommand('test'); - $command->prepare()->setResponse(new Response(200), true); - $result = $command->execute(); - $this->assertSame($result, $foo); - } - - /** - * @group issue-399 - * @link https://github.com/guzzle/guzzle/issues/501 - */ - public function testAdditionalPropertiesWithRefAreResolved() - { - $parser = OperationResponseParser::getInstance(); - $description = ServiceDescription::factory(array( - 'operations' => array('test' => array('responseClass' => 'Foo')), - 'models' => array( - 'Baz' => array('type' => 'string'), - 'Foo' => array( - 'type' => 'object', - 'additionalProperties' => array('$ref' => 'Baz', 'location' => 'json') - ) - ) - )); - $operation = $description->getOperation('test'); - $op = new OperationCommand(array(), $operation); - $op->setResponseParser($parser)->setClient(new Client()); - $json = '{"a":"a","b":"b","c":"c"}'; - $op->prepare()->setResponse(new Response(200, array('Content-Type' => 'application/json'), $json), true); - $result = $op->execute()->toArray(); - $this->assertEquals(array('a' => 'a', 'b' => 'b', 'c' => 'c'), $result); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Description/OperationTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Description/OperationTest.php deleted file mode 100644 index ae33b6925..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Description/OperationTest.php +++ /dev/null @@ -1,308 +0,0 @@ - 'test', - 'summary' => 'doc', - 'notes' => 'notes', - 'documentationUrl' => 'http://www.example.com', - 'httpMethod' => 'POST', - 'uri' => '/api/v1', - 'responseClass' => 'array', - 'responseNotes' => 'returns the json_decoded response', - 'deprecated' => true, - 'parameters' => array( - 'key' => array( - 'required' => true, - 'type' => 'string', - 'maxLength' => 10 - ), - 'key_2' => array( - 'required' => true, - 'type' => 'integer', - 'default' => 10 - ) - ) - )); - - $this->assertEquals('test', $c->getName()); - $this->assertEquals('doc', $c->getSummary()); - $this->assertEquals('http://www.example.com', $c->getDocumentationUrl()); - $this->assertEquals('POST', $c->getHttpMethod()); - $this->assertEquals('/api/v1', $c->getUri()); - $this->assertEquals('array', $c->getResponseClass()); - $this->assertEquals('returns the json_decoded response', $c->getResponseNotes()); - $this->assertTrue($c->getDeprecated()); - $this->assertEquals('Guzzle\\Service\\Command\\OperationCommand', $c->getClass()); - $this->assertEquals(array( - 'key' => new Parameter(array( - 'name' => 'key', - 'required' => true, - 'type' => 'string', - 'maxLength' => 10, - 'parent' => $c - )), - 'key_2' => new Parameter(array( - 'name' => 'key_2', - 'required' => true, - 'type' => 'integer', - 'default' => 10, - 'parent' => $c - )) - ), $c->getParams()); - - $this->assertEquals(new Parameter(array( - 'name' => 'key_2', - 'required' => true, - 'type' => 'integer', - 'default' => 10, - 'parent' => $c - )), $c->getParam('key_2')); - - $this->assertNull($c->getParam('afefwef')); - $this->assertArrayNotHasKey('parent', $c->getParam('key_2')->toArray()); - } - - public function testAllowsConcreteCommands() - { - $c = new Operation(array( - 'name' => 'test', - 'class' => 'Guzzle\\Service\\Command\ClosureCommand', - 'parameters' => array( - 'p' => new Parameter(array( - 'name' => 'foo' - )) - ) - )); - $this->assertEquals('Guzzle\\Service\\Command\ClosureCommand', $c->getClass()); - } - - public function testConvertsToArray() - { - $data = array( - 'name' => 'test', - 'class' => 'Guzzle\\Service\\Command\ClosureCommand', - 'summary' => 'test', - 'documentationUrl' => 'http://www.example.com', - 'httpMethod' => 'PUT', - 'uri' => '/', - 'parameters' => array('p' => array('name' => 'foo')) - ); - $c = new Operation($data); - $toArray = $c->toArray(); - unset($data['name']); - $this->assertArrayHasKey('parameters', $toArray); - $this->assertInternalType('array', $toArray['parameters']); - - // Normalize the array - unset($data['parameters']); - unset($toArray['parameters']); - - $data['responseType'] = 'primitive'; - $data['responseClass'] = 'array'; - $this->assertEquals($data, $toArray); - } - - public function testDeterminesIfHasParam() - { - $command = $this->getTestCommand(); - $this->assertTrue($command->hasParam('data')); - $this->assertFalse($command->hasParam('baz')); - } - - public function testReturnsParamNames() - { - $command = $this->getTestCommand(); - $this->assertEquals(array('data'), $command->getParamNames()); - } - - protected function getTestCommand() - { - return new Operation(array( - 'parameters' => array( - 'data' => new Parameter(array( - 'type' => 'string' - )) - ) - )); - } - - public function testCanBuildUpCommands() - { - $c = new Operation(array()); - $c->setName('foo') - ->setClass('Baz') - ->setDeprecated(false) - ->setSummary('summary') - ->setDocumentationUrl('http://www.foo.com') - ->setHttpMethod('PUT') - ->setResponseNotes('oh') - ->setResponseClass('string') - ->setUri('/foo/bar') - ->addParam(new Parameter(array( - 'name' => 'test' - ))); - - $this->assertEquals('foo', $c->getName()); - $this->assertEquals('Baz', $c->getClass()); - $this->assertEquals(false, $c->getDeprecated()); - $this->assertEquals('summary', $c->getSummary()); - $this->assertEquals('http://www.foo.com', $c->getDocumentationUrl()); - $this->assertEquals('PUT', $c->getHttpMethod()); - $this->assertEquals('oh', $c->getResponseNotes()); - $this->assertEquals('string', $c->getResponseClass()); - $this->assertEquals('/foo/bar', $c->getUri()); - $this->assertEquals(array('test'), $c->getParamNames()); - } - - public function testCanRemoveParams() - { - $c = new Operation(array()); - $c->addParam(new Parameter(array('name' => 'foo'))); - $this->assertTrue($c->hasParam('foo')); - $c->removeParam('foo'); - $this->assertFalse($c->hasParam('foo')); - } - - public function testAddsNameToParametersIfNeeded() - { - $command = new Operation(array('parameters' => array('foo' => new Parameter(array())))); - $this->assertEquals('foo', $command->getParam('foo')->getName()); - } - - public function testContainsApiErrorInformation() - { - $command = $this->getOperation(); - $this->assertEquals(1, count($command->getErrorResponses())); - $arr = $command->toArray(); - $this->assertEquals(1, count($arr['errorResponses'])); - $command->addErrorResponse(400, 'Foo', 'Baz\\Bar'); - $this->assertEquals(2, count($command->getErrorResponses())); - $command->setErrorResponses(array()); - $this->assertEquals(0, count($command->getErrorResponses())); - } - - public function testHasNotes() - { - $o = new Operation(array('notes' => 'foo')); - $this->assertEquals('foo', $o->getNotes()); - $o->setNotes('bar'); - $this->assertEquals('bar', $o->getNotes()); - } - - public function testHasData() - { - $o = new Operation(array('data' => array('foo' => 'baz', 'bar' => 123))); - $o->setData('test', false); - $this->assertEquals('baz', $o->getData('foo')); - $this->assertEquals(123, $o->getData('bar')); - $this->assertNull($o->getData('wfefwe')); - $this->assertEquals(array( - 'parameters' => array(), - 'class' => 'Guzzle\Service\Command\OperationCommand', - 'data' => array('foo' => 'baz', 'bar' => 123, 'test' => false), - 'responseClass' => 'array', - 'responseType' => 'primitive' - ), $o->toArray()); - } - - public function testHasServiceDescription() - { - $s = new ServiceDescription(); - $o = new Operation(array(), $s); - $this->assertSame($s, $o->getServiceDescription()); - } - - /** - * @expectedException Guzzle\Common\Exception\InvalidArgumentException - */ - public function testValidatesResponseType() - { - $o = new Operation(array('responseClass' => 'array', 'responseType' => 'foo')); - } - - public function testInfersResponseType() - { - $o = $this->getOperation(); - $o->setServiceDescription(new ServiceDescription(array('models' => array('Foo' => array())))); - $this->assertEquals('primitive', $o->getResponseType()); - $this->assertEquals('primitive', $o->setResponseClass('boolean')->getResponseType()); - $this->assertEquals('primitive', $o->setResponseClass('array')->getResponseType()); - $this->assertEquals('primitive', $o->setResponseClass('integer')->getResponseType()); - $this->assertEquals('primitive', $o->setResponseClass('string')->getResponseType()); - $this->assertEquals('class', $o->setResponseClass('foo')->getResponseType()); - $this->assertEquals('class', $o->setResponseClass(__CLASS__)->getResponseType()); - $this->assertEquals('model', $o->setResponseClass('Foo')->getResponseType()); - } - - public function testHasResponseType() - { - // infers in the constructor - $o = new Operation(array('responseClass' => 'array')); - $this->assertEquals('primitive', $o->getResponseType()); - // Infers when set - $o = new Operation(); - $this->assertEquals('primitive', $o->getResponseType()); - $this->assertEquals('model', $o->setResponseType('model')->getResponseType()); - } - - public function testHasAdditionalParameters() - { - $o = new Operation(array( - 'additionalParameters' => array( - 'type' => 'string', 'name' => 'binks' - ), - 'parameters' => array( - 'foo' => array('type' => 'integer') - ) - )); - $this->assertEquals('string', $o->getAdditionalParameters()->getType()); - $arr = $o->toArray(); - $this->assertEquals(array( - 'type' => 'string' - ), $arr['additionalParameters']); - } - - /** - * @return Operation - */ - protected function getOperation() - { - return new Operation(array( - 'name' => 'OperationTest', - 'class' => get_class($this), - 'parameters' => array( - 'test' => array('type' => 'object'), - 'bool_1' => array('default' => true, 'type' => 'boolean'), - 'bool_2' => array('default' => false), - 'float' => array('type' => 'numeric'), - 'int' => array('type' => 'integer'), - 'date' => array('type' => 'string'), - 'timestamp' => array('type' => 'string'), - 'string' => array('type' => 'string'), - 'username' => array('type' => 'string', 'required' => true, 'filters' => 'strtolower'), - 'test_function' => array('type' => 'string', 'filters' => __CLASS__ . '::strtoupper') - ), - 'errorResponses' => array( - array('code' => 503, 'reason' => 'InsufficientCapacity', 'class' => 'Guzzle\\Exception\\RuntimeException') - ) - )); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Description/ParameterTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Description/ParameterTest.php deleted file mode 100644 index b9c162aae..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Description/ParameterTest.php +++ /dev/null @@ -1,411 +0,0 @@ - 'foo', - 'type' => 'bar', - 'required' => true, - 'default' => '123', - 'description' => '456', - 'minLength' => 2, - 'maxLength' => 5, - 'location' => 'body', - 'static' => 'static!', - 'filters' => array('trim', 'json_encode') - ); - - public function testCreatesParamFromArray() - { - $p = new Parameter($this->data); - $this->assertEquals('foo', $p->getName()); - $this->assertEquals('bar', $p->getType()); - $this->assertEquals(true, $p->getRequired()); - $this->assertEquals('123', $p->getDefault()); - $this->assertEquals('456', $p->getDescription()); - $this->assertEquals(2, $p->getMinLength()); - $this->assertEquals(5, $p->getMaxLength()); - $this->assertEquals('body', $p->getLocation()); - $this->assertEquals('static!', $p->getStatic()); - $this->assertEquals(array('trim', 'json_encode'), $p->getFilters()); - } - - public function testCanConvertToArray() - { - $p = new Parameter($this->data); - unset($this->data['name']); - $this->assertEquals($this->data, $p->toArray()); - } - - public function testUsesStatic() - { - $d = $this->data; - $d['default'] = 'booboo'; - $d['static'] = true; - $p = new Parameter($d); - $this->assertEquals('booboo', $p->getValue('bar')); - } - - public function testUsesDefault() - { - $d = $this->data; - $d['default'] = 'foo'; - $d['static'] = null; - $p = new Parameter($d); - $this->assertEquals('foo', $p->getValue(null)); - } - - public function testReturnsYourValue() - { - $d = $this->data; - $d['static'] = null; - $p = new Parameter($d); - $this->assertEquals('foo', $p->getValue('foo')); - } - - public function testZeroValueDoesNotCauseDefaultToBeReturned() - { - $d = $this->data; - $d['default'] = '1'; - $d['static'] = null; - $p = new Parameter($d); - $this->assertEquals('0', $p->getValue('0')); - } - - public function testFiltersValues() - { - $d = $this->data; - $d['static'] = null; - $d['filters'] = 'strtoupper'; - $p = new Parameter($d); - $this->assertEquals('FOO', $p->filter('foo')); - } - - public function testConvertsBooleans() - { - $p = new Parameter(array('type' => 'boolean')); - $this->assertEquals(true, $p->filter('true')); - $this->assertEquals(false, $p->filter('false')); - } - - public function testUsesArrayByDefaultForFilters() - { - $d = $this->data; - $d['filters'] = null; - $p = new Parameter($d); - $this->assertEquals(array(), $p->getFilters()); - } - - public function testAllowsSimpleLocationValue() - { - $p = new Parameter(array('name' => 'myname', 'location' => 'foo', 'sentAs' => 'Hello')); - $this->assertEquals('foo', $p->getLocation()); - $this->assertEquals('Hello', $p->getSentAs()); - } - - public function testParsesTypeValues() - { - $p = new Parameter(array('type' => 'foo')); - $this->assertEquals('foo', $p->getType()); - } - - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage A [method] value must be specified for each complex filter - */ - public function testValidatesComplexFilters() - { - $p = new Parameter(array('filters' => array(array('args' => 'foo')))); - } - - public function testCanBuildUpParams() - { - $p = new Parameter(array()); - $p->setName('foo') - ->setDescription('c') - ->setFilters(array('d')) - ->setLocation('e') - ->setSentAs('f') - ->setMaxLength(1) - ->setMinLength(1) - ->setMinimum(2) - ->setMaximum(2) - ->setMinItems(3) - ->setMaxItems(3) - ->setRequired(true) - ->setStatic(true) - ->setDefault('h') - ->setType('i'); - - $p->addFilter('foo'); - - $this->assertEquals('foo', $p->getName()); - $this->assertEquals('h', $p->getDefault()); - $this->assertEquals('c', $p->getDescription()); - $this->assertEquals(array('d', 'foo'), $p->getFilters()); - $this->assertEquals('e', $p->getLocation()); - $this->assertEquals('f', $p->getSentAs()); - $this->assertEquals(1, $p->getMaxLength()); - $this->assertEquals(1, $p->getMinLength()); - $this->assertEquals(2, $p->getMaximum()); - $this->assertEquals(2, $p->getMinimum()); - $this->assertEquals(3, $p->getMaxItems()); - $this->assertEquals(3, $p->getMinItems()); - $this->assertEquals(true, $p->getRequired()); - $this->assertEquals(true, $p->getStatic()); - $this->assertEquals('i', $p->getType()); - } - - public function testAllowsNestedShape() - { - $command = $this->getServiceBuilder()->get('mock')->getCommand('mock_command')->getOperation(); - $param = new Parameter(array( - 'parent' => $command, - 'name' => 'foo', - 'type' => 'object', - 'location' => 'query', - 'properties' => array( - 'foo' => array( - 'type' => 'object', - 'required' => true, - 'properties' => array( - 'baz' => array( - 'name' => 'baz', - 'type' => 'bool', - ) - ) - ), - 'bar' => array( - 'name' => 'bar', - 'default' => '123' - ) - ) - )); - - $this->assertSame($command, $param->getParent()); - $this->assertNotEmpty($param->getProperties()); - $this->assertInstanceOf('Guzzle\Service\Description\Parameter', $param->getProperty('foo')); - $this->assertSame($param, $param->getProperty('foo')->getParent()); - $this->assertSame($param->getProperty('foo'), $param->getProperty('foo')->getProperty('baz')->getParent()); - $this->assertInstanceOf('Guzzle\Service\Description\Parameter', $param->getProperty('bar')); - $this->assertSame($param, $param->getProperty('bar')->getParent()); - - $array = $param->toArray(); - $this->assertInternalType('array', $array['properties']); - $this->assertArrayHasKey('foo', $array['properties']); - $this->assertArrayHasKey('bar', $array['properties']); - } - - public function testAllowsComplexFilters() - { - $that = $this; - $param = new Parameter(array()); - $param->setFilters(array(array('method' => function ($a, $b, $c, $d) use ($that, $param) { - $that->assertEquals('test', $a); - $that->assertEquals('my_value!', $b); - $that->assertEquals('bar', $c); - $that->assertSame($param, $d); - return 'abc' . $b; - }, 'args' => array('test', '@value', 'bar', '@api')))); - $this->assertEquals('abcmy_value!', $param->filter('my_value!')); - } - - public function testCanChangeParentOfNestedParameter() - { - $param1 = new Parameter(array('name' => 'parent')); - $param2 = new Parameter(array('name' => 'child')); - $param2->setParent($param1); - $this->assertSame($param1, $param2->getParent()); - } - - public function testCanRemoveFromNestedStructure() - { - $param1 = new Parameter(array('name' => 'parent')); - $param2 = new Parameter(array('name' => 'child')); - $param1->addProperty($param2); - $this->assertSame($param1, $param2->getParent()); - $this->assertSame($param2, $param1->getProperty('child')); - - // Remove a single child from the structure - $param1->removeProperty('child'); - $this->assertNull($param1->getProperty('child')); - // Remove the entire structure - $param1->addProperty($param2); - $param1->removeProperty('child'); - $this->assertNull($param1->getProperty('child')); - } - - public function testAddsAdditionalProperties() - { - $p = new Parameter(array( - 'type' => 'object', - 'additionalProperties' => array('type' => 'string') - )); - $this->assertInstanceOf('Guzzle\Service\Description\Parameter', $p->getAdditionalProperties()); - $this->assertNull($p->getAdditionalProperties()->getAdditionalProperties()); - $p = new Parameter(array('type' => 'object')); - $this->assertTrue($p->getAdditionalProperties()); - } - - public function testAddsItems() - { - $p = new Parameter(array( - 'type' => 'array', - 'items' => array('type' => 'string') - )); - $this->assertInstanceOf('Guzzle\Service\Description\Parameter', $p->getItems()); - $out = $p->toArray(); - $this->assertEquals('array', $out['type']); - $this->assertInternalType('array', $out['items']); - } - - public function testHasExtraProperties() - { - $p = new Parameter(); - $this->assertEquals(array(), $p->getData()); - $p->setData(array('foo' => 'bar')); - $this->assertEquals('bar', $p->getData('foo')); - $p->setData('baz', 'boo'); - $this->assertEquals(array('foo' => 'bar', 'baz' => 'boo'), $p->getData()); - } - - public function testCanRetrieveKnownPropertiesUsingDataMethod() - { - $p = new Parameter(); - $this->assertEquals(null, $p->getData('foo')); - $p->setName('test'); - $this->assertEquals('test', $p->getData('name')); - } - - public function testHasInstanceOf() - { - $p = new Parameter(); - $this->assertNull($p->getInstanceOf()); - $p->setInstanceOf('Foo'); - $this->assertEquals('Foo', $p->getInstanceOf()); - } - - public function testHasPattern() - { - $p = new Parameter(); - $this->assertNull($p->getPattern()); - $p->setPattern('/[0-9]+/'); - $this->assertEquals('/[0-9]+/', $p->getPattern()); - } - - public function testHasEnum() - { - $p = new Parameter(); - $this->assertNull($p->getEnum()); - $p->setEnum(array('foo', 'bar')); - $this->assertEquals(array('foo', 'bar'), $p->getEnum()); - } - - public function testSerializesItems() - { - $p = new Parameter(array( - 'type' => 'object', - 'additionalProperties' => array('type' => 'string') - )); - $this->assertEquals(array( - 'type' => 'object', - 'additionalProperties' => array('type' => 'string') - ), $p->toArray()); - } - - public function testResolvesRefKeysRecursively() - { - $description = new ServiceDescription(array( - 'models' => array( - 'JarJar' => array('type' => 'string', 'default' => 'Mesa address tha senate!'), - 'Anakin' => array('type' => 'array', 'items' => array('$ref' => 'JarJar')) - ) - )); - $p = new Parameter(array('$ref' => 'Anakin', 'description' => 'added'), $description); - $this->assertEquals(array( - 'type' => 'array', - 'items' => array('type' => 'string', 'default' => 'Mesa address tha senate!'), - 'description' => 'added' - ), $p->toArray()); - } - - public function testResolvesExtendsRecursively() - { - $jarJar = array('type' => 'string', 'default' => 'Mesa address tha senate!', 'description' => 'a'); - $anakin = array('type' => 'array', 'items' => array('extends' => 'JarJar', 'description' => 'b')); - $description = new ServiceDescription(array( - 'models' => array('JarJar' => $jarJar, 'Anakin' => $anakin) - )); - // Description attribute will be updated, and format added - $p = new Parameter(array('extends' => 'Anakin', 'format' => 'date'), $description); - $this->assertEquals(array( - 'type' => 'array', - 'format' => 'date', - 'items' => array( - 'type' => 'string', - 'default' => 'Mesa address tha senate!', - 'description' => 'b' - ) - ), $p->toArray()); - } - - public function testHasKeyMethod() - { - $p = new Parameter(array('name' => 'foo', 'sentAs' => 'bar')); - $this->assertEquals('bar', $p->getWireName()); - $p->setSentAs(null); - $this->assertEquals('foo', $p->getWireName()); - } - - public function testIncludesNameInToArrayWhenItemsAttributeHasName() - { - $p = new Parameter(array( - 'type' => 'array', - 'name' => 'Abc', - 'items' => array( - 'name' => 'Foo', - 'type' => 'object' - ) - )); - $result = $p->toArray(); - $this->assertEquals(array( - 'type' => 'array', - 'items' => array( - 'name' => 'Foo', - 'type' => 'object', - 'additionalProperties' => true - ) - ), $result); - } - - public function dateTimeProvider() - { - $d = 'October 13, 2012 16:15:46 UTC'; - - return array( - array($d, 'date-time', '2012-10-13T16:15:46Z'), - array($d, 'date', '2012-10-13'), - array($d, 'timestamp', strtotime($d)), - array(new \DateTime($d), 'timestamp', strtotime($d)) - ); - } - - /** - * @dataProvider dateTimeProvider - */ - public function testAppliesFormat($d, $format, $result) - { - $p = new Parameter(); - $p->setFormat($format); - $this->assertEquals($format, $p->getFormat()); - $this->assertEquals($result, $p->filter($d)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Description/SchemaFormatterTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Description/SchemaFormatterTest.php deleted file mode 100644 index eb3619bea..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Description/SchemaFormatterTest.php +++ /dev/null @@ -1,61 +0,0 @@ -assertEquals($result, SchemaFormatter::format($format, $value)); - } - - /** - * @expectedException \Guzzle\Common\Exception\InvalidArgumentException - */ - public function testValidatesDateTimeInput() - { - SchemaFormatter::format('date-time', false); - } - - public function testEnsuresTimestampsAreIntegers() - { - $t = time(); - $result = SchemaFormatter::format('timestamp', $t); - $this->assertSame($t, $result); - $this->assertInternalType('int', $result); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Description/SchemaValidatorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Description/SchemaValidatorTest.php deleted file mode 100644 index 4d6cc8728..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Description/SchemaValidatorTest.php +++ /dev/null @@ -1,326 +0,0 @@ -validator = new SchemaValidator(); - } - - public function testValidatesArrayListsAreNumericallyIndexed() - { - $value = array(array(1)); - $this->assertFalse($this->validator->validate($this->getComplexParam(), $value)); - $this->assertEquals( - array('[Foo][0] must be an array of properties. Got a numerically indexed array.'), - $this->validator->getErrors() - ); - } - - public function testValidatesArrayListsContainProperItems() - { - $value = array(true); - $this->assertFalse($this->validator->validate($this->getComplexParam(), $value)); - $this->assertEquals( - array('[Foo][0] must be of type object'), - $this->validator->getErrors() - ); - } - - public function testAddsDefaultValuesInLists() - { - $value = array(array()); - $this->assertTrue($this->validator->validate($this->getComplexParam(), $value)); - $this->assertEquals(array(array('Bar' => true)), $value); - } - - public function testMergesDefaultValuesInLists() - { - $value = array( - array('Baz' => 'hello!'), - array('Bar' => false) - ); - $this->assertTrue($this->validator->validate($this->getComplexParam(), $value)); - $this->assertEquals(array( - array( - 'Baz' => 'hello!', - 'Bar' => true - ), - array('Bar' => false) - ), $value); - } - - public function testCorrectlyConvertsParametersToArrayWhenArraysArePresent() - { - $param = $this->getComplexParam(); - $result = $param->toArray(); - $this->assertInternalType('array', $result['items']); - $this->assertEquals('array', $result['type']); - $this->assertInstanceOf('Guzzle\Service\Description\Parameter', $param->getItems()); - } - - public function testAllowsInstanceOf() - { - $p = new Parameter(array( - 'name' => 'foo', - 'type' => 'object', - 'instanceOf' => get_class($this) - )); - $this->assertTrue($this->validator->validate($p, $this)); - $this->assertFalse($this->validator->validate($p, $p)); - $this->assertEquals(array('[foo] must be an instance of ' . __CLASS__), $this->validator->getErrors()); - } - - public function testEnforcesInstanceOfOnlyWhenObject() - { - $p = new Parameter(array( - 'name' => 'foo', - 'type' => array('object', 'string'), - 'instanceOf' => get_class($this) - )); - $this->assertTrue($this->validator->validate($p, $this)); - $s = 'test'; - $this->assertTrue($this->validator->validate($p, $s)); - } - - public function testConvertsObjectsToArraysWhenToArrayInterface() - { - $o = $this->getMockBuilder('Guzzle\Common\ToArrayInterface') - ->setMethods(array('toArray')) - ->getMockForAbstractClass(); - $o->expects($this->once()) - ->method('toArray') - ->will($this->returnValue(array( - 'foo' => 'bar' - ))); - $p = new Parameter(array( - 'name' => 'test', - 'type' => 'object', - 'properties' => array( - 'foo' => array('required' => 'true') - ) - )); - $this->assertTrue($this->validator->validate($p, $o)); - } - - public function testMergesValidationErrorsInPropertiesWithParent() - { - $p = new Parameter(array( - 'name' => 'foo', - 'type' => 'object', - 'properties' => array( - 'bar' => array('type' => 'string', 'required' => true, 'description' => 'This is what it does'), - 'test' => array('type' => 'string', 'minLength' => 2, 'maxLength' => 5), - 'test2' => array('type' => 'string', 'minLength' => 2, 'maxLength' => 2), - 'test3' => array('type' => 'integer', 'minimum' => 100), - 'test4' => array('type' => 'integer', 'maximum' => 10), - 'test5' => array('type' => 'array', 'maxItems' => 2), - 'test6' => array('type' => 'string', 'enum' => array('a', 'bc')), - 'test7' => array('type' => 'string', 'pattern' => '/[0-9]+/'), - 'test8' => array('type' => 'number'), - 'baz' => array( - 'type' => 'array', - 'minItems' => 2, - 'required' => true, - "items" => array("type" => "string") - ) - ) - )); - - $value = array( - 'test' => 'a', - 'test2' => 'abc', - 'baz' => array(false), - 'test3' => 10, - 'test4' => 100, - 'test5' => array(1, 3, 4), - 'test6' => 'Foo', - 'test7' => 'abc', - 'test8' => 'abc' - ); - - $this->assertFalse($this->validator->validate($p, $value)); - $this->assertEquals(array ( - '[foo][bar] is a required string: This is what it does', - '[foo][baz] must contain 2 or more elements', - '[foo][baz][0] must be of type string', - '[foo][test2] length must be less than or equal to 2', - '[foo][test3] must be greater than or equal to 100', - '[foo][test4] must be less than or equal to 10', - '[foo][test5] must contain 2 or fewer elements', - '[foo][test6] must be one of "a" or "bc"', - '[foo][test7] must match the following regular expression: /[0-9]+/', - '[foo][test8] must be of type number', - '[foo][test] length must be greater than or equal to 2', - ), $this->validator->getErrors()); - } - - public function testHandlesNullValuesInArraysWithDefaults() - { - $p = new Parameter(array( - 'name' => 'foo', - 'type' => 'object', - 'required' => true, - 'properties' => array( - 'bar' => array( - 'type' => 'object', - 'required' => true, - 'properties' => array( - 'foo' => array('default' => 'hi') - ) - ) - ) - )); - $value = array(); - $this->assertTrue($this->validator->validate($p, $value)); - $this->assertEquals(array('bar' => array('foo' => 'hi')), $value); - } - - public function testFailsWhenNullValuesInArraysWithNoDefaults() - { - $p = new Parameter(array( - 'name' => 'foo', - 'type' => 'object', - 'required' => true, - 'properties' => array( - 'bar' => array( - 'type' => 'object', - 'required' => true, - 'properties' => array('foo' => array('type' => 'string')) - ) - ) - )); - $value = array(); - $this->assertFalse($this->validator->validate($p, $value)); - $this->assertEquals(array('[foo][bar] is a required object'), $this->validator->getErrors()); - } - - public function testChecksTypes() - { - $p = new SchemaValidator(); - $r = new \ReflectionMethod($p, 'determineType'); - $r->setAccessible(true); - $this->assertEquals('any', $r->invoke($p, 'any', 'hello')); - $this->assertEquals(false, $r->invoke($p, 'foo', 'foo')); - $this->assertEquals('string', $r->invoke($p, 'string', 'hello')); - $this->assertEquals(false, $r->invoke($p, 'string', false)); - $this->assertEquals('integer', $r->invoke($p, 'integer', 1)); - $this->assertEquals(false, $r->invoke($p, 'integer', 'abc')); - $this->assertEquals('numeric', $r->invoke($p, 'numeric', 1)); - $this->assertEquals('numeric', $r->invoke($p, 'numeric', '1')); - $this->assertEquals('number', $r->invoke($p, 'number', 1)); - $this->assertEquals('number', $r->invoke($p, 'number', '1')); - $this->assertEquals(false, $r->invoke($p, 'numeric', 'a')); - $this->assertEquals('boolean', $r->invoke($p, 'boolean', true)); - $this->assertEquals('boolean', $r->invoke($p, 'boolean', false)); - $this->assertEquals(false, $r->invoke($p, 'boolean', 'false')); - $this->assertEquals('null', $r->invoke($p, 'null', null)); - $this->assertEquals(false, $r->invoke($p, 'null', 'abc')); - $this->assertEquals('array', $r->invoke($p, 'array', array())); - $this->assertEquals(false, $r->invoke($p, 'array', 'foo')); - } - - public function testValidatesFalseAdditionalProperties() - { - $param = new Parameter(array( - 'name' => 'foo', - 'type' => 'object', - 'properties' => array('bar' => array('type' => 'string')), - 'additionalProperties' => false - )); - $value = array('test' => '123'); - $this->assertFalse($this->validator->validate($param, $value)); - $this->assertEquals(array('[foo][test] is not an allowed property'), $this->validator->getErrors()); - $value = array('bar' => '123'); - $this->assertTrue($this->validator->validate($param, $value)); - } - - public function testAllowsUndefinedAdditionalProperties() - { - $param = new Parameter(array( - 'name' => 'foo', - 'type' => 'object', - 'properties' => array('bar' => array('type' => 'string')) - )); - $value = array('test' => '123'); - $this->assertTrue($this->validator->validate($param, $value)); - } - - public function testValidatesAdditionalProperties() - { - $param = new Parameter(array( - 'name' => 'foo', - 'type' => 'object', - 'properties' => array('bar' => array('type' => 'string')), - 'additionalProperties' => array('type' => 'integer') - )); - $value = array('test' => 'foo'); - $this->assertFalse($this->validator->validate($param, $value)); - $this->assertEquals(array('[foo][test] must be of type integer'), $this->validator->getErrors()); - } - - public function testValidatesAdditionalPropertiesThatArrayArrays() - { - $param = new Parameter(array( - 'name' => 'foo', - 'type' => 'object', - 'additionalProperties' => array( - 'type' => 'array', - 'items' => array('type' => 'string') - ) - )); - $value = array('test' => array(true)); - $this->assertFalse($this->validator->validate($param, $value)); - $this->assertEquals(array('[foo][test][0] must be of type string'), $this->validator->getErrors()); - } - - public function testIntegersCastToStringWhenTypeMismatch() - { - $param = new Parameter(array('name' => 'test', 'type' => 'string')); - $value = 12; - $this->assertTrue($this->validator->validate($param, $value)); - $this->assertEquals('12', $value); - } - - public function testRequiredMessageIncludesType() - { - $param = new Parameter(array('name' => 'test', 'type' => array('string', 'boolean'), 'required' => true)); - $value = null; - $this->assertFalse($this->validator->validate($param, $value)); - $this->assertEquals(array('[test] is a required string or boolean'), $this->validator->getErrors()); - } - - protected function getComplexParam() - { - return new Parameter(array( - 'name' => 'Foo', - 'type' => 'array', - 'required' => true, - 'min' => 1, - 'items' => array( - 'type' => 'object', - 'properties' => array( - 'Baz' => array( - 'type' => 'string', - ), - 'Bar' => array( - 'required' => true, - 'type' => 'boolean', - 'default' => true - ) - ) - ) - )); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Description/ServiceDescriptionLoaderTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Description/ServiceDescriptionLoaderTest.php deleted file mode 100644 index bbfd1d6df..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Description/ServiceDescriptionLoaderTest.php +++ /dev/null @@ -1,177 +0,0 @@ - true, - 'baz' => array('bar'), - 'apiVersion' => '123', - 'operations' => array() - )); - - $this->assertEquals(true, $d->getData('foo')); - $this->assertEquals(array('bar'), $d->getData('baz')); - $this->assertEquals('123', $d->getApiVersion()); - } - - public function testAllowsDeepNestedInheritance() - { - $d = ServiceDescription::factory(array( - 'operations' => array( - 'abstract' => array( - 'httpMethod' => 'HEAD', - 'parameters' => array( - 'test' => array('type' => 'string', 'required' => true) - ) - ), - 'abstract2' => array('uri' => '/test', 'extends' => 'abstract'), - 'concrete' => array('extends' => 'abstract2'), - 'override' => array('extends' => 'abstract', 'httpMethod' => 'PUT'), - 'override2' => array('extends' => 'override', 'httpMethod' => 'POST', 'uri' => '/') - ) - )); - - $c = $d->getOperation('concrete'); - $this->assertEquals('/test', $c->getUri()); - $this->assertEquals('HEAD', $c->getHttpMethod()); - $params = $c->getParams(); - $param = $params['test']; - $this->assertEquals('string', $param->getType()); - $this->assertTrue($param->getRequired()); - - // Ensure that merging HTTP method does not make an array - $this->assertEquals('PUT', $d->getOperation('override')->getHttpMethod()); - $this->assertEquals('POST', $d->getOperation('override2')->getHttpMethod()); - $this->assertEquals('/', $d->getOperation('override2')->getUri()); - } - - /** - * @expectedException RuntimeException - */ - public function testThrowsExceptionWhenExtendingMissingCommand() - { - ServiceDescription::factory(array( - 'operations' => array( - 'concrete' => array( - 'extends' => 'missing' - ) - ) - )); - } - - public function testAllowsMultipleInheritance() - { - $description = ServiceDescription::factory(array( - 'operations' => array( - 'a' => array( - 'httpMethod' => 'GET', - 'parameters' => array( - 'a1' => array( - 'default' => 'foo', - 'required' => true, - 'prepend' => 'hi' - ) - ) - ), - 'b' => array( - 'extends' => 'a', - 'parameters' => array( - 'b2' => array() - ) - ), - 'c' => array( - 'parameters' => array( - 'a1' => array( - 'default' => 'bar', - 'required' => true, - 'description' => 'test' - ), - 'c3' => array() - ) - ), - 'd' => array( - 'httpMethod' => 'DELETE', - 'extends' => array('b', 'c'), - 'parameters' => array( - 'test' => array() - ) - ) - ) - )); - - $command = $description->getOperation('d'); - $this->assertEquals('DELETE', $command->getHttpMethod()); - $this->assertContains('a1', $command->getParamNames()); - $this->assertContains('b2', $command->getParamNames()); - $this->assertContains('c3', $command->getParamNames()); - $this->assertContains('test', $command->getParamNames()); - - $this->assertTrue($command->getParam('a1')->getRequired()); - $this->assertEquals('bar', $command->getParam('a1')->getDefault()); - $this->assertEquals('test', $command->getParam('a1')->getDescription()); - } - - public function testAddsOtherFields() - { - $description = ServiceDescription::factory(array( - 'operations' => array(), - 'description' => 'Foo', - 'apiVersion' => 'bar' - )); - $this->assertEquals('Foo', $description->getDescription()); - $this->assertEquals('bar', $description->getApiVersion()); - } - - public function testCanLoadNestedExtends() - { - $description = ServiceDescription::factory(array( - 'operations' => array( - 'root' => array( - 'class' => 'foo' - ), - 'foo' => array( - 'extends' => 'root', - 'parameters' => array( - 'baz' => array('type' => 'string') - ) - ), - 'foo_2' => array( - 'extends' => 'foo', - 'parameters' => array( - 'bar' => array('type' => 'string') - ) - ), - 'foo_3' => array( - 'class' => 'bar', - 'parameters' => array( - 'bar2' => array('type' => 'string') - ) - ), - 'foo_4' => array( - 'extends' => array('foo_2', 'foo_3'), - 'parameters' => array( - 'bar3' => array('type' => 'string') - ) - ) - ) - )); - - $this->assertTrue($description->hasOperation('foo_4')); - $foo4 = $description->getOperation('foo_4'); - $this->assertTrue($foo4->hasParam('baz')); - $this->assertTrue($foo4->hasParam('bar')); - $this->assertTrue($foo4->hasParam('bar2')); - $this->assertTrue($foo4->hasParam('bar3')); - $this->assertEquals('bar', $foo4->getClass()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Description/ServiceDescriptionTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Description/ServiceDescriptionTest.php deleted file mode 100644 index ff2545235..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Description/ServiceDescriptionTest.php +++ /dev/null @@ -1,240 +0,0 @@ -serviceData = array( - 'test_command' => new Operation(array( - 'name' => 'test_command', - 'description' => 'documentationForCommand', - 'httpMethod' => 'DELETE', - 'class' => 'Guzzle\\Tests\\Service\\Mock\\Command\\MockCommand', - 'parameters' => array( - 'bucket' => array('required' => true), - 'key' => array('required' => true) - ) - )) - ); - } - - /** - * @covers Guzzle\Service\Description\ServiceDescription::factory - * @covers Guzzle\Service\Description\ServiceDescriptionLoader::build - */ - public function testFactoryDelegatesToConcreteFactories() - { - $jsonFile = __DIR__ . '/../../TestData/test_service.json'; - $this->assertInstanceOf('Guzzle\Service\Description\ServiceDescription', ServiceDescription::factory($jsonFile)); - } - - public function testConstructor() - { - $service = new ServiceDescription(array('operations' => $this->serviceData)); - $this->assertEquals(1, count($service->getOperations())); - $this->assertFalse($service->hasOperation('foobar')); - $this->assertTrue($service->hasOperation('test_command')); - } - - public function testIsSerializable() - { - $service = new ServiceDescription(array('operations' => $this->serviceData)); - $data = serialize($service); - $d2 = unserialize($data); - $this->assertEquals(serialize($service), serialize($d2)); - } - - public function testSerializesParameters() - { - $service = new ServiceDescription(array( - 'operations' => array( - 'foo' => new Operation(array('parameters' => array('foo' => array('type' => 'string')))) - ) - )); - $serialized = serialize($service); - $this->assertContains('"parameters":{"foo":', $serialized); - $service = unserialize($serialized); - $this->assertTrue($service->getOperation('foo')->hasParam('foo')); - } - - public function testAllowsForJsonBasedArrayParamsFunctionalTest() - { - $description = new ServiceDescription(array( - 'operations' => array( - 'test' => new Operation(array( - 'httpMethod' => 'PUT', - 'parameters' => array( - 'data' => array( - 'required' => true, - 'filters' => 'json_encode', - 'location' => 'body' - ) - ) - )) - ) - )); - $client = new Client(); - $client->setDescription($description); - $command = $client->getCommand('test', array( - 'data' => array( - 'foo' => 'bar' - ) - )); - - $request = $command->prepare(); - $this->assertEquals('{"foo":"bar"}', (string) $request->getBody()); - } - - public function testContainsModels() - { - $d = new ServiceDescription(array( - 'operations' => array('foo' => array()), - 'models' => array( - 'Tag' => array('type' => 'object'), - 'Person' => array('type' => 'object') - ) - )); - $this->assertTrue($d->hasModel('Tag')); - $this->assertTrue($d->hasModel('Person')); - $this->assertFalse($d->hasModel('Foo')); - $this->assertInstanceOf('Guzzle\Service\Description\Parameter', $d->getModel('Tag')); - $this->assertNull($d->getModel('Foo')); - $this->assertContains('"models":{', serialize($d)); - $this->assertEquals(array('Tag', 'Person'), array_keys($d->getModels())); - } - - public function testCanAddModels() - { - $d = new ServiceDescription(array()); - $this->assertFalse($d->hasModel('Foo')); - $d->addModel(new Parameter(array('name' => 'Foo'))); - $this->assertTrue($d->hasModel('Foo')); - } - - public function testHasAttributes() - { - $d = new ServiceDescription(array( - 'operations' => array(), - 'name' => 'Name', - 'description' => 'Description', - 'apiVersion' => '1.24' - )); - - $this->assertEquals('Name', $d->getName()); - $this->assertEquals('Description', $d->getDescription()); - $this->assertEquals('1.24', $d->getApiVersion()); - - $s = serialize($d); - $this->assertContains('"name":"Name"', $s); - $this->assertContains('"description":"Description"', $s); - $this->assertContains('"apiVersion":"1.24"', $s); - - $d = unserialize($s); - $this->assertEquals('Name', $d->getName()); - $this->assertEquals('Description', $d->getDescription()); - $this->assertEquals('1.24', $d->getApiVersion()); - } - - public function testPersistsCustomAttributes() - { - $data = array( - 'operations' => array('foo' => array('class' => 'foo', 'parameters' => array())), - 'name' => 'Name', - 'description' => 'Test', - 'apiVersion' => '1.24', - 'auth' => 'foo', - 'keyParam' => 'bar' - ); - $d = new ServiceDescription($data); - $d->setData('hello', 'baz'); - $this->assertEquals('foo', $d->getData('auth')); - $this->assertEquals('baz', $d->getData('hello')); - $this->assertEquals('bar', $d->getData('keyParam')); - // responseClass and responseType are added by default - $data['operations']['foo']['responseClass'] = 'array'; - $data['operations']['foo']['responseType'] = 'primitive'; - $this->assertEquals($data + array('hello' => 'baz'), json_decode($d->serialize(), true)); - } - - public function testHasToArray() - { - $data = array( - 'operations' => array(), - 'name' => 'Name', - 'description' => 'Test' - ); - $d = new ServiceDescription($data); - $arr = $d->toArray(); - $this->assertEquals('Name', $arr['name']); - $this->assertEquals('Test', $arr['description']); - } - - public function testReturnsNullWhenRetrievingMissingOperation() - { - $s = new ServiceDescription(array()); - $this->assertNull($s->getOperation('foo')); - } - - public function testCanAddOperations() - { - $s = new ServiceDescription(array()); - $this->assertFalse($s->hasOperation('Foo')); - $s->addOperation(new Operation(array('name' => 'Foo'))); - $this->assertTrue($s->hasOperation('Foo')); - } - - /** - * @expectedException Guzzle\Common\Exception\InvalidArgumentException - */ - public function testValidatesOperationTypes() - { - $s = new ServiceDescription(array( - 'operations' => array('foo' => new \stdClass()) - )); - } - - public function testHasBaseUrl() - { - $description = new ServiceDescription(array('baseUrl' => 'http://foo.com')); - $this->assertEquals('http://foo.com', $description->getBaseUrl()); - $description->setBaseUrl('http://foobar.com'); - $this->assertEquals('http://foobar.com', $description->getBaseUrl()); - } - - public function testCanUseBasePath() - { - $description = new ServiceDescription(array('basePath' => 'http://foo.com')); - $this->assertEquals('http://foo.com', $description->getBaseUrl()); - } - - public function testModelsHaveNames() - { - $desc = array( - 'models' => array( - 'date' => array('type' => 'string'), - 'user'=> array( - 'type' => 'object', - 'properties' => array( - 'dob' => array('$ref' => 'date') - ) - ) - ) - ); - - $s = ServiceDescription::factory($desc); - $this->assertEquals('date', $s->getModel('date')->getName()); - $this->assertEquals('dob', $s->getModel('user')->getProperty('dob')->getName()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Exception/CommandTransferExceptionTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Exception/CommandTransferExceptionTest.php deleted file mode 100644 index be0d4ac8b..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Exception/CommandTransferExceptionTest.php +++ /dev/null @@ -1,66 +0,0 @@ -addSuccessfulCommand($c1)->addFailedCommand($c2); - $this->assertSame(array($c1), $e->getSuccessfulCommands()); - $this->assertSame(array($c2), $e->getFailedCommands()); - $this->assertSame(array($c1, $c2), $e->getAllCommands()); - } - - public function testConvertsMultiExceptionIntoCommandTransfer() - { - $r1 = new Request('GET', 'http://foo.com'); - $r2 = new Request('GET', 'http://foobaz.com'); - $e = new MultiTransferException('Test', 123); - $e->addSuccessfulRequest($r1)->addFailedRequest($r2); - $ce = CommandTransferException::fromMultiTransferException($e); - - $this->assertInstanceOf('Guzzle\Service\Exception\CommandTransferException', $ce); - $this->assertEquals('Test', $ce->getMessage()); - $this->assertEquals(123, $ce->getCode()); - $this->assertSame(array($r1), $ce->getSuccessfulRequests()); - $this->assertSame(array($r2), $ce->getFailedRequests()); - } - - public function testCanRetrieveExceptionForCommand() - { - $r1 = new Request('GET', 'http://foo.com'); - $e1 = new \Exception('foo'); - $c1 = $this->getMockBuilder('Guzzle\Tests\Service\Mock\Command\MockCommand') - ->setMethods(array('getRequest')) - ->getMock(); - $c1->expects($this->once())->method('getRequest')->will($this->returnValue($r1)); - - $e = new MultiTransferException('Test', 123); - $e->addFailedRequestWithException($r1, $e1); - $ce = CommandTransferException::fromMultiTransferException($e); - $ce->addFailedCommand($c1); - - $this->assertSame($e1, $ce->getExceptionForFailedCommand($c1)); - } - - public function testAddsNonRequestExceptions() - { - $e = new MultiTransferException(); - $e->add(new \Exception('bar')); - $e->addFailedRequestWithException(new Request('GET', 'http://www.foo.com'), new \Exception('foo')); - $ce = CommandTransferException::fromMultiTransferException($e); - $this->assertEquals(2, count($ce)); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Exception/InconsistentClientTransferExceptionTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Exception/InconsistentClientTransferExceptionTest.php deleted file mode 100644 index 6455295ad..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Exception/InconsistentClientTransferExceptionTest.php +++ /dev/null @@ -1,15 +0,0 @@ -assertEquals($items, $e->getCommands()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Exception/ValidationExceptionTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Exception/ValidationExceptionTest.php deleted file mode 100644 index ef789d8a9..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Exception/ValidationExceptionTest.php +++ /dev/null @@ -1,17 +0,0 @@ -setErrors($errors); - $this->assertEquals($errors, $e->getErrors()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Mock/Command/IterableCommand.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Mock/Command/IterableCommand.php deleted file mode 100644 index 4ab423e85..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Mock/Command/IterableCommand.php +++ /dev/null @@ -1,31 +0,0 @@ - 'iterable_command', - 'parameters' => array( - 'page_size' => array('type' => 'integer'), - 'next_token' => array('type' => 'string') - ) - )); - } - - protected function build() - { - $this->request = $this->client->createRequest('GET'); - - // Add the next token and page size query string values - $this->request->getQuery()->set('next_token', $this->get('next_token')); - - if ($this->get('page_size')) { - $this->request->getQuery()->set('page_size', $this->get('page_size')); - } - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Mock/Command/MockCommand.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Mock/Command/MockCommand.php deleted file mode 100644 index 831a7e795..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Mock/Command/MockCommand.php +++ /dev/null @@ -1,32 +0,0 @@ - get_called_class() == __CLASS__ ? 'mock_command' : 'sub.sub', - 'httpMethod' => 'POST', - 'parameters' => array( - 'test' => array( - 'default' => 123, - 'required' => true, - 'doc' => 'Test argument' - ), - '_internal' => array( - 'default' => 'abc' - ), - 'foo' => array('filters' => array('strtoupper')) - ) - )); - } - - protected function build() - { - $this->request = $this->client->createRequest(); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Mock/Command/OtherCommand.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Mock/Command/OtherCommand.php deleted file mode 100644 index 72ae1f6a7..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Mock/Command/OtherCommand.php +++ /dev/null @@ -1,30 +0,0 @@ - 'other_command', - 'parameters' => array( - 'test' => array( - 'default' => '123', - 'required' => true, - 'doc' => 'Test argument' - ), - 'other' => array(), - 'arg' => array('type' => 'string'), - 'static' => array('static' => true, 'default' => 'this is static') - ) - )); - } - - protected function build() - { - $this->request = $this->client->getRequest('HEAD'); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Mock/Command/Sub/Sub.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Mock/Command/Sub/Sub.php deleted file mode 100644 index d348480cf..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Mock/Command/Sub/Sub.php +++ /dev/null @@ -1,7 +0,0 @@ - '{scheme}://127.0.0.1:8124/{api_version}/{subdomain}', - 'scheme' => 'http', - 'api_version' => 'v1' - ), array('username', 'password', 'subdomain')); - - return new self($config->get('base_url'), $config); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Mock/Model/MockCommandIterator.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Mock/Model/MockCommandIterator.php deleted file mode 100644 index 8faf4123a..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Mock/Model/MockCommandIterator.php +++ /dev/null @@ -1,42 +0,0 @@ -nextToken) { - $this->command->set('next_token', $this->nextToken); - } - - $this->command->set('page_size', (int) $this->calculatePageSize()); - $this->command->execute(); - - $data = json_decode($this->command->getResponse()->getBody(true), true); - - $this->nextToken = $data['next_token']; - - return $data['resources']; - } - - public function next() - { - $this->calledNext++; - parent::next(); - } - - public function getResources() - { - return $this->resources; - } - - public function getIteratedCount() - { - return $this->iteratedCount; - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Resource/CompositeResourceIteratorFactoryTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Resource/CompositeResourceIteratorFactoryTest.php deleted file mode 100644 index 41c207372..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Resource/CompositeResourceIteratorFactoryTest.php +++ /dev/null @@ -1,37 +0,0 @@ -assertFalse($factory->canBuild($cmd)); - $factory->build($cmd); - } - - public function testBuildsResourceIterators() - { - $f1 = new ResourceIteratorClassFactory('Guzzle\Tests\Service\Mock\Model'); - $factory = new CompositeResourceIteratorFactory(array()); - $factory->addFactory($f1); - $command = new MockCommand(); - $iterator = $factory->build($command, array('client.namespace' => 'Guzzle\Tests\Service\Mock')); - $this->assertInstanceOf('Guzzle\Tests\Service\Mock\Model\MockCommandIterator', $iterator); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Resource/MapResourceIteratorFactoryTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Resource/MapResourceIteratorFactoryTest.php deleted file mode 100644 index d166e9261..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Resource/MapResourceIteratorFactoryTest.php +++ /dev/null @@ -1,40 +0,0 @@ -build(new MockCommand()); - } - - public function testBuildsResourceIterators() - { - $factory = new MapResourceIteratorFactory(array( - 'mock_command' => 'Guzzle\Tests\Service\Mock\Model\MockCommandIterator' - )); - $iterator = $factory->build(new MockCommand()); - $this->assertInstanceOf('Guzzle\Tests\Service\Mock\Model\MockCommandIterator', $iterator); - } - - public function testUsesWildcardMappings() - { - $factory = new MapResourceIteratorFactory(array( - '*' => 'Guzzle\Tests\Service\Mock\Model\MockCommandIterator' - )); - $iterator = $factory->build(new MockCommand()); - $this->assertInstanceOf('Guzzle\Tests\Service\Mock\Model\MockCommandIterator', $iterator); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Resource/ModelTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Resource/ModelTest.php deleted file mode 100644 index 7214133e5..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Resource/ModelTest.php +++ /dev/null @@ -1,65 +0,0 @@ - 'object')); - $model = new Model(array('foo' => 'bar'), $param); - $this->assertSame($param, $model->getStructure()); - $this->assertEquals('bar', $model->get('foo')); - $this->assertEquals('bar', $model['foo']); - } - - public function testCanBeUsedWithoutStructure() - { - $model = new Model(array( - 'Foo' => 'baz', - 'Bar' => array( - 'Boo' => 'Bam' - ) - )); - $transform = function ($key, $value) { - return ($value && is_array($value)) ? new Collection($value) : $value; - }; - $model = $model->map($transform); - $this->assertInstanceOf('Guzzle\Common\Collection', $model->getPath('Bar')); - } - - public function testAllowsFiltering() - { - $model = new Model(array( - 'Foo' => 'baz', - 'Bar' => 'a' - )); - $model = $model->filter(function ($i, $v) { - return $v[0] == 'a'; - }); - $this->assertEquals(array('Bar' => 'a'), $model->toArray()); - } - - public function testDoesNotIncludeEmptyStructureInString() - { - $model = new Model(array('Foo' => 'baz')); - $str = (string) $model; - $this->assertContains('Debug output of model', $str); - $this->assertNotContains('Model structure', $str); - } - - public function testDoesIncludeModelStructureInString() - { - $model = new Model(array('Foo' => 'baz'), new Parameter(array('name' => 'Foo'))); - $str = (string) $model; - $this->assertContains('Debug output of Foo model', $str); - $this->assertContains('Model structure', $str); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Resource/ResourceIteratorClassFactoryTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Resource/ResourceIteratorClassFactoryTest.php deleted file mode 100644 index 7b061b537..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Resource/ResourceIteratorClassFactoryTest.php +++ /dev/null @@ -1,41 +0,0 @@ -registerNamespace('Baz'); - $command = new MockCommand(); - $factory->build($command); - } - - public function testBuildsResourceIterators() - { - $factory = new ResourceIteratorClassFactory('Guzzle\Tests\Service\Mock\Model'); - $command = new MockCommand(); - $iterator = $factory->build($command, array('client.namespace' => 'Guzzle\Tests\Service\Mock')); - $this->assertInstanceOf('Guzzle\Tests\Service\Mock\Model\MockCommandIterator', $iterator); - } - - public function testChecksIfCanBuild() - { - $factory = new ResourceIteratorClassFactory('Guzzle\Tests\Service'); - $this->assertFalse($factory->canBuild(new MockCommand())); - $factory = new ResourceIteratorClassFactory('Guzzle\Tests\Service\Mock\Model'); - $this->assertTrue($factory->canBuild(new MockCommand())); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Resource/ResourceIteratorTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Resource/ResourceIteratorTest.php deleted file mode 100644 index 573fb6d6e..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/Resource/ResourceIteratorTest.php +++ /dev/null @@ -1,184 +0,0 @@ -assertInternalType('array', ResourceIterator::getAllEvents()); - } - - public function testConstructorConfiguresDefaults() - { - $ri = $this->getMockForAbstractClass('Guzzle\\Service\\Resource\\ResourceIterator', array( - $this->getServiceBuilder()->get('mock')->getCommand('iterable_command'), - array( - 'limit' => 10, - 'page_size' => 3 - ) - ), 'MockIterator'); - - $this->assertEquals(false, $ri->getNextToken()); - $this->assertEquals(false, $ri->current()); - } - - public function testSendsRequestsForNextSetOfResources() - { - // Queue up an array of responses for iterating - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 200 OK\r\nContent-Length: 52\r\n\r\n{ \"next_token\": \"g\", \"resources\": [\"d\", \"e\", \"f\"] }", - "HTTP/1.1 200 OK\r\nContent-Length: 52\r\n\r\n{ \"next_token\": \"j\", \"resources\": [\"g\", \"h\", \"i\"] }", - "HTTP/1.1 200 OK\r\nContent-Length: 41\r\n\r\n{ \"next_token\": \"\", \"resources\": [\"j\"] }" - )); - - // Create a new resource iterator using the IterableCommand mock - $ri = new MockCommandIterator($this->getServiceBuilder()->get('mock')->getCommand('iterable_command'), array( - 'page_size' => 3 - )); - - // Ensure that no requests have been sent yet - $this->assertEquals(0, count($this->getServer()->getReceivedRequests(false))); - - //$this->assertEquals(array('d', 'e', 'f', 'g', 'h', 'i', 'j'), $ri->toArray()); - $ri->toArray(); - $requests = $this->getServer()->getReceivedRequests(true); - $this->assertEquals(3, count($requests)); - - $this->assertEquals(3, $requests[0]->getQuery()->get('page_size')); - $this->assertEquals(3, $requests[1]->getQuery()->get('page_size')); - $this->assertEquals(3, $requests[2]->getQuery()->get('page_size')); - - // Reset and resend - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 200 OK\r\nContent-Length: 52\r\n\r\n{ \"next_token\": \"g\", \"resources\": [\"d\", \"e\", \"f\"] }", - "HTTP/1.1 200 OK\r\nContent-Length: 52\r\n\r\n{ \"next_token\": \"j\", \"resources\": [\"g\", \"h\", \"i\"] }", - "HTTP/1.1 200 OK\r\nContent-Length: 41\r\n\r\n{ \"next_token\": \"\", \"resources\": [\"j\"] }", - )); - - $d = array(); - foreach ($ri as $data) { - $d[] = $data; - } - $this->assertEquals(array('d', 'e', 'f', 'g', 'h', 'i', 'j'), $d); - } - - public function testCalculatesPageSize() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 200 OK\r\nContent-Length: 52\r\n\r\n{ \"next_token\": \"g\", \"resources\": [\"d\", \"e\", \"f\"] }", - "HTTP/1.1 200 OK\r\nContent-Length: 52\r\n\r\n{ \"next_token\": \"j\", \"resources\": [\"g\", \"h\", \"i\"] }", - "HTTP/1.1 200 OK\r\nContent-Length: 52\r\n\r\n{ \"next_token\": \"j\", \"resources\": [\"j\", \"k\"] }" - )); - - $ri = new MockCommandIterator($this->getServiceBuilder()->get('mock')->getCommand('iterable_command'), array( - 'page_size' => 3, - 'limit' => 7 - )); - - $this->assertEquals(array('d', 'e', 'f', 'g', 'h', 'i', 'j'), $ri->toArray()); - $requests = $this->getServer()->getReceivedRequests(true); - $this->assertEquals(3, count($requests)); - $this->assertEquals(3, $requests[0]->getQuery()->get('page_size')); - $this->assertEquals(3, $requests[1]->getQuery()->get('page_size')); - $this->assertEquals(1, $requests[2]->getQuery()->get('page_size')); - } - - public function testUseAsArray() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 200 OK\r\nContent-Length: 52\r\n\r\n{ \"next_token\": \"g\", \"resources\": [\"d\", \"e\", \"f\"] }", - "HTTP/1.1 200 OK\r\nContent-Length: 52\r\n\r\n{ \"next_token\": \"\", \"resources\": [\"g\", \"h\", \"i\"] }" - )); - - $ri = new MockCommandIterator($this->getServiceBuilder()->get('mock')->getCommand('iterable_command')); - - // Ensure that the key is never < 0 - $this->assertEquals(0, $ri->key()); - $this->assertEquals(0, count($ri)); - - // Ensure that the iterator can be used as KVP array - $data = array(); - foreach ($ri as $key => $value) { - $data[$key] = $value; - } - - // Ensure that the iterate is countable - $this->assertEquals(6, count($ri)); - $this->assertEquals(array('d', 'e', 'f', 'g', 'h', 'i'), $data); - } - - public function testBailsWhenSendReturnsNoResults() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 200 OK\r\n\r\n{ \"next_token\": \"g\", \"resources\": [\"d\", \"e\", \"f\"] }", - "HTTP/1.1 200 OK\r\n\r\n{ \"next_token\": \"\", \"resources\": [] }" - )); - - $ri = new MockCommandIterator($this->getServiceBuilder()->get('mock')->getCommand('iterable_command')); - - // Ensure that the iterator can be used as KVP array - $data = $ri->toArray(); - - // Ensure that the iterate is countable - $this->assertEquals(3, count($ri)); - $this->assertEquals(array('d', 'e', 'f'), $data); - - $this->assertEquals(2, $ri->getRequestCount()); - } - - public function testHoldsDataOptions() - { - $ri = new MockCommandIterator($this->getServiceBuilder()->get('mock')->getCommand('iterable_command')); - $this->assertNull($ri->get('foo')); - $this->assertSame($ri, $ri->set('foo', 'bar')); - $this->assertEquals('bar', $ri->get('foo')); - } - - public function testSettingLimitOrPageSizeClearsData() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 200 OK\r\n\r\n{ \"next_token\": \"\", \"resources\": [\"d\", \"e\", \"f\"] }", - "HTTP/1.1 200 OK\r\n\r\n{ \"next_token\": \"\", \"resources\": [\"d\", \"e\", \"f\"] }", - "HTTP/1.1 200 OK\r\n\r\n{ \"next_token\": \"\", \"resources\": [\"d\", \"e\", \"f\"] }" - )); - - $ri = new MockCommandIterator($this->getServiceBuilder()->get('mock')->getCommand('iterable_command')); - $ri->toArray(); - $this->assertNotEmpty($this->readAttribute($ri, 'resources')); - - $ri->setLimit(10); - $this->assertEmpty($this->readAttribute($ri, 'resources')); - - $ri->toArray(); - $this->assertNotEmpty($this->readAttribute($ri, 'resources')); - $ri->setPageSize(10); - $this->assertEmpty($this->readAttribute($ri, 'resources')); - } - - public function testWorksWithCustomAppendIterator() - { - $this->getServer()->flush(); - $this->getServer()->enqueue(array( - "HTTP/1.1 200 OK\r\n\r\n{ \"next_token\": \"\", \"resources\": [\"d\", \"e\", \"f\"] }" - )); - $ri = new MockCommandIterator($this->getServiceBuilder()->get('mock')->getCommand('iterable_command')); - $a = new \Guzzle\Iterator\AppendIterator(); - $a->append($ri); - $results = iterator_to_array($a, false); - $this->assertEquals(4, $ri->calledNext); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Stream/PhpStreamRequestFactoryTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Stream/PhpStreamRequestFactoryTest.php deleted file mode 100644 index 083aaa0d9..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Stream/PhpStreamRequestFactoryTest.php +++ /dev/null @@ -1,172 +0,0 @@ -client = new Client($this->getServer()->getUrl()); - $this->factory = new PhpStreamRequestFactory(); - } - - public function testOpensValidStreamByCreatingContext() - { - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\nhi"); - $request = $this->client->get('/'); - $stream = $this->factory->fromRequest($request); - $this->assertEquals('hi', (string) $stream); - $headers = $this->factory->getLastResponseHeaders(); - $this->assertContains('HTTP/1.1 200 OK', $headers); - $this->assertContains('Content-Length: 2', $headers); - $this->assertSame($headers, $stream->getCustomData('response_headers')); - $this->assertEquals(2, $stream->getSize()); - } - - public function testOpensValidStreamByPassingContextAndMerging() - { - $request = $this->client->get('/'); - $this->factory = $this->getMockBuilder('Guzzle\Stream\PhpStreamRequestFactory') - ->setMethods(array('createContext', 'createStream')) - ->getMock(); - $this->factory->expects($this->never()) - ->method('createContext'); - $this->factory->expects($this->once()) - ->method('createStream') - ->will($this->returnValue(new Stream(fopen('php://temp', 'r')))); - - $context = array('http' => array('method' => 'HEAD', 'ignore_errors' => false)); - $this->factory->fromRequest($request, stream_context_create($context)); - $options = stream_context_get_options($this->readAttribute($this->factory, 'context')); - $this->assertEquals('HEAD', $options['http']['method']); - $this->assertFalse($options['http']['ignore_errors']); - $this->assertEquals('1.1', $options['http']['protocol_version']); - } - - public function testAppliesProxySettings() - { - $request = $this->client->get('/'); - $request->getCurlOptions()->set(CURLOPT_PROXY, 'tcp://foo.com'); - $this->factory = $this->getMockBuilder('Guzzle\Stream\PhpStreamRequestFactory') - ->setMethods(array('createStream')) - ->getMock(); - $this->factory->expects($this->once()) - ->method('createStream') - ->will($this->returnValue(new Stream(fopen('php://temp', 'r')))); - $this->factory->fromRequest($request); - $options = stream_context_get_options($this->readAttribute($this->factory, 'context')); - $this->assertEquals('tcp://foo.com', $options['http']['proxy']); - } - - public function testAddsPostFields() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\nhi"); - $request = $this->client->post('/', array('Foo' => 'Bar'), array('foo' => 'baz bar')); - $stream = $this->factory->fromRequest($request); - $this->assertEquals('hi', (string) $stream); - - $headers = $this->factory->getLastResponseHeaders(); - $this->assertContains('HTTP/1.1 200 OK', $headers); - $this->assertContains('Content-Length: 2', $headers); - $this->assertSame($headers, $stream->getCustomData('response_headers')); - - $received = $this->getServer()->getReceivedRequests(); - $this->assertEquals(1, count($received)); - $this->assertContains('POST / HTTP/1.1', $received[0]); - $this->assertContains('host: ', $received[0]); - $this->assertContains('user-agent: Guzzle/', $received[0]); - $this->assertContains('foo: Bar', $received[0]); - $this->assertContains('content-length: 13', $received[0]); - $this->assertContains('foo=baz%20bar', $received[0]); - } - - public function testAddsBody() - { - $this->getServer()->flush(); - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\nhi"); - $request = $this->client->put('/', array('Foo' => 'Bar'), 'Testing...123'); - $stream = $this->factory->fromRequest($request); - $this->assertEquals('hi', (string) $stream); - - $headers = $this->factory->getLastResponseHeaders(); - $this->assertContains('HTTP/1.1 200 OK', $headers); - $this->assertContains('Content-Length: 2', $headers); - $this->assertSame($headers, $stream->getCustomData('response_headers')); - - $received = $this->getServer()->getReceivedRequests(); - $this->assertEquals(1, count($received)); - $this->assertContains('PUT / HTTP/1.1', $received[0]); - $this->assertContains('host: ', $received[0]); - $this->assertContains('user-agent: Guzzle/', $received[0]); - $this->assertContains('foo: Bar', $received[0]); - $this->assertContains('content-length: 13', $received[0]); - $this->assertContains('Testing...123', $received[0]); - } - - public function testCanDisableSslValidation() - { - $request = $this->client->get('/'); - $request->getCurlOptions()->set(CURLOPT_SSL_VERIFYPEER, false); - $this->factory = $this->getMockBuilder('Guzzle\Stream\PhpStreamRequestFactory') - ->setMethods(array('createStream')) - ->getMock(); - $this->factory->expects($this->once()) - ->method('createStream') - ->will($this->returnValue(new Stream(fopen('php://temp', 'r')))); - $this->factory->fromRequest($request); - $options = stream_context_get_options($this->readAttribute($this->factory, 'context')); - $this->assertFalse($options['ssl']['verify_peer']); - } - - public function testUsesSslValidationByDefault() - { - $request = $this->client->get('/'); - $this->factory = $this->getMockBuilder('Guzzle\Stream\PhpStreamRequestFactory') - ->setMethods(array('createStream')) - ->getMock(); - $this->factory->expects($this->once()) - ->method('createStream') - ->will($this->returnValue(new Stream(fopen('php://temp', 'r')))); - $this->factory->fromRequest($request); - $options = stream_context_get_options($this->readAttribute($this->factory, 'context')); - $this->assertTrue($options['ssl']['verify_peer']); - $this->assertSame($request->getCurlOptions()->get(CURLOPT_CAINFO), $options['ssl']['cafile']); - } - - public function testBasicAuthAddsUserAndPassToUrl() - { - $request = $this->client->get('/'); - $request->setAuth('Foo', 'Bar'); - $this->factory = $this->getMockBuilder('Guzzle\Stream\PhpStreamRequestFactory') - ->setMethods(array('createStream')) - ->getMock(); - $this->factory->expects($this->once()) - ->method('createStream') - ->will($this->returnValue(new Stream(fopen('php://temp', 'r')))); - $this->factory->fromRequest($request); - $this->assertContains('Foo:Bar@', (string) $this->readAttribute($this->factory, 'url')); - } - - public function testCanCreateCustomStreamClass() - { - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\nhi"); - $request = $this->client->get('/'); - $stream = $this->factory->fromRequest($request, array(), array('stream_class' => 'Guzzle\Http\EntityBody')); - $this->assertInstanceOf('Guzzle\Http\EntityBody', $stream); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Stream/StreamTest.php b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Stream/StreamTest.php deleted file mode 100644 index 4973f252e..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/Stream/StreamTest.php +++ /dev/null @@ -1,189 +0,0 @@ -assertEquals($handle, $stream->getStream()); - $this->assertTrue($stream->isReadable()); - $this->assertTrue($stream->isWritable()); - $this->assertTrue($stream->isLocal()); - $this->assertTrue($stream->isSeekable()); - $this->assertEquals('PHP', $stream->getWrapper()); - $this->assertEquals('TEMP', $stream->getStreamType()); - $this->assertEquals(4, $stream->getSize()); - $this->assertEquals('php://temp', $stream->getUri()); - $this->assertEquals(array(), $stream->getWrapperData()); - $this->assertFalse($stream->isConsumed()); - unset($stream); - } - - public function testCanModifyStream() - { - $handle1 = fopen('php://temp', 'r+'); - $handle2 = fopen('php://temp', 'r+'); - $stream = new Stream($handle1); - $this->assertSame($handle1, $stream->getStream()); - $stream->setStream($handle2, 10); - $this->assertEquals(10, $stream->getSize()); - $this->assertSame($handle2, $stream->getStream()); - } - - public function testStreamClosesHandleOnDestruct() - { - $handle = fopen('php://temp', 'r'); - $stream = new Stream($handle); - unset($stream); - $this->assertFalse(is_resource($handle)); - } - - public function testConvertsToString() - { - $handle = fopen('php://temp', 'w+'); - fwrite($handle, 'data'); - $stream = new Stream($handle); - $this->assertEquals('data', (string) $stream); - unset($stream); - - $handle = fopen(__DIR__ . '/../TestData/FileBody.txt', 'r'); - $stream = new Stream($handle); - $this->assertEquals('', (string) $stream); - unset($stream); - } - - public function testConvertsToStringAndRestoresCursorPos() - { - $handle = fopen('php://temp', 'w+'); - $stream = new Stream($handle); - $stream->write('foobazbar'); - $stream->seek(3); - $this->assertEquals('foobazbar', (string) $stream); - $this->assertEquals(3, $stream->ftell()); - } - - public function testIsConsumed() - { - $handle = fopen('php://temp', 'w+'); - fwrite($handle, 'data'); - $stream = new Stream($handle); - $this->assertFalse($stream->isConsumed()); - $stream->read(4); - $this->assertTrue($stream->isConsumed()); - } - - public function testAllowsSettingManualSize() - { - $handle = fopen('php://temp', 'w+'); - fwrite($handle, 'data'); - $stream = new Stream($handle); - $stream->setSize(10); - $this->assertEquals(10, $stream->getSize()); - unset($stream); - } - - public function testWrapsStream() - { - $handle = fopen('php://temp', 'w+'); - fwrite($handle, 'data'); - $stream = new Stream($handle); - $this->assertTrue($stream->isSeekable()); - $this->assertTrue($stream->isReadable()); - $this->assertTrue($stream->seek(0)); - $this->assertEquals('da', $stream->read(2)); - $this->assertEquals('ta', $stream->read(2)); - $this->assertTrue($stream->seek(0)); - $this->assertEquals('data', $stream->read(4)); - $stream->write('_appended'); - $stream->seek(0); - $this->assertEquals('data_appended', $stream->read(13)); - } - - public function testGetSize() - { - $size = filesize(__DIR__ . '/../../../bootstrap.php'); - $handle = fopen(__DIR__ . '/../../../bootstrap.php', 'r'); - $stream = new Stream($handle); - $this->assertEquals($handle, $stream->getStream()); - $this->assertEquals($size, $stream->getSize()); - $this->assertEquals($size, $stream->getSize()); - unset($stream); - - // Make sure that false is returned when the size cannot be determined - $this->getServer()->enqueue("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); - $handle = fopen('http://127.0.0.1:' . $this->getServer()->getPort(), 'r'); - $stream = new Stream($handle); - $this->assertEquals(false, $stream->getSize()); - unset($stream); - } - - public function testEnsuresSizeIsConsistent() - { - $h = fopen('php://temp', 'r+'); - fwrite($h, 'foo'); - $stream = new Stream($h); - $this->assertEquals(3, $stream->getSize()); - $stream->write('test'); - $this->assertEquals(7, $stream->getSize()); - fclose($h); - } - - public function testAbstractsMetaData() - { - $handle = fopen(__DIR__ . '/../../../bootstrap.php', 'r'); - $stream = new Stream($handle); - $this->assertEquals('plainfile', $stream->getMetaData('wrapper_type')); - $this->assertEquals(null, $stream->getMetaData('wrapper_data')); - $this->assertInternalType('array', $stream->getMetaData()); - } - - public function testDoesNotAttemptToWriteToReadonlyStream() - { - $handle = fopen(__DIR__ . '/../../../bootstrap.php', 'r'); - $stream = new Stream($handle); - $this->assertEquals(0, $stream->write('foo')); - } - - public function testProvidesStreamPosition() - { - $handle = fopen(__DIR__ . '/../../../bootstrap.php', 'r'); - $stream = new Stream($handle); - $stream->read(2); - $this->assertSame(ftell($handle), $stream->ftell()); - $this->assertEquals(2, $stream->ftell()); - } - - public function testRewindIsSeekZero() - { - $stream = new Stream(fopen('php://temp', 'w+')); - $stream->write('foobazbar'); - $this->assertTrue($stream->rewind()); - $this->assertEquals('foobazbar', $stream->read(9)); - } - - public function testCanDetachStream() - { - $r = fopen('php://temp', 'w+'); - $stream = new Stream($r); - $stream->detachStream(); - $this->assertNull($stream->getStream()); - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/FileBody.txt b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/FileBody.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/description/bar.json b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/description/bar.json deleted file mode 100644 index c354ed788..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/description/bar.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "includes": ["foo.json"] -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/description/baz.json b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/description/baz.json deleted file mode 100644 index 765237b3e..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/description/baz.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "includes": ["foo.json", "bar.json"] -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/description/foo.json b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/description/foo.json deleted file mode 100644 index cee5005b8..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/description/foo.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "includes": ["recursive.json"], - "operations": { - "abstract": { - "httpMethod": "POST" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/description/recursive.json b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/description/recursive.json deleted file mode 100644 index c354ed788..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/description/recursive.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "includes": ["foo.json"] -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/mock_response b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/mock_response deleted file mode 100644 index b6938a28c..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/mock_response +++ /dev/null @@ -1,3 +0,0 @@ -HTTP/1.1 200 OK -Content-Length: 0 - diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/services/json1.json b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/services/json1.json deleted file mode 100644 index 7b2a9dad4..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/services/json1.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "includes": [ "json2.json" ], - "services": { - "abstract": { - "access_key": "xyz", - "secret": "abc" - }, - "mock": { - "class": "Guzzle\\Tests\\Service\\Mock\\MockClient", - "extends": "abstract", - "params": { - "username": "foo", - "password": "baz", - "subdomain": "bar" - } - } - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/services/json2.json b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/services/json2.json deleted file mode 100644 index 08e5566f0..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/services/json2.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "services": { - "foo": { - "class": "Guzzle\\Tests\\Service\\Mock\\MockClient", - "extends": "abstract", - "params": { - "baz": "bar" - } - } - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/services/services.json b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/services/services.json deleted file mode 100644 index 25452e4a4..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/services/services.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "abstract": { - "access_key": "xyz", - "secret": "abc" - }, - "mock": { - "class": "Guzzle\\Tests\\Service\\Mock\\MockClient", - "extends": "abstract", - "params": { - "username": "foo", - "password": "baz", - "subdomain": "bar" - } - }, - - "test.abstract.aws": { - "params": { - "access_key": "12345", - "secret_key": "abcd" - } - }, - - "test.s3": { - "class": "Guzzle\\Service\\Aws\\S3Client", - "extends": "test.abstract.aws", - "params": { - "devpay_product_token": "", - "devpay_user_token": "" - } - }, - - "test.simple_db": { - "class": "Guzzle\\Service\\Aws\\SimpleDb\\SimpleDbClient", - "extends": "test.abstract.aws" - }, - - "test.sqs": { - "class": "Guzzle\\Service\\Aws\\Sqs\\SqsClient", - "extends": "test.abstract.aws" - }, - - "test.centinel": { - "class": "Guzzle\\Service\\CardinalCommerce\\Centinel.CentinelClient", - "params": { - "password": "test", - "processor_id": "123", - "merchant_id": "456" - } - }, - - "test.mws": { - "class": "Guzzle\\Service\\Mws\\MwsClient", - "extends": "test.abstract.aws", - "params": { - "merchant_id": "ABCDE", - "marketplace_id": "FGHIJ", - "application_name": "GuzzleTest", - "application_version": "0.1", - "base_url": "https://mws.amazonservices.com" - } - }, - - "mock": { - "class": "Guzzle\\Tests\\Service\\Mock\\MockClient", - "params": { - "username": "test_user", - "password": "****", - "subdomain": "test" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/test_service.json b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/test_service.json deleted file mode 100644 index 01557ca11..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/test_service.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "includes": [ "test_service2.json" ], - "operations": { - "test": { - "uri": "/path" - }, - "concrete": { - "extends": "abstract" - }, - "foo_bar": { - "uri": "/testing", - "parameters": { - "other": { - "location": "json", - "location_key": "Other" - }, - "test": { - "type": "object", - "location": "json", - "properties": { - "baz": { - "type": "boolean", - "default": true - }, - "bar": { - "type": "string", - "filters": [ - { - "method": "strtolower", - "args": ["test", "@value"] - }, - "strtoupper" - ] - } - } - } - } - } - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/test_service2.json b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/test_service2.json deleted file mode 100644 index 66dd9ef7e..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/test_service2.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "operations": { - "abstract": { - "uri": "/abstract" - } - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/test_service_3.json b/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/test_service_3.json deleted file mode 100644 index ae2ae0bd4..000000000 --- a/bb-vendor/guzzle/guzzle/tests/Guzzle/Tests/TestData/test_service_3.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "includes": [ "test_service2.json" ], - "operations": { - "test": { - "uri": "/path" - }, - "concrete": { - "extends": "abstract" - }, - "baz_qux": { - "uri": "/testing", - "parameters": { - "other": { - "location": "json", - "location_key": "Other" - }, - "test": { - "type": "object", - "location": "json", - "properties": { - "baz": { - "type": "boolean", - "default": true - }, - "bar": { - "type": "string", - "filters": [ - { - "method": "strtolower", - "args": ["test", "@value"] - }, - "strtoupper" - ] - } - } - } - } - } - } -} diff --git a/bb-vendor/guzzle/guzzle/tests/bootstrap.php b/bb-vendor/guzzle/guzzle/tests/bootstrap.php deleted file mode 100644 index 28908d310..000000000 --- a/bb-vendor/guzzle/guzzle/tests/bootstrap.php +++ /dev/null @@ -1,10 +0,0 @@ -=5.6", + "composer/ca-bundle": "^1.0.3", + "ext-curl": "*", + "ext-json": "*" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "2.*", + "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0", + "squizlabs/php_codesniffer": "3.*" + }, + "autoload": { + "psr-4": { + "MaxMind\\Exception\\": "src/Exception", + "MaxMind\\WebService\\": "src/WebService" + } + } +} diff --git a/bb-vendor/maxmind/web-service-common/dev-bin/release.sh b/bb-vendor/maxmind/web-service-common/dev-bin/release.sh new file mode 100755 index 000000000..a5de03027 --- /dev/null +++ b/bb-vendor/maxmind/web-service-common/dev-bin/release.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +set -eu -o pipefail + + +changelog=$(cat CHANGELOG.md) + +regex=' +([0-9]+\.[0-9]+\.[0-9]+) \(([0-9]{4}-[0-9]{2}-[0-9]{2})\) +-* + +((.| +)*) +' + +if [[ ! $changelog =~ $regex ]]; then + echo "Could not find date line in change log!" + exit 1 +fi + +version="${BASH_REMATCH[1]}" +date="${BASH_REMATCH[2]}" +notes="$(echo "${BASH_REMATCH[3]}" | sed -n -E '/^[0-9]+\.[0-9]+\.[0-9]+/,$!p')" + +if [[ "$date" != $(date +"%Y-%m-%d") ]]; then + echo "$date is not today!" + exit 1 +fi + +tag="v$version" + +if [ -n "$(git status --porcelain)" ]; then + echo ". is not clean." >&2 + exit 1 +fi + +php composer.phar self-update +php composer.phar update + +./vendor/bin/phpunit + +echo "Release notes for $tag:" +echo "$notes" + +read -e -p "Commit changes and push to origin? " should_push + +if [ "$should_push" != "y" ]; then + echo "Aborting" + exit 1 +fi + +git push + +message="$version + +$notes" + +hub release create -m "$message" "$tag" + +git push --tags diff --git a/bb-vendor/maxmind/web-service-common/src/Exception/AuthenticationException.php b/bb-vendor/maxmind/web-service-common/src/Exception/AuthenticationException.php new file mode 100644 index 000000000..ba423627b --- /dev/null +++ b/bb-vendor/maxmind/web-service-common/src/Exception/AuthenticationException.php @@ -0,0 +1,10 @@ +uri = $uri; + parent::__construct($message, $httpStatus, $previous); + } + + public function getUri() + { + return $this->uri; + } + + public function getStatusCode() + { + return $this->getCode(); + } +} diff --git a/bb-vendor/maxmind/web-service-common/src/Exception/InsufficientFundsException.php b/bb-vendor/maxmind/web-service-common/src/Exception/InsufficientFundsException.php new file mode 100644 index 000000000..fe159a2a5 --- /dev/null +++ b/bb-vendor/maxmind/web-service-common/src/Exception/InsufficientFundsException.php @@ -0,0 +1,10 @@ +error = $error; + parent::__construct($message, $httpStatus, $uri, $previous); + } + + public function getErrorCode() + { + return $this->error; + } +} diff --git a/bb-vendor/maxmind/web-service-common/src/Exception/IpAddressNotFoundException.php b/bb-vendor/maxmind/web-service-common/src/Exception/IpAddressNotFoundException.php new file mode 100644 index 000000000..31608f718 --- /dev/null +++ b/bb-vendor/maxmind/web-service-common/src/Exception/IpAddressNotFoundException.php @@ -0,0 +1,7 @@ +accountId = $accountId; + $this->licenseKey = $licenseKey; + + $this->httpRequestFactory = isset($options['httpRequestFactory']) + ? $options['httpRequestFactory'] + : new RequestFactory(); + + if (isset($options['host'])) { + $this->host = $options['host']; + } + if (isset($options['userAgent'])) { + $this->userAgentPrefix = $options['userAgent'] . ' '; + } + + $this->caBundle = isset($options['caBundle']) ? + $this->caBundle = $options['caBundle'] : $this->getCaBundle(); + + if (isset($options['connectTimeout'])) { + $this->connectTimeout = $options['connectTimeout']; + } + if (isset($options['timeout'])) { + $this->timeout = $options['timeout']; + } + + if (isset($options['proxy'])) { + $this->proxy = $options['proxy']; + } + } + + /** + * @param string $service name of the service querying + * @param string $path the URI path to use + * @param array $input the data to be posted as JSON + * + * @throws InvalidInputException when the request has missing or invalid + * data + * @throws AuthenticationException when there is an issue authenticating the + * request + * @throws InsufficientFundsException when your account is out of funds + * @throws InvalidRequestException when the request is invalid for some + * other reason, e.g., invalid JSON in the POST. + * @throws HttpException when an unexpected HTTP error occurs + * @throws WebServiceException when some other error occurs. This also + * serves as the base class for the above exceptions. + * + * @return array The decoded content of a successful response + */ + public function post($service, $path, $input) + { + $requestBody = json_encode($input); + if ($requestBody === false) { + throw new InvalidInputException( + 'Error encoding input as JSON: ' + . $this->jsonErrorDescription() + ); + } + + $request = $this->createRequest( + $path, + ['Content-Type: application/json'] + ); + + list($statusCode, $contentType, $responseBody) = $request->post($requestBody); + + return $this->handleResponse( + $statusCode, + $contentType, + $responseBody, + $service, + $path + ); + } + + public function get($service, $path) + { + $request = $this->createRequest($path); + + list($statusCode, $contentType, $responseBody) = $request->get(); + + return $this->handleResponse( + $statusCode, + $contentType, + $responseBody, + $service, + $path + ); + } + + private function userAgent() + { + $curlVersion = curl_version(); + + return $this->userAgentPrefix . 'MaxMind-WS-API/' . self::VERSION . ' PHP/' . PHP_VERSION . + ' curl/' . $curlVersion['version']; + } + + private function createRequest($path, $headers = []) + { + array_push( + $headers, + 'Authorization: Basic ' + . base64_encode($this->accountId . ':' . $this->licenseKey), + 'Accept: application/json' + ); + + return $this->httpRequestFactory->request( + $this->urlFor($path), + [ + 'caBundle' => $this->caBundle, + 'connectTimeout' => $this->connectTimeout, + 'headers' => $headers, + 'proxy' => $this->proxy, + 'timeout' => $this->timeout, + 'userAgent' => $this->userAgent(), + ] + ); + } + + /** + * @param int $statusCode the HTTP status code of the response + * @param string $contentType the Content-Type of the response + * @param string $responseBody the response body + * @param string $service the name of the service + * @param string $path the path used in the request + * + * @throws AuthenticationException when there is an issue authenticating the + * request + * @throws InsufficientFundsException when your account is out of funds + * @throws InvalidRequestException when the request is invalid for some + * other reason, e.g., invalid JSON in the POST. + * @throws HttpException when an unexpected HTTP error occurs + * @throws WebServiceException when some other error occurs. This also + * serves as the base class for the above exceptions + * + * @return array The decoded content of a successful response + */ + private function handleResponse( + $statusCode, + $contentType, + $responseBody, + $service, + $path + ) { + if ($statusCode >= 400 && $statusCode <= 499) { + $this->handle4xx($statusCode, $contentType, $responseBody, $service, $path); + } elseif ($statusCode >= 500) { + $this->handle5xx($statusCode, $service, $path); + } elseif ($statusCode !== 200 && $statusCode !== 204) { + $this->handleUnexpectedStatus($statusCode, $service, $path); + } + + return $this->handleSuccess($statusCode, $responseBody, $service); + } + + /** + * @return string describing the JSON error + */ + private function jsonErrorDescription() + { + $errno = json_last_error(); + switch ($errno) { + case JSON_ERROR_DEPTH: + return 'The maximum stack depth has been exceeded.'; + case JSON_ERROR_STATE_MISMATCH: + return 'Invalid or malformed JSON.'; + case JSON_ERROR_CTRL_CHAR: + return 'Control character error.'; + case JSON_ERROR_SYNTAX: + return 'Syntax error.'; + case JSON_ERROR_UTF8: + return 'Malformed UTF-8 characters.'; + default: + return "Other JSON error ($errno)."; + } + } + + /** + * @param string $path the path to use in the URL + * + * @return string the constructed URL + */ + private function urlFor($path) + { + return 'https://' . $this->host . $path; + } + + /** + * @param int $statusCode the HTTP status code + * @param string $contentType the response content-type + * @param string $body the response body + * @param string $service the service name + * @param string $path the path used in the request + * + * @throws AuthenticationException + * @throws HttpException + * @throws InsufficientFundsException + * @throws InvalidRequestException + */ + private function handle4xx( + $statusCode, + $contentType, + $body, + $service, + $path + ) { + if (\strlen($body) === 0) { + throw new HttpException( + "Received a $statusCode error for $service with no body", + $statusCode, + $this->urlFor($path) + ); + } + if (!strstr($contentType, 'json')) { + throw new HttpException( + "Received a $statusCode error for $service with " . + 'the following body: ' . $body, + $statusCode, + $this->urlFor($path) + ); + } + + $message = json_decode($body, true); + if ($message === null) { + throw new HttpException( + "Received a $statusCode error for $service but could " . + 'not decode the response as JSON: ' + . $this->jsonErrorDescription() . ' Body: ' . $body, + $statusCode, + $this->urlFor($path) + ); + } + + if (!isset($message['code']) || !isset($message['error'])) { + throw new HttpException( + 'Error response contains JSON but it does not ' . + 'specify code or error keys: ' . $body, + $statusCode, + $this->urlFor($path) + ); + } + + $this->handleWebServiceError( + $message['error'], + $message['code'], + $statusCode, + $path + ); + } + + /** + * @param string $message the error message from the web service + * @param string $code the error code from the web service + * @param int $statusCode the HTTP status code + * @param string $path the path used in the request + * + * @throws AuthenticationException + * @throws InvalidRequestException + * @throws InsufficientFundsException + */ + private function handleWebServiceError( + $message, + $code, + $statusCode, + $path + ) { + switch ($code) { + case 'IP_ADDRESS_NOT_FOUND': + case 'IP_ADDRESS_RESERVED': + throw new IpAddressNotFoundException( + $message, + $code, + $statusCode, + $this->urlFor($path) + ); + case 'ACCOUNT_ID_REQUIRED': + case 'ACCOUNT_ID_UNKNOWN': + case 'AUTHORIZATION_INVALID': + case 'LICENSE_KEY_REQUIRED': + case 'USER_ID_REQUIRED': + case 'USER_ID_UNKNOWN': + throw new AuthenticationException( + $message, + $code, + $statusCode, + $this->urlFor($path) + ); + case 'OUT_OF_QUERIES': + case 'INSUFFICIENT_FUNDS': + throw new InsufficientFundsException( + $message, + $code, + $statusCode, + $this->urlFor($path) + ); + case 'PERMISSION_REQUIRED': + throw new PermissionRequiredException( + $message, + $code, + $statusCode, + $this->urlFor($path) + ); + default: + throw new InvalidRequestException( + $message, + $code, + $statusCode, + $this->urlFor($path) + ); + } + } + + /** + * @param int $statusCode the HTTP status code + * @param string $service the service name + * @param string $path the URI path used in the request + * + * @throws HttpException + */ + private function handle5xx($statusCode, $service, $path) + { + throw new HttpException( + "Received a server error ($statusCode) for $service", + $statusCode, + $this->urlFor($path) + ); + } + + /** + * @param int $statusCode the HTTP status code + * @param string $service the service name + * @param string $path the URI path used in the request + * + * @throws HttpException + */ + private function handleUnexpectedStatus($statusCode, $service, $path) + { + throw new HttpException( + 'Received an unexpected HTTP status ' . + "($statusCode) for $service", + $statusCode, + $this->urlFor($path) + ); + } + + /** + * @param int $statusCode the HTTP status code + * @param string $body the successful request body + * @param string $service the service name + * + * @throws WebServiceException if a response body is included but not + * expected, or is not expected but not + * included, or is expected and included + * but cannot be decoded as JSON + * + * @return array the decoded request body + */ + private function handleSuccess($statusCode, $body, $service) + { + // A 204 should have no response body + if ($statusCode === 204) { + if (\strlen($body) !== 0) { + throw new WebServiceException( + "Received a 204 response for $service along with an " . + "unexpected HTTP body: $body" + ); + } + + return null; + } + + // A 200 should have a valid JSON body + if (\strlen($body) === 0) { + throw new WebServiceException( + "Received a 200 response for $service but did not " . + 'receive a HTTP body.' + ); + } + + $decodedContent = json_decode($body, true); + if ($decodedContent === null) { + throw new WebServiceException( + "Received a 200 response for $service but could " . + 'not decode the response as JSON: ' + . $this->jsonErrorDescription() . ' Body: ' . $body + ); + } + + return $decodedContent; + } + + private function getCaBundle() + { + $curlVersion = curl_version(); + + // On OS X, when the SSL version is "SecureTransport", the system's + // keychain will be used. + if ($curlVersion['ssl_version'] === 'SecureTransport') { + return null; + } + $cert = CaBundle::getSystemCaRootBundlePath(); + + // Check if the cert is inside a phar. If so, we need to copy the cert + // to a temp file so that curl can see it. + if (substr($cert, 0, 7) === 'phar://') { + $tempDir = sys_get_temp_dir(); + $newCert = tempnam($tempDir, 'geoip2-'); + if ($newCert === false) { + throw new \RuntimeException( + "Unable to create temporary file in $tempDir" + ); + } + if (!copy($cert, $newCert)) { + throw new \RuntimeException( + "Could not copy $cert to $newCert: " + . var_export(error_get_last(), true) + ); + } + + // We use a shutdown function rather than the destructor as the + // destructor isn't called on a fatal error such as an uncaught + // exception. + register_shutdown_function( + function () use ($newCert) { + unlink($newCert); + } + ); + $cert = $newCert; + } + if (!file_exists($cert)) { + throw new \RuntimeException("CA cert does not exist at $cert"); + } + + return $cert; + } +} diff --git a/bb-vendor/maxmind/web-service-common/src/WebService/Http/CurlRequest.php b/bb-vendor/maxmind/web-service-common/src/WebService/Http/CurlRequest.php new file mode 100644 index 000000000..ce1cf73ad --- /dev/null +++ b/bb-vendor/maxmind/web-service-common/src/WebService/Http/CurlRequest.php @@ -0,0 +1,136 @@ +url = $url; + $this->options = $options; + $this->ch = $options['curlHandle']; + } + + /** + * @param string $body + * + * @throws HttpException + * + * @return array + */ + public function post($body) + { + $curl = $this->createCurl(); + + curl_setopt($curl, CURLOPT_POST, true); + curl_setopt($curl, CURLOPT_POSTFIELDS, $body); + + return $this->execute($curl); + } + + public function get() + { + $curl = $this->createCurl(); + + curl_setopt($curl, CURLOPT_HTTPGET, true); + + return $this->execute($curl); + } + + /** + * @return resource + */ + private function createCurl() + { + curl_reset($this->ch); + + $opts = []; + $opts[CURLOPT_URL] = $this->url; + + if (!empty($this->options['caBundle'])) { + $opts[CURLOPT_CAINFO] = $this->options['caBundle']; + } + + $opts[CURLOPT_ENCODING] = ''; + $opts[CURLOPT_SSL_VERIFYHOST] = 2; + $opts[CURLOPT_FOLLOWLOCATION] = false; + $opts[CURLOPT_SSL_VERIFYPEER] = true; + $opts[CURLOPT_RETURNTRANSFER] = true; + + $opts[CURLOPT_HTTPHEADER] = $this->options['headers']; + $opts[CURLOPT_USERAGENT] = $this->options['userAgent']; + $opts[CURLOPT_PROXY] = $this->options['proxy']; + + // The defined()s are here as the *_MS opts are not available on older + // cURL versions + $connectTimeout = $this->options['connectTimeout']; + if (\defined('CURLOPT_CONNECTTIMEOUT_MS')) { + $opts[CURLOPT_CONNECTTIMEOUT_MS] = ceil($connectTimeout * 1000); + } else { + $opts[CURLOPT_CONNECTTIMEOUT] = ceil($connectTimeout); + } + + $timeout = $this->options['timeout']; + if (\defined('CURLOPT_TIMEOUT_MS')) { + $opts[CURLOPT_TIMEOUT_MS] = ceil($timeout * 1000); + } else { + $opts[CURLOPT_TIMEOUT] = ceil($timeout); + } + + curl_setopt_array($this->ch, $opts); + + return $this->ch; + } + + /** + * @param resource $curl + * + * @throws HttpException + * + * @return array + */ + private function execute($curl) + { + $body = curl_exec($curl); + if ($errno = curl_errno($curl)) { + $errorMessage = curl_error($curl); + + throw new HttpException( + "cURL error ({$errno}): {$errorMessage}", + 0, + $this->url + ); + } + + $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); + $contentType = curl_getinfo($curl, CURLINFO_CONTENT_TYPE); + + return [$statusCode, $contentType, $body]; + } +} diff --git a/bb-vendor/maxmind/web-service-common/src/WebService/Http/Request.php b/bb-vendor/maxmind/web-service-common/src/WebService/Http/Request.php new file mode 100644 index 000000000..641c1ffcc --- /dev/null +++ b/bb-vendor/maxmind/web-service-common/src/WebService/Http/Request.php @@ -0,0 +1,29 @@ +ch)) { + curl_close($this->ch); + } + } + + private function getCurlHandle() + { + if (empty($this->ch)) { + $this->ch = curl_init(); + } + + return $this->ch; + } + + /** + * @param string $url + * @param array $options + * + * @return Request + */ + public function request($url, $options) + { + $options['curlHandle'] = $this->getCurlHandle(); + + return new CurlRequest($url, $options); + } +} diff --git a/bb-vendor/michelf/php-markdown/.editorconfig b/bb-vendor/michelf/php-markdown/.editorconfig new file mode 100644 index 000000000..179d40c91 --- /dev/null +++ b/bb-vendor/michelf/php-markdown/.editorconfig @@ -0,0 +1,11 @@ +# EditorConfig is awesome: https://EditorConfig.org +root = true + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = false + +[*.php] +indent_style = tab +insert_final_newline = true diff --git a/bb-vendor/michelf/php-markdown/.gitignore b/bb-vendor/michelf/php-markdown/.gitignore new file mode 100644 index 000000000..5bd6475b7 --- /dev/null +++ b/bb-vendor/michelf/php-markdown/.gitignore @@ -0,0 +1,3 @@ +*~ +/composer.lock +/vendor/ diff --git a/bb-vendor/michelf/php-markdown/.scrutinizer.yml b/bb-vendor/michelf/php-markdown/.scrutinizer.yml new file mode 100644 index 000000000..b4f5dfb9e --- /dev/null +++ b/bb-vendor/michelf/php-markdown/.scrutinizer.yml @@ -0,0 +1,36 @@ +build: + environment: + php: + version: '7.0.20' + nodes: + analysis: + project_setup: + override: + - 'true' + tests: + override: + - + command: 'vendor/bin/phpunit --coverage-clover=clover.xml' + coverage: + file: 'clover.xml' + format: 'clover' + - + command: phpcs-run + use_website_config: true + environment: + node: + version: 6.0.0 + tests: true +filter: + excluded_paths: + - 'test/*' +checks: + php: true +coding_style: + php: + indentation: + general: + use_tabs: true + spaces: + around_operators: + concatenation: true diff --git a/bb-vendor/michelf/php-markdown/.travis.yml b/bb-vendor/michelf/php-markdown/.travis.yml new file mode 100644 index 000000000..d46714787 --- /dev/null +++ b/bb-vendor/michelf/php-markdown/.travis.yml @@ -0,0 +1,29 @@ +language: php + +sudo: false + +cache: + directories: + - $HOME/.composer/ + +# Run tests against all these PHP versions +# TODO: When it becomes possible in TravisCI, switch 7.4snapshot to plain 7.4 +php: + - 5.4 + - 5.5 + - 5.6 + - 7.0 + - 7.1 + - 7.2 + - 7.3 + - 7.4snapshot + - hhvm + +before_script: + - composer install --prefer-dist + +script: + - vendor/bin/phpunit --log-junit=phpunit.log + +notifications: + email: false diff --git a/bb-vendor/michelf/php-markdown/License.md b/bb-vendor/michelf/php-markdown/License.md index c16197b69..16bbd5400 100644 --- a/bb-vendor/michelf/php-markdown/License.md +++ b/bb-vendor/michelf/php-markdown/License.md @@ -1,11 +1,11 @@ PHP Markdown Lib -Copyright (c) 2004-2016 Michel Fortin +Copyright (c) 2004-2019 Michel Fortin All rights reserved. Based on Markdown -Copyright (c) 2003-2006 John Gruber - +Copyright (c) 2003-2006 John Gruber + All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/bb-vendor/michelf/php-markdown/Michelf/Markdown.php b/bb-vendor/michelf/php-markdown/Michelf/Markdown.php index c3eaf4464..43b3c79e8 100644 --- a/bb-vendor/michelf/php-markdown/Michelf/Markdown.php +++ b/bb-vendor/michelf/php-markdown/Michelf/Markdown.php @@ -4,7 +4,7 @@ * * @package php-markdown * @author Michel Fortin - * @copyright 2004-2016 Michel Fortin + * @copyright 2004-2019 Michel Fortin * @copyright (Original Markdown) 2004-2006 John Gruber */ @@ -18,7 +18,7 @@ class Markdown implements MarkdownInterface { * Define the package version * @var string */ - const MARKDOWNLIB_VERSION = "1.7.0"; + const MARKDOWNLIB_VERSION = "1.9.0"; /** * Simple function interface - Initialize the parser and return the result @@ -61,14 +61,14 @@ class Markdown implements MarkdownInterface { * @var int */ public $tab_width = 4; - + /** * Change to `true` to disallow markup or entities. * @var boolean */ public $no_markup = false; public $no_entities = false; - + /** * Change to `true` to enable line breaks on \n without two trailling spaces @@ -85,25 +85,25 @@ class Markdown implements MarkdownInterface { /** * Optional filter function for URLs - * @var callable + * @var callable|null */ public $url_filter_func = null; /** * Optional header id="" generation callback function. - * @var callable + * @var callable|null */ public $header_id_func = null; - + /** * Optional function for converting code block content to HTML - * @var callable + * @var callable|null */ public $code_block_content_func = null; /** * Optional function for converting code span content to HTML. - * @var callable + * @var callable|null */ public $code_span_content_func = null; @@ -111,7 +111,7 @@ class Markdown implements MarkdownInterface { * Class attribute to toggle "enhanced ordered list" behaviour * setting this to true will allow ordered lists to start from the index * number that is defined first. - * + * * For example: * 2. List item two * 3. List item three @@ -155,17 +155,17 @@ class Markdown implements MarkdownInterface { public function __construct() { $this->_initDetab(); $this->prepareItalicsAndBold(); - - $this->nested_brackets_re = + + $this->nested_brackets_re = str_repeat('(?>[^\[\]]+|\[', $this->nested_brackets_depth). str_repeat('\])*', $this->nested_brackets_depth); - - $this->nested_url_parenthesis_re = + + $this->nested_url_parenthesis_re = str_repeat('(?>[^()\s]+|\(', $this->nested_url_parenthesis_depth). str_repeat('(?>\)))*', $this->nested_url_parenthesis_depth); - + $this->escape_chars_re = '['.preg_quote($this->escape_chars).']'; - + // Sort document, block, and span gamut in ascendent priority order. asort($this->document_gamut); asort($this->block_gamut); @@ -180,13 +180,19 @@ class Markdown implements MarkdownInterface { protected $urls = array(); protected $titles = array(); protected $html_hashes = array(); - + /** * Status flag to avoid invalid nesting. * @var boolean */ protected $in_anchor = false; - + + /** + * Status flag to avoid invalid nesting. + * @var boolean + */ + protected $in_emphasis_processing = false; + /** * Called before the transformation process starts to setup parser states. * @return void @@ -197,8 +203,9 @@ class Markdown implements MarkdownInterface { $this->titles = $this->predef_titles; $this->html_hashes = array(); $this->in_anchor = false; + $this->in_emphasis_processing = false; } - + /** * Called after the transformation process to clear any variable which may * be taking up memory unnecessarly. @@ -221,7 +228,7 @@ class Markdown implements MarkdownInterface { */ public function transform($text) { $this->setup(); - + # Remove UTF-8 BOM and marker character in input, if present. $text = preg_replace('{^\xEF\xBB\xBF|\x1A}', '', $text); @@ -248,7 +255,7 @@ class Markdown implements MarkdownInterface { foreach ($this->document_gamut as $method => $priority) { $text = $this->$method($text); } - + $this->teardown(); return $text . "\n"; @@ -271,7 +278,7 @@ class Markdown implements MarkdownInterface { * @return string */ protected function stripLinkDefinitions($text) { - + $less_than_tab = $this->tab_width - 1; // Link defs are in the form: ^[id]: url "optional title" @@ -338,8 +345,8 @@ class Markdown implements MarkdownInterface { * for is hard-coded: * * * List "a" is made of tags which can be both inline or block-level. - * These will be treated block-level when the start tag is alone on - * its line, otherwise they're not matched here and will be taken as + * These will be treated block-level when the start tag is alone on + * its line, otherwise they're not matched here and will be taken as * inline later. * * List "b" is made of tags which are always block-level; */ @@ -363,7 +370,7 @@ class Markdown implements MarkdownInterface { | \'[^\']*\' # text inside single quotes (tolerate ">") )* - )? + )? '; $content = str_repeat(' @@ -380,7 +387,7 @@ class Markdown implements MarkdownInterface { str_repeat(' # closing nested tag ) - | + | <(?!/\2\s*> # other tags with a different name ) )*', @@ -409,9 +416,9 @@ class Markdown implements MarkdownInterface { ) ( # save in $1 - # Match from `\n` to `\n`, handling nested tags + # Match from `\n` to `\n`, handling nested tags # in between. - + [ ]{0,'.$less_than_tab.'} <('.$block_tags_b_re.')# start tag = $2 '.$attr.'> # attributes followed by > and \n @@ -429,28 +436,28 @@ class Markdown implements MarkdownInterface { # the matching end tag [ ]* # trailing spaces/tabs (?=\n+|\Z) # followed by a newline or end of document - - | # Special case just for
    . It was easier to make a special + + | # Special case just for
    . It was easier to make a special # case than to make the other regex more complicated. - + [ ]{0,'.$less_than_tab.'} <(hr) # start tag = $2 '.$attr.' # attributes /?> # the matching end tag [ ]* (?=\n{2,}|\Z) # followed by a blank line or end of document - + | # Special case for standalone HTML comments: - + [ ]{0,'.$less_than_tab.'} (?s: ) [ ]* (?=\n{2,}|\Z) # followed by a blank line or end of document - + | # PHP and ASP-style processor instructions (hashBlock($text); return "\n\n$key\n\n"; } - + /** - * Called whenever a tag must be hashed when a function insert an atomic + * Called whenever a tag must be hashed when a function insert an atomic * element in the text stream. Passing $text to through this function gives * a unique text-token which will be reverted back when calling unhash. * @@ -498,7 +505,7 @@ class Markdown implements MarkdownInterface { // Swap back any tag hash found in $text so we do not have to `unhash` // multiple times at the end. $text = $this->unhash($text); - + // Then hash the block. static $i = 0; $key = "$boundary\x1A" . ++$i . $boundary; @@ -531,10 +538,10 @@ class Markdown implements MarkdownInterface { /** * Run block gamut tranformations. * - * We need to escape raw HTML in Markdown source before doing anything - * else. This need to be done for each block, and not only at the + * We need to escape raw HTML in Markdown source before doing anything + * else. This need to be done for each block, and not only at the * begining in the Markdown function since hashed blocks can be part of - * list items and could have been indented. Indented blocks would have + * list items and could have been indented. Indented blocks would have * been seen as a code block in a previous pass of hashHTMLBlocks. * * @param string $text @@ -546,7 +553,7 @@ class Markdown implements MarkdownInterface { } /** - * Run block gamut tranformations, without hashing HTML blocks. This is + * Run block gamut tranformations, without hashing HTML blocks. This is * useful when HTML blocks are known to be already hashed, like in the first * whole-document pass. * @@ -554,11 +561,11 @@ class Markdown implements MarkdownInterface { * @return string */ protected function runBasicBlockGamut($text) { - + foreach ($this->block_gamut as $method => $priority) { $text = $this->$method($text); } - + // Finally form paragraph and restore hashed blocks. $text = $this->formParagraphs($text); @@ -582,7 +589,7 @@ class Markdown implements MarkdownInterface { [ ]* # Tailing spaces $ # End of line. }mx', - "\n".$this->hashBlock("empty_element_suffix")."\n", + "\n".$this->hashBlock("empty_element_suffix")."\n", $text ); } @@ -629,10 +636,10 @@ class Markdown implements MarkdownInterface { */ protected function doHardBreaks($text) { if ($this->hard_wrap) { - return preg_replace_callback('/ *\n/', + return preg_replace_callback('/ *\n/', array($this, '_doHardBreaks_callback'), $text); } else { - return preg_replace_callback('/ {2,}\n/', + return preg_replace_callback('/ {2,}\n/', array($this, '_doHardBreaks_callback'), $text); } } @@ -656,7 +663,7 @@ class Markdown implements MarkdownInterface { return $text; } $this->in_anchor = true; - + // First, handle reference-style links: [link text] [id] $text = preg_replace_callback('{ ( # wrap whole match in $1 @@ -729,7 +736,7 @@ class Markdown implements MarkdownInterface { // for shortcut links like [this][] or [this]. $link_id = $link_text; } - + // lower-case and turn embedded newlines into spaces $link_id = strtolower($link_id); $link_id = preg_replace('{[ ]?\n}', ' ', $link_id); @@ -737,14 +744,14 @@ class Markdown implements MarkdownInterface { if (isset($this->urls[$link_id])) { $url = $this->urls[$link_id]; $url = $this->encodeURLAttribute($url); - + $result = "titles[$link_id] ) ) { $title = $this->titles[$link_id]; $title = $this->encodeAttribute($title); $result .= " title=\"$title\""; } - + $link_text = $this->runSpanGamut($link_text); $result .= ">$link_text"; $result = $this->hashPart($result); @@ -760,16 +767,15 @@ class Markdown implements MarkdownInterface { * @return string */ protected function _doAnchors_inline_callback($matches) { - $whole_match = $matches[1]; $link_text = $this->runSpanGamut($matches[2]); - $url = $matches[3] == '' ? $matches[4] : $matches[3]; + $url = $matches[3] === '' ? $matches[4] : $matches[3]; $title =& $matches[7]; // If the URL was of the form it got caught by the HTML // tag parser and hashed. Need to reverse the process before using // the URL. $unhashed = $this->unhash($url); - if ($unhashed != $url) + if ($unhashed !== $url) $url = preg_replace('/^<(.*)>$/', '\1', $unhashed); $url = $this->encodeURLAttribute($url); @@ -779,7 +785,7 @@ class Markdown implements MarkdownInterface { $title = $this->encodeAttribute($title); $result .= " title=\"$title\""; } - + $link_text = $this->runSpanGamut($link_text); $result .= ">$link_text"; @@ -807,7 +813,7 @@ class Markdown implements MarkdownInterface { \] ) - }xs', + }xs', array($this, '_doImages_reference_callback'), $text); // Next, handle inline images: ![alt text](url "optional title") @@ -906,7 +912,7 @@ class Markdown implements MarkdownInterface { * Setext-style headers: * Header 1 * ======== - * + * * Header 2 * -------- */ @@ -944,8 +950,8 @@ class Markdown implements MarkdownInterface { if ($matches[2] == '-' && preg_match('{^-(?: |$)}', $matches[1])) { return $matches[0]; } - - $level = $matches[2]{0} == '=' ? 1 : 2; + + $level = $matches[2][0] == '=' ? 1 : 2; // ID attribute generation $idAtt = $this->_generateIdFromHeaderValue($matches[1]); @@ -977,7 +983,7 @@ class Markdown implements MarkdownInterface { * @param string $headerValue * @return string */ - protected function _generateIdFromHeaderValue($headerValue) { + protected function _generateIdFromHeaderValue($headerValue) { if (!is_callable($this->header_id_func)) { return ""; } @@ -1035,10 +1041,10 @@ class Markdown implements MarkdownInterface { ) ) '; // mx - + // We use a different prefix before nested lists than top-level lists. //See extended comment in _ProcessListItems(). - + if ($this->list_level) { $text = preg_replace_callback('{ ^ @@ -1132,7 +1138,7 @@ class Markdown implements MarkdownInterface { * without resorting to mind-reading. Perhaps the solution is to * change the syntax rules such that sub-lists must start with a * starting cardinal number; e.g. "1." or "a.". - */ + */ $this->list_level++; // Trim trailing blank lines: @@ -1166,7 +1172,7 @@ class Markdown implements MarkdownInterface { $marker_space = $matches[3]; $tailing_blank_line =& $matches[5]; - if ($leading_line || $tailing_blank_line || + if ($leading_line || $tailing_blank_line || preg_match('/\n{2,}/', $item)) { // Replace marker with the appropriate whitespace indentation @@ -1211,7 +1217,7 @@ class Markdown implements MarkdownInterface { $codeblock = $matches[1]; $codeblock = $this->outdent($codeblock); - if ($this->code_block_content_func) { + if (is_callable($this->code_block_content_func)) { $codeblock = call_user_func($this->code_block_content_func, $codeblock, ""); } else { $codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES); @@ -1230,7 +1236,7 @@ class Markdown implements MarkdownInterface { * @return string */ protected function makeCodeSpan($code) { - if ($this->code_span_content_func) { + if (is_callable($this->code_span_content_func)) { $code = call_user_func($this->code_span_content_func, $code); } else { $code = htmlspecialchars(trim($code), ENT_NOQUOTES); @@ -1273,7 +1279,7 @@ class Markdown implements MarkdownInterface { * @var array */ protected $em_strong_prepared_relist; - + /** * Prepare regular expressions for searching emphasis tokens in any * context. @@ -1289,7 +1295,7 @@ class Markdown implements MarkdownInterface { } $token_relist[] = $em_re; $token_relist[] = $strong_re; - + // Construct master expression from list. $token_re = '{(' . implode('|', $token_relist) . ')}'; $this->em_strong_prepared_relist["$em$strong"] = $token_re; @@ -1303,24 +1309,29 @@ class Markdown implements MarkdownInterface { * @return string */ protected function doItalicsAndBold($text) { + if ($this->in_emphasis_processing) { + return $text; // avoid reentrency + } + $this->in_emphasis_processing = true; + $token_stack = array(''); $text_stack = array(''); $em = ''; $strong = ''; $tree_char_em = false; - + while (1) { // Get prepared regular expression for seraching emphasis tokens // in current context. $token_re = $this->em_strong_prepared_relist["$em$strong"]; - - // Each loop iteration search for the next emphasis token. + + // Each loop iteration search for the next emphasis token. // Each token is then passed to handleSpanToken. $parts = preg_split($token_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE); $text_stack[0] .= $parts[0]; $token =& $parts[1]; $text =& $parts[2]; - + if (empty($token)) { // Reached end of text span: empty stack without emitting. // any more emphasis. @@ -1330,7 +1341,7 @@ class Markdown implements MarkdownInterface { } break; } - + $token_len = strlen($token); if ($tree_char_em) { // Reached closing marker while inside a three-char emphasis. @@ -1346,7 +1357,7 @@ class Markdown implements MarkdownInterface { } else { // Other closing marker: close one em or strong and // change current token state to match the other - $token_stack[0] = str_repeat($token{0}, 3-$token_len); + $token_stack[0] = str_repeat($token[0], 3-$token_len); $tag = $token_len == 2 ? "strong" : "em"; $span = $text_stack[0]; $span = $this->runSpanGamut($span); @@ -1369,9 +1380,9 @@ class Markdown implements MarkdownInterface { $$tag = ''; // $$tag stands for $em or $strong } } else { - // Reached opening three-char emphasis marker. Push on token + // Reached opening three-char emphasis marker. Push on token // stack; will be handled by the special condition above. - $em = $token{0}; + $em = $token[0]; $strong = "$em$em"; array_unshift($token_stack, $token); array_unshift($text_stack, ''); @@ -1383,6 +1394,7 @@ class Markdown implements MarkdownInterface { if (strlen($token_stack[0]) == 1) { $text_stack[1] .= array_shift($token_stack); $text_stack[0] .= array_shift($text_stack); + $em = ''; } // Closing strong marker: array_shift($token_stack); @@ -1417,6 +1429,7 @@ class Markdown implements MarkdownInterface { } } } + $this->in_emphasis_processing = false; return $text_stack[0]; } @@ -1453,9 +1466,9 @@ class Markdown implements MarkdownInterface { $bq = $this->runBlockGamut($bq); // recurse $bq = preg_replace('/^/m', " ", $bq); - // These leading spaces cause problem with
     content, 
    +		// These leading spaces cause problem with 
     content,
     		// so we need to fix that:
    -		$bq = preg_replace_callback('{(\s*
    .+?
    )}sx', + $bq = preg_replace_callback('{(\s*
    .+?
    )}sx', array($this, '_doBlockQuotes_callback2'), $bq); return "\n" . $this->hashBlock("
    \n$bq\n
    ") . "\n\n"; @@ -1525,7 +1538,7 @@ class Markdown implements MarkdownInterface { // // We can't call Markdown(), because that resets the hash; // // that initialization code should be pulled into its own sub, though. // $div_content = $this->hashHTMLBlocks($div_content); -// +// // // Run document gamut methods on the content. // foreach ($this->document_gamut as $method => $priority) { // $div_content = $this->$method($div_content); @@ -1562,11 +1575,11 @@ class Markdown implements MarkdownInterface { * This function is *not* suitable for attributes enclosed in single quotes. * * @param string $url - * @param string &$text Passed by reference + * @param string $text Passed by reference * @return string URL */ protected function encodeURLAttribute($url, &$text = null) { - if ($this->url_filter_func) { + if (is_callable($this->url_filter_func)) { $url = call_user_func($this->url_filter_func, $url); } @@ -1582,9 +1595,9 @@ class Markdown implements MarkdownInterface { return $url; } - + /** - * Smart processing for ampersands and angle brackets that need to + * Smart processing for ampersands and angle brackets that need to * be encoded. Valid character entities are left alone unless the * no-entities mode is set. * @param string $text @@ -1596,7 +1609,7 @@ class Markdown implements MarkdownInterface { } else { // Ampersand-encoding based entirely on Nat Irons's Amputator // MT plugin: - $text = preg_replace('/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/', + $text = preg_replace('/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/', '&', $text); } // Encode remaining <'s @@ -1680,7 +1693,7 @@ class Markdown implements MarkdownInterface { * attribute special characters by Allan Odgaard. * * @param string $text - * @param string &$tail + * @param string $tail Passed by reference * @param integer $head_length * @return string */ @@ -1724,7 +1737,7 @@ class Markdown implements MarkdownInterface { */ protected function parseSpan($str) { $output = ''; - + $span_re = '{ ( \\\\'.$this->escape_chars_re.' @@ -1752,16 +1765,16 @@ class Markdown implements MarkdownInterface { }xs'; while (1) { - // Each loop iteration seach for either the next tag, the next - // openning code span marker, or the next escaped character. + // Each loop iteration seach for either the next tag, the next + // openning code span marker, or the next escaped character. // Each token is then passed to handleSpanToken. $parts = preg_split($span_re, $str, 2, PREG_SPLIT_DELIM_CAPTURE); - + // Create token from text preceding tag. if ($parts[0] != "") { $output .= $parts[0]; } - + // Check if we reach the end. if (isset($parts[1])) { $output .= $this->handleSpanToken($parts[1], $parts[2]); @@ -1770,7 +1783,7 @@ class Markdown implements MarkdownInterface { break; } } - + return $output; } @@ -1778,16 +1791,16 @@ class Markdown implements MarkdownInterface { * Handle $token provided by parseSpan by determining its nature and * returning the corresponding value that should replace it. * @param string $token - * @param string &$str + * @param string $str Passed by reference * @return string */ protected function handleSpanToken($token, &$str) { - switch ($token{0}) { + switch ($token[0]) { case "\\": - return $this->hashPart("&#". ord($token{1}). ";"); + return $this->hashPart("&#". ord($token[1]). ";"); case "`": // Search for end marker in remaining text. - if (preg_match('/^(.*?[^`])'.preg_quote($token).'(?!`)(.*)$/sm', + if (preg_match('/^(.*?[^`])'.preg_quote($token).'(?!`)(.*)$/sm', $str, $matches)) { $str = $matches[2]; @@ -1823,11 +1836,11 @@ class Markdown implements MarkdownInterface { * For each line we separate the line in blocks delemited by tab characters. * Then we reconstruct every line by adding the appropriate number of space * between each blocks. - * + * * @param string $text * @return string */ - protected function detab($text) { + protected function detab($text) { $text = preg_replace_callback('/^.*\t.*$/m', array($this, '_detab_callback'), $text); @@ -1842,7 +1855,7 @@ class Markdown implements MarkdownInterface { protected function _detab_callback($matches) { $line = $matches[0]; $strlen = $this->utf8_strlen; // strlen function for UTF-8. - + // Split in blocks. $blocks = explode("\t", $line); // Add each blocks to the line. @@ -1850,7 +1863,7 @@ class Markdown implements MarkdownInterface { unset($blocks[0]); // Do not add first block twice. foreach ($blocks as $block) { // Calculate amount of space, insert spaces, insert block. - $amount = $this->tab_width - + $amount = $this->tab_width - $strlen($line, 'UTF-8') % $this->tab_width; $line .= str_repeat(" ", $amount) . $block; } @@ -1859,20 +1872,20 @@ class Markdown implements MarkdownInterface { /** * Check for the availability of the function in the `utf8_strlen` property - * (initially `mb_strlen`). If the function is not available, create a + * (initially `mb_strlen`). If the function is not available, create a * function that will loosely count the number of UTF-8 characters with a * regular expression. * @return void */ protected function _initDetab() { - + if (function_exists($this->utf8_strlen)) { return; } - $this->utf8_strlen = create_function('$text', 'return preg_match_all( - "/[\\\\x00-\\\\xBF]|[\\\\xC0-\\\\xFF][\\\\x80-\\\\xBF]*/", - $text, $m);'); + $this->utf8_strlen = function($text) { + return preg_match_all('/[\x00-\xBF]|[\xC0-\xFF][\x80-\xBF]*/', $text, $m); + }; } /** @@ -1881,7 +1894,7 @@ class Markdown implements MarkdownInterface { * @return string */ protected function unhash($text) { - return preg_replace_callback('/(.)\x1A[0-9]+\1/', + return preg_replace_callback('/(.)\x1A[0-9]+\1/', array($this, '_unhash_callback'), $text); } diff --git a/bb-vendor/michelf/php-markdown/Michelf/MarkdownExtra.php b/bb-vendor/michelf/php-markdown/Michelf/MarkdownExtra.php index ac6b1b4f2..62d25f38e 100644 --- a/bb-vendor/michelf/php-markdown/Michelf/MarkdownExtra.php +++ b/bb-vendor/michelf/php-markdown/Michelf/MarkdownExtra.php @@ -4,7 +4,7 @@ * * @package php-markdown * @author Michel Fortin - * @copyright 2004-2016 Michel Fortin + * @copyright 2004-2019 Michel Fortin * @copyright (Original Markdown) 2004-2006 John Gruber */ @@ -23,14 +23,13 @@ class MarkdownExtra extends \Michelf\Markdown { * @var string */ public $fn_id_prefix = ""; - + /** - * Optional title attribute for footnote links and backlinks. + * Optional title attribute for footnote links. * @var string */ - public $fn_link_title = ""; - public $fn_backlink_title = ""; - + public $fn_link_title = ""; + /** * Optional class attribute for footnote links and backlinks. * @var string @@ -42,10 +41,22 @@ class MarkdownExtra extends \Michelf\Markdown { * Content to be displayed within footnote backlinks. The default is '↩'; * the U+FE0E on the end is a Unicode variant selector used to prevent iOS * from displaying the arrow character as an emoji. + * Optionally use '^^' and '%%' to refer to the footnote number and + * reference number respectively. {@see parseFootnotePlaceholders()} * @var string */ public $fn_backlink_html = '↩︎'; + /** + * Optional title and aria-label attributes for footnote backlinks for + * added accessibility (to ensure backlink uniqueness). + * Use '^^' and '%%' to refer to the footnote number and reference number + * respectively. {@see parseFootnotePlaceholders()} + * @var string + */ + public $fn_backlink_title = ""; + public $fn_backlink_label = ""; + /** * Class name for table cell alignment (%% replaced left/center/right) * For instance: 'go-%%' becomes 'go-left' or 'go-right' or 'go-center' @@ -73,20 +84,47 @@ class MarkdownExtra extends \Michelf\Markdown { */ public $predef_abbr = array(); + /** + * Only convert atx-style headers if there's a space between the header and # + * @var boolean + */ + public $hashtag_protection = false; + + /** + * Determines whether footnotes should be appended to the end of the document. + * If true, footnote html can be retrieved from $this->footnotes_assembled. + * @var boolean + */ + public $omit_footnotes = false; + + + /** + * After parsing, the HTML for the list of footnotes appears here. + * This is available only if $omit_footnotes == true. + * + * Note: when placing the content of `footnotes_assembled` on the page, + * consider adding the attribute `role="doc-endnotes"` to the `div` or + * `section` that will enclose the list of footnotes so they are + * reachable to accessibility tools the same way they would be with the + * default HTML output. + * @var null|string + */ + public $footnotes_assembled = null; + /** * Parser implementation */ - + /** * Constructor function. Initialize the parser object. * @return void */ public function __construct() { - // Add extra escapable characters before parent constructor + // Add extra escapable characters before parent constructor // initialize the table. $this->escape_chars .= ':|'; - - // Insert extra document, block, and span transformations. + + // Insert extra document, block, and span transformations. // Parent constructor will do the sorting. $this->document_gamut += array( "doFencedCodeBlocks" => 5, @@ -103,12 +141,12 @@ class MarkdownExtra extends \Michelf\Markdown { "doFootnotes" => 5, "doAbbreviations" => 70, ); - + $this->enhanced_ordered_list = true; parent::__construct(); } - - + + /** * Extra variables used during extra transformations. * @var array @@ -118,21 +156,27 @@ class MarkdownExtra extends \Michelf\Markdown { protected $footnotes_ref_count = array(); protected $footnotes_numbers = array(); protected $abbr_desciptions = array(); - /** @var @string */ + /** @var string */ protected $abbr_word_re = ''; - + /** * Give the current footnote number. * @var integer */ protected $footnote_counter = 1; - + + /** + * Ref attribute for links + * @var array + */ + protected $ref_attr = array(); + /** * Setting up Extra-specific variables. */ protected function setup() { parent::setup(); - + $this->footnotes = array(); $this->footnotes_ordered = array(); $this->footnotes_ref_count = array(); @@ -140,7 +184,8 @@ class MarkdownExtra extends \Michelf\Markdown { $this->abbr_desciptions = array(); $this->abbr_word_re = ''; $this->footnote_counter = 1; - + $this->footnotes_assembled = null; + foreach ($this->predef_abbr as $abbr_word => $abbr_desc) { if ($this->abbr_word_re) $this->abbr_word_re .= '|'; @@ -159,11 +204,14 @@ class MarkdownExtra extends \Michelf\Markdown { $this->footnotes_numbers = array(); $this->abbr_desciptions = array(); $this->abbr_word_re = ''; - + + if ( ! $this->omit_footnotes ) + $this->footnotes_assembled = null; + parent::teardown(); } - - + + /** * Extra attribute parser */ @@ -196,8 +244,10 @@ class MarkdownExtra extends \Michelf\Markdown { * @return string */ protected function doExtraAttributes($tag_name, $attr, $defaultIdValue = null, $classes = array()) { - if (empty($attr) && !$defaultIdValue && empty($classes)) return ""; - + if (empty($attr) && !$defaultIdValue && empty($classes)) { + return ""; + } + // Split on components preg_match_all('/[#.a-z][-_:a-zA-Z0-9=]+/', $attr, $matches); $elements = $matches[0]; @@ -206,9 +256,9 @@ class MarkdownExtra extends \Michelf\Markdown { $attributes = array(); $id = false; foreach ($elements as $element) { - if ($element{0} == '.') { + if ($element[0] === '.') { $classes[] = substr($element, 1); - } else if ($element{0} == '#') { + } else if ($element[0] === '#') { if ($id === false) $id = substr($element, 1); } else if (strpos($element, '=') > 0) { $parts = explode('=', $element, 2); @@ -216,7 +266,9 @@ class MarkdownExtra extends \Michelf\Markdown { } } - if (!$id) $id = $defaultIdValue; + if ($id === false || $id === '') { + $id = $defaultIdValue; + } // Compose attributes as string $attr_str = ""; @@ -288,38 +340,38 @@ class MarkdownExtra extends \Michelf\Markdown { /** * HTML block parser */ - + /** * Tags that are always treated as block tags * @var string */ protected $block_tags_re = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|form|fieldset|iframe|hr|legend|article|section|nav|aside|hgroup|header|footer|figcaption|figure'; - + /** * Tags treated as block tags only if the opening tag is alone on its line * @var string */ protected $context_block_tags_re = 'script|noscript|style|ins|del|iframe|object|source|track|param|math|svg|canvas|audio|video'; - + /** * Tags where markdown="1" default to span mode: * @var string */ protected $contain_span_tags_re = 'p|h[1-6]|li|dd|dt|td|th|legend|address'; - + /** * Tags which must not have their contents modified, no matter where * they appear * @var string */ protected $clean_tags_re = 'script|style|math|svg'; - + /** * Tags that do not need to be closed. * @var string */ protected $auto_close_tags_re = 'hr|img|param|source|track'; - + /** * Hashify HTML Blocks and "clean tags". * @@ -330,7 +382,7 @@ class MarkdownExtra extends \Michelf\Markdown { * hard-coded. * * This works by calling _HashHTMLBlocks_InMarkdown, which then calls - * _HashHTMLBlocks_InHTML when it encounter block tags. When the markdown="1" + * _HashHTMLBlocks_InHTML when it encounter block tags. When the markdown="1" * attribute is found within a tag, _HashHTMLBlocks_InHTML calls back * _HashHTMLBlocks_InMarkdown to handle the Markdown syntax within the tag. * These two functions are calling each other. It's recursive! @@ -344,15 +396,15 @@ class MarkdownExtra extends \Michelf\Markdown { // Call the HTML-in-Markdown hasher. list($text, ) = $this->_hashHTMLBlocks_inMarkdown($text); - + return $text; } /** * Parse markdown text, calling _HashHTMLBlocks_InHTML for block tags. * - * * $indent is the number of space to be ignored when checking for code - * blocks. This is important because if we don't take the indent into + * * $indent is the number of space to be ignored when checking for code + * blocks. This is important because if we don't take the indent into * account, something like this (which looks right) won't work as expected: * *
    @@ -364,11 +416,11 @@ class MarkdownExtra extends \Michelf\Markdown { * If you don't like this, just don't indent the tag on which * you apply the markdown="1" attribute. * - * * If $enclosing_tag_re is not empty, stops at the first unmatched closing + * * If $enclosing_tag_re is not empty, stops at the first unmatched closing * tag with that name. Nested tags supported. * - * * If $span is true, text inside must treated as span. So any double - * newline will be replaced by a single newline so that it does not create + * * If $span is true, text inside must treated as span. So any double + * newline will be replaced by a single newline so that it does not create * paragraphs. * * Returns an array of that form: ( processed text , remaining text ) @@ -382,18 +434,18 @@ class MarkdownExtra extends \Michelf\Markdown { protected function _hashHTMLBlocks_inMarkdown($text, $indent = 0, $enclosing_tag_re = '', $span = false) { - + if ($text === '') return array('', ''); // Regex to check for the presense of newlines around a block tag. $newline_before_re = '/(?:^\n?|\n\n)*$/'; - $newline_after_re = + $newline_after_re = '{ ^ # Start of text following the tag. (?>[ ]*)? # Optional comment. [ ]*\n # Must be followed by newline. }xs'; - + // Regex to match any tag. $block_tag_re = '{ @@ -448,7 +500,7 @@ class MarkdownExtra extends \Michelf\Markdown { ) }xs'; - + $depth = 0; // Current depth inside the tag tree. $parsed = ""; // Parsed text that will be returned. @@ -457,31 +509,30 @@ class MarkdownExtra extends \Michelf\Markdown { do { // Split the text using the first $tag_match pattern found. // Text before pattern will be first in the array, text after - // pattern will be at the end, and between will be any catches made + // pattern will be at the end, and between will be any catches made // by the pattern. - $parts = preg_split($block_tag_re, $text, 2, + $parts = preg_split($block_tag_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE); - - // If in Markdown span mode, add a empty-string span-level hash + + // If in Markdown span mode, add a empty-string span-level hash // after each newline to prevent triggering any block element. if ($span) { $void = $this->hashPart("", ':'); $newline = "\n$void"; $parts[0] = $void . str_replace("\n", $newline, $parts[0]) . $void; } - + $parsed .= $parts[0]; // Text before current tag. - + // If end of $text has been reached. Stop loop. if (count($parts) < 3) { $text = ""; break; } - + $tag = $parts[1]; // Tag to handle. $text = $parts[2]; // Remaining text after current tag. - $tag_re = preg_quote($tag); // For use in a regular expression. - + // Check for: Fenced code block marker. // Note: need to recheck the whole tag to disambiguate backtick // fences from code spans @@ -490,7 +541,7 @@ class MarkdownExtra extends \Michelf\Markdown { $fence_indent = strlen($capture[1]); // use captured indent in re $fence_re = $capture[2]; // use captured fence in re if (preg_match('{^(?>.*\n)*?[ ]{' . ($fence_indent) . '}' . $fence_re . '[ ]*(?:\n|$)}', $text, - $matches)) + $matches)) { // End marker found: pass text unchanged until marker. $parsed .= $tag . $matches[0]; @@ -502,14 +553,14 @@ class MarkdownExtra extends \Michelf\Markdown { } } // Check for: Indented code block. - else if ($tag{0} == "\n" || $tag{0} == " ") { - // Indented code block: pass it unchanged, will be handled + else if ($tag[0] === "\n" || $tag[0] === " ") { + // Indented code block: pass it unchanged, will be handled // later. $parsed .= $tag; } // Check for: Code span marker // Note: need to check this after backtick fenced code blocks - else if ($tag{0} == "`") { + else if ($tag[0] === "`") { // Find corresponding end marker. $tag_re = preg_quote($tag); if (preg_match('{^(?>.+?|\n(?!\n))*?(?block_tags_re . ')\b}', $tag) || ( preg_match('{^<(?:' . $this->context_block_tags_re . ')\b}', $tag) && @@ -534,22 +585,22 @@ class MarkdownExtra extends \Michelf\Markdown { ) { // Need to parse tag and following text using the HTML parser. - list($block_text, $text) = + list($block_text, $text) = $this->_hashHTMLBlocks_inHTML($tag . $text, "hashBlock", true); - + // Make sure it stays outside of any paragraph by adding newlines. $parsed .= "\n\n$block_text\n\n"; } // Check for: Clean tag (like script, math) // HTML Comments, processing instructions. else if (preg_match('{^<(?:' . $this->clean_tags_re . ')\b}', $tag) || - $tag{1} == '!' || $tag{1} == '?') + $tag[1] === '!' || $tag[1] === '?') { // Need to parse tag and following text using the HTML parser. // (don't check for markdown attribute) - list($block_text, $text) = + list($block_text, $text) = $this->_hashHTMLBlocks_inHTML($tag . $text, "hashClean", false); - + $parsed .= $block_text; } // Check for: Tag with same name as enclosing tag. @@ -558,8 +609,11 @@ class MarkdownExtra extends \Michelf\Markdown { preg_match('{^= 0); - + return array($parsed, $text); } @@ -589,12 +643,12 @@ class MarkdownExtra extends \Michelf\Markdown { * Returns an array of that form: ( processed text , remaining text ) * @param string $text * @param string $hash_method - * @param string $md_attr + * @param bool $md_attr Handle `markdown="1"` attribute * @return array */ protected function _hashHTMLBlocks_inHTML($text, $hash_method, $md_attr) { if ($text === '') return array('', ''); - + // Regex to match `markdown` attribute inside of a tag. $markdown_attr_re = ' { @@ -602,15 +656,15 @@ class MarkdownExtra extends \Michelf\Markdown { markdown \s*=\s* (?> - (["\']) # $1: quote delimiter + (["\']) # $1: quote delimiter (.*?) # $2: attribute value - \1 # matching delimiter + \1 # matching delimiter | ([^\s>]*) # $3: unquoted attribute value ) () # $4: make $3 always defined (avoid warnings) }xs'; - + // Regex to match any tag. $tag_re = '{ ( # $2: Capture whole tag. @@ -633,12 +687,13 @@ class MarkdownExtra extends \Michelf\Markdown { # CData Block ) }xs'; - + $original_text = $text; // Save original text in case of faliure. - + $depth = 0; // Current depth inside the tag tree. $block_text = ""; // Temporary text holder for current text. $parsed = ""; // Parsed text that will be returned. + $base_tag_name_re = ''; // Get the name of the starting tag. // (This pattern makes $base_tag_name_re safe without quoting.) @@ -649,26 +704,26 @@ class MarkdownExtra extends \Michelf\Markdown { do { // Split the text using the first $tag_match pattern found. // Text before pattern will be first in the array, text after - // pattern will be at the end, and between will be any catches made + // pattern will be at the end, and between will be any catches made // by the pattern. $parts = preg_split($tag_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE); - + if (count($parts) < 3) { // End of $text reached with unbalenced tag(s). // In that case, we return original text unchanged and pass the - // first character as filtered to prevent an infinite loop in the + // first character as filtered to prevent an infinite loop in the // parent function. - return array($original_text{0}, substr($original_text, 1)); + return array($original_text[0], substr($original_text, 1)); } - + $block_text .= $parts[0]; // Text before current tag. $tag = $parts[1]; // Tag to handle. $text = $parts[2]; // Remaining text after current tag. - + // Check for: Auto-close tag (like
    ) // Comments and Processing Instructions. if (preg_match('{^auto_close_tags_re . ')\b}', $tag) || - $tag{1} == '!' || $tag{1} == '?') + $tag[1] === '!' || $tag[1] === '?') { // Just add the tag to the block as if it was text. $block_text .= $tag; @@ -677,23 +732,26 @@ class MarkdownExtra extends \Michelf\Markdown { // Increase/decrease nested tag count. Only do so if // the tag's name match base tag's. if (preg_match('{^mode = $attr_m[2] . $attr_m[3]; - $span_mode = $this->mode == 'span' || $this->mode != 'block' && - preg_match('{^<(?:' . $this->contain_span_tags_re . ')\b}', $tag); - + $mode = $attr_m[2] . $attr_m[3]; + $span_mode = $mode === 'span' || ($mode !== 'block' && + preg_match('{^<(?:' . $this->contain_span_tags_re . ')\b}', $tag)); + // Calculate indent before tag. if (preg_match('/(?:^|\n)( *?)(?! ).*?$/', $block_text, $matches)) { $strlen = $this->utf8_strlen; @@ -701,48 +759,51 @@ class MarkdownExtra extends \Michelf\Markdown { } else { $indent = 0; } - + // End preceding block with this tag. $block_text .= $tag; $parsed .= $this->$hash_method($block_text); - + // Get enclosing tag name for the ParseMarkdown function. // (This pattern makes $tag_name_re safe without quoting.) preg_match('/^<([\w:$]*)\b/', $tag, $matches); $tag_name_re = $matches[1]; - + // Parse the content using the HTML-in-Markdown parser. list ($block_text, $text) - = $this->_hashHTMLBlocks_inMarkdown($text, $indent, + = $this->_hashHTMLBlocks_inMarkdown($text, $indent, $tag_name_re, $span_mode); - + // Outdent markdown text. if ($indent > 0) { - $block_text = preg_replace("/^[ ]{1,$indent}/m", "", + $block_text = preg_replace("/^[ ]{1,$indent}/m", "", $block_text); } - + // Append tag content to parsed text. - if (!$span_mode) $parsed .= "\n\n$block_text\n\n"; - else $parsed .= "$block_text"; - + if (!$span_mode) { + $parsed .= "\n\n$block_text\n\n"; + } else { + $parsed .= (string) $block_text; + } + // Start over with a new block. $block_text = ""; } else $block_text .= $tag; } - + } while ($depth > 0); - + // Hash last block text that wasn't processed inside the loop. $parsed .= $this->$hash_method($block_text); - + return array($parsed, $text); } /** * Called whenever a tag must be hashed when a function inserts a "clean" tag - * in $text, it passes through this function and is automaticaly escaped, + * in $text, it passes through this function and is automaticaly escaped, * blocking invalid nested overlap. * @param string $text * @return string @@ -835,7 +896,7 @@ class MarkdownExtra extends \Michelf\Markdown { // for shortcut links like [this][] or [this]. $link_id = $link_text; } - + // lower-case and turn embedded newlines into spaces $link_id = strtolower($link_id); $link_id = preg_replace('{[ ]?\n}', ' ', $link_id); @@ -843,7 +904,7 @@ class MarkdownExtra extends \Michelf\Markdown { if (isset($this->urls[$link_id])) { $url = $this->urls[$link_id]; $url = $this->encodeURLAttribute($url); - + $result = "titles[$link_id] ) ) { $title = $this->titles[$link_id]; @@ -852,7 +913,7 @@ class MarkdownExtra extends \Michelf\Markdown { } if (isset($this->ref_attr[$link_id])) $result .= $this->ref_attr[$link_id]; - + $link_text = $this->runSpanGamut($link_text); $result .= ">$link_text"; $result = $this->hashPart($result); @@ -869,16 +930,15 @@ class MarkdownExtra extends \Michelf\Markdown { * @return string */ protected function _doAnchors_inline_callback($matches) { - $whole_match = $matches[1]; $link_text = $this->runSpanGamut($matches[2]); - $url = $matches[3] == '' ? $matches[4] : $matches[3]; + $url = $matches[3] === '' ? $matches[4] : $matches[3]; $title =& $matches[7]; $attr = $this->doExtraAttributes("a", $dummy =& $matches[8]); // if the URL was of the form it got caught by the HTML // tag parser and hashed. Need to reverse the process before using the URL. $unhashed = $this->unhash($url); - if ($unhashed != $url) + if ($unhashed !== $url) $url = preg_replace('/^<(.*)>$/', '\1', $unhashed); $url = $this->encodeURLAttribute($url); @@ -889,7 +949,7 @@ class MarkdownExtra extends \Michelf\Markdown { $result .= " title=\"$title\""; } $result .= $attr; - + $link_text = $this->runSpanGamut($link_text); $result .= ">$link_text"; @@ -917,7 +977,7 @@ class MarkdownExtra extends \Michelf\Markdown { \] ) - }xs', + }xs', array($this, '_doImages_reference_callback'), $text); // Next, handle inline images: ![alt text](url "optional title") @@ -961,7 +1021,7 @@ class MarkdownExtra extends \Michelf\Markdown { $alt_text = $matches[2]; $link_id = strtolower($matches[3]); - if ($link_id == "") { + if ($link_id === "") { $link_id = strtolower($alt_text); // for shortcut links like ![this][]. } @@ -974,8 +1034,9 @@ class MarkdownExtra extends \Michelf\Markdown { $title = $this->encodeAttribute($title); $result .= " title=\"$title\""; } - if (isset($this->ref_attr[$link_id])) + if (isset($this->ref_attr[$link_id])) { $result .= $this->ref_attr[$link_id]; + } $result .= $this->empty_element_suffix; $result = $this->hashPart($result); } @@ -993,9 +1054,8 @@ class MarkdownExtra extends \Michelf\Markdown { * @return string */ protected function _doImages_inline_callback($matches) { - $whole_match = $matches[1]; $alt_text = $matches[2]; - $url = $matches[3] == '' ? $matches[4] : $matches[3]; + $url = $matches[3] === '' ? $matches[4] : $matches[3]; $title =& $matches[7]; $attr = $this->doExtraAttributes("img", $dummy =& $matches[8]); @@ -1021,7 +1081,7 @@ class MarkdownExtra extends \Michelf\Markdown { // Setext-style headers: // Header 1 {#header1} // ======== - // + // // Header 2 {#header2 .class1 .class2} // -------- // @@ -1042,7 +1102,7 @@ class MarkdownExtra extends \Michelf\Markdown { // $text = preg_replace_callback('{ ^(\#{1,6}) # $1 = string of #\'s - [ ]* + [ ]'.($this->hashtag_protection ? '+' : '*').' (.+?) # $2 = Header text [ ]* \#* # optional closing #\'s (not counted) @@ -1061,11 +1121,11 @@ class MarkdownExtra extends \Michelf\Markdown { * @return string */ protected function _doHeaders_callback_setext($matches) { - if ($matches[3] == '-' && preg_match('{^- }', $matches[1])) { + if ($matches[3] === '-' && preg_match('{^- }', $matches[1])) { return $matches[0]; } - $level = $matches[3]{0} == '=' ? 1 : 2; + $level = $matches[3][0] === '=' ? 1 : 2; $defaultId = is_callable($this->header_id_func) ? call_user_func($this->header_id_func, $matches[1]) : null; @@ -1107,10 +1167,10 @@ class MarkdownExtra extends \Michelf\Markdown { [ ]{0,' . $less_than_tab . '} # Allowed whitespace. [|] # Optional leading pipe (present) (.+) \n # $1: Header row (at least one pipe) - + [ ]{0,' . $less_than_tab . '} # Allowed whitespace. [|] ([ ]*[-:]+[-| :]*) \n # $2: Header underline - + ( # $3: Cells (?> [ ]* # Allowed whitespace. @@ -1132,10 +1192,10 @@ class MarkdownExtra extends \Michelf\Markdown { ^ # Start of a line [ ]{0,' . $less_than_tab . '} # Allowed whitespace. (\S.*[|].*) \n # $1: Header row (at least one pipe) - + [ ]{0,' . $less_than_tab . '} # Allowed whitespace. ([-:]+[ ]*[|][-| :]*) \n # $2: Header underline - + ( # $3: Cells (?> .* [|] .* \n # Row content @@ -1159,7 +1219,7 @@ class MarkdownExtra extends \Michelf\Markdown { $content = $matches[3]; $content = preg_replace('/^ *[|]/m', '', $content); - + return $this->_doTable_callback(array($matches[0], $head, $underline, $content)); } @@ -1168,8 +1228,7 @@ class MarkdownExtra extends \Michelf\Markdown { * @param string $alignname * @return string */ - protected function _doTable_makeAlignAttr($alignname) - { + protected function _doTable_makeAlignAttr($alignname) { if (empty($this->table_align_class_tmpl)) { return " align=\"$alignname\""; } @@ -1192,7 +1251,7 @@ class MarkdownExtra extends \Michelf\Markdown { $head = preg_replace('/[|] *$/m', '', $head); $underline = preg_replace('/[|] *$/m', '', $underline); $content = preg_replace('/[|] *$/m', '', $content); - + // Reading alignement from header underline. $separators = preg_split('/ *[|] */', $underline); foreach ($separators as $n => $s) { @@ -1205,44 +1264,46 @@ class MarkdownExtra extends \Michelf\Markdown { else $attr[$n] = ''; } - - // Parsing span elements, including code spans, character escapes, + + // Parsing span elements, including code spans, character escapes, // and inline HTML tags, so that pipes inside those gets ignored. $head = $this->parseSpan($head); $headers = preg_split('/ *[|] */', $head); $col_count = count($headers); $attr = array_pad($attr, $col_count, ''); - + // Write column headers. $text = "\n"; $text .= "\n"; $text .= "\n"; - foreach ($headers as $n => $header) + foreach ($headers as $n => $header) { $text .= " " . $this->runSpanGamut(trim($header)) . "\n"; + } $text .= "\n"; $text .= "\n"; - + // Split content by row. $rows = explode("\n", trim($content, "\n")); - + $text .= "\n"; foreach ($rows as $row) { - // Parsing span elements, including code spans, character escapes, + // Parsing span elements, including code spans, character escapes, // and inline HTML tags, so that pipes inside those gets ignored. $row = $this->parseSpan($row); - + // Split row by cell. $row_cells = preg_split('/ *[|] */', $row, $col_count); $row_cells = array_pad($row_cells, $col_count, ''); - + $text .= "\n"; - foreach ($row_cells as $n => $cell) + foreach ($row_cells as $n => $cell) { $text .= " " . $this->runSpanGamut(trim($cell)) . "\n"; + } $text .= "\n"; } $text .= "\n"; $text .= "
    "; - + return $this->hashBlock($text) . "\n"; } @@ -1299,7 +1360,7 @@ class MarkdownExtra extends \Michelf\Markdown { protected function _doDefLists_callback($matches) { // Re-usable patterns to match list item bullets and number markers: $list = $matches[1]; - + // Turn double returns into triple returns, so that we can make a // paragraph for the last item in a list, if necessary: $result = trim($this->processDefListItems($list)); @@ -1314,9 +1375,9 @@ class MarkdownExtra extends \Michelf\Markdown { * @return string */ protected function processDefListItems($list_str) { - + $less_than_tab = $this->tab_width - 1; - + // Trim trailing blank lines: $list_str = preg_replace("/\n{2,}\\z/", "\n", $list_str); @@ -1327,9 +1388,9 @@ class MarkdownExtra extends \Michelf\Markdown { [ ]{0,' . $less_than_tab . '} # leading whitespace (?!\:[ ]|[ ]) # negative lookahead for a definition # mark (colon) or more whitespace. - (?> \S.* \n)+? # actual term (not whitespace). - ) - (?=\n?[ ]{0,3}:[ ]) # lookahead for following line feed + (?> \S.* \n)+? # actual term (not whitespace). + ) + (?=\n?[ ]{0,3}:[ ]) # lookahead for following line feed # with a definition mark. }xm', array($this, '_processDefListItems_callback_dt'), $list_str); @@ -1346,8 +1407,8 @@ class MarkdownExtra extends \Michelf\Markdown { (?: # next term or end of text [ ]{0,' . $less_than_tab . '} \:[ ] |
    | \z - ) - ) + ) + ) }xm', array($this, '_processDefListItems_callback_dd'), $list_str); @@ -1399,14 +1460,12 @@ class MarkdownExtra extends \Michelf\Markdown { * ~~~ * Code block * ~~~ - * + * * @param string $text * @return string */ protected function doFencedCodeBlocks($text) { - - $less_than_tab = $this->tab_width; - + $text = preg_replace_callback('{ (?:\n|\A) # 1: Opening marker @@ -1422,7 +1481,7 @@ class MarkdownExtra extends \Michelf\Markdown { ' . $this->id_class_attr_catch_re . ' # 3: Extra attributes )? [ ]* \n # Whitespace and newline following marker. - + # 4: Content ( (?> @@ -1430,7 +1489,7 @@ class MarkdownExtra extends \Michelf\Markdown { .*\n+ )+ ) - + # Closing marker. \1 [ ]* (?= \n ) }xm', @@ -1459,16 +1518,17 @@ class MarkdownExtra extends \Michelf\Markdown { array($this, '_doFencedCodeBlocks_newlines'), $codeblock); $classes = array(); - if ($classname != "") { - if ($classname{0} == '.') + if ($classname !== "") { + if ($classname[0] === '.') { $classname = substr($classname, 1); + } $classes[] = $this->code_class_prefix . $classname; } $attr_str = $this->doExtraAttributes($this->code_attr_on_pre ? "pre" : "code", $attrs, null, $classes); $pre_attr_str = $this->code_attr_on_pre ? $attr_str : ''; $code_attr_str = $this->code_attr_on_pre ? '' : $attr_str; $codeblock = "$codeblock
    "; - + return "\n\n".$this->hashBlock($codeblock)."\n\n"; } @@ -1478,7 +1538,7 @@ class MarkdownExtra extends \Michelf\Markdown { * @return string */ protected function _doFencedCodeBlocks_newlines($matches) { - return str_repeat("empty_element_suffix", + return str_repeat("empty_element_suffix", strlen($matches[0])); } @@ -1518,27 +1578,27 @@ class MarkdownExtra extends \Michelf\Markdown { // Wrap

    tags and unhashify HTML blocks foreach ($grafs as $key => $value) { $value = trim($this->runSpanGamut($value)); - + // Check if this should be enclosed in a paragraph. // Clean tag hashes & block tag hashes are left alone. $is_p = $wrap_in_p && !preg_match('/^B\x1A[0-9]+B|^C\x1A[0-9]+C$/', $value); - + if ($is_p) { $value = "

    $value

    "; } $grafs[$key] = $value; } - - // Join grafs in one text, then unhash HTML tags. + + // Join grafs in one text, then unhash HTML tags. $text = implode("\n\n", $grafs); - + // Finish by removing any tag hashes still present in $text. $text = $this->unhash($text); - + return $text; } - - + + /** * Footnotes - Strips link definitions from text, stores the URLs and * titles in hash references. @@ -1554,15 +1614,15 @@ class MarkdownExtra extends \Michelf\Markdown { [ ]* \n? # maybe *one* newline ( # text = $2 (no blank lines allowed) - (?: + (?: .+ # actual text | - \n # newlines but + \n # newlines but (?!\[.+?\][ ]?:\s)# negative lookahead for footnote or link definition marker. - (?!\n+[ ]{0,3}\S)# ensure line is not blank and followed + (?!\n+[ ]{0,3}\S)# ensure line is not blank and followed # by non-indented content )* - ) + ) }xm', array($this, '_stripFootnotes_callback'), $text); @@ -1581,7 +1641,7 @@ class MarkdownExtra extends \Michelf\Markdown { } /** - * Replace footnote references in $text [^id] with a special text-token + * Replace footnote references in $text [^id] with a special text-token * which will be replaced by the actual footnote marker in appendFootnotes. * @param string $text * @return string @@ -1599,66 +1659,98 @@ class MarkdownExtra extends \Michelf\Markdown { * @return string */ protected function appendFootnotes($text) { - $text = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}', + $text = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}', array($this, '_appendFootnotes_callback'), $text); - - if (!empty($this->footnotes_ordered)) { - $text .= "\n\n"; - $text .= "
    \n"; - $text .= "empty_element_suffix . "\n"; - $text .= "
      \n\n"; - $attr = ""; - if ($this->fn_backlink_class != "") { - $class = $this->fn_backlink_class; - $class = $this->encodeAttribute($class); - $attr .= " class=\"$class\""; + if ( ! empty( $this->footnotes_ordered ) ) { + $this->_doFootnotes(); + if ( ! $this->omit_footnotes ) { + $text .= "\n\n"; + $text .= "
      \n"; + $text .= "empty_element_suffix . "\n"; + $text .= $this->footnotes_assembled; + $text .= "
      "; } - if ($this->fn_backlink_title != "") { - $title = $this->fn_backlink_title; - $title = $this->encodeAttribute($title); - $attr .= " title=\"$title\""; - } - $backlink_text = $this->fn_backlink_html; - $num = 0; - - while (!empty($this->footnotes_ordered)) { - $footnote = reset($this->footnotes_ordered); - $note_id = key($this->footnotes_ordered); - unset($this->footnotes_ordered[$note_id]); - $ref_count = $this->footnotes_ref_count[$note_id]; - unset($this->footnotes_ref_count[$note_id]); - unset($this->footnotes[$note_id]); - - $footnote .= "\n"; // Need to append newline before parsing. - $footnote = $this->runBlockGamut("$footnote\n"); - $footnote = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}', - array($this, '_appendFootnotes_callback'), $footnote); - - $attr = str_replace("%%", ++$num, $attr); - $note_id = $this->encodeAttribute($note_id); + } + return $text; + } - // Prepare backlink, multiple backlinks if multiple references - $backlink = "$backlink_text"; - for ($ref_num = 2; $ref_num <= $ref_count; ++$ref_num) { - $backlink .= " $backlink_text"; + + /** + * Generates the HTML for footnotes. Called by appendFootnotes, even if + * footnotes are not being appended. + * @return void + */ + protected function _doFootnotes() { + $attr = array(); + if ($this->fn_backlink_class !== "") { + $class = $this->fn_backlink_class; + $class = $this->encodeAttribute($class); + $attr['class'] = " class=\"$class\""; + } + $attr['role'] = " role=\"doc-backlink\""; + $num = 0; + + $text = "
        \n\n"; + while (!empty($this->footnotes_ordered)) { + $footnote = reset($this->footnotes_ordered); + $note_id = key($this->footnotes_ordered); + unset($this->footnotes_ordered[$note_id]); + $ref_count = $this->footnotes_ref_count[$note_id]; + unset($this->footnotes_ref_count[$note_id]); + unset($this->footnotes[$note_id]); + + $footnote .= "\n"; // Need to append newline before parsing. + $footnote = $this->runBlockGamut("$footnote\n"); + $footnote = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}', + array($this, '_appendFootnotes_callback'), $footnote); + + $num++; + $note_id = $this->encodeAttribute($note_id); + + // Prepare backlink, multiple backlinks if multiple references + // Do not create empty backlinks if the html is blank + $backlink = ""; + if (!empty($this->fn_backlink_html)) { + for ($ref_num = 1; $ref_num <= $ref_count; ++$ref_num) { + if (!empty($this->fn_backlink_title)) { + $attr['title'] = ' title="' . $this->encodeAttribute($this->fn_backlink_title) . '"'; + } + if (!empty($this->fn_backlink_label)) { + $attr['label'] = ' aria-label="' . $this->encodeAttribute($this->fn_backlink_label) . '"'; + } + $parsed_attr = $this->parseFootnotePlaceholders( + implode('', $attr), + $num, + $ref_num + ); + $backlink_text = $this->parseFootnotePlaceholders( + $this->fn_backlink_html, + $num, + $ref_num + ); + $ref_count_mark = $ref_num > 1 ? $ref_num : ''; + $backlink .= " $backlink_text"; } - // Add backlink to last paragraph; create new paragraph if needed. + $backlink = trim($backlink); + } + + // Add backlink to last paragraph; create new paragraph if needed. + if (!empty($backlink)) { if (preg_match('{

        $}', $footnote)) { $footnote = substr($footnote, 0, -4) . " $backlink

        "; } else { $footnote .= "\n\n

        $backlink

        "; } - - $text .= "
      1. \n"; - $text .= $footnote . "\n"; - $text .= "
      2. \n\n"; } - - $text .= "
      \n"; - $text .= "
    "; + + $text .= "
  • \n"; + $text .= $footnote . "\n"; + $text .= "
  • \n\n"; } - return $text; + $text .= "\n"; + + $this->footnotes_assembled = $text; } /** @@ -1668,7 +1760,7 @@ class MarkdownExtra extends \Michelf\Markdown { */ protected function _appendFootnotes_callback($matches) { $node_id = $this->fn_id_prefix . $matches[1]; - + // Create footnote marker only if it has a corresponding footnote *and* // the footnote hasn't been used by another marker. if (isset($this->footnotes[$node_id])) { @@ -1685,30 +1777,48 @@ class MarkdownExtra extends \Michelf\Markdown { } $attr = ""; - if ($this->fn_link_class != "") { + if ($this->fn_link_class !== "") { $class = $this->fn_link_class; $class = $this->encodeAttribute($class); $attr .= " class=\"$class\""; } - if ($this->fn_link_title != "") { + if ($this->fn_link_title !== "") { $title = $this->fn_link_title; $title = $this->encodeAttribute($title); $attr .= " title=\"$title\""; } - + $attr .= " role=\"doc-noteref\""; + $attr = str_replace("%%", $num, $attr); $node_id = $this->encodeAttribute($node_id); - + return "". "$num". ""; } - + return "[^" . $matches[1] . "]"; } - - + + /** + * Build footnote label by evaluating any placeholders. + * - ^^ footnote number + * - %% footnote reference number (Nth reference to footnote number) + * @param string $label + * @param int $footnote_number + * @param int $reference_number + * @return string + */ + protected function parseFootnotePlaceholders($label, $footnote_number, $reference_number) { + return str_replace( + array('^^', '%%'), + array($footnote_number, $reference_number), + $label + ); + } + + /** * Abbreviations - strips abbreviations from text, stores titles in hash * references. @@ -1721,7 +1831,7 @@ class MarkdownExtra extends \Michelf\Markdown { // Link defs are in the form: [id]*: url "optional title" $text = preg_replace_callback('{ ^[ ]{0,' . $less_than_tab . '}\*\[(.+?)\][ ]?: # abbr_id = $1 - (.*) # text = $2 (no blank lines allowed) + (.*) # text = $2 (no blank lines allowed) }xm', array($this, '_stripAbbreviations_callback'), $text); @@ -1751,7 +1861,7 @@ class MarkdownExtra extends \Michelf\Markdown { */ protected function doAbbreviations($text) { if ($this->abbr_word_re) { - // cannot use the /x modifier because abbr_word_re may + // cannot use the /x modifier because abbr_word_re may // contain significant spaces: $text = preg_replace_callback('{' . '(?abbr_desciptions[$abbr]; if (empty($desc)) { return $this->hashPart("$abbr"); - } else { - $desc = $this->encodeAttribute($desc); - return $this->hashPart("$abbr"); } - } else { - return $matches[0]; + $desc = $this->encodeAttribute($desc); + return $this->hashPart("$abbr"); } + return $matches[0]; } } diff --git a/bb-vendor/michelf/php-markdown/Michelf/MarkdownInterface.php b/bb-vendor/michelf/php-markdown/Michelf/MarkdownInterface.php index 8512e3753..006452445 100644 --- a/bb-vendor/michelf/php-markdown/Michelf/MarkdownInterface.php +++ b/bb-vendor/michelf/php-markdown/Michelf/MarkdownInterface.php @@ -4,14 +4,14 @@ * * @package php-markdown * @author Michel Fortin - * @copyright 2004-2016 Michel Fortin + * @copyright 2004-2019 Michel Fortin * @copyright (Original Markdown) 2004-2006 John Gruber */ namespace Michelf; /** - * Markdown Parser Interface + * Markdown Parser Interface */ interface MarkdownInterface { /** diff --git a/bb-vendor/michelf/php-markdown/Readme.md b/bb-vendor/michelf/php-markdown/Readme.md index 044407106..e1eb30660 100644 --- a/bb-vendor/michelf/php-markdown/Readme.md +++ b/bb-vendor/michelf/php-markdown/Readme.md @@ -1,7 +1,7 @@ PHP Markdown ============ -PHP Markdown Lib 1.7.0 - 29 Oct 2016 +PHP Markdown Lib 1.9.0 - 1 Dec 2019 by Michel Fortin @@ -13,16 +13,16 @@ based on Markdown by John Gruber Introduction ------------ -This is a library package that includes the PHP Markdown parser and its +This is a library package that includes the PHP Markdown parser and its sibling PHP Markdown Extra with additional features. Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML). -"Markdown" is actually two things: a plain text markup syntax, and a -software tool, originally written in Perl, that converts the plain text -markup to HTML. PHP Markdown is a port to PHP of the original Markdown +"Markdown" is actually two things: a plain text markup syntax, and a +software tool, originally written in Perl, that converts the plain text +markup to HTML. PHP Markdown is a port to PHP of the original Markdown program by John Gruber. * [Full documentation of the Markdown syntax]() @@ -37,68 +37,77 @@ Requirement This library package requires PHP 5.3 or later. Note: The older plugin/library hybrid package for PHP Markdown and -PHP Markdown Extra is still maintained and will work with PHP 4.0.5 and later. +PHP Markdown Extra is no longer maintained but will work with PHP 4.0.5 and +later. Before PHP 5.3.7, pcre.backtrack_limit defaults to 100 000, which is too small -in many situations. You might need to set it to higher values. Later PHP +in many situations. You might need to set it to higher values. Later PHP releases defaults to 1 000 000, which is usually fine. Usage ----- -This library package is meant to be used with class autoloading. For autoloading -to work, your project needs have setup a PSR-0-compatible autoloader. See the -included Readme.php file for a minimal autoloader setup. (If you cannot use -autoloading, see below.) +To use this library with Composer, first install it with: -With class autoloading in place, putting the 'Michelf' folder in your -include path should be enough for this to work: + $ composer require michelf/php-markdown - use \Michelf\Markdown; +Then include Composer's generated vendor/autoload.php to [enable autoloading]: + + require 'vendor/autoload.php'; + +Without Composer, for autoloading to work, your project needs an autoloader +compatible with PSR-4 or PSR-0. See the included Readme.php file for a minimal +autoloader setup. (If you cannot use autoloading, see below.) + +With class autoloading in place: + + use Michelf\Markdown; $my_html = Markdown::defaultTransform($my_text); Markdown Extra syntax is also available the same way: - use \Michelf\MarkdownExtra; + use Michelf\MarkdownExtra; $my_html = MarkdownExtra::defaultTransform($my_text); -If you wish to use PHP Markdown with another text filter function +If you wish to use PHP Markdown with another text filter function built to parse HTML, you should filter the text *after* the `transform` -function call. This is an example with [PHP SmartyPants][psp]: +function call. This is an example with [PHP SmartyPants]: - use \Michelf\Markdown, \Michelf\SmartyPants; + use Michelf\Markdown, Michelf\SmartyPants; $my_html = Markdown::defaultTransform($my_text); $my_html = SmartyPants::defaultTransform($my_html); -All these examples are using the static `defaultTransform` static function -found inside the parser class. If you want to customize the parser -configuration, you can also instantiate it directly and change some +All these examples are using the static `defaultTransform` static function +found inside the parser class. If you want to customize the parser +configuration, you can also instantiate it directly and change some configuration variables: - use \Michelf\MarkdownExtra; + use Michelf\MarkdownExtra; $parser = new MarkdownExtra; $parser->fn_id_prefix = "post22-"; $my_html = $parser->transform($my_text); To learn more, see the full list of [configuration variables]. + [enable autoloading]: https://getcomposer.org/doc/01-basic-usage.md#autoloading + [PHP SmartyPants]: https://michelf.ca/projects/php-smartypants/ [configuration variables]: https://michelf.ca/projects/php-markdown/configuration/ ### Usage without an autoloader -If you cannot use class autoloading, you can still use `include` or `require` -to access the parser. To load the `\Michelf\Markdown` parser, do it this way: +If you cannot use class autoloading, you can still use `include` or `require` +to access the parser. To load the `Michelf\Markdown` parser, do it this way: require_once 'Michelf/Markdown.inc.php'; -Or, if you need the `\Michelf\MarkdownExtra` parser: +Or, if you need the `Michelf\MarkdownExtra` parser: require_once 'Michelf/MarkdownExtra.inc.php'; While the plain `.php` files depend on autoloading to work correctly, using the -`.inc.php` files instead will eagerly load the dependencies that would be +`.inc.php` files instead will eagerly load the dependencies that would be loaded on demand if you were using autoloading. @@ -113,19 +122,19 @@ functions and their configuration variables. The public API is stable for a given major version number. It might get additions when the minor version number increments. -**Protected members are not considered public API.** This is unconventional -and deserves an explanation. Incrementing the major version number every time +**Protected members are not considered public API.** This is unconventional +and deserves an explanation. Incrementing the major version number every time the underlying implementation of something changes is going to give nonessential version numbers for the vast majority of people who just use the parser. Protected members are meant to create parser subclasses that behave in -different ways. Very few people create parser subclasses. I don't want to -discourage it by making everything private, but at the same time I can't +different ways. Very few people create parser subclasses. I don't want to +discourage it by making everything private, but at the same time I can't guarantee any stable hook between versions if you use protected members. -**Syntax changes** will increment the minor number for new features, and the -patch number for small corrections. A *new feature* is something that needs a +**Syntax changes** will increment the minor number for new features, and the +patch number for small corrections. A *new feature* is something that needs a change in the syntax documentation. Note that since PHP Markdown Lib includes -two parsers, a syntax change for either of them will increment the minor +two parsers, a syntax change for either of them will increment the minor number. Also note that there is nothing perfectly backward-compatible with the Markdown syntax: all inputs are always valid, so new features always replace something that was previously legal, although generally nonsensical to do. @@ -140,7 +149,7 @@ To file bug reports please send email to: Please include with your report: (1) the example input; (2) the output you expected; (3) the output PHP Markdown actually produced. -If you have a problem where Markdown gives you an empty result, first check +If you have a problem where Markdown gives you an empty result, first check that the backtrack limit is not too low by running `php --info | grep pcre`. See Installation and Requirement above for details. @@ -149,81 +158,125 @@ Development and Testing ----------------------- Pull requests for fixing bugs are welcome. Proposed new features are -going to be meticulously reviewed -- taking into account backward compatibility, +going to be meticulously reviewed -- taking into account backward compatibility, potential side effects, and future extensibility -- before deciding on acceptance or rejection. -If you make a pull request that includes changes to the parser please add -tests for what is being changed to [MDTest][] and make a pull request there -too. +If you make a pull request that includes changes to the parser please add +tests for what is being changed to the `test/` directory. This can be as +simple as adding a `.text` (input) file with a corresponding `.xhtml` +(output) file to proper category under `./test/resources/`. - [MDTest]: https://github.com/michelf/mdtest/ +Traditionally tests were in a separate repository, [MDTest](https://github.com/michelf/mdtest) +but they are now located here, alongside the source code. Donations --------- -If you wish to make a donation that will help me devote more time to -PHP Markdown, please visit [michelf.ca/donate] or send Bitcoin to -[1HiuX34czvVPPdhXbUAsAu7pZcesniDCGH]. +If you wish to make a donation that will help me devote more time to +PHP Markdown, please visit [michelf.ca/donate]. [michelf.ca/donate]: https://michelf.ca/donate/#!Thanks%20for%20PHP%20Markdown - [1HiuX34czvVPPdhXbUAsAu7pZcesniDCGH]: bitcoin:1HiuX34czvVPPdhXbUAsAu7pZcesniDCGH Version History --------------- +PHP Markdown Lib 1.9.0 (1 Dec 2019) + +* Added `fn_backlink_label` configuration variable to put some text in the + `aria-label` attribute. + (Thanks to Sunny Walker for the implementation.) + +* Occurances of "`^^`" in `fn_backlink_html`, `fn_backlink_class`, + `fn_backlink_title`, and `fn_backlink_label` will be replaced by the + corresponding footnote number in the HTML output. Occurances of "`%%`" will be + replaced by a number for the reference (footnotes can have multiple references). + (Thanks to Sunny Walker for the implementation.) + +* Added configuration variable `omit_footnotes`. When `true` footnotes are not + appended at the end of the generated HTML and the `footnotes_assembled` + variable will contain the HTML for the footnote list, allowing footnotes to be + moved somewhere else on the page. + (Thanks to James K. for the implementation.) + + Note: when placing the content of `footnotes_assembled` on the page, consider + adding the attribute `role="doc-endnotes"` to the `
    ` or `
    ` that will + enclose the list of footnotes so they are reachable to accessibility tools the + same way they would be with the default HTML output. + +* Fixed deprecation warnings from PHP about usage of curly braces to access + characters in text strings. + (Thanks to Remi Collet and Frans-Willem Post.) + + +PHP Markdown Lib 1.8.0 (14 Jan 2018) + +* Autoloading with Composer now uses PSR-4. + +* HTML output for Markdown Extra footnotes now include `role` attributes + with values from [WAI-ARIA](https://www.w3.org/TR/dpub-aria/) to + make them more accessible. + (Thanks to Tobias Bengfort) + +* In Markdown Extra, added the `hashtag_protection` configuration variable. + When set to `true` it prevents ATX-style headers with no space after the initial + hash from being interpreted as headers. This way your precious hashtags + are preserved. + (Thanks to Jaussoin Timothée for the implementation.) + + PHP Markdown Lib 1.7.0 (29 Oct 2016) -* Added a `hard_wrap` configuration variable to make all newline characters - in the text become `
    ` tags in the HTML output. By default, according - to the standard Markdown syntax these newlines are ignored unless they a +* Added a `hard_wrap` configuration variable to make all newline characters + in the text become `
    ` tags in the HTML output. By default, according + to the standard Markdown syntax these newlines are ignored unless they a preceded by two spaces. Thanks to Jonathan Cohlmeyer for the implementation. -* Improved the parsing of list items to fix problematic cases that came to - light with the addition of `hard_wrap`. This should have no effect on the - output except span-level list items that ended with two spaces (and thus +* Improved the parsing of list items to fix problematic cases that came to + light with the addition of `hard_wrap`. This should have no effect on the + output except span-level list items that ended with two spaces (and thus ended with a line break). -* Added a `code_span_content_func` configuration variable which takes a +* Added a `code_span_content_func` configuration variable which takes a function that will convert the content of the code span to HTML. This can - be useful to implement syntax highlighting. Although contrary to its - code block equivalent, there is no syntax for specifying a language. + be useful to implement syntax highlighting. Although contrary to its + code block equivalent, there is no syntax for specifying a language. Credits to styxit for the implementation. -* Fixed a Markdwon Extra issue where two-space-at-end-of-line hard breaks - wouldn't work inside of HTML block elements such as `

    ` +* Fixed a Markdown Extra issue where two-space-at-end-of-line hard breaks + wouldn't work inside of HTML block elements such as `

    ` where the element expects only span-level content. -* In the parser code, switched to PHPDoc comment format. Thanks to +* In the parser code, switched to PHPDoc comment format. Thanks to Robbie Averill for the help. -PHP Markdown Lib 1.6.0 (23 Dec 2015) +PHP Markdown Lib 1.6.0 (23 Dec 2015) -Note: this version was incorrectly released as 1.5.1 on Dec 22, a number +Note: this version was incorrectly released as 1.5.1 on Dec 22, a number that contradicted the versioning policy. -* For fenced code blocks in Markdown Extra, can now set a class name for the - code block's language before the special attribute block. Previously, this +* For fenced code blocks in Markdown Extra, can now set a class name for the + code block's language before the special attribute block. Previously, this class name was only allowed in the absence of the special attribute block. -* Added a `code_block_content_func` configuration variable which takes a - function that will convert the content of the code block to HTML. This is - most useful for syntax highlighting. For fenced code blocks in Markdown - Extra, the function has access to the language class name (the one outside - of the special attribute block). Credits to Mario Konrad for providing the +* Added a `code_block_content_func` configuration variable which takes a + function that will convert the content of the code block to HTML. This is + most useful for syntax highlighting. For fenced code blocks in Markdown + Extra, the function has access to the language class name (the one outside + of the special attribute block). Credits to Mario Konrad for providing the implementation. * The curled arrow character for the backlink in footnotes is now followed by a Unicode variant selector to prevent it from being displayed in emoji form on iOS. - Note that in older browsers the variant selector is often interpreted as a - separate character, making it visible after the arrow. So there is now a - also a `fn_backlink_html` configuration variable that can be used to set - the link text to something else. Credits to Dana for providing the + Note that in older browsers the variant selector is often interpreted as a + separate character, making it visible after the arrow. So there is now a + also a `fn_backlink_html` configuration variable that can be used to set + the link text to something else. Credits to Dana for providing the implementation. * Fixed an issue in MarkdownExtra where long header lines followed by a @@ -235,13 +288,13 @@ PHP Markdown Lib 1.5.0 (1 Mar 2015) * Added the ability start ordered lists with a number different from 1 and and have that reflected in the HTML output. This can be enabled with - the `enhanced_ordered_lists` configuration variable for the Markdown + the `enhanced_ordered_lists` configuration variable for the Markdown parser; it is enabled by default for Markdown Extra. Credits to Matt Gorle for providing the implementation. -* Added the ability to insert custom HTML attributes with simple values +* Added the ability to insert custom HTML attributes with simple values everywhere an extra attribute block is allowed (links, images, headers). - The value must be unquoted, cannot contains spaces and is limited to + The value must be unquoted, cannot contains spaces and is limited to alphanumeric ASCII characters. Credits to Peter Droogmans for providing the implementation. @@ -256,7 +309,7 @@ PHP Markdown Lib 1.5.0 (1 Mar 2015) PHP Markdown Lib 1.4.1 (4 May 2014) * The HTML block parser will now treat `

    ` as a block-level element - (as it should) and no longer wrap it in `

    ` or parse it's content with + (as it should) and no longer wrap it in `

    ` or parse it's content with the as Markdown syntax (although with Extra you can use `markdown="1"` if you wish to use the Markdown syntax inside it). @@ -265,7 +318,7 @@ PHP Markdown Lib 1.4.1 (4 May 2014) * Corrected an bug where some inline links with spaces in them would not work even when surounded with angle brackets: - + [link]() * Fixed an issue where email addresses with quotes in them would not always @@ -281,9 +334,9 @@ PHP Markdown Lib 1.4.0 (29 Nov 2013) * Added support for the `tel:` URL scheme in automatic links. - + It gets converted to this (note the `tel:` prefix becomes invisible): - + +1-111-111-1111 * Added backtick fenced code blocks to MarkdownExtra, originally from @@ -294,16 +347,16 @@ PHP Markdown Lib 1.4.0 (29 Nov 2013) you want to create a mockup parser object for unit testing. * For those of you who cannot use class autoloading, you can now - include `Michelf/Markdown.inc.php` or `Michelf/MarkdownExtra.inc.php` (note + include `Michelf/Markdown.inc.php` or `Michelf/MarkdownExtra.inc.php` (note the `.inc.php` extension) to automatically include other files required by the parser. PHP Markdown Lib 1.3 (11 Apr 2013) -This is the first release of PHP Markdown Lib. This package requires PHP -version 5.3 or later and is designed to work with PSR-0 autoloading and, -optionally with Composer. Here is a list of the changes since +This is the first release of PHP Markdown Lib. This package requires PHP +version 5.3 or later and is designed to work with PSR-0 autoloading and, +optionally with Composer. Here is a list of the changes since PHP Markdown Extra 1.2.6: * Plugin interface for WordPress and other systems is no longer present in @@ -323,22 +376,22 @@ PHP Markdown Extra 1.2.6: * Added optional class and id attributes to images and links using the same syntax as for headers: - [link](url){#id .class} + [link](url){#id .class} ![img](url){#id .class} - + It work too for reference-style links and images. In this case you need to put those attributes at the reference definition: - [link][linkref] or [linkref] + [link][linkref] or [linkref] ![img][linkref] - + [linkref]: url "optional title" {#id .class} -* Fixed a PHP notice message triggered when some table column separator +* Fixed a PHP notice message triggered when some table column separator markers are missing on the separator line below column headers. * Fixed a small mistake that could cause the parser to retain an invalid - state related to parsing links across multiple runs. This was never + state related to parsing links across multiple runs. This was never observed (that I know of), but it's still worth fixing. @@ -346,25 +399,25 @@ Copyright and License --------------------- PHP Markdown Lib -Copyright (c) 2004-2016 Michel Fortin +Copyright (c) 2004-2019 Michel Fortin All rights reserved. Based on Markdown -Copyright (c) 2003-2005 John Gruber - +Copyright (c) 2003-2005 John Gruber + All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -* Redistributions of source code must retain the above copyright +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the + documentation and/or other materials provided with the distribution. * Neither the name "Markdown" nor the names of its contributors may diff --git a/bb-vendor/michelf/php-markdown/Readme.php b/bb-vendor/michelf/php-markdown/Readme.php index 89449dea4..726bbe3d3 100644 --- a/bb-vendor/michelf/php-markdown/Readme.php +++ b/bb-vendor/michelf/php-markdown/Readme.php @@ -4,13 +4,15 @@ // through the Markdown filter. You can adapt this sample code in any way // you like. -// Install PSR-0-compatible class autoloader +// Install PSR-4-compatible class autoloader spl_autoload_register(function($class){ - require preg_replace('{\\\\|_(?!.*\\\\)}', DIRECTORY_SEPARATOR, ltrim($class, '\\')).'.php'; + require str_replace('\\', DIRECTORY_SEPARATOR, ltrim($class, '\\')).'.php'; }); +// If using Composer, use this instead: +//require 'vendor/autoload.php'; // Get Markdown class -use \Michelf\Markdown; +use Michelf\Markdown; // Read file and pass content through the Markdown parser $text = file_get_contents('Readme.md'); @@ -19,13 +21,13 @@ $html = Markdown::defaultTransform($text); ?> - - PHP Markdown Lib - Readme - - + + PHP Markdown Lib - Readme + + - + diff --git a/bb-vendor/michelf/php-markdown/composer.json b/bb-vendor/michelf/php-markdown/composer.json index 36a4f744a..093507554 100644 --- a/bb-vendor/michelf/php-markdown/composer.json +++ b/bb-vendor/michelf/php-markdown/composer.json @@ -21,11 +21,9 @@ "php": ">=5.3.0" }, "autoload": { - "psr-0": { "Michelf": "" } + "psr-4": { "Michelf\\": "Michelf/" } }, - "extra": { - "branch-alias": { - "dev-lib": "1.4.x-dev" - } + "require-dev": { + "phpunit/phpunit": ">=4.3 <5.8" } } diff --git a/bb-vendor/michelf/php-markdown/phpunit.xml.dist b/bb-vendor/michelf/php-markdown/phpunit.xml.dist new file mode 100644 index 000000000..8f2dab54d --- /dev/null +++ b/bb-vendor/michelf/php-markdown/phpunit.xml.dist @@ -0,0 +1,24 @@ + + + + + ./test/unit/ + + + ./test/integration/ + + + + + + Michelf + + + diff --git a/bb-vendor/michelf/php-markdown/test/bootstrap.php b/bb-vendor/michelf/php-markdown/test/bootstrap.php new file mode 100644 index 000000000..a7b3507d0 --- /dev/null +++ b/bb-vendor/michelf/php-markdown/test/bootstrap.php @@ -0,0 +1,6 @@ +loadXML('' . + "" . + "$t_result"); + + $document2 = new DOMDocument(); + $doc_output = $document2->loadXML('' . + "" . + "$t_output"); + + if ($doc_result) { + static::normalizeElementContent($document->documentElement, false); + $n_result = $document->saveXML(); + } else { + $n_result = '--- Expected Result: XML Parse Error ---'; + } + if ($doc_output) { + static::normalizeElementContent($document2->documentElement, false); + $n_output = $document2->saveXML(); + } else { + $n_output = '--- Output: XML Parse Error ---'; + } + } else { + + // '@' suppressors used because some tests have invalid HTML (multiple elements with the same id attribute) + // Perhaps isolate to a separate test and remove this? + + $document = new DOMDocument(); + $doc_result = @$document->loadHTML($t_result); + + $document2 = new DOMDocument(); + $doc_output = @$document2->loadHTML($t_output); + + if ($doc_result) { + static::normalizeElementContent($document->documentElement, false); + $n_result = $document->saveHTML(); + } else { + $n_result = '--- Expected Result: HTML Parse Error ---'; + } + + if ($doc_output) { + static::normalizeElementContent($document2->documentElement, false); + $n_output = $document2->saveHTML(); + } else { + $n_output = '--- Output: HTML Parse Error ---'; + } + } + + $n_result = preg_replace('{^.*?|.*?$}is', '', $n_result); + $n_output = preg_replace('{^.*?|.*?$}is', '', $n_output); + + $c_result = $n_result; + $c_output = $n_output; + + $c_result = trim($c_result) . "\n"; + $c_output = trim($c_output) . "\n"; + + // This will throw a test exception if the strings don't exactly match + TestCase::assertSame($c_result, $c_output, $message); + } + + /** + * @param DOMElement $element Modifies this element by reference + * @param bool $whitespace_preserve Preserve Whitespace + * @return void + */ + protected static function normalizeElementContent($element, $whitespace_preserve) { + # + # Normalize content of HTML DOM $element. The $whitespace_preserve + # argument indicates that whitespace is significant and shouldn't be + # normalized; it should be used for the content of certain elements like + #

     or