ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Gettext\Utils\ParsedFunction Class Reference

Function parsed by PhpFunctionsScanner. More...

+ Collaboration diagram for Gettext\Utils\ParsedFunction:

Public Member Functions

 __construct ($name, $line)
 Initializes the instance. More...
 
 stopArgument ()
 Stop extracting strings from the current argument (because we found something that's not a string). More...
 
 nextArgument ()
 Go to the next argument because we a comma was found. More...
 
 addArgumentChunk ($chunk)
 Add a string to the current argument. More...
 
 addComment ($comment)
 Add a comment associated to this function. More...
 
 close ()
 

Protected Attributes

 $name
 
 $line
 
 $arguments
 
 $argumentIndex
 
 $argumentStopped
 
 $comments
 

Detailed Description

Function parsed by PhpFunctionsScanner.

Definition at line 8 of file ParsedFunction.php.

Constructor & Destructor Documentation

◆ __construct()

Gettext\Utils\ParsedFunction::__construct (   $name,
  $line 
)

Initializes the instance.

Parameters
string$nameThe function name.
int$lineThe line where the function starts.

Definition at line 58 of file ParsedFunction.php.

References Gettext\Utils\ParsedFunction\$line, and Gettext\Utils\ParsedFunction\$name.

59  {
60  $this->name = $name;
61  $this->line = $line;
62  $this->arguments = array();
63  $this->argumentIndex = -1;
64  $this->argumentStopped = false;
65  $this->comments = null;
66  }

Member Function Documentation

◆ addArgumentChunk()

Gettext\Utils\ParsedFunction::addArgumentChunk (   $chunk)

Add a string to the current argument.

Parameters
string$chunk

Definition at line 98 of file ParsedFunction.php.

References Gettext\Utils\ParsedFunction\$argumentIndex.

99  {
100  if ($this->argumentStopped === false) {
101  if ($this->argumentIndex === -1) {
102  $this->argumentIndex = 0;
103  }
104  if (isset($this->arguments[$this->argumentIndex])) {
105  $this->arguments[$this->argumentIndex] .= $chunk;
106  } else {
107  $this->arguments[$this->argumentIndex] = $chunk;
108  }
109  }
110  }

◆ addComment()

Gettext\Utils\ParsedFunction::addComment (   $comment)

Add a comment associated to this function.

Parameters
string$comment

Definition at line 117 of file ParsedFunction.php.

References $comment.

118  {
119  if ($this->comments === null) {
120  $this->comments = array();
121  }
122  $this->comments[] = $comment;
123  }
$comment
Definition: buildRTE.php:83

◆ close()

Gettext\Utils\ParsedFunction::close ( )

Definition at line 135 of file ParsedFunction.php.

References Gettext\Utils\ParsedFunction\$argumentIndex, Gettext\Utils\ParsedFunction\$arguments, and $i.

136  {
137  $arguments = array();
138  for ($i = 0; $i <= $this->argumentIndex; ++$i) {
139  $arguments[$i] = isset($this->arguments[$i]) ? $this->arguments[$i] : '';
140  }
141 
142  return array(
143  $this->name,
144  $this->line,
145  $arguments,
146  $this->comments,
147  );
148  }
$i
Definition: disco.tpl.php:19

◆ nextArgument()

Gettext\Utils\ParsedFunction::nextArgument ( )

Go to the next argument because we a comma was found.

Definition at line 82 of file ParsedFunction.php.

References Gettext\Utils\ParsedFunction\$argumentIndex.

83  {
84  if ($this->argumentIndex === -1) {
85  // This should neve occur, but let's stay safe - During test/development an Exception should be thrown.
86  $this->argumentIndex = 1;
87  } else {
89  }
90  $this->argumentStopped = false;
91  }

◆ stopArgument()

Gettext\Utils\ParsedFunction::stopArgument ( )

Stop extracting strings from the current argument (because we found something that's not a string).

Definition at line 71 of file ParsedFunction.php.

72  {
73  if ($this->argumentIndex === -1) {
74  $this->argumentIndex = 0;
75  }
76  $this->argumentStopped = true;
77  }

Field Documentation

◆ $argumentIndex

Gettext\Utils\ParsedFunction::$argumentIndex
protected

◆ $arguments

Gettext\Utils\ParsedFunction::$arguments
protected

Definition at line 29 of file ParsedFunction.php.

Referenced by Gettext\Utils\ParsedFunction\close().

◆ $argumentStopped

Gettext\Utils\ParsedFunction::$argumentStopped
protected

Definition at line 43 of file ParsedFunction.php.

◆ $comments

Gettext\Utils\ParsedFunction::$comments
protected

Definition at line 50 of file ParsedFunction.php.

◆ $line

Gettext\Utils\ParsedFunction::$line
protected

Definition at line 22 of file ParsedFunction.php.

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

◆ $name

Gettext\Utils\ParsedFunction::$name
protected

Definition at line 15 of file ParsedFunction.php.

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


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