MediaWiki  1.34.0
Wikimedia\ParamValidator\Util\UploadedFileStream Class Reference

Implementation of StreamInterface for a file in $_FILES. More...

Inheritance diagram for Wikimedia\ParamValidator\Util\UploadedFileStream:
Collaboration diagram for Wikimedia\ParamValidator\Util\UploadedFileStream:

Public Member Functions

 __construct ( $filename)
 
 __destruct ()
 
 __toString ()
 
 close ()
 
 detach ()
 
 eof ()
 
 getContents ()
 
 getMetadata ( $key=null)
 
 getSize ()
 
 isReadable ()
 
 isSeekable ()
 
 isWritable ()
 
 read ( $length)
 
 rewind ()
 
 seek ( $offset, $whence=SEEK_SET)
 
 tell ()
 
 write ( $string)
 

Private Member Functions

 checkOpen ()
 Check if the stream is open. More...
 

Static Private Member Functions

static quietCall (callable $func, array $args, $fail, $msg)
 Call, throwing on error. More...
 

Private Attributes

resource $fp
 File handle. More...
 
int false null $size = false
 File size. More...
 

Detailed Description

Implementation of StreamInterface for a file in $_FILES.

This exists so ParamValidator needn't depend on any specific PSR-7 implementation for a class implementing UploadedFileInterface. It shouldn't be used directly by other code.

Definition at line 21 of file UploadedFileStream.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\ParamValidator\Util\UploadedFileStream::__construct (   $filename)
Parameters
string$filename

Definition at line 54 of file UploadedFileStream.php.

References Wikimedia\ParamValidator\Util\UploadedFileStream\quietCall().

◆ __destruct()

Wikimedia\ParamValidator\Util\UploadedFileStream::__destruct ( )

Member Function Documentation

◆ __toString()

Wikimedia\ParamValidator\Util\UploadedFileStream::__toString ( )

◆ checkOpen()

◆ close()

Wikimedia\ParamValidator\Util\UploadedFileStream::close ( )

◆ detach()

Wikimedia\ParamValidator\Util\UploadedFileStream::detach ( )

◆ eof()

Wikimedia\ParamValidator\Util\UploadedFileStream::eof ( )

Definition at line 118 of file UploadedFileStream.php.

◆ getContents()

◆ getMetadata()

Wikimedia\ParamValidator\Util\UploadedFileStream::getMetadata (   $key = null)

◆ getSize()

Wikimedia\ParamValidator\Util\UploadedFileStream::getSize ( )

◆ isReadable()

Wikimedia\ParamValidator\Util\UploadedFileStream::isReadable ( )

◆ isSeekable()

Wikimedia\ParamValidator\Util\UploadedFileStream::isSeekable ( )

◆ isWritable()

Wikimedia\ParamValidator\Util\UploadedFileStream::isWritable ( )

Definition at line 136 of file UploadedFileStream.php.

◆ quietCall()

static Wikimedia\ParamValidator\Util\UploadedFileStream::quietCall ( callable  $func,
array  $args,
  $fail,
  $msg 
)
staticprivate

Call, throwing on error.

Parameters
callable$funcCallable to call
array$argsArguments
mixed$failFailure return value
string$msgMessage prefix
Returns
mixed
Exceptions
RuntimeExceptionif $func returns $fail

Definition at line 38 of file UploadedFileStream.php.

References $args.

Referenced by Wikimedia\ParamValidator\Util\UploadedFileStream\__construct(), Wikimedia\ParamValidator\Util\UploadedFileStream\getContents(), Wikimedia\ParamValidator\Util\UploadedFileStream\getMetadata(), Wikimedia\ParamValidator\Util\UploadedFileStream\read(), Wikimedia\ParamValidator\Util\UploadedFileStream\seek(), and Wikimedia\ParamValidator\Util\UploadedFileStream\tell().

◆ read()

Wikimedia\ParamValidator\Util\UploadedFileStream::read (   $length)

◆ rewind()

Wikimedia\ParamValidator\Util\UploadedFileStream::rewind ( )

◆ seek()

◆ tell()

Wikimedia\ParamValidator\Util\UploadedFileStream::tell ( )

◆ write()

Wikimedia\ParamValidator\Util\UploadedFileStream::write (   $string)

Member Data Documentation

◆ $fp

◆ $size

int false null Wikimedia\ParamValidator\Util\UploadedFileStream::$size = false
private

File size.

False if not set yet.

Definition at line 27 of file UploadedFileStream.php.

Referenced by Wikimedia\ParamValidator\Util\UploadedFileStream\getSize().


The documentation for this class was generated from the following file: