ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ParsedFunction.php
Go to the documentation of this file.
1<?php
2
3namespace Gettext\Utils;
4
9{
15 protected $name;
16
22 protected $line;
23
29 protected $arguments;
30
36 protected $argumentIndex;
37
44
50 protected $comments;
51
58 public function __construct($name, $line)
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 }
67
71 public function stopArgument()
72 {
73 if ($this->argumentIndex === -1) {
74 $this->argumentIndex = 0;
75 }
76 $this->argumentStopped = true;
77 }
78
82 public function nextArgument()
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 }
92
98 public function addArgumentChunk($chunk)
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 }
111
117 public function addComment($comment)
118 {
119 if ($this->comments === null) {
120 $this->comments = array();
121 }
122 $this->comments[] = $comment;
123 }
135 public function close()
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,
146 $this->comments,
147 );
148 }
149}
$comment
Definition: buildRTE.php:83
An exception for terminatinating execution or to throw for unit testing.
Function parsed by PhpFunctionsScanner.
addComment($comment)
Add a comment associated to this function.
__construct($name, $line)
Initializes the instance.
stopArgument()
Stop extracting strings from the current argument (because we found something that's not a string).
addArgumentChunk($chunk)
Add a string to the current argument.
nextArgument()
Go to the next argument because we a comma was found.
$i
Definition: disco.tpl.php:19