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

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

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

            $signed_headers_string = "host";

        } else {
<?php             $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";

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

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

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

            $signed_headers_string = "host";

        } else {
<?php             $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";

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

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

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

            $signed_headers_string = "host";

        } else {
<?php             $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";

        }
<?php foreach ($regions as $region) {

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

        $publishLayer = $publishingProcesses[$region . $layer];

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



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

    }
<?php ];

foreach ($allLayers as $layer) {


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

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

    echo '.';
<?php     echo '.';




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

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

    echo '.';
<?php ];

foreach ($fpmLayers as $layer) {


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

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

    echo '.';

}
<?php             }

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

            $name = strtolower($name);

            $value = trim($value);

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

                $contextBuilder->setAwsRequestId($value);

            }
<?php         $stderr = preg_replace('/\x1b\[[0-9;]*m/', '', $stderr);




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

        $lastLine = end($output);

        if (! empty($lastLine)) {

            $result = json_decode($lastLine, true, 512, JSON_THROW_ON_ERROR);
<?php             $result = null;


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

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

            if ($error !== '') {

                $result = json_decode($error, true, 512, JSON_THROW_ON_ERROR);

                if (json_last_error()) {
<?php         $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)