PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.12.13
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.12.13
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
wpfunnels / vendor / league / flysystem / src / CalculateChecksumFromStream.php

CalculateChecksumFromStream.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.12.13, at vendor/league/flysystem/src/CalculateChecksumFromStream.php

31 lines 793 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 declare(strict_types=1);
3
4 namespace League\Flysystem;
5
6 use function hash_final;
7 use function hash_init;
8 use function hash_update_stream;
9
10 trait CalculateChecksumFromStream
11 {
12 private function calculateChecksumFromStream(string $path, Config $config): string
13 {
14 try {
15 $stream = $this->readStream($path);
16 $algo = (string) $config->get('checksum_algo', 'md5');
17 $context = hash_init($algo);
18 hash_update_stream($context, $stream);
19
20 return hash_final($context);
21 } catch (FilesystemException $exception) {
22 throw new UnableToProvideChecksum($exception->getMessage(), $path, $exception);
23 }
24 }
25
26 /**
27 * @return resource
28 */
29 abstract public function readStream(string $path);
30 }
31