1 | <?php |
||
39 | class ResultParserRegistry implements SingletonInterface |
||
40 | { |
||
41 | /** |
||
42 | * Array of available parser classNames |
||
43 | * |
||
44 | * @var array |
||
45 | */ |
||
46 | protected $parsers = [ |
||
47 | 100 => DefaultResultParser::class, |
||
48 | ]; |
||
49 | |||
50 | /** |
||
51 | * @var AbstractResultParser[] |
||
52 | */ |
||
53 | protected $parserInstances; |
||
54 | |||
55 | /** |
||
56 | * Get registered parser classNames |
||
57 | * |
||
58 | * @return array |
||
59 | */ |
||
60 | public function getParsers() |
||
64 | |||
65 | /** |
||
66 | * Can be used to register a custom parser. |
||
67 | * |
||
68 | * @param string $className classname of the parser that should be used |
||
69 | * @param int $priority higher priority means more important |
||
70 | * @throws \InvalidArgumentException |
||
71 | */ |
||
72 | public function registerParser($className, $priority) |
||
89 | |||
90 | /** |
||
91 | * Method to check if a certain parser is allready registered |
||
92 | * |
||
93 | * @param string $className |
||
94 | * @param int $priority |
||
95 | * @return boolean |
||
96 | */ |
||
97 | public function hasParser($className, $priority) |
||
105 | |||
106 | /** |
||
107 | * @return AbstractResultParser[] |
||
108 | */ |
||
109 | public function getParserInstances() |
||
120 | |||
121 | /** |
||
122 | * @param SearchResultSet $resultSet |
||
123 | * @return AbstractResultParser|null |
||
124 | */ |
||
125 | public function getParser(SearchResultSet $resultSet) |
||
135 | |||
136 | /** |
||
137 | * Create an instance of a certain parser class |
||
138 | * |
||
139 | * @return AbstractResultParser |
||
140 | */ |
||
141 | protected function createParserInstance($className) |
||
145 | } |
||
146 |