src/Server/AmazonServer.php
private function createHeaders(BucketInterface $bucket, string $name, StreamInterface $stream): array
    {
        if (empty($mimetype = mimetype_from_filename($name))) {
            $mimetype = self::DEFAULT_MIMETYPE;
        };

        //Possible to add custom headers into the bucket
        $headers = $bucket->getOption('headers', []);

        if (!empty($maxAge = $bucket->getOption('maxAge', 0))) {
            //Shortcut
            $headers['Cache-control'] = 'max-age=' . $bucket->getOption('maxAge', 0) . ', public';
            $headers['Expires'] = gmdate(
                'D, d M Y H:i:s T',
                time() + $bucket->getOption('maxAge', 0)
            );
        }

        $stream->rewind();

        return $headers + [
                'Content-MD5'  => base64_encode(md5($stream->getContents(), true)),
                'Content-Type' => $mimetype
            ];
    }
private function createHeaders(BucketInterface $bucket, string $name, StreamInterface $stream): array
    {
        if (empty($mimetype = mimetype_from_filename($name))) {
            $mimetype = self::DEFAULT_MIMETYPE;
        };

        //Possible to add custom headers into the bucket
        $headers = $bucket->getOption('headers', []);

        if (!empty($maxAge = $bucket->getOption('maxAge', 0))) {
            //Shortcut
            $headers['Cache-control'] = 'max-age=' . $bucket->getOption('maxAge', 0) . ', public';
            $headers['Expires'] = gmdate(
                'D, d M Y H:i:s T',
                time() + $bucket->getOption('maxAge', 0)
            );
        }

        $stream->rewind();

        return $headers + [
                'Content-MD5'  => base64_encode(md5($stream->getContents(), true)),
                'Content-Type' => $mimetype
            ];
    }
private function createHeaders ( BucketInterface $ bucket , string $ name , StreamInterface $ stream ) : array { if ( empty ( $ mimetype = mimetype_from_filename ( $ name ) ) ) { $ mimetype = self :: DEFAULT_MIMETYPE ; } ; //Possible to add custom headers into the bucket $ headers = $ bucket -> getOption ( 'headers' , [ ] ) ; if ( ! empty ( $ maxAge = $ bucket -> getOption ( 'maxAge' , 0 ) ) ) { //Shortcut $ headers [ 'Cache-control' ] = 'max-age=' . $ bucket -> getOption ( 'maxAge' , 0 ) . ', public' ; $ headers [ 'Expires' ] = gmdate ( 'D, d M Y H:i:s T' , time ( ) + $ bucket -> getOption ( 'maxAge' , 0 ) ) ; } $ stream -> rewind ( ) ; return $ headers + [ 'Content-MD5' => base64_encode ( md5 ( $ stream -> getContents ( ) , true ) ) , 'Content-Type' => $ mimetype ] ; }
Generate object headers.

@param BucketInterface $bucket
@param string          $name
@param StreamInterface $stream

@return array
Generate object headers .