mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-12 19:21:33 +00:00
The official image from streamline does not currently work for the arm64 platform. As a temporary measure, the source code and docker build scripts have been lifted from the official images and are used to build locally. Some additional modifications are made to reduce overall image size, these are documented in docker/README.md
31 lines
793 B
PHP
31 lines
793 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace League\Flysystem;
|
|
|
|
use function hash_final;
|
|
use function hash_init;
|
|
use function hash_update_stream;
|
|
|
|
trait CalculateChecksumFromStream
|
|
{
|
|
private function calculateChecksumFromStream(string $path, Config $config): string
|
|
{
|
|
try {
|
|
$stream = $this->readStream($path);
|
|
$algo = (string) $config->get('checksum_algo', 'md5');
|
|
$context = hash_init($algo);
|
|
hash_update_stream($context, $stream);
|
|
|
|
return hash_final($context);
|
|
} catch (FilesystemException $exception) {
|
|
throw new UnableToProvideChecksum($exception->getMessage(), $path, $exception);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @return resource
|
|
*/
|
|
abstract public function readStream(string $path);
|
|
}
|