ILIAS  release_8 Revision v8.24
ILIAS\Filesystem\Util\PHPStreamFunctions Class Reference

Class PHPFunctions. 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

Class PHPFunctions.

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
Since
5.3
Version
1.0.0

Definition at line 34 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 63 of file PHPStreamFunctions.php.

63 : void
64 {
65 fclose($handle);
66 }

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
Returns
bool|string
See also
fread()

Definition at line 73 of file PHPStreamFunctions.php.

74 {
75 return fread($handle, $length);
76 }

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 54 of file PHPStreamFunctions.php.

54 : int
55 {
56 return fseek($stream, $offset, $whence);
57 }
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
Returns
bool|int
See also
ftell()

Definition at line 45 of file PHPStreamFunctions.php.

46 {
47 return ftell($handle);
48 }

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
Returns
bool|int
See also
fwrite()

Definition at line 94 of file PHPStreamFunctions.php.

95 {
96 if (is_null($length)) {
97 return fwrite($handle, $string);
98 }
99
100 return fwrite($handle, $string, $length);
101 }
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
Returns
bool|string
See also
stream_get_contents()

Definition at line 83 of file PHPStreamFunctions.php.

84 {
85 return stream_get_contents($handle, $length);
86 }
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: