mcordingley/HashBin

View on GitHub
src/Hashers/IntegerInterpreters/Unpack.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace mcordingley\HashBin\Hashers\IntegerInterpreters;

use mcordingley\HashBin\Hashers\IntegerInterpreter;

final class Unpack implements IntegerInterpreter
{
    public function interpret(string $string): int
    {
        return unpack(PHP_INT_SIZE >= 8 ? 'q' : 'l', $string)[1];
    }
}