ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Gettext\Utils\StringReader Class Reference
+ Collaboration diagram for Gettext\Utils\StringReader:

Public Member Functions

 __construct ($str)
 Constructor. More...
 
 read ($bytes)
 Read and returns a part of the string. More...
 
 seekto ($pos)
 Move the cursor to a specific position. More...
 

Data Fields

 $pos
 
 $str
 
 $strlen
 

Detailed Description

Definition at line 5 of file StringReader.php.

Constructor & Destructor Documentation

◆ __construct()

Gettext\Utils\StringReader::__construct (   $str)

Constructor.

Parameters
string$strThe string to read

Definition at line 16 of file StringReader.php.

References Gettext\Utils\StringReader\$str, and GuzzleHttp\Psr7\str().

17  {
18  $this->str = $str;
19  $this->strlen = strlen($this->str);
20  }
str(MessageInterface $message)
Returns the string representation of an HTTP message.
Definition: functions.php:18
+ Here is the call graph for this function:

Member Function Documentation

◆ read()

Gettext\Utils\StringReader::read (   $bytes)

Read and returns a part of the string.

Parameters
int$bytesThe number of bytes to read
Returns
string

Definition at line 29 of file StringReader.php.

References $data, Gettext\Utils\StringReader\seekto(), and GuzzleHttp\Psr7\str().

Referenced by Gettext\Extractors\Mo\readInt(), and Gettext\Extractors\Mo\readIntArray().

30  {
31  $data = substr($this->str, $this->pos, $bytes);
32 
33  $this->seekto($this->pos + $bytes);
34 
35  return $data;
36  }
seekto($pos)
Move the cursor to a specific position.
str(MessageInterface $message)
Returns the string representation of an HTTP message.
Definition: functions.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ seekto()

Gettext\Utils\StringReader::seekto (   $pos)

Move the cursor to a specific position.

Parameters
int$posThe amount of bytes to move
Returns
int The new position

Definition at line 45 of file StringReader.php.

References Gettext\Utils\StringReader\$pos.

Referenced by Gettext\Utils\StringReader\read().

46  {
47  $this->pos = ($this->strlen < $pos) ? $this->strlen : $pos;
48 
49  return $this->pos;
50  }
+ Here is the caller graph for this function:

Field Documentation

◆ $pos

Gettext\Utils\StringReader::$pos

Definition at line 7 of file StringReader.php.

Referenced by Gettext\Utils\StringReader\seekto().

◆ $str

Gettext\Utils\StringReader::$str

Definition at line 8 of file StringReader.php.

Referenced by Gettext\Utils\StringReader\__construct().

◆ $strlen

Gettext\Utils\StringReader::$strlen

Definition at line 9 of file StringReader.php.


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