ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 18 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 43 of file PHPStreamFunctions.php.

Referenced by ILIAS\Filesystem\Stream\Stream\close().

44  {
45  fclose($handle);
46  }
static fclose($handle)
fclose wrapper
+ 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 74 of file PHPStreamFunctions.php.

Referenced by ILIAS\Filesystem\Stream\Stream\read().

75  {
76  return fread($handle, $length);
77  }
static fread($handle, $length)
fread wrapper
+ 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 58 of file PHPStreamFunctions.php.

References GuzzleHttp\Psr7\$stream.

Referenced by ILIAS\Filesystem\Stream\Stream\seek().

59  {
60  return fseek($stream, $offset, $whence);
61  }
static fseek($stream, $offset, $whence)
fseek wrapper.
$stream
PHP stream implementation.
+ 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 30 of file PHPStreamFunctions.php.

Referenced by ILIAS\Filesystem\Stream\Stream\tell().

31  {
32  return ftell($handle);
33  }
+ 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 107 of file PHPStreamFunctions.php.

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

108  {
109 
110  //it seems like php juggles the null to 0 and pass it to the function which leads to a write operation of zero length ...
111  if (is_null($length)) {
112  return fwrite($handle, $string);
113  }
114 
115  return fwrite($handle, $string, $length);
116  }
static fwrite($handle, $string, $length=null)
fwrite wrapper
+ 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 90 of file PHPStreamFunctions.php.

Referenced by ILIAS\Filesystem\Stream\Stream\getContents().

91  {
92  return stream_get_contents($handle, $length);
93  }
static stream_get_contents($handle, $length=-1)
stream_get_contents wrapper
+ Here is the caller graph for this function:

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