protected static function convertToBytes(string $number): int
    {
        /**
         * Prefixes to specify unit of measure for memory amount.
         *
         * Warning: it is important to maintain the exact order of letters in this literal,
         * as it is used to convert string with units to bytes
         */
        $memoryUnits = 'BKMGTPE';

        if (\preg_match('/^(.*\d)\h*(\D)$/', $number, $matches) !== 1) {
            throw new InvalidArgumentException("Number format '{$number}' is not recognized.");
        }

        $unitSymbol = \mb_strtoupper($matches[2]);

        if (\mb_strpos($memoryUnits, $unitSymbol) === false) {
            throw new InvalidArgumentException("The number '{$number}' has an unrecognized unit: '{$unitSymbol}'.");
        }

        $result = self::convertToNumber($matches[1]);
        $pow    = $unitSymbol ? \mb_strpos($memoryUnits, $unitSymbol) : 0;

        if (\PHP_INT_SIZE <= 4 && $pow >= 4) {
            throw new OutOfBoundsException('A 32-bit system is unable to process such a number.');
        }

        if ($unitSymbol) {
            $result *= 1024 ** $pow;
        }

        return (int) $result;
    }