ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Filesystem\Util\PHPStreamFunctions Class Reference

The purpose of this class is to wrap all stream handling php functions. More...

+ Collaboration diagram for ILIAS\Filesystem\Util\PHPStreamFunctions:

Static Public Member Functions

static ftell ($handle)
 ftell wrapper More...
 
static fseek ($stream, int $offset, int $whence)
 
static fclose ($handle)
 
static fread ($handle, int $length)
 
static stream_get_contents ($handle, $length=-1)
 
static fwrite ($handle, string $string, ?int $length=null)
 

Detailed Description

The purpose of this class is to wrap all stream handling php functions.

This allows to mock the functions within unit test which would otherwise require us to redefine the function in a scope which is scanned before the root scope and somehow call the function on our mocks the verify the function calls.

Author
Nicolas Schäfli ns@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s

Definition at line 33 of file PHPStreamFunctions.php.

Member Function Documentation

◆ fclose()

static ILIAS\Filesystem\Util\PHPStreamFunctions::fclose (   $handle)
static
Parameters
resource$handle
See also
fclose()

Definition at line 61 of file PHPStreamFunctions.php.

61 : void
62 {
63 fclose($handle);
64 }

References ILIAS\Filesystem\Util\PHPStreamFunctions\fclose().

Referenced by ILIAS\Filesystem\Stream\Stream\close(), and ILIAS\Filesystem\Util\PHPStreamFunctions\fclose().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fread()

static ILIAS\Filesystem\Util\PHPStreamFunctions::fread (   $handle,
int  $length 
)
static
Parameters
resource$handle
See also
fread()

Definition at line 70 of file PHPStreamFunctions.php.

70 : bool|string
71 {
72 return fread($handle, $length);
73 }

References ILIAS\Filesystem\Util\PHPStreamFunctions\fread().

Referenced by ILIAS\Filesystem\Util\PHPStreamFunctions\fread(), and ILIAS\Filesystem\Stream\Stream\read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fseek()

static ILIAS\Filesystem\Util\PHPStreamFunctions::fseek (   $stream,
int  $offset,
int  $whence 
)
static
Parameters
resource$stream
Returns
int 0 or -1

Definition at line 52 of file PHPStreamFunctions.php.

52 : int
53 {
54 return fseek($stream, $offset, $whence);
55 }
static fseek($stream, int $offset, int $whence)

References ILIAS\Filesystem\Util\PHPStreamFunctions\fseek().

Referenced by ILIAS\Filesystem\Util\PHPStreamFunctions\fseek(), and ILIAS\Filesystem\Stream\Stream\seek().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ftell()

static ILIAS\Filesystem\Util\PHPStreamFunctions::ftell (   $handle)
static

ftell wrapper

Parameters
resource$handle
See also
ftell()

Definition at line 43 of file PHPStreamFunctions.php.

43 : bool|int
44 {
45 return ftell($handle);
46 }

References ILIAS\Filesystem\Util\PHPStreamFunctions\ftell().

Referenced by ILIAS\Filesystem\Util\PHPStreamFunctions\ftell(), and ILIAS\Filesystem\Stream\Stream\tell().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fwrite()

static ILIAS\Filesystem\Util\PHPStreamFunctions::fwrite (   $handle,
string  $string,
?int  $length = null 
)
static
Parameters
resource$handle
See also
fwrite()

Definition at line 89 of file PHPStreamFunctions.php.

89 : bool|int
90 {
91 if (is_null($length)) {
92 return fwrite($handle, $string);
93 }
94
95 return fwrite($handle, $string, $length);
96 }
static fwrite($handle, string $string, ?int $length=null)

References ILIAS\Filesystem\Util\PHPStreamFunctions\fwrite().

Referenced by ILIAS\Filesystem\Util\PHPStreamFunctions\fwrite(), ILIAS\Filesystem\Stream\StreamTest\testWriteWhichShouldSucceed(), and ILIAS\Filesystem\Stream\Stream\write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ stream_get_contents()

static ILIAS\Filesystem\Util\PHPStreamFunctions::stream_get_contents (   $handle,
  $length = -1 
)
static
Parameters
resource$handle
See also
stream_get_contents()

Definition at line 79 of file PHPStreamFunctions.php.

79 : bool|string
80 {
81 return stream_get_contents($handle, $length);
82 }
static stream_get_contents($handle, $length=-1)

References ILIAS\Filesystem\Util\PHPStreamFunctions\stream_get_contents().

Referenced by ILIAS\Filesystem\Stream\Stream\getContents(), and ILIAS\Filesystem\Util\PHPStreamFunctions\stream_get_contents().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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