PHP 7.4.33
Preview: UserAgentTrait.php Size: 999 B
/home/godevadmin/www/admin/vendor/aws/Aws/S3/Crypto/UserAgentTrait.php

<?php
namespace Aws\S3\Crypto;

use Aws\AwsClientInterface;
use Aws\Middleware;
use Psr\Http\Message\RequestInterface;

trait UserAgentTrait
{
    private function appendUserAgent(AwsClientInterface $client, $agentString)
    {
        $list = $client->getHandlerList();
        $list->appendBuild(Middleware::mapRequest(
            function(RequestInterface $req) use ($agentString) {
                if (!empty($req->getHeader('User-Agent'))
                    && !empty($req->getHeader('User-Agent')[0])
                ) {
                    $userAgent = $req->getHeader('User-Agent')[0];
                    if (strpos($userAgent, $agentString) === false) {
                        $userAgent .= " {$agentString}";
                    };
                } else {
                    $userAgent = $agentString;
                }

                $req =  $req->withHeader('User-Agent', $userAgent);
                return $req;
            }
        ));
    }
}

Directory Contents

Dirs: 0 × Files: 9

Name Size Perms Modified Actions
2.58 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
524 B lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
1.64 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
2.98 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
13.75 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
18.36 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
6.81 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
7.44 KB lrwxrwxr-x 2024-06-18 20:10:40
Edit Download
999 B lrwxrwxr-x 2024-06-18 20:10:40
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).