1: <?php
2: /**
3: * A parser variant that does not automatically exit on a parser error.
4: *
5: * PHP version 5
6: *
7: * @category Kolab
8: * @package Kolab_Filter
9: * @author Gunnar Wrobel <wrobel@pardus.de>
10: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
11: * @link http://pear.horde.org/index.php?package=Kolab_Filter
12: */
13:
14: /**
15: * A parser variant that does not automatically exit on a parser error.
16: *
17: * Copyright 2008 Klarälvdalens Datakonsult AB
18: *
19: * See the enclosed file COPYING for license information (LGPL). If you did not
20: * receive this file, see
21: * http://www.horde.org/licenses/lgpl21.
22: *
23: * @category Kolab
24: * @package Kolab_Filter
25: * @author Gunnar Wrobel <wrobel@pardus.de>
26: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
27: * @link http://pear.horde.org/index.php?package=Kolab_Filter
28: */
29: class Horde_Kolab_Filter_Cli_Parser extends Horde_Argv_Parser
30: {
31: public function parserError($msg)
32: {
33: return $this->parserExit(0, $msg);
34: }
35:
36: public function parserExit($status = 0, $msg = null)
37: {
38: throw new InvalidArgumentException(
39: sprintf("%s: error: %s\n", $this->getProgName(), $msg)
40: );
41: }
42: }
43: