aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/maennchen/zipstream-php/src/Zip64/EndOfCentralDirectoryLocator.php
blob: ef431c347fed312ab78341658b1d4180729703d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php

declare(strict_types=1);

namespace ZipStream\Zip64;

use ZipStream\PackField;

/**
 * @internal
 */
abstract class EndOfCentralDirectoryLocator
{
    private const SIGNATURE = 0x07064b50;

    public static function generate(
        int $numberOfTheDiskWithZip64CentralDirectoryStart,
        int $zip64centralDirectoryStartOffsetOnDisk,
        int $totalNumberOfDisks,
    ): string {
        /** @psalm-suppress MixedArgument */
        return PackField::pack(
            new PackField(format: 'V', value: static::SIGNATURE),
            new PackField(format: 'V', value: $numberOfTheDiskWithZip64CentralDirectoryStart),
            new PackField(format: 'P', value: $zip64centralDirectoryStartOffsetOnDisk),
            new PackField(format: 'V', value: $totalNumberOfDisks),
        );
    }
}