ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 fclose ($handle)
 fclose wrapper More...
 
static fseek ($stream, $offset, $whence)
 fseek wrapper. More...
 
static fread ($handle, $length)
 fread wrapper More...
 
static stream_get_contents ($handle, $length=-1)
 stream_get_contents wrapper More...
 
static fwrite ($handle, $string, $length=null)
 fwrite wrapper More...
 

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

Member Function Documentation

◆ fclose()

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

fclose wrapper

Parameters
$handle
See also
fclose()

Definition at line 44 of file PHPStreamFunctions.php.

45 {
46 fclose($handle);
47 }
static fclose($handle)
fclose wrapper

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,
  $length 
)
static

fread wrapper

Parameters
$handle
$length
Returns
bool|string
See also
fread()

Definition at line 75 of file PHPStreamFunctions.php.

76 {
77 return fread($handle, $length);
78 }
static fread($handle, $length)
fread wrapper

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,
  $offset,
  $whence 
)
static

fseek wrapper.

Parameters
$stream
$offset
$whence
Returns
int 0 or -1

Definition at line 59 of file PHPStreamFunctions.php.

60 {
61 return fseek($stream, $offset, $whence);
62 }
static fseek($stream, $offset, $whence)
fseek wrapper.
$stream
PHP stream implementation.

References GuzzleHttp\Psr7\$stream, and 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
$handle
Returns
bool|int
See also
ftell()

Definition at line 31 of file PHPStreamFunctions.php.

32 {
33 return ftell($handle);
34 }

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,
  $length = null 
)
static

fwrite wrapper

Parameters
$handle
$string
null$length
Returns
bool|int
See also
fwrite()

Definition at line 108 of file PHPStreamFunctions.php.

109 {
110
111 //it seems like php juggles the null to 0 and pass it to the function which leads to a write operation of zero length ...
112 if (is_null($length)) {
113 return fwrite($handle, $string);
114 }
115
116 return fwrite($handle, $string, $length);
117 }
static fwrite($handle, $string, $length=null)
fwrite wrapper

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

stream_get_contents wrapper

Parameters
$handle
$length
Returns
bool|string
See also
stream_get_contents()

Definition at line 91 of file PHPStreamFunctions.php.

92 {
93 return stream_get_contents($handle, $length);
94 }
static stream_get_contents($handle, $length=-1)
stream_get_contents wrapper

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: