|
1
|
|
|
<?php |
|
2
|
|
|
namespace ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets; |
|
3
|
|
|
|
|
4
|
|
|
/* |
|
5
|
|
|
* This file is part of the TYPO3 CMS project. |
|
6
|
|
|
* |
|
7
|
|
|
* It is free software; you can redistribute it and/or modify it under |
|
8
|
|
|
* the terms of the GNU General Public License, either version 2 |
|
9
|
|
|
* of the License, or any later version. |
|
10
|
|
|
* |
|
11
|
|
|
* For the full copyright and license information, please read the |
|
12
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
13
|
|
|
* |
|
14
|
|
|
* The TYPO3 project - inspiring people to share! |
|
15
|
|
|
*/ |
|
16
|
|
|
|
|
17
|
|
|
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets\OptionBased\Hierarchy\HierarchyUrlDecoder; |
|
18
|
|
|
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets\OptionBased\QueryGroup\QueryGroupUrlDecoder; |
|
19
|
|
|
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets\RangeBased\DateRange\DateRangeUrlDecoder; |
|
20
|
|
|
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets\RangeBased\NumericRange\NumericRangeUrlDecoder; |
|
21
|
|
|
use ApacheSolrForTypo3\Solr\System\Object\AbstractClassRegistry; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Class FacetUrlEncoderRegistry |
|
25
|
|
|
* |
|
26
|
|
|
* Responsibility: This class can be used to register and retrieve classed that are |
|
27
|
|
|
* responsible to encode and decode the facet values for the EXT:solr urls. |
|
28
|
|
|
* |
|
29
|
|
|
* @author Frans Saris <[email protected]> |
|
30
|
|
|
* @author Timo Hund <[email protected]> |
|
31
|
|
|
* @package ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Facets |
|
32
|
|
|
*/ |
|
33
|
|
|
class FacetUrlDecoderRegistry extends AbstractClassRegistry |
|
34
|
|
|
{ |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Array of available encoder classNames |
|
38
|
|
|
* @var array |
|
39
|
|
|
*/ |
|
40
|
|
|
protected $classMap = [ |
|
41
|
|
|
'hierarchy' => HierarchyUrlDecoder::class, |
|
42
|
|
|
'queryGroup' => QueryGroupUrlDecoder::class, |
|
43
|
|
|
'dateRange' => DateRangeUrlDecoder::class, |
|
44
|
|
|
'numericRange' => NumericRangeUrlDecoder::class |
|
45
|
|
|
]; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Default parser className |
|
49
|
|
|
* |
|
50
|
|
|
* @var string |
|
51
|
|
|
*/ |
|
52
|
|
|
protected $defaultClass = DefaultUrlDecoder::class; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Get url encoder |
|
56
|
|
|
* |
|
57
|
|
|
* @param string $type |
|
58
|
|
|
* @return FacetUrlDecoderInterface |
|
59
|
|
|
* @throws \Exception |
|
60
|
|
|
*/ |
|
61
|
3 |
|
public function getUrlDecoder($type) |
|
62
|
|
|
{ |
|
63
|
3 |
|
$instance = $this->getInstance($type); |
|
64
|
3 |
|
if(!$instance instanceof FacetUrlDecoderInterface) { |
|
65
|
|
|
throw new \Exception('Invalid class registered for ' . htmlspecialchars($type)); |
|
66
|
|
|
} |
|
67
|
3 |
|
return $instance; |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
|