Server IP : 104.21.14.103 / Your IP : 3.15.219.174 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/thread-self/root/home/giankuin/sieuthiweb.com.vn/wp-content/plugins/duplicator-pro/aws/Guzzle/Service/Command/LocationVisitor/Response/ |
Upload File : |
<?php namespace DuplicatorPro\Guzzle\Service\Command\LocationVisitor\Response; use DuplicatorPro\Guzzle\Http\Message\Response; use DuplicatorPro\Guzzle\Service\Description\Parameter; use DuplicatorPro\Guzzle\Service\Command\CommandInterface; /** * Location visitor used to add a particular header of a response to a key in the result */ class HeaderVisitor extends AbstractResponseVisitor { public function visit( CommandInterface $command, Response $response, Parameter $param, &$value, $context = null ) { if ($param->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; } } } } }