/**
* Parses machine object (MO) format, independent of the machine's endian it
* was created on. Both 32bit and 64bit systems are supported.
*/
protected function loadResource(string
$resource): array
{ $stream =
fopen($resource, 'r'
);
$stat =
fstat($stream);
if ($stat['size'
] < self::MO_HEADER_SIZE
) { throw new InvalidResourceException('MO stream content has an invalid format.'
);
} $magic =
unpack('V1',
fread($stream, 4
));
$magic =
hexdec(substr(dechex(current($magic)), -8
));
if (self::MO_LITTLE_ENDIAN_MAGIC ==
$magic) { $isBigEndian = false;
} elseif (self::MO_BIG_ENDIAN_MAGIC ==
$magic) { $isBigEndian = true;
} else { throw new InvalidResourceException('MO stream content has an invalid format.'
);
}