SVN
| Revision 1490,
697 bytes
checked in by anatoo, 10 months ago
(diff) |
|
0.2ブランチのリビジョン1489,1488の変更をtrunkに取り込んだ
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | /** |
|---|
| 3 | * @package PEG |
|---|
| 4 | * @author anatoo<anatoo@nequal.jp> |
|---|
| 5 | * @license http://www.opensource.org/licenses/mit-license.php MIT License |
|---|
| 6 | * @version $Id: CallbackAction.php 655 2009-04-12 07:26:42Z anatoo $ |
|---|
| 7 | */ |
|---|
| 8 | |
|---|
| 9 | class PEG_CallbackAction extends PEG_Action |
|---|
| 10 | { |
|---|
| 11 | protected $callback; |
|---|
| 12 | function __construct($callback, PEG_IParser $parser) |
|---|
| 13 | { |
|---|
| 14 | if (!is_callable($callback) && !function_exists($callback)) throw new InvalidArgumentException('first argument must be callable'); |
|---|
| 15 | $this->callback = $callback; |
|---|
| 16 | parent::__construct($parser); |
|---|
| 17 | } |
|---|
| 18 | protected function process($result) |
|---|
| 19 | { |
|---|
| 20 | return call_user_func($this->callback, $result); |
|---|
| 21 | } |
|---|
| 22 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.