Skip to content

Commit 50bba47

Browse files
committed
Hold the structs information in a private property
1 parent d90c20a commit 50bba47

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

PHPCtags.class.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@ class PHPCtags
1515

1616
private $mParser;
1717

18+
private $mStructs;
19+
1820
private $mOptions;
1921

2022
public function __construct($options)
2123
{
2224
$this->mParser = new PHPParser_Parser(new PHPParser_Lexer);
25+
$this->mStructs = array();
2326
$this->mOptions = $options;
2427
}
2528

@@ -208,10 +211,10 @@ private function struct($node, $reset=FALSE, $parent=array())
208211
return $structs;
209212
}
210213

211-
private function render($structs)
214+
private function render()
212215
{
213216
$str = '';
214-
foreach ($structs as $struct) {
217+
foreach ($this->mStructs as $struct) {
215218
$file = $struct['file'];
216219

217220
if (!isset($files[$file]))
@@ -293,7 +296,6 @@ private function render($structs)
293296

294297
public function export($file)
295298
{
296-
$structs = array();
297299
if (is_dir($file) && isset($this->mOptions['R'])) {
298300
$iterator = new RecursiveIteratorIterator(
299301
new RecursiveDirectoryIterator(
@@ -315,13 +317,13 @@ public function export($file)
315317
}
316318

317319
$this->setMFile((string) $filename);
318-
$structs += $this->struct($this->mParser->parse(file_get_contents($this->mFile)), TRUE);
320+
$this->mStructs += $this->struct($this->mParser->parse(file_get_contents($this->mFile)), TRUE);
319321
}
320322
} else {
321323
$this->setMFile($file);
322-
$structs += $this->struct($this->mParser->parse(file_get_contents($this->mFile)), TRUE);
324+
$this->mStructs += $this->struct($this->mParser->parse(file_get_contents($this->mFile)), TRUE);
323325
}
324-
return $this->render($structs);
326+
return $this->render();
325327
}
326328
}
327329

0 commit comments

Comments
 (0)