1 | <?php |
||
11 | abstract class BaseParser implements ParserInterface |
||
12 | { |
||
13 | use LoggerAwareTrait; |
||
14 | |||
15 | protected $collector; |
||
16 | protected $parseWarningThreshold; |
||
17 | |||
18 | const DEFAULT_PARSE_WARNING_THRESHOLD = 500; |
||
19 | |||
20 | 7 | public function __construct(CollectorInterface $collector = null) |
|
27 | |||
28 | /** |
||
29 | * {@inheritdoc} |
||
30 | */ |
||
31 | 2 | public function setCollector(CollectorInterface $collector) |
|
36 | |||
37 | /** |
||
38 | * {@inheritdoc} |
||
39 | */ |
||
40 | 3 | public function getCollector() |
|
44 | |||
45 | /** |
||
46 | * Getter for parseWarningThreshold |
||
47 | * |
||
48 | * return string |
||
49 | */ |
||
50 | 4 | public function getParseWarningThreshold() |
|
55 | |||
56 | /** |
||
57 | * Setter for parseWarningThreshold |
||
58 | * |
||
59 | * @param int $parseWarningThreshold |
||
60 | * @return BaseParser |
||
61 | */ |
||
62 | 2 | public function setParseWarningThreshold($parseWarningThreshold) |
|
67 | |||
68 | |||
69 | /** |
||
70 | * Return data stream, either from passed in stream or from the collector. |
||
71 | * |
||
72 | * @throws Exception if no StreamInterface can be retrurned |
||
73 | * |
||
74 | * @param StreamInterface $data = null |
||
75 | * @return StreamInterface |
||
76 | */ |
||
77 | 6 | protected function getStreamData(StreamInterface $data = null) |
|
94 | |||
95 | |||
96 | /** |
||
97 | * {@inheritdoc} |
||
98 | */ |
||
99 | abstract public function parse(StreamInterface $data = null); |
||
100 | } |
||
101 |