Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Strip whitespace (or other characters) from the beginning and end of a string
trim(string $stringstring $characters " \n\r\t\v\x00"): string
        if ($AWSRegion == 'us-east-1') {

            
$hostname trim($BucketName ".s3.amazonaws.com");

            
$header_string "host:" $hostname "\n";

            
$signed_headers_string "host";

        } else {
            $header_string "host:" $hostname "\n";

            
$signed_headers_string "host";

        } else {

            
$hostname trim($BucketName ".s3-" $AWSRegion ".amazonaws.com");

            
$header_string "host:" $hostname "\n";

            
$signed_headers_string "host";

        }
        if ($AWSRegion == 'us-east-1') {

            
$hostname trim($BucketName ".s3.amazonaws.com");

            
$header_string "host:" $hostname "\n";

            
$signed_headers_string "host";

        } else {
            $header_string "host:" $hostname "\n";

            
$signed_headers_string "host";

        } else {

            
$hostname trim($BucketName ".s3-" $AWSRegion ".amazonaws.com");

            
$header_string "host:" $hostname "\n";

            
$signed_headers_string "host";

        }
        if ($AWSRegion == 'us-east-1') {

            
$hostname trim($BucketName ".s3.amazonaws.com");

            
$header_string "host:" $hostname "\n";

            
$signed_headers_string "host";

        } else {
            $header_string "host:" $hostname "\n";

            
$signed_headers_string "host";

        } else {

            
$hostname trim($BucketName ".s3-" $AWSRegion ".amazonaws.com");

            
$header_string "host:" $hostname "\n";

            
$signed_headers_string "host";

        }
foreach ($regions as $region) {

    foreach (
$layers as $layer => $layerDescription) {

        
$publishLayer $publishingProcesses[$region $layer];

        
$layerVersion trim($publishLayer->getOutput());



        
$permissionProcesses[] = addPublicLayerPermissions($region$layer$layerVersion);

    }
];

foreach (
$allLayers as $layer) {


    
$workdir trim(`docker run --rm --entrypoint pwd $layer`);

    
assertEquals('/var/task'$workdir);

    echo 
'.';
    echo '.';




    
$phpVersion trim(`docker run --rm --entrypoint php $layer -v`);

    
assertMatchesRegex('/PHP (7|8)\.\d+\.\d+/'$phpVersion);

    echo 
'.';
];

foreach (
$fpmLayers as $layer) {


    
$phpVersion trim(`docker run --rm --entrypoint php-fpm $layer -v`);

    
assertMatchesRegex('/PHP (7|8)\.\d+\.\d+/'$phpVersion);

    echo 
'.';

}
            }

            [
$name$value] = preg_split('/:\s*/'$header2);

            
$name strtolower($name);

            
$value trim($value);

            if (
$name === 'lambda-runtime-aws-request-id') {

                
$contextBuilder->setAwsRequestId($value);

            }
        $stderr preg_replace('/\x1b\[[0-9;]*m/'''$stderr);




        
$output explode("\n"trim($process->getOutput()));

        
$lastLine end($output);

        if (! empty(
$lastLine)) {

            
$result json_decode($lastLinetrue512JSON_THROW_ON_ERROR);
            $result null;


            
preg_match('/REPORT RequestId: [^\n]*(.*)/s'$stderr$matches);

            
$error trim($matches[1] ?? '');

            if (
$error !== '') {

                
$result json_decode($errortrue512JSON_THROW_ON_ERROR);

                if (
json_last_error()) {
        $logLines explode("\n"$logs);

        
$logLines array_filter($logLines, function (string $line): bool {

            
$line trim($line);

            return 
$line !== ''

                
&& (strpos($line'START') !== 0)

                && (
strpos($line'END') !== 0)