1: <?php
2: /**
3: * Indicates a parse error when reading a Kolab Format object.
4: *
5: * PHP version 5
6: *
7: * @category Kolab
8: * @package Kolab_Format
9: * @author Gunnar Wrobel <wrobel@pardus.de>
10: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
11: * @link http://www.horde.org/libraries/Horde_Kolab_Format
12: */
13:
14: /**
15: * Indicates a parse error when reading a Kolab Format object.
16: *
17: * Copyright 2009-2012 Horde LLC (http://www.horde.org/)
18: *
19: * See the enclosed file COPYING for license information (LGPL). If you
20: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
21: *
22: * @category Kolab
23: * @package Kolab_Format
24: * @author Gunnar Wrobel <wrobel@pardus.de>
25: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
26: * @link http://www.horde.org/libraries/Horde_Kolab_Format
27: */
28: class Horde_Kolab_Format_Exception_ParseError
29: extends Horde_Kolab_Format_Exception
30: {
31: /**
32: * The input that failed to parse.
33: *
34: * @var resource
35: */
36: private $_input;
37:
38: /**
39: * Constructor.
40: *
41: * @param string $input The input that failed to parse.
42: */
43: public function __construct($input)
44: {
45: if (strlen((string)$input) > 50) {
46: $output = substr((string)$input, 0, 50)
47: . '... [shortened to 50 characters]';
48: } else {
49: $output = (string)$input;
50: }
51: $this->_input = $input;
52: parent::__construct(
53: sprintf(
54: "Failed parsing Kolab object input data of type %s! Input was:\n%s",
55: gettype($input), $output
56: )
57: );
58: }
59:
60: /**
61: * Return the complete input.
62: *
63: * @return resource The input that failed to parse.
64: */
65: public function getInput()
66: {
67: return $this->_input;
68: }
69: }