mirror of
https://codeberg.org/demostf/api.git
synced 2026-06-04 02:14:06 +02:00
cleanup
This commit is contained in:
parent
5986d8552d
commit
73469d2aa1
29 changed files with 140 additions and 149 deletions
|
|
@ -4,11 +4,13 @@ declare(strict_types=1);
|
|||
|
||||
namespace Demostf\API\Demo;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
class HeaderParser {
|
||||
/**
|
||||
* @param string $head string containing the demo header binary data
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @return Header
|
||||
*/
|
||||
|
|
@ -18,7 +20,7 @@ class HeaderParser {
|
|||
$head
|
||||
);
|
||||
if (!isset($info['type']) || 'HL2DEMO' !== $info['type']) {
|
||||
throw new \InvalidArgumentException('Not an HL2 demo');
|
||||
throw new InvalidArgumentException('Not an HL2 demo');
|
||||
}
|
||||
|
||||
return Header::fromArray($info);
|
||||
|
|
@ -29,7 +31,7 @@ class HeaderParser {
|
|||
*
|
||||
* @param resource $stream
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @return Header
|
||||
*/
|
||||
|
|
@ -44,13 +46,13 @@ class HeaderParser {
|
|||
*
|
||||
* @param string $path
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @return Header
|
||||
*/
|
||||
public function parseHeader(string $path): Header {
|
||||
if (!is_readable($path)) {
|
||||
throw new \InvalidArgumentException('Unable to open demo: ' . $path);
|
||||
throw new InvalidArgumentException('Unable to open demo: ' . $path);
|
||||
}
|
||||
$fh = fopen($path, 'r');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue