ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

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

61  : void
62  {
63  fclose($handle);
64  }
+ 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.

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

70  : bool|string
71  {
72  return fread($handle, $length);
73  }
+ 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.

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

52  : int
53  {
54  return fseek($stream, $offset, $whence);
55  }
static fseek($stream, int $offset, int $whence)
+ 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.

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

43  : bool|int
44  {
45  return ftell($handle);
46  }
+ 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.

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

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)
+ 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.

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

79  : bool|string
80  {
81  return stream_get_contents($handle, $length);
82  }
static stream_get_contents($handle, $length=-1)
+ Here is the caller graph for this function:

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