Skip to content

Commit 14b0b9b

Browse files
committed
Be compatible with PHP 5.3.*
Fix #20.
1 parent 0387287 commit 14b0b9b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

buildPHAR.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
$phar = new Phar('build/phpctags.phar', 0, 'phpctags.phar');
44

5+
if (version_compare(PHP_VERSION, '5.4.0') < 0) {
6+
class RecursiveCallbackFilterIterator extends RecursiveFilterIterator {
7+
public function __construct ( RecursiveIterator $iterator, $callback ) {
8+
$this->callback = $callback;
9+
parent::__construct($iterator);
10+
}
11+
12+
public function accept () {
13+
$callback = $this->callback;
14+
return $callback(parent::current(), parent::key(), parent::getInnerIterator());
15+
}
16+
17+
public function getChildren () {
18+
return new self($this->getInnerIterator()->getChildren(), $this->callback);
19+
}
20+
}
21+
}
22+
523
$phar->buildFromIterator(
624
new RecursiveIteratorIterator(
725
new RecursiveCallbackFilterIterator(

0 commit comments

Comments
 (0)