nur-sery/nur_src/b/io/EOFException.php

18 lines
405 B
PHP
Raw Normal View History

2023-12-03 22:10:18 +04:00
<?php
namespace nur\b\io;
/**
* Class EOFException: exception lancée quand plus aucune donnée n'est
* disponible sur un flux
*/
class EOFException extends IOException {
static final function no_more_data(): self {
return new self("no more data");
}
static final function ensure_not_eof($data, $eof=false) {
if ($data !== $eof) return $data;
else throw self::no_more_data();
}
}