aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/maennchen/zipstream-php/src/Exception/ResourceActionException.php
blob: cbd9b0bb95e15c536de3938ec5e1107fcb2d7c4b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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.');
    }
}