Livraison d ela gestion des opérations v0.4.0

This commit is contained in:
d6soft
2025-06-24 13:01:43 +02:00
parent b9672a6228
commit 7763d02fae
819 changed files with 306790 additions and 145462 deletions

View File

@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace ZipStream\Exception;
use DateTimeInterface;
use ZipStream\Exception;
/**
* This Exception gets invoked if a file wasn't found
*/
class DosTimeOverflowException extends Exception
{
/**
* @internal
*/
public function __construct(
public readonly DateTimeInterface $dateTime
) {
parent::__construct('The date ' . $dateTime->format(DateTimeInterface::ATOM) . " can't be represented as DOS time / date.");
}
}

View File

@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace ZipStream\Exception;
use ZipStream\Exception;
/**
* This Exception gets invoked if a file wasn't found
*/
class FileNotFoundException extends Exception
{
/**
* @internal
*/
public function __construct(
public readonly string $path
) {
parent::__construct("The file with the path $path wasn't found.");
}
}

View File

@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace ZipStream\Exception;
use ZipStream\Exception;
/**
* This Exception gets invoked if a file wasn't found
*/
class FileNotReadableException extends Exception
{
/**
* @internal
*/
public function __construct(
public readonly string $path
) {
parent::__construct("The file with the path $path isn't readable.");
}
}

View File

@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace ZipStream\Exception;
use ZipStream\Exception;
/**
* This Exception gets invoked if a file is not as large as it was specified.
*/
class FileSizeIncorrectException extends Exception
{
/**
* @internal
*/
public function __construct(
public readonly int $expectedSize,
public readonly int $actualSize
) {
parent::__construct("File is {$actualSize} instead of {$expectedSize} bytes large. Adjust `exactSize` parameter.");
}
}

View File

@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace ZipStream\Exception;
use ZipStream\Exception;
/**
* This Exception gets invoked if a counter value exceeds storage size
*/
class OverflowException extends Exception
{
/**
* @internal
*/
public function __construct()
{
parent::__construct('File size exceeds limit of 32 bit integer. Please enable "zip64" option.');
}
}

View File

@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace ZipStream\Exception;
use ZipStream\Exception;
/**
* This Exception gets invoked if a resource like `fread` returns false
*/
class ResourceActionException extends Exception
{
/**
* @var ?resource
*/
public $resource;
/**
* @param resource $resource
*/
public function __construct(
public readonly string $function,
$resource = null,
) {
$this->resource = $resource;
parent::__construct('Function ' . $function . 'failed on resource.');
}
}

View File

@@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
namespace ZipStream\Exception;
use ZipStream\Exception;
/**
* This Exception gets invoked if a strict simulation is executed and the file
* information can't be determined without reading the entire file.
*/
class SimulationFileUnknownException extends Exception
{
public function __construct()
{
parent::__construct('The details of the strict simulation file could not be determined without reading the entire file.');
}
}

View File

@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace ZipStream\Exception;
use ZipStream\Exception;
/**
* This Exception gets invoked if a stream can't be read.
*/
class StreamNotReadableException extends Exception
{
/**
* @internal
*/
public function __construct()
{
parent::__construct('The stream could not be read.');
}
}

View File

@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace ZipStream\Exception;
use ZipStream\Exception;
/**
* This Exception gets invoked if a non seekable stream is
* provided and zero headers are disabled.
*/
class StreamNotSeekableException extends Exception
{
/**
* @internal
*/
public function __construct()
{
parent::__construct('enableZeroHeader must be enable to add non seekable streams');
}
}