1 | <?php |
||
32 | abstract class AbstractFieldList implements ParameterBuilder |
||
33 | { |
||
34 | /** |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $fieldList = []; |
||
38 | |||
39 | /** |
||
40 | * Parameter key which should be used for Apache Solr URL query |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $parameterKey = ''; |
||
45 | |||
46 | /** |
||
47 | * FieldList parameter builder constructor. |
||
48 | * |
||
49 | * private constructor should only be created with the from* methods |
||
50 | * |
||
51 | * @param array $fieldList |
||
52 | */ |
||
53 | private function __construct(array $fieldList) |
||
57 | |||
58 | /** |
||
59 | * @param string $fieldName |
||
60 | * @param float $boost |
||
61 | * |
||
62 | * @return ParameterBuilder |
||
63 | */ |
||
64 | public function add(string $fieldName, float $boost = 1.0): ParameterBuilder |
||
69 | |||
70 | /** |
||
71 | * @return array |
||
72 | */ |
||
73 | public function build() : array |
||
79 | |||
80 | /** |
||
81 | * Creates the string representation |
||
82 | * |
||
83 | * @param string $delimiter |
||
84 | * @return string |
||
85 | */ |
||
86 | public function toString(string $delimiter = ' ') |
||
102 | |||
103 | /** |
||
104 | * Parses the string representation of the fieldList (e.g. content^100, title^10) to the object representation. |
||
105 | * |
||
106 | * @param string $fieldListString |
||
107 | * @param string $delimiter |
||
108 | * @return AbstractFieldList |
||
109 | */ |
||
110 | protected static function initializeFromString(string $fieldListString, string $delimiter = ',') : AbstractFieldList |
||
129 | } |
||
130 |