| | private mixed $handle; |
| | private bool $temporary; |
| | - private bool $owned; |
| | private string $buffer; |
| | private int $bufferPos; |
| | private int $bufferLen; |
| | |
| | - private function __construct( |
| | - mixed $handle, |
| | - bool $temporary, |
| | - bool $owned = true |
| | - ) { |
| | + private function __construct( mixed $handle, bool $temporary ) { |
| | $this->handle = $handle; |
| | $this->temporary = $temporary; |
| | - $this->owned = $owned; |
| | $this->buffer = ''; |
| | $this->bufferPos = 0; |
 |
| | public static function createTemp(): self { |
| | return new self( @fopen( 'php://temp/maxmemory:65536', 'w+b' ), true ); |
| | - } |
| | - |
| | - public static function wrap( mixed $handle ): self { |
| | - return new self( $handle, false, false ); |
| | } |
| | |
| | public function isOpen(): bool { |
| | return is_resource( $this->handle ); |
| | } |
| | |
| | public function __destruct() { |
| | - if( $this->owned && $this->isOpen() ) { |
| | + if( $this->isOpen() ) { |
| | fclose( $this->handle ); |
| | } |