@@ -43,235 +43,235 @@ |
||
43 | 43 | * |
44 | 44 | */ |
45 | 45 | final class WidgetSetup implements JsonSerializable { |
46 | - public const SIZE_TYPE_MIN = 'min'; |
|
47 | - public const SIZE_TYPE_MAX = 'max'; |
|
48 | - public const SIZE_TYPE_DEFAULT = 'default'; |
|
49 | - |
|
50 | - |
|
51 | - /** @var array */ |
|
52 | - private $sizes = []; |
|
53 | - |
|
54 | - /** @var array */ |
|
55 | - private $menus = []; |
|
56 | - |
|
57 | - /** @var array */ |
|
58 | - private $jobs = []; |
|
59 | - |
|
60 | - /** @var string */ |
|
61 | - private $push = ''; |
|
62 | - |
|
63 | - /** @var array */ |
|
64 | - private $settings = []; |
|
65 | - |
|
66 | - |
|
67 | - /** |
|
68 | - * Get the defined size for a specific type (min, max, default) |
|
69 | - * Returns an array: |
|
70 | - * [ |
|
71 | - * 'width' => width, |
|
72 | - * 'height' => height |
|
73 | - * ] |
|
74 | - * |
|
75 | - * |
|
76 | - * @since 15.0.0 |
|
77 | - * @deprecated 20.0.0 |
|
78 | - * |
|
79 | - * @param string $type |
|
80 | - * |
|
81 | - * @return array |
|
82 | - */ |
|
83 | - public function getSize(string $type): array { |
|
84 | - if (array_key_exists($type, $this->sizes)) { |
|
85 | - return $this->sizes[$type]; |
|
86 | - } |
|
87 | - |
|
88 | - return []; |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * Returns all sizes defined for the widget. |
|
93 | - * |
|
94 | - * @since 15.0.0 |
|
95 | - * @deprecated 20.0.0 |
|
96 | - * |
|
97 | - * @return array |
|
98 | - */ |
|
99 | - public function getSizes(): array { |
|
100 | - return $this->sizes; |
|
101 | - } |
|
102 | - |
|
103 | - /** |
|
104 | - * Add a new size to the setup. |
|
105 | - * |
|
106 | - * @since 15.0.0 |
|
107 | - * @deprecated 20.0.0 |
|
108 | - * |
|
109 | - * @param string $type |
|
110 | - * @param int $width |
|
111 | - * @param int $height |
|
112 | - * |
|
113 | - * @return WidgetSetup |
|
114 | - */ |
|
115 | - public function addSize(string $type, int $width, int $height): WidgetSetup { |
|
116 | - $this->sizes[$type] = [ |
|
117 | - 'width' => $width, |
|
118 | - 'height' => $height |
|
119 | - ]; |
|
120 | - |
|
121 | - return $this; |
|
122 | - } |
|
123 | - |
|
124 | - /** |
|
125 | - * Returns menu entries. |
|
126 | - * |
|
127 | - * @since 15.0.0 |
|
128 | - * @deprecated 20.0.0 |
|
129 | - * |
|
130 | - * @return array |
|
131 | - */ |
|
132 | - public function getMenuEntries(): array { |
|
133 | - return $this->menus; |
|
134 | - } |
|
135 | - |
|
136 | - /** |
|
137 | - * Add a menu entry to the widget. |
|
138 | - * $function is the Javascript function to be called when clicking the |
|
139 | - * menu entry. |
|
140 | - * $icon is the css class of the icon. |
|
141 | - * $text is the display name of the menu entry. |
|
142 | - * |
|
143 | - * @since 15.0.0 |
|
144 | - * @deprecated 20.0.0 |
|
145 | - * |
|
146 | - * @param string $function |
|
147 | - * @param string $icon |
|
148 | - * @param string $text |
|
149 | - * |
|
150 | - * @return WidgetSetup |
|
151 | - */ |
|
152 | - public function addMenuEntry(string $function, string $icon, string $text): WidgetSetup { |
|
153 | - $this->menus[] = [ |
|
154 | - 'function' => $function, |
|
155 | - 'icon' => $icon, |
|
156 | - 'text' => $text |
|
157 | - ]; |
|
158 | - |
|
159 | - return $this; |
|
160 | - } |
|
161 | - |
|
162 | - |
|
163 | - /** |
|
164 | - * Add a delayed job to the widget. |
|
165 | - * |
|
166 | - * $function is the Javascript function to be called. |
|
167 | - * $delay is the time in seconds between each call. |
|
168 | - * |
|
169 | - * @since 15.0.0 |
|
170 | - * @deprecated 20.0.0 |
|
171 | - * |
|
172 | - * @param string $function |
|
173 | - * @param int $delay |
|
174 | - * |
|
175 | - * @return WidgetSetup |
|
176 | - */ |
|
177 | - public function addDelayedJob(string $function, int $delay): WidgetSetup { |
|
178 | - $this->jobs[] = [ |
|
179 | - 'function' => $function, |
|
180 | - 'delay' => $delay |
|
181 | - ]; |
|
182 | - |
|
183 | - return $this; |
|
184 | - } |
|
185 | - |
|
186 | - /** |
|
187 | - * Get delayed jobs. |
|
188 | - * |
|
189 | - * @since 15.0.0 |
|
190 | - * @deprecated 20.0.0 |
|
191 | - * |
|
192 | - * @return array |
|
193 | - */ |
|
194 | - public function getDelayedJobs(): array { |
|
195 | - return $this->jobs; |
|
196 | - } |
|
197 | - |
|
198 | - |
|
199 | - /** |
|
200 | - * Get the push function, called when an event is send to the front-end |
|
201 | - * |
|
202 | - * @since 15.0.0 |
|
203 | - * @deprecated 20.0.0 |
|
204 | - * |
|
205 | - * @return string |
|
206 | - */ |
|
207 | - public function getPush(): string { |
|
208 | - return $this->push; |
|
209 | - } |
|
210 | - |
|
211 | - /** |
|
212 | - * Set the Javascript function to be called when an event is pushed to the |
|
213 | - * frontend. |
|
214 | - * |
|
215 | - * @since 15.0.0 |
|
216 | - * @deprecated 20.0.0 |
|
217 | - * |
|
218 | - * @param string $function |
|
219 | - * |
|
220 | - * @return WidgetSetup |
|
221 | - */ |
|
222 | - public function setPush(string $function): WidgetSetup { |
|
223 | - $this->push = $function; |
|
224 | - |
|
225 | - return $this; |
|
226 | - } |
|
227 | - |
|
228 | - |
|
229 | - /** |
|
230 | - * Returns the default settings for a widget. |
|
231 | - * |
|
232 | - * @since 15.0.0 |
|
233 | - * @deprecated 20.0.0 |
|
234 | - * |
|
235 | - * @return array |
|
236 | - */ |
|
237 | - public function getDefaultSettings(): array { |
|
238 | - return $this->settings; |
|
239 | - } |
|
240 | - |
|
241 | - /** |
|
242 | - * Set the default settings for a widget. |
|
243 | - * This method is used by the Dashboard app, using the settings created |
|
244 | - * using WidgetSetting |
|
245 | - * |
|
246 | - * @see WidgetSetting |
|
247 | - * |
|
248 | - * @since 15.0.0 |
|
249 | - * @deprecated 20.0.0 |
|
250 | - * |
|
251 | - * @param array $settings |
|
252 | - * |
|
253 | - * @return WidgetSetup |
|
254 | - */ |
|
255 | - public function setDefaultSettings(array $settings): WidgetSetup { |
|
256 | - $this->settings = $settings; |
|
257 | - |
|
258 | - return $this; |
|
259 | - } |
|
260 | - |
|
261 | - |
|
262 | - /** |
|
263 | - * @since 15.0.0 |
|
264 | - * @deprecated 20.0.0 |
|
265 | - * |
|
266 | - * @return array |
|
267 | - */ |
|
268 | - public function jsonSerialize() { |
|
269 | - return [ |
|
270 | - 'size' => $this->getSizes(), |
|
271 | - 'menu' => $this->getMenuEntries(), |
|
272 | - 'jobs' => $this->getDelayedJobs(), |
|
273 | - 'push' => $this->getPush(), |
|
274 | - 'settings' => $this->getDefaultSettings() |
|
275 | - ]; |
|
276 | - } |
|
46 | + public const SIZE_TYPE_MIN = 'min'; |
|
47 | + public const SIZE_TYPE_MAX = 'max'; |
|
48 | + public const SIZE_TYPE_DEFAULT = 'default'; |
|
49 | + |
|
50 | + |
|
51 | + /** @var array */ |
|
52 | + private $sizes = []; |
|
53 | + |
|
54 | + /** @var array */ |
|
55 | + private $menus = []; |
|
56 | + |
|
57 | + /** @var array */ |
|
58 | + private $jobs = []; |
|
59 | + |
|
60 | + /** @var string */ |
|
61 | + private $push = ''; |
|
62 | + |
|
63 | + /** @var array */ |
|
64 | + private $settings = []; |
|
65 | + |
|
66 | + |
|
67 | + /** |
|
68 | + * Get the defined size for a specific type (min, max, default) |
|
69 | + * Returns an array: |
|
70 | + * [ |
|
71 | + * 'width' => width, |
|
72 | + * 'height' => height |
|
73 | + * ] |
|
74 | + * |
|
75 | + * |
|
76 | + * @since 15.0.0 |
|
77 | + * @deprecated 20.0.0 |
|
78 | + * |
|
79 | + * @param string $type |
|
80 | + * |
|
81 | + * @return array |
|
82 | + */ |
|
83 | + public function getSize(string $type): array { |
|
84 | + if (array_key_exists($type, $this->sizes)) { |
|
85 | + return $this->sizes[$type]; |
|
86 | + } |
|
87 | + |
|
88 | + return []; |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * Returns all sizes defined for the widget. |
|
93 | + * |
|
94 | + * @since 15.0.0 |
|
95 | + * @deprecated 20.0.0 |
|
96 | + * |
|
97 | + * @return array |
|
98 | + */ |
|
99 | + public function getSizes(): array { |
|
100 | + return $this->sizes; |
|
101 | + } |
|
102 | + |
|
103 | + /** |
|
104 | + * Add a new size to the setup. |
|
105 | + * |
|
106 | + * @since 15.0.0 |
|
107 | + * @deprecated 20.0.0 |
|
108 | + * |
|
109 | + * @param string $type |
|
110 | + * @param int $width |
|
111 | + * @param int $height |
|
112 | + * |
|
113 | + * @return WidgetSetup |
|
114 | + */ |
|
115 | + public function addSize(string $type, int $width, int $height): WidgetSetup { |
|
116 | + $this->sizes[$type] = [ |
|
117 | + 'width' => $width, |
|
118 | + 'height' => $height |
|
119 | + ]; |
|
120 | + |
|
121 | + return $this; |
|
122 | + } |
|
123 | + |
|
124 | + /** |
|
125 | + * Returns menu entries. |
|
126 | + * |
|
127 | + * @since 15.0.0 |
|
128 | + * @deprecated 20.0.0 |
|
129 | + * |
|
130 | + * @return array |
|
131 | + */ |
|
132 | + public function getMenuEntries(): array { |
|
133 | + return $this->menus; |
|
134 | + } |
|
135 | + |
|
136 | + /** |
|
137 | + * Add a menu entry to the widget. |
|
138 | + * $function is the Javascript function to be called when clicking the |
|
139 | + * menu entry. |
|
140 | + * $icon is the css class of the icon. |
|
141 | + * $text is the display name of the menu entry. |
|
142 | + * |
|
143 | + * @since 15.0.0 |
|
144 | + * @deprecated 20.0.0 |
|
145 | + * |
|
146 | + * @param string $function |
|
147 | + * @param string $icon |
|
148 | + * @param string $text |
|
149 | + * |
|
150 | + * @return WidgetSetup |
|
151 | + */ |
|
152 | + public function addMenuEntry(string $function, string $icon, string $text): WidgetSetup { |
|
153 | + $this->menus[] = [ |
|
154 | + 'function' => $function, |
|
155 | + 'icon' => $icon, |
|
156 | + 'text' => $text |
|
157 | + ]; |
|
158 | + |
|
159 | + return $this; |
|
160 | + } |
|
161 | + |
|
162 | + |
|
163 | + /** |
|
164 | + * Add a delayed job to the widget. |
|
165 | + * |
|
166 | + * $function is the Javascript function to be called. |
|
167 | + * $delay is the time in seconds between each call. |
|
168 | + * |
|
169 | + * @since 15.0.0 |
|
170 | + * @deprecated 20.0.0 |
|
171 | + * |
|
172 | + * @param string $function |
|
173 | + * @param int $delay |
|
174 | + * |
|
175 | + * @return WidgetSetup |
|
176 | + */ |
|
177 | + public function addDelayedJob(string $function, int $delay): WidgetSetup { |
|
178 | + $this->jobs[] = [ |
|
179 | + 'function' => $function, |
|
180 | + 'delay' => $delay |
|
181 | + ]; |
|
182 | + |
|
183 | + return $this; |
|
184 | + } |
|
185 | + |
|
186 | + /** |
|
187 | + * Get delayed jobs. |
|
188 | + * |
|
189 | + * @since 15.0.0 |
|
190 | + * @deprecated 20.0.0 |
|
191 | + * |
|
192 | + * @return array |
|
193 | + */ |
|
194 | + public function getDelayedJobs(): array { |
|
195 | + return $this->jobs; |
|
196 | + } |
|
197 | + |
|
198 | + |
|
199 | + /** |
|
200 | + * Get the push function, called when an event is send to the front-end |
|
201 | + * |
|
202 | + * @since 15.0.0 |
|
203 | + * @deprecated 20.0.0 |
|
204 | + * |
|
205 | + * @return string |
|
206 | + */ |
|
207 | + public function getPush(): string { |
|
208 | + return $this->push; |
|
209 | + } |
|
210 | + |
|
211 | + /** |
|
212 | + * Set the Javascript function to be called when an event is pushed to the |
|
213 | + * frontend. |
|
214 | + * |
|
215 | + * @since 15.0.0 |
|
216 | + * @deprecated 20.0.0 |
|
217 | + * |
|
218 | + * @param string $function |
|
219 | + * |
|
220 | + * @return WidgetSetup |
|
221 | + */ |
|
222 | + public function setPush(string $function): WidgetSetup { |
|
223 | + $this->push = $function; |
|
224 | + |
|
225 | + return $this; |
|
226 | + } |
|
227 | + |
|
228 | + |
|
229 | + /** |
|
230 | + * Returns the default settings for a widget. |
|
231 | + * |
|
232 | + * @since 15.0.0 |
|
233 | + * @deprecated 20.0.0 |
|
234 | + * |
|
235 | + * @return array |
|
236 | + */ |
|
237 | + public function getDefaultSettings(): array { |
|
238 | + return $this->settings; |
|
239 | + } |
|
240 | + |
|
241 | + /** |
|
242 | + * Set the default settings for a widget. |
|
243 | + * This method is used by the Dashboard app, using the settings created |
|
244 | + * using WidgetSetting |
|
245 | + * |
|
246 | + * @see WidgetSetting |
|
247 | + * |
|
248 | + * @since 15.0.0 |
|
249 | + * @deprecated 20.0.0 |
|
250 | + * |
|
251 | + * @param array $settings |
|
252 | + * |
|
253 | + * @return WidgetSetup |
|
254 | + */ |
|
255 | + public function setDefaultSettings(array $settings): WidgetSetup { |
|
256 | + $this->settings = $settings; |
|
257 | + |
|
258 | + return $this; |
|
259 | + } |
|
260 | + |
|
261 | + |
|
262 | + /** |
|
263 | + * @since 15.0.0 |
|
264 | + * @deprecated 20.0.0 |
|
265 | + * |
|
266 | + * @return array |
|
267 | + */ |
|
268 | + public function jsonSerialize() { |
|
269 | + return [ |
|
270 | + 'size' => $this->getSizes(), |
|
271 | + 'menu' => $this->getMenuEntries(), |
|
272 | + 'jobs' => $this->getDelayedJobs(), |
|
273 | + 'push' => $this->getPush(), |
|
274 | + 'settings' => $this->getDefaultSettings() |
|
275 | + ]; |
|
276 | + } |
|
277 | 277 | } |
@@ -50,197 +50,197 @@ |
||
50 | 50 | * |
51 | 51 | */ |
52 | 52 | final class WidgetSetting implements JsonSerializable { |
53 | - public const TYPE_INPUT = 'input'; |
|
54 | - public const TYPE_CHECKBOX = 'checkbox'; |
|
55 | - |
|
56 | - |
|
57 | - /** @var string */ |
|
58 | - private $name = ''; |
|
59 | - |
|
60 | - /** @var string */ |
|
61 | - private $title = ''; |
|
62 | - |
|
63 | - /** @var string */ |
|
64 | - private $type = ''; |
|
65 | - |
|
66 | - /** @var string */ |
|
67 | - private $placeholder = ''; |
|
68 | - |
|
69 | - /** @var string */ |
|
70 | - private $default = ''; |
|
71 | - |
|
72 | - |
|
73 | - /** |
|
74 | - * WidgetSetting constructor. |
|
75 | - * |
|
76 | - * @since 15.0.0 |
|
77 | - * @deprecated 20.0.0 |
|
78 | - * |
|
79 | - * @param string $type |
|
80 | - */ |
|
81 | - public function __construct(string $type = '') { |
|
82 | - $this->type = $type; |
|
83 | - } |
|
84 | - |
|
85 | - |
|
86 | - /** |
|
87 | - * Set the name of the setting (full string, no space) |
|
88 | - * |
|
89 | - * @since 15.0.0 |
|
90 | - * @deprecated 20.0.0 |
|
91 | - * |
|
92 | - * @param string $name |
|
93 | - * |
|
94 | - * @return WidgetSetting |
|
95 | - */ |
|
96 | - public function setName(string $name): WidgetSetting { |
|
97 | - $this->name = $name; |
|
98 | - |
|
99 | - return $this; |
|
100 | - } |
|
101 | - |
|
102 | - /** |
|
103 | - * Get the name of the setting |
|
104 | - * |
|
105 | - * @since 15.0.0 |
|
106 | - * @deprecated 20.0.0 |
|
107 | - * |
|
108 | - * @return string |
|
109 | - */ |
|
110 | - public function getName(): string { |
|
111 | - return $this->name; |
|
112 | - } |
|
113 | - |
|
114 | - |
|
115 | - /** |
|
116 | - * Set the title/display name of the setting. |
|
117 | - * |
|
118 | - * @since 15.0.0 |
|
119 | - * @deprecated 20.0.0 |
|
120 | - * |
|
121 | - * @param string $title |
|
122 | - * |
|
123 | - * @return WidgetSetting |
|
124 | - */ |
|
125 | - public function setTitle(string $title): WidgetSetting { |
|
126 | - $this->title = $title; |
|
127 | - |
|
128 | - return $this; |
|
129 | - } |
|
130 | - |
|
131 | - /** |
|
132 | - * Get the title of the setting |
|
133 | - * |
|
134 | - * @since 15.0.0 |
|
135 | - * @deprecated 20.0.0 |
|
136 | - * |
|
137 | - * @return string |
|
138 | - */ |
|
139 | - public function getTitle(): string { |
|
140 | - return $this->title; |
|
141 | - } |
|
142 | - |
|
143 | - |
|
144 | - /** |
|
145 | - * Set the type of the setting (input, checkbox, ...) |
|
146 | - * |
|
147 | - * @since 15.0.0 |
|
148 | - * @deprecated 20.0.0 |
|
149 | - * |
|
150 | - * @param string $type |
|
151 | - * |
|
152 | - * @return WidgetSetting |
|
153 | - */ |
|
154 | - public function setType(string $type): WidgetSetting { |
|
155 | - $this->type = $type; |
|
156 | - |
|
157 | - return $this; |
|
158 | - } |
|
159 | - |
|
160 | - /** |
|
161 | - * Get the type of the setting. |
|
162 | - * |
|
163 | - * @since 15.0.0 |
|
164 | - * @deprecated 20.0.0 |
|
165 | - * |
|
166 | - * @return string |
|
167 | - */ |
|
168 | - public function getType(): string { |
|
169 | - return $this->type; |
|
170 | - } |
|
171 | - |
|
172 | - |
|
173 | - /** |
|
174 | - * Set the placeholder (in case of type=input) |
|
175 | - * |
|
176 | - * @since 15.0.0 |
|
177 | - * @deprecated 20.0.0 |
|
178 | - * |
|
179 | - * @param string $text |
|
180 | - * |
|
181 | - * @return WidgetSetting |
|
182 | - */ |
|
183 | - public function setPlaceholder(string $text): WidgetSetting { |
|
184 | - $this->placeholder = $text; |
|
185 | - |
|
186 | - return $this; |
|
187 | - } |
|
188 | - |
|
189 | - /** |
|
190 | - * Get the placeholder. |
|
191 | - * |
|
192 | - * @since 15.0.0 |
|
193 | - * @deprecated 20.0.0 |
|
194 | - * |
|
195 | - * @return string |
|
196 | - */ |
|
197 | - public function getPlaceholder(): string { |
|
198 | - return $this->placeholder; |
|
199 | - } |
|
200 | - |
|
201 | - |
|
202 | - /** |
|
203 | - * Set the default value of the setting. |
|
204 | - * |
|
205 | - * @since 15.0.0 |
|
206 | - * @deprecated 20.0.0 |
|
207 | - * |
|
208 | - * @param string $value |
|
209 | - * |
|
210 | - * @return WidgetSetting |
|
211 | - */ |
|
212 | - public function setDefault(string $value): WidgetSetting { |
|
213 | - $this->default = $value; |
|
214 | - |
|
215 | - return $this; |
|
216 | - } |
|
217 | - |
|
218 | - /** |
|
219 | - * Get the default value. |
|
220 | - * |
|
221 | - * @since 15.0.0 |
|
222 | - * @deprecated 20.0.0 |
|
223 | - * |
|
224 | - * @return string |
|
225 | - */ |
|
226 | - public function getDefault(): string { |
|
227 | - return $this->default; |
|
228 | - } |
|
229 | - |
|
230 | - |
|
231 | - /** |
|
232 | - * @since 15.0.0 |
|
233 | - * @deprecated 20.0.0 |
|
234 | - * |
|
235 | - * @return array |
|
236 | - */ |
|
237 | - public function jsonSerialize() { |
|
238 | - return [ |
|
239 | - 'name' => $this->getName(), |
|
240 | - 'title' => $this->getTitle(), |
|
241 | - 'type' => $this->getTitle(), |
|
242 | - 'default' => $this->getDefault(), |
|
243 | - 'placeholder' => $this->getPlaceholder() |
|
244 | - ]; |
|
245 | - } |
|
53 | + public const TYPE_INPUT = 'input'; |
|
54 | + public const TYPE_CHECKBOX = 'checkbox'; |
|
55 | + |
|
56 | + |
|
57 | + /** @var string */ |
|
58 | + private $name = ''; |
|
59 | + |
|
60 | + /** @var string */ |
|
61 | + private $title = ''; |
|
62 | + |
|
63 | + /** @var string */ |
|
64 | + private $type = ''; |
|
65 | + |
|
66 | + /** @var string */ |
|
67 | + private $placeholder = ''; |
|
68 | + |
|
69 | + /** @var string */ |
|
70 | + private $default = ''; |
|
71 | + |
|
72 | + |
|
73 | + /** |
|
74 | + * WidgetSetting constructor. |
|
75 | + * |
|
76 | + * @since 15.0.0 |
|
77 | + * @deprecated 20.0.0 |
|
78 | + * |
|
79 | + * @param string $type |
|
80 | + */ |
|
81 | + public function __construct(string $type = '') { |
|
82 | + $this->type = $type; |
|
83 | + } |
|
84 | + |
|
85 | + |
|
86 | + /** |
|
87 | + * Set the name of the setting (full string, no space) |
|
88 | + * |
|
89 | + * @since 15.0.0 |
|
90 | + * @deprecated 20.0.0 |
|
91 | + * |
|
92 | + * @param string $name |
|
93 | + * |
|
94 | + * @return WidgetSetting |
|
95 | + */ |
|
96 | + public function setName(string $name): WidgetSetting { |
|
97 | + $this->name = $name; |
|
98 | + |
|
99 | + return $this; |
|
100 | + } |
|
101 | + |
|
102 | + /** |
|
103 | + * Get the name of the setting |
|
104 | + * |
|
105 | + * @since 15.0.0 |
|
106 | + * @deprecated 20.0.0 |
|
107 | + * |
|
108 | + * @return string |
|
109 | + */ |
|
110 | + public function getName(): string { |
|
111 | + return $this->name; |
|
112 | + } |
|
113 | + |
|
114 | + |
|
115 | + /** |
|
116 | + * Set the title/display name of the setting. |
|
117 | + * |
|
118 | + * @since 15.0.0 |
|
119 | + * @deprecated 20.0.0 |
|
120 | + * |
|
121 | + * @param string $title |
|
122 | + * |
|
123 | + * @return WidgetSetting |
|
124 | + */ |
|
125 | + public function setTitle(string $title): WidgetSetting { |
|
126 | + $this->title = $title; |
|
127 | + |
|
128 | + return $this; |
|
129 | + } |
|
130 | + |
|
131 | + /** |
|
132 | + * Get the title of the setting |
|
133 | + * |
|
134 | + * @since 15.0.0 |
|
135 | + * @deprecated 20.0.0 |
|
136 | + * |
|
137 | + * @return string |
|
138 | + */ |
|
139 | + public function getTitle(): string { |
|
140 | + return $this->title; |
|
141 | + } |
|
142 | + |
|
143 | + |
|
144 | + /** |
|
145 | + * Set the type of the setting (input, checkbox, ...) |
|
146 | + * |
|
147 | + * @since 15.0.0 |
|
148 | + * @deprecated 20.0.0 |
|
149 | + * |
|
150 | + * @param string $type |
|
151 | + * |
|
152 | + * @return WidgetSetting |
|
153 | + */ |
|
154 | + public function setType(string $type): WidgetSetting { |
|
155 | + $this->type = $type; |
|
156 | + |
|
157 | + return $this; |
|
158 | + } |
|
159 | + |
|
160 | + /** |
|
161 | + * Get the type of the setting. |
|
162 | + * |
|
163 | + * @since 15.0.0 |
|
164 | + * @deprecated 20.0.0 |
|
165 | + * |
|
166 | + * @return string |
|
167 | + */ |
|
168 | + public function getType(): string { |
|
169 | + return $this->type; |
|
170 | + } |
|
171 | + |
|
172 | + |
|
173 | + /** |
|
174 | + * Set the placeholder (in case of type=input) |
|
175 | + * |
|
176 | + * @since 15.0.0 |
|
177 | + * @deprecated 20.0.0 |
|
178 | + * |
|
179 | + * @param string $text |
|
180 | + * |
|
181 | + * @return WidgetSetting |
|
182 | + */ |
|
183 | + public function setPlaceholder(string $text): WidgetSetting { |
|
184 | + $this->placeholder = $text; |
|
185 | + |
|
186 | + return $this; |
|
187 | + } |
|
188 | + |
|
189 | + /** |
|
190 | + * Get the placeholder. |
|
191 | + * |
|
192 | + * @since 15.0.0 |
|
193 | + * @deprecated 20.0.0 |
|
194 | + * |
|
195 | + * @return string |
|
196 | + */ |
|
197 | + public function getPlaceholder(): string { |
|
198 | + return $this->placeholder; |
|
199 | + } |
|
200 | + |
|
201 | + |
|
202 | + /** |
|
203 | + * Set the default value of the setting. |
|
204 | + * |
|
205 | + * @since 15.0.0 |
|
206 | + * @deprecated 20.0.0 |
|
207 | + * |
|
208 | + * @param string $value |
|
209 | + * |
|
210 | + * @return WidgetSetting |
|
211 | + */ |
|
212 | + public function setDefault(string $value): WidgetSetting { |
|
213 | + $this->default = $value; |
|
214 | + |
|
215 | + return $this; |
|
216 | + } |
|
217 | + |
|
218 | + /** |
|
219 | + * Get the default value. |
|
220 | + * |
|
221 | + * @since 15.0.0 |
|
222 | + * @deprecated 20.0.0 |
|
223 | + * |
|
224 | + * @return string |
|
225 | + */ |
|
226 | + public function getDefault(): string { |
|
227 | + return $this->default; |
|
228 | + } |
|
229 | + |
|
230 | + |
|
231 | + /** |
|
232 | + * @since 15.0.0 |
|
233 | + * @deprecated 20.0.0 |
|
234 | + * |
|
235 | + * @return array |
|
236 | + */ |
|
237 | + public function jsonSerialize() { |
|
238 | + return [ |
|
239 | + 'name' => $this->getName(), |
|
240 | + 'title' => $this->getTitle(), |
|
241 | + 'type' => $this->getTitle(), |
|
242 | + 'default' => $this->getDefault(), |
|
243 | + 'placeholder' => $this->getPlaceholder() |
|
244 | + ]; |
|
245 | + } |
|
246 | 246 | } |
@@ -37,90 +37,90 @@ |
||
37 | 37 | // This means that they should be used by apps instead of the internal ownCloud classes |
38 | 38 | |
39 | 39 | namespace OCP { |
40 | - /** |
|
41 | - * Interface IAddressBook |
|
42 | - * |
|
43 | - * @since 5.0.0 |
|
44 | - */ |
|
45 | - interface IAddressBook { |
|
40 | + /** |
|
41 | + * Interface IAddressBook |
|
42 | + * |
|
43 | + * @since 5.0.0 |
|
44 | + */ |
|
45 | + interface IAddressBook { |
|
46 | 46 | |
47 | - /** |
|
48 | - * @return string defining the technical unique key |
|
49 | - * @since 5.0.0 |
|
50 | - */ |
|
51 | - public function getKey(); |
|
47 | + /** |
|
48 | + * @return string defining the technical unique key |
|
49 | + * @since 5.0.0 |
|
50 | + */ |
|
51 | + public function getKey(); |
|
52 | 52 | |
53 | - /** |
|
54 | - * @return string defining the unique uri |
|
55 | - * @since 16.0.0 |
|
56 | - * @return string |
|
57 | - */ |
|
58 | - public function getUri(): string; |
|
53 | + /** |
|
54 | + * @return string defining the unique uri |
|
55 | + * @since 16.0.0 |
|
56 | + * @return string |
|
57 | + */ |
|
58 | + public function getUri(): string; |
|
59 | 59 | |
60 | - /** |
|
61 | - * In comparison to getKey() this function returns a human readable (maybe translated) name |
|
62 | - * @return mixed |
|
63 | - * @since 5.0.0 |
|
64 | - */ |
|
65 | - public function getDisplayName(); |
|
60 | + /** |
|
61 | + * In comparison to getKey() this function returns a human readable (maybe translated) name |
|
62 | + * @return mixed |
|
63 | + * @since 5.0.0 |
|
64 | + */ |
|
65 | + public function getDisplayName(); |
|
66 | 66 | |
67 | - /** |
|
68 | - * @param string $pattern which should match within the $searchProperties |
|
69 | - * @param array $searchProperties defines the properties within the query pattern should match |
|
70 | - * @param array $options Options to define the output format and search behavior |
|
71 | - * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array |
|
72 | - * example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => '[email protected]']] |
|
73 | - * - 'escape_like_param' - If set to false wildcards _ and % are not escaped |
|
74 | - * - 'limit' - Set a numeric limit for the search results |
|
75 | - * - 'offset' - Set the offset for the limited search results |
|
76 | - * @return array an array of contacts which are arrays of key-value-pairs |
|
77 | - * example result: |
|
78 | - * [ |
|
79 | - * ['id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => '[email protected]', 'GEO' => '37.386013;-122.082932'], |
|
80 | - * ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['[email protected]', '[email protected]']] |
|
81 | - * ] |
|
82 | - * @since 5.0.0 |
|
83 | - */ |
|
84 | - public function search($pattern, $searchProperties, $options); |
|
67 | + /** |
|
68 | + * @param string $pattern which should match within the $searchProperties |
|
69 | + * @param array $searchProperties defines the properties within the query pattern should match |
|
70 | + * @param array $options Options to define the output format and search behavior |
|
71 | + * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array |
|
72 | + * example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => '[email protected]']] |
|
73 | + * - 'escape_like_param' - If set to false wildcards _ and % are not escaped |
|
74 | + * - 'limit' - Set a numeric limit for the search results |
|
75 | + * - 'offset' - Set the offset for the limited search results |
|
76 | + * @return array an array of contacts which are arrays of key-value-pairs |
|
77 | + * example result: |
|
78 | + * [ |
|
79 | + * ['id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => '[email protected]', 'GEO' => '37.386013;-122.082932'], |
|
80 | + * ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['[email protected]', '[email protected]']] |
|
81 | + * ] |
|
82 | + * @since 5.0.0 |
|
83 | + */ |
|
84 | + public function search($pattern, $searchProperties, $options); |
|
85 | 85 | |
86 | - /** |
|
87 | - * @param array $properties this array if key-value-pairs defines a contact |
|
88 | - * @return array an array representing the contact just created or updated |
|
89 | - * @since 5.0.0 |
|
90 | - */ |
|
91 | - public function createOrUpdate($properties); |
|
92 | - // // dummy |
|
93 | - // return array('id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => '[email protected]', |
|
94 | - // 'PHOTO' => 'VALUE=uri:http://www.abc.com/pub/photos/jqpublic.gif', |
|
95 | - // 'ADR' => ';;123 Main Street;Any Town;CA;91921-1234' |
|
96 | - // ); |
|
86 | + /** |
|
87 | + * @param array $properties this array if key-value-pairs defines a contact |
|
88 | + * @return array an array representing the contact just created or updated |
|
89 | + * @since 5.0.0 |
|
90 | + */ |
|
91 | + public function createOrUpdate($properties); |
|
92 | + // // dummy |
|
93 | + // return array('id' => 0, 'FN' => 'Thomas Müller', 'EMAIL' => '[email protected]', |
|
94 | + // 'PHOTO' => 'VALUE=uri:http://www.abc.com/pub/photos/jqpublic.gif', |
|
95 | + // 'ADR' => ';;123 Main Street;Any Town;CA;91921-1234' |
|
96 | + // ); |
|
97 | 97 | |
98 | - /** |
|
99 | - * @return mixed |
|
100 | - * @since 5.0.0 |
|
101 | - */ |
|
102 | - public function getPermissions(); |
|
98 | + /** |
|
99 | + * @return mixed |
|
100 | + * @since 5.0.0 |
|
101 | + */ |
|
102 | + public function getPermissions(); |
|
103 | 103 | |
104 | - /** |
|
105 | - * @param object $id the unique identifier to a contact |
|
106 | - * @return bool successful or not |
|
107 | - * @since 5.0.0 |
|
108 | - */ |
|
109 | - public function delete($id); |
|
104 | + /** |
|
105 | + * @param object $id the unique identifier to a contact |
|
106 | + * @return bool successful or not |
|
107 | + * @since 5.0.0 |
|
108 | + */ |
|
109 | + public function delete($id); |
|
110 | 110 | |
111 | - /** |
|
112 | - * Returns true if this address-book is not owned by the current user, |
|
113 | - * but shared with them. |
|
114 | - * |
|
115 | - * @return bool |
|
116 | - * @since 20.0.0 |
|
117 | - */ |
|
118 | - public function isShared(): bool; |
|
111 | + /** |
|
112 | + * Returns true if this address-book is not owned by the current user, |
|
113 | + * but shared with them. |
|
114 | + * |
|
115 | + * @return bool |
|
116 | + * @since 20.0.0 |
|
117 | + */ |
|
118 | + public function isShared(): bool; |
|
119 | 119 | |
120 | - /** |
|
121 | - * @return bool |
|
122 | - * @since 20.0.0 |
|
123 | - */ |
|
124 | - public function isSystemAddressBook(): bool; |
|
125 | - } |
|
120 | + /** |
|
121 | + * @return bool |
|
122 | + * @since 20.0.0 |
|
123 | + */ |
|
124 | + public function isSystemAddressBook(): bool; |
|
125 | + } |
|
126 | 126 | } |
@@ -39,92 +39,92 @@ |
||
39 | 39 | * |
40 | 40 | */ |
41 | 41 | interface ISearchRequestSimpleQuery { |
42 | - public const COMPARE_TYPE_TEXT = 1; |
|
43 | - public const COMPARE_TYPE_KEYWORD = 2; |
|
44 | - public const COMPARE_TYPE_INT_EQ = 3; |
|
45 | - public const COMPARE_TYPE_INT_GTE = 4; |
|
46 | - public const COMPARE_TYPE_INT_GT = 5; |
|
47 | - public const COMPARE_TYPE_INT_LTE = 6; |
|
48 | - public const COMPARE_TYPE_INT_LT = 7; |
|
49 | - public const COMPARE_TYPE_BOOL = 8; |
|
50 | - public const COMPARE_TYPE_ARRAY = 9; |
|
51 | - public const COMPARE_TYPE_REGEX = 10; |
|
52 | - public const COMPARE_TYPE_WILDCARD = 11; |
|
42 | + public const COMPARE_TYPE_TEXT = 1; |
|
43 | + public const COMPARE_TYPE_KEYWORD = 2; |
|
44 | + public const COMPARE_TYPE_INT_EQ = 3; |
|
45 | + public const COMPARE_TYPE_INT_GTE = 4; |
|
46 | + public const COMPARE_TYPE_INT_GT = 5; |
|
47 | + public const COMPARE_TYPE_INT_LTE = 6; |
|
48 | + public const COMPARE_TYPE_INT_LT = 7; |
|
49 | + public const COMPARE_TYPE_BOOL = 8; |
|
50 | + public const COMPARE_TYPE_ARRAY = 9; |
|
51 | + public const COMPARE_TYPE_REGEX = 10; |
|
52 | + public const COMPARE_TYPE_WILDCARD = 11; |
|
53 | 53 | |
54 | 54 | |
55 | - /** |
|
56 | - * Get the compare type of the query |
|
57 | - * |
|
58 | - * @return int |
|
59 | - * @since 17.0.0 |
|
60 | - */ |
|
61 | - public function getType(): int; |
|
55 | + /** |
|
56 | + * Get the compare type of the query |
|
57 | + * |
|
58 | + * @return int |
|
59 | + * @since 17.0.0 |
|
60 | + */ |
|
61 | + public function getType(): int; |
|
62 | 62 | |
63 | 63 | |
64 | - /** |
|
65 | - * Get the field to apply query |
|
66 | - * |
|
67 | - * @return string |
|
68 | - * @since 17.0.0 |
|
69 | - */ |
|
70 | - public function getField(): string; |
|
64 | + /** |
|
65 | + * Get the field to apply query |
|
66 | + * |
|
67 | + * @return string |
|
68 | + * @since 17.0.0 |
|
69 | + */ |
|
70 | + public function getField(): string; |
|
71 | 71 | |
72 | - /** |
|
73 | - * Set the field to apply query |
|
74 | - * |
|
75 | - * @param string $field |
|
76 | - * |
|
77 | - * @return ISearchRequestSimpleQuery |
|
78 | - * @since 17.0.0 |
|
79 | - */ |
|
80 | - public function setField(string $field): ISearchRequestSimpleQuery; |
|
72 | + /** |
|
73 | + * Set the field to apply query |
|
74 | + * |
|
75 | + * @param string $field |
|
76 | + * |
|
77 | + * @return ISearchRequestSimpleQuery |
|
78 | + * @since 17.0.0 |
|
79 | + */ |
|
80 | + public function setField(string $field): ISearchRequestSimpleQuery; |
|
81 | 81 | |
82 | 82 | |
83 | - /** |
|
84 | - * Get the all values to compare |
|
85 | - * |
|
86 | - * @return array |
|
87 | - * @since 17.0.0 |
|
88 | - */ |
|
89 | - public function getValues(): array; |
|
83 | + /** |
|
84 | + * Get the all values to compare |
|
85 | + * |
|
86 | + * @return array |
|
87 | + * @since 17.0.0 |
|
88 | + */ |
|
89 | + public function getValues(): array; |
|
90 | 90 | |
91 | - /** |
|
92 | - * Add value to compare (string) |
|
93 | - * |
|
94 | - * @param string $value |
|
95 | - * |
|
96 | - * @return ISearchRequestSimpleQuery |
|
97 | - * @since 17.0.0 |
|
98 | - */ |
|
99 | - public function addValue(string $value): ISearchRequestSimpleQuery; |
|
91 | + /** |
|
92 | + * Add value to compare (string) |
|
93 | + * |
|
94 | + * @param string $value |
|
95 | + * |
|
96 | + * @return ISearchRequestSimpleQuery |
|
97 | + * @since 17.0.0 |
|
98 | + */ |
|
99 | + public function addValue(string $value): ISearchRequestSimpleQuery; |
|
100 | 100 | |
101 | - /** |
|
102 | - * Add value to compare (int) |
|
103 | - * |
|
104 | - * @param int $value |
|
105 | - * |
|
106 | - * @return ISearchRequestSimpleQuery |
|
107 | - * @since 17.0.0 |
|
108 | - */ |
|
109 | - public function addValueInt(int $value): ISearchRequestSimpleQuery; |
|
101 | + /** |
|
102 | + * Add value to compare (int) |
|
103 | + * |
|
104 | + * @param int $value |
|
105 | + * |
|
106 | + * @return ISearchRequestSimpleQuery |
|
107 | + * @since 17.0.0 |
|
108 | + */ |
|
109 | + public function addValueInt(int $value): ISearchRequestSimpleQuery; |
|
110 | 110 | |
111 | - /** |
|
112 | - * Add value to compare (array) |
|
113 | - * |
|
114 | - * @param array $value |
|
115 | - * |
|
116 | - * @return ISearchRequestSimpleQuery |
|
117 | - * @since 17.0.0 |
|
118 | - */ |
|
119 | - public function addValueArray(array $value): ISearchRequestSimpleQuery; |
|
111 | + /** |
|
112 | + * Add value to compare (array) |
|
113 | + * |
|
114 | + * @param array $value |
|
115 | + * |
|
116 | + * @return ISearchRequestSimpleQuery |
|
117 | + * @since 17.0.0 |
|
118 | + */ |
|
119 | + public function addValueArray(array $value): ISearchRequestSimpleQuery; |
|
120 | 120 | |
121 | - /** |
|
122 | - * Add value to compare (bool) |
|
123 | - * |
|
124 | - * @param bool $value |
|
125 | - * |
|
126 | - * @return ISearchRequestSimpleQuery |
|
127 | - * @since 17.0.0 |
|
128 | - */ |
|
129 | - public function addValueBool(bool $value): ISearchRequestSimpleQuery; |
|
121 | + /** |
|
122 | + * Add value to compare (bool) |
|
123 | + * |
|
124 | + * @param bool $value |
|
125 | + * |
|
126 | + * @return ISearchRequestSimpleQuery |
|
127 | + * @since 17.0.0 |
|
128 | + */ |
|
129 | + public function addValueBool(bool $value): ISearchRequestSimpleQuery; |
|
130 | 130 | } |
@@ -41,92 +41,92 @@ |
||
41 | 41 | * |
42 | 42 | */ |
43 | 43 | interface IRunner { |
44 | - public const RESULT_TYPE_SUCCESS = 1; |
|
45 | - public const RESULT_TYPE_WARNING = 4; |
|
46 | - public const RESULT_TYPE_FAIL = 9; |
|
44 | + public const RESULT_TYPE_SUCCESS = 1; |
|
45 | + public const RESULT_TYPE_WARNING = 4; |
|
46 | + public const RESULT_TYPE_FAIL = 9; |
|
47 | 47 | |
48 | 48 | |
49 | - /** |
|
50 | - * Info are displayed in the user interface when an admin execute the |
|
51 | - * ./occ fulltextsearch:index command. |
|
52 | - * |
|
53 | - * quick list of info that can be edited: |
|
54 | - * 'documentId', 'info', 'title', 'resultIndex', 'resultStatus', |
|
55 | - * 'content', 'documentCurrent', 'documentTotal', 'progressStatus', |
|
56 | - * 'errorCurrent', 'errorException', 'errorIndex'. |
|
57 | - * |
|
58 | - * List of all editable info can be find in the Command\Index.php of the |
|
59 | - * FullTextSearch app. |
|
60 | - * (look for a comment 'full list of info that can be edited') |
|
61 | - * |
|
62 | - * @since 15.0.0 |
|
63 | - * |
|
64 | - * @param string $info |
|
65 | - * @param string $value |
|
66 | - */ |
|
67 | - public function setInfo(string $info, string $value); |
|
49 | + /** |
|
50 | + * Info are displayed in the user interface when an admin execute the |
|
51 | + * ./occ fulltextsearch:index command. |
|
52 | + * |
|
53 | + * quick list of info that can be edited: |
|
54 | + * 'documentId', 'info', 'title', 'resultIndex', 'resultStatus', |
|
55 | + * 'content', 'documentCurrent', 'documentTotal', 'progressStatus', |
|
56 | + * 'errorCurrent', 'errorException', 'errorIndex'. |
|
57 | + * |
|
58 | + * List of all editable info can be find in the Command\Index.php of the |
|
59 | + * FullTextSearch app. |
|
60 | + * (look for a comment 'full list of info that can be edited') |
|
61 | + * |
|
62 | + * @since 15.0.0 |
|
63 | + * |
|
64 | + * @param string $info |
|
65 | + * @param string $value |
|
66 | + */ |
|
67 | + public function setInfo(string $info, string $value); |
|
68 | 68 | |
69 | 69 | |
70 | - /** |
|
71 | - * This method should be used when editing multiple info to avoid too many |
|
72 | - * refresh of the interface. |
|
73 | - * |
|
74 | - * @since 15.0.0 |
|
75 | - * |
|
76 | - * @param array $data |
|
77 | - */ |
|
78 | - public function setInfoArray(array $data); |
|
70 | + /** |
|
71 | + * This method should be used when editing multiple info to avoid too many |
|
72 | + * refresh of the interface. |
|
73 | + * |
|
74 | + * @since 15.0.0 |
|
75 | + * |
|
76 | + * @param array $data |
|
77 | + */ |
|
78 | + public function setInfoArray(array $data); |
|
79 | 79 | |
80 | 80 | |
81 | - /** |
|
82 | - * Method used to update the current Action when an index is running. |
|
83 | - * |
|
84 | - * This method should be used instead of manually update the 'action' using |
|
85 | - * setInfo()/setInfoArray() as it is also used to keep the process alive, |
|
86 | - * manage the input, and some statistics of the load of the process. |
|
87 | - * |
|
88 | - * $action is a string with no space |
|
89 | - * $force should be set to true if the action is heavy while being executed |
|
90 | - * multiple times |
|
91 | - * |
|
92 | - * @since 15.0.0 |
|
93 | - * |
|
94 | - * @param string $action |
|
95 | - * @param bool $force |
|
96 | - * |
|
97 | - * @return string |
|
98 | - * @throws \Exception |
|
99 | - */ |
|
100 | - public function updateAction(string $action = '', bool $force = false): string; |
|
81 | + /** |
|
82 | + * Method used to update the current Action when an index is running. |
|
83 | + * |
|
84 | + * This method should be used instead of manually update the 'action' using |
|
85 | + * setInfo()/setInfoArray() as it is also used to keep the process alive, |
|
86 | + * manage the input, and some statistics of the load of the process. |
|
87 | + * |
|
88 | + * $action is a string with no space |
|
89 | + * $force should be set to true if the action is heavy while being executed |
|
90 | + * multiple times |
|
91 | + * |
|
92 | + * @since 15.0.0 |
|
93 | + * |
|
94 | + * @param string $action |
|
95 | + * @param bool $force |
|
96 | + * |
|
97 | + * @return string |
|
98 | + * @throws \Exception |
|
99 | + */ |
|
100 | + public function updateAction(string $action = '', bool $force = false): string; |
|
101 | 101 | |
102 | 102 | |
103 | - /** |
|
104 | - * Call this method in a Search Platform or Content Provider if there is an |
|
105 | - * issue while generating a document or while indexing the current document. |
|
106 | - * This is used to store and display errors in the UI during an index to help |
|
107 | - * admin to keep track of errors. |
|
108 | - * |
|
109 | - * @since 15.0.0 |
|
110 | - * |
|
111 | - * @param IIndex $index |
|
112 | - * @param string $message |
|
113 | - * @param string $class |
|
114 | - * @param int $sev |
|
115 | - */ |
|
116 | - public function newIndexError(IIndex $index, string $message, string $class = '', int $sev = 3); |
|
103 | + /** |
|
104 | + * Call this method in a Search Platform or Content Provider if there is an |
|
105 | + * issue while generating a document or while indexing the current document. |
|
106 | + * This is used to store and display errors in the UI during an index to help |
|
107 | + * admin to keep track of errors. |
|
108 | + * |
|
109 | + * @since 15.0.0 |
|
110 | + * |
|
111 | + * @param IIndex $index |
|
112 | + * @param string $message |
|
113 | + * @param string $class |
|
114 | + * @param int $sev |
|
115 | + */ |
|
116 | + public function newIndexError(IIndex $index, string $message, string $class = '', int $sev = 3); |
|
117 | 117 | |
118 | 118 | |
119 | - /** |
|
120 | - * Call this method only in a Search Platform after an index of a document. |
|
121 | - * This is used to store and display results (good or bad) in the UI during |
|
122 | - * an index to help admin to keep track of fail and successful indexes. |
|
123 | - * |
|
124 | - * @since 15.0.0 |
|
125 | - * |
|
126 | - * @param IIndex $index |
|
127 | - * @param string $message |
|
128 | - * @param string $status |
|
129 | - * @param int $type |
|
130 | - */ |
|
131 | - public function newIndexResult(IIndex $index, string $message, string $status, int $type); |
|
119 | + /** |
|
120 | + * Call this method only in a Search Platform after an index of a document. |
|
121 | + * This is used to store and display results (good or bad) in the UI during |
|
122 | + * an index to help admin to keep track of fail and successful indexes. |
|
123 | + * |
|
124 | + * @since 15.0.0 |
|
125 | + * |
|
126 | + * @param IIndex $index |
|
127 | + * @param string $message |
|
128 | + * @param string $status |
|
129 | + * @param int $type |
|
130 | + */ |
|
131 | + public function newIndexResult(IIndex $index, string $message, string $status, int $type); |
|
132 | 132 | } |
@@ -42,585 +42,585 @@ |
||
42 | 42 | * @since 15.0.0 |
43 | 43 | */ |
44 | 44 | interface IIndexDocument { |
45 | - public const NOT_ENCODED = 0; |
|
46 | - public const ENCODED_BASE64 = 1; |
|
47 | - |
|
48 | - |
|
49 | - |
|
50 | - /** |
|
51 | - * Returns the Id of the original document. |
|
52 | - * |
|
53 | - * @since 15.0.0 |
|
54 | - * |
|
55 | - * @return string |
|
56 | - */ |
|
57 | - public function getId(): string; |
|
58 | - |
|
59 | - |
|
60 | - /** |
|
61 | - * Returns the Id of the provider. |
|
62 | - * |
|
63 | - * @since 15.0.0 |
|
64 | - * |
|
65 | - * @return string |
|
66 | - */ |
|
67 | - public function getProviderId(): string; |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * Set the Index related to the IIndexDocument. |
|
72 | - * |
|
73 | - * @see IIndex |
|
74 | - * |
|
75 | - * @since 15.0.0 |
|
76 | - * |
|
77 | - * @param IIndex $index |
|
78 | - * |
|
79 | - * @return IIndexDocument |
|
80 | - */ |
|
81 | - public function setIndex(IIndex $index): IIndexDocument; |
|
82 | - |
|
83 | - /** |
|
84 | - * Get the Index. |
|
85 | - * |
|
86 | - * @since 15.0.0 |
|
87 | - * |
|
88 | - * @return IIndex |
|
89 | - */ |
|
90 | - public function getIndex(): IIndex; |
|
91 | - |
|
92 | - /** |
|
93 | - * return if Index is defined. |
|
94 | - * |
|
95 | - * @since 16.0.0 |
|
96 | - * |
|
97 | - * @return bool |
|
98 | - */ |
|
99 | - public function hasIndex(): bool; |
|
100 | - |
|
101 | - |
|
102 | - /** |
|
103 | - * Set the modified time of the original document. |
|
104 | - * |
|
105 | - * @since 15.0.0 |
|
106 | - * |
|
107 | - * @param int $modifiedTime |
|
108 | - * |
|
109 | - * @return IIndexDocument |
|
110 | - */ |
|
111 | - public function setModifiedTime(int $modifiedTime): IIndexDocument; |
|
112 | - |
|
113 | - /** |
|
114 | - * Get the modified time of the original document. |
|
115 | - * |
|
116 | - * @since 15.0.0 |
|
117 | - * |
|
118 | - * @return int |
|
119 | - */ |
|
120 | - public function getModifiedTime(): int; |
|
121 | - |
|
122 | - /** |
|
123 | - * Check if the original document of the IIndexDocument is older than $time. |
|
124 | - * |
|
125 | - * @since 15.0.0 |
|
126 | - * |
|
127 | - * @param int $time |
|
128 | - * |
|
129 | - * @return bool |
|
130 | - */ |
|
131 | - public function isOlderThan(int $time): bool; |
|
132 | - |
|
133 | - |
|
134 | - /** |
|
135 | - * Set the read rights of the original document using a IDocumentAccess. |
|
136 | - * |
|
137 | - * @see IDocumentAccess |
|
138 | - * |
|
139 | - * @since 15.0.0 |
|
140 | - * |
|
141 | - * @param IDocumentAccess $access |
|
142 | - * |
|
143 | - * @return $this |
|
144 | - */ |
|
145 | - public function setAccess(IDocumentAccess $access): IIndexDocument; |
|
146 | - |
|
147 | - /** |
|
148 | - * Get the IDocumentAccess related to the original document. |
|
149 | - * |
|
150 | - * @since 15.0.0 |
|
151 | - * |
|
152 | - * @return IDocumentAccess |
|
153 | - */ |
|
154 | - public function getAccess(): IDocumentAccess; |
|
155 | - |
|
156 | - |
|
157 | - /** |
|
158 | - * Add a tag to the list. |
|
159 | - * |
|
160 | - * @since 15.0.0 |
|
161 | - * |
|
162 | - * @param string $tag |
|
163 | - * |
|
164 | - * @return IIndexDocument |
|
165 | - */ |
|
166 | - public function addTag(string $tag): IIndexDocument; |
|
167 | - |
|
168 | - /** |
|
169 | - * Set the list of tags assigned to the original document. |
|
170 | - * |
|
171 | - * @since 15.0.0 |
|
172 | - * |
|
173 | - * @param array $tags |
|
174 | - * |
|
175 | - * @return IIndexDocument |
|
176 | - */ |
|
177 | - public function setTags(array $tags): IIndexDocument; |
|
178 | - |
|
179 | - /** |
|
180 | - * Get the list of tags assigned to the original document. |
|
181 | - * |
|
182 | - * @since 15.0.0 |
|
183 | - * |
|
184 | - * @return array |
|
185 | - */ |
|
186 | - public function getTags(): array; |
|
187 | - |
|
188 | - |
|
189 | - /** |
|
190 | - * Add a meta tag to the list. |
|
191 | - * |
|
192 | - * @since 15.0.0 |
|
193 | - * |
|
194 | - * @param string $tag |
|
195 | - * |
|
196 | - * @return IIndexDocument |
|
197 | - */ |
|
198 | - public function addMetaTag(string $tag): IIndexDocument; |
|
199 | - |
|
200 | - /** |
|
201 | - * Set the list of meta tags assigned to the original document. |
|
202 | - * |
|
203 | - * @since 15.0.0 |
|
204 | - * |
|
205 | - * @param array $tags |
|
206 | - * |
|
207 | - * @return IIndexDocument |
|
208 | - */ |
|
209 | - public function setMetaTags(array $tags): IIndexDocument; |
|
210 | - |
|
211 | - /** |
|
212 | - * Get the list of meta tags assigned to the original document. |
|
213 | - * |
|
214 | - * @since 15.0.0 |
|
215 | - * |
|
216 | - * @return array |
|
217 | - */ |
|
218 | - public function getMetaTags(): array; |
|
219 | - |
|
220 | - |
|
221 | - /** |
|
222 | - * Add a sub tag to the list. |
|
223 | - * |
|
224 | - * @since 15.0.0 |
|
225 | - * |
|
226 | - * @param string $sub |
|
227 | - * @param string $tag |
|
228 | - * |
|
229 | - * @return IIndexDocument |
|
230 | - */ |
|
231 | - public function addSubTag(string $sub, string $tag): IIndexDocument; |
|
232 | - |
|
233 | - /** |
|
234 | - * Set the list of sub tags assigned to the original document. |
|
235 | - * |
|
236 | - * @since 15.0.0 |
|
237 | - * |
|
238 | - * @param array $tags |
|
239 | - * |
|
240 | - * @return IIndexDocument |
|
241 | - */ |
|
242 | - public function setSubTags(array $tags): IIndexDocument; |
|
243 | - |
|
244 | - /** |
|
245 | - * Get the list of sub tags assigned to the original document. |
|
246 | - * If $formatted is true, the result will be formatted in a one |
|
247 | - * dimensional array. |
|
248 | - * |
|
249 | - * @since 15.0.0 |
|
250 | - * |
|
251 | - * @param bool $formatted |
|
252 | - * |
|
253 | - * @return array |
|
254 | - */ |
|
255 | - public function getSubTags(bool $formatted = false): array; |
|
256 | - |
|
257 | - |
|
258 | - /** |
|
259 | - * Set the source of the original document. |
|
260 | - * |
|
261 | - * @since 15.0.0 |
|
262 | - * |
|
263 | - * @param string $source |
|
264 | - * |
|
265 | - * @return IIndexDocument |
|
266 | - */ |
|
267 | - public function setSource(string $source): IIndexDocument; |
|
268 | - |
|
269 | - /** |
|
270 | - * Get the source of the original document. |
|
271 | - * |
|
272 | - * @since 15.0.0 |
|
273 | - * |
|
274 | - * @return string |
|
275 | - */ |
|
276 | - public function getSource(): string; |
|
277 | - |
|
278 | - |
|
279 | - /** |
|
280 | - * Set the title of the original document. |
|
281 | - * |
|
282 | - * @since 15.0.0 |
|
283 | - * |
|
284 | - * @param string $title |
|
285 | - * |
|
286 | - * @return IIndexDocument |
|
287 | - */ |
|
288 | - public function setTitle(string $title): IIndexDocument; |
|
289 | - |
|
290 | - /** |
|
291 | - * Get the title of the original document. |
|
292 | - * |
|
293 | - * @since 15.0.0 |
|
294 | - * |
|
295 | - * @return string |
|
296 | - */ |
|
297 | - public function getTitle(): string; |
|
298 | - |
|
299 | - |
|
300 | - /** |
|
301 | - * Set the content of the document. |
|
302 | - * $encoded can be NOT_ENCODED or ENCODED_BASE64 if the content is raw or |
|
303 | - * encoded in base64. |
|
304 | - * |
|
305 | - * @since 15.0.0 |
|
306 | - * |
|
307 | - * @param string $content |
|
308 | - * @param int $encoded |
|
309 | - * |
|
310 | - * @return IIndexDocument |
|
311 | - */ |
|
312 | - public function setContent(string $content, int $encoded = 0): IIndexDocument; |
|
313 | - |
|
314 | - /** |
|
315 | - * Get the content of the original document. |
|
316 | - * |
|
317 | - * @since 15.0.0 |
|
318 | - * |
|
319 | - * @return string |
|
320 | - */ |
|
321 | - public function getContent(): string; |
|
322 | - |
|
323 | - /** |
|
324 | - * Returns the type of the encoding on the content. |
|
325 | - * |
|
326 | - * @since 15.0.0 |
|
327 | - * |
|
328 | - * @return int |
|
329 | - */ |
|
330 | - public function isContentEncoded(): int; |
|
331 | - |
|
332 | - /** |
|
333 | - * Return the size of the content. |
|
334 | - * |
|
335 | - * @since 15.0.0 |
|
336 | - * |
|
337 | - * @return int |
|
338 | - */ |
|
339 | - public function getContentSize(): int; |
|
340 | - |
|
341 | - |
|
342 | - /** |
|
343 | - * Generate an hash, based on the content of the original document. |
|
344 | - * |
|
345 | - * @since 15.0.0 |
|
346 | - * |
|
347 | - * @return IIndexDocument |
|
348 | - */ |
|
349 | - public function initHash(): IIndexDocument; |
|
350 | - |
|
351 | - /** |
|
352 | - * Set the hash of the original document. |
|
353 | - * |
|
354 | - * @since 15.0.0 |
|
355 | - * |
|
356 | - * @param string $hash |
|
357 | - * |
|
358 | - * @return IIndexDocument |
|
359 | - */ |
|
360 | - public function setHash(string $hash): IIndexDocument; |
|
361 | - |
|
362 | - /** |
|
363 | - * Get the hash of the original document. |
|
364 | - * |
|
365 | - * @since 15.0.0 |
|
366 | - * |
|
367 | - * @return string |
|
368 | - */ |
|
369 | - public function getHash(): string; |
|
370 | - |
|
371 | - |
|
372 | - /** |
|
373 | - * Add a part, identified by a string, and its content. |
|
374 | - * |
|
375 | - * It is strongly advised to use alphanumerical chars with no space in the |
|
376 | - * $part string. |
|
377 | - * |
|
378 | - * @since 15.0.0 |
|
379 | - * |
|
380 | - * @param string $part |
|
381 | - * @param string $content |
|
382 | - * |
|
383 | - * @return IIndexDocument |
|
384 | - */ |
|
385 | - public function addPart(string $part, string $content): IIndexDocument; |
|
386 | - |
|
387 | - /** |
|
388 | - * Set all parts and their content. |
|
389 | - * |
|
390 | - * @since 15.0.0 |
|
391 | - * |
|
392 | - * @param array $parts |
|
393 | - * |
|
394 | - * @return IIndexDocument |
|
395 | - */ |
|
396 | - public function setParts(array $parts): IIndexDocument; |
|
397 | - |
|
398 | - /** |
|
399 | - * Get all parts of the IIndexDocument. |
|
400 | - * |
|
401 | - * @since 15.0.0 |
|
402 | - * |
|
403 | - * @return array |
|
404 | - */ |
|
405 | - public function getParts(): array; |
|
406 | - |
|
407 | - |
|
408 | - /** |
|
409 | - * Add a link, usable by the frontend. |
|
410 | - * |
|
411 | - * @since 15.0.0 |
|
412 | - * |
|
413 | - * @param string $link |
|
414 | - * |
|
415 | - * @return IIndexDocument |
|
416 | - */ |
|
417 | - public function setLink(string $link): IIndexDocument; |
|
418 | - |
|
419 | - /** |
|
420 | - * Get the link. |
|
421 | - * |
|
422 | - * @since 15.0.0 |
|
423 | - * |
|
424 | - * @return string |
|
425 | - */ |
|
426 | - public function getLink(): string; |
|
427 | - |
|
428 | - |
|
429 | - /** |
|
430 | - * Set more information that couldn't be set using other method. |
|
431 | - * |
|
432 | - * @since 15.0.0 |
|
433 | - * |
|
434 | - * @param array $more |
|
435 | - * |
|
436 | - * @return IIndexDocument |
|
437 | - */ |
|
438 | - public function setMore(array $more): IIndexDocument; |
|
439 | - |
|
440 | - /** |
|
441 | - * Get more information. |
|
442 | - * |
|
443 | - * @since 15.0.0 |
|
444 | - * |
|
445 | - * @return array |
|
446 | - */ |
|
447 | - public function getMore(): array; |
|
448 | - |
|
449 | - |
|
450 | - /** |
|
451 | - * Add some excerpt of the content of the original document, usually based |
|
452 | - * on the search request. |
|
453 | - * |
|
454 | - * @since 16.0.0 |
|
455 | - * |
|
456 | - * @param string $source |
|
457 | - * @param string $excerpt |
|
458 | - * |
|
459 | - * @return IIndexDocument |
|
460 | - */ |
|
461 | - public function addExcerpt(string $source, string $excerpt): IIndexDocument; |
|
462 | - |
|
463 | - /** |
|
464 | - * Set all excerpts of the content of the original document. |
|
465 | - * |
|
466 | - * @since 16.0.0 |
|
467 | - * |
|
468 | - * @param array $excerpts |
|
469 | - * |
|
470 | - * @return IIndexDocument |
|
471 | - */ |
|
472 | - public function setExcerpts(array $excerpts): IIndexDocument; |
|
473 | - |
|
474 | - /** |
|
475 | - * Get all excerpts of the content of the original document. |
|
476 | - * |
|
477 | - * @since 15.0.0 |
|
478 | - * |
|
479 | - * @return array |
|
480 | - */ |
|
481 | - public function getExcerpts(): array; |
|
482 | - |
|
483 | - |
|
484 | - /** |
|
485 | - * Set the score to the result assigned to this document during a search |
|
486 | - * request. |
|
487 | - * |
|
488 | - * @since 15.0.0 |
|
489 | - * |
|
490 | - * @param string $score |
|
491 | - * |
|
492 | - * @return IIndexDocument |
|
493 | - */ |
|
494 | - public function setScore(string $score): IIndexDocument; |
|
495 | - |
|
496 | - /** |
|
497 | - * Get the score. |
|
498 | - * |
|
499 | - * @since 15.0.0 |
|
500 | - * |
|
501 | - * @return string |
|
502 | - */ |
|
503 | - public function getScore(): string; |
|
504 | - |
|
505 | - |
|
506 | - /** |
|
507 | - * Set some information about the original document that will be available |
|
508 | - * to the front-end when displaying search result. (as string) |
|
509 | - * Because this information will not be indexed, this method can also be |
|
510 | - * used to manage some data while filling the IIndexDocument before its |
|
511 | - * indexing. |
|
512 | - * |
|
513 | - * @since 15.0.0 |
|
514 | - * |
|
515 | - * @param string $info |
|
516 | - * @param string $value |
|
517 | - * |
|
518 | - * @return IIndexDocument |
|
519 | - */ |
|
520 | - public function setInfo(string $info, string $value): IIndexDocument; |
|
521 | - |
|
522 | - /** |
|
523 | - * Get an information about a document. (string) |
|
524 | - * |
|
525 | - * @since 15.0.0 |
|
526 | - * |
|
527 | - * @param string $info |
|
528 | - * @param string $default |
|
529 | - * |
|
530 | - * @return string |
|
531 | - */ |
|
532 | - public function getInfo(string $info, string $default = ''): string; |
|
533 | - |
|
534 | - /** |
|
535 | - * Set some information about the original document that will be available |
|
536 | - * to the front-end when displaying search result. (as array) |
|
537 | - * Because this information will not be indexed, this method can also be |
|
538 | - * used to manage some data while filling the IIndexDocument before its |
|
539 | - * indexing. |
|
540 | - * |
|
541 | - * @since 15.0.0 |
|
542 | - * |
|
543 | - * @param string $info |
|
544 | - * @param array $value |
|
545 | - * |
|
546 | - * @return IIndexDocument |
|
547 | - */ |
|
548 | - public function setInfoArray(string $info, array $value): IIndexDocument; |
|
549 | - |
|
550 | - /** |
|
551 | - * Get an information about a document. (array) |
|
552 | - * |
|
553 | - * @since 15.0.0 |
|
554 | - * |
|
555 | - * @param string $info |
|
556 | - * @param array $default |
|
557 | - * |
|
558 | - * @return array |
|
559 | - */ |
|
560 | - public function getInfoArray(string $info, array $default = []): array; |
|
561 | - |
|
562 | - /** |
|
563 | - * Set some information about the original document that will be available |
|
564 | - * to the front-end when displaying search result. (as int) |
|
565 | - * Because this information will not be indexed, this method can also be |
|
566 | - * used to manage some data while filling the IIndexDocument before its |
|
567 | - * indexing. |
|
568 | - * |
|
569 | - * @since 15.0.0 |
|
570 | - * |
|
571 | - * @param string $info |
|
572 | - * @param int $value |
|
573 | - * |
|
574 | - * @return IIndexDocument |
|
575 | - */ |
|
576 | - public function setInfoInt(string $info, int $value): IIndexDocument; |
|
577 | - |
|
578 | - /** |
|
579 | - * Get an information about a document. (int) |
|
580 | - * |
|
581 | - * @since 15.0.0 |
|
582 | - * |
|
583 | - * @param string $info |
|
584 | - * @param int $default |
|
585 | - * |
|
586 | - * @return int |
|
587 | - */ |
|
588 | - public function getInfoInt(string $info, int $default = 0): int; |
|
589 | - |
|
590 | - /** |
|
591 | - * Set some information about the original document that will be available |
|
592 | - * to the front-end when displaying search result. (as bool) |
|
593 | - * Because this information will not be indexed, this method can also be |
|
594 | - * used to manage some data while filling the IIndexDocument before its |
|
595 | - * indexing. |
|
596 | - * |
|
597 | - * @since 15.0.0 |
|
598 | - * |
|
599 | - * @param string $info |
|
600 | - * @param bool $value |
|
601 | - * |
|
602 | - * @return IIndexDocument |
|
603 | - */ |
|
604 | - public function setInfoBool(string $info, bool $value): IIndexDocument; |
|
605 | - |
|
606 | - /** |
|
607 | - * Get an information about a document. (bool) |
|
608 | - * |
|
609 | - * @since 15.0.0 |
|
610 | - * |
|
611 | - * @param string $info |
|
612 | - * @param bool $default |
|
613 | - * |
|
614 | - * @return bool |
|
615 | - */ |
|
616 | - public function getInfoBool(string $info, bool $default = false): bool; |
|
617 | - |
|
618 | - /** |
|
619 | - * Get all info. |
|
620 | - * |
|
621 | - * @since 15.0.0 |
|
622 | - * |
|
623 | - * @return array |
|
624 | - */ |
|
625 | - public function getInfoAll(): array; |
|
45 | + public const NOT_ENCODED = 0; |
|
46 | + public const ENCODED_BASE64 = 1; |
|
47 | + |
|
48 | + |
|
49 | + |
|
50 | + /** |
|
51 | + * Returns the Id of the original document. |
|
52 | + * |
|
53 | + * @since 15.0.0 |
|
54 | + * |
|
55 | + * @return string |
|
56 | + */ |
|
57 | + public function getId(): string; |
|
58 | + |
|
59 | + |
|
60 | + /** |
|
61 | + * Returns the Id of the provider. |
|
62 | + * |
|
63 | + * @since 15.0.0 |
|
64 | + * |
|
65 | + * @return string |
|
66 | + */ |
|
67 | + public function getProviderId(): string; |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * Set the Index related to the IIndexDocument. |
|
72 | + * |
|
73 | + * @see IIndex |
|
74 | + * |
|
75 | + * @since 15.0.0 |
|
76 | + * |
|
77 | + * @param IIndex $index |
|
78 | + * |
|
79 | + * @return IIndexDocument |
|
80 | + */ |
|
81 | + public function setIndex(IIndex $index): IIndexDocument; |
|
82 | + |
|
83 | + /** |
|
84 | + * Get the Index. |
|
85 | + * |
|
86 | + * @since 15.0.0 |
|
87 | + * |
|
88 | + * @return IIndex |
|
89 | + */ |
|
90 | + public function getIndex(): IIndex; |
|
91 | + |
|
92 | + /** |
|
93 | + * return if Index is defined. |
|
94 | + * |
|
95 | + * @since 16.0.0 |
|
96 | + * |
|
97 | + * @return bool |
|
98 | + */ |
|
99 | + public function hasIndex(): bool; |
|
100 | + |
|
101 | + |
|
102 | + /** |
|
103 | + * Set the modified time of the original document. |
|
104 | + * |
|
105 | + * @since 15.0.0 |
|
106 | + * |
|
107 | + * @param int $modifiedTime |
|
108 | + * |
|
109 | + * @return IIndexDocument |
|
110 | + */ |
|
111 | + public function setModifiedTime(int $modifiedTime): IIndexDocument; |
|
112 | + |
|
113 | + /** |
|
114 | + * Get the modified time of the original document. |
|
115 | + * |
|
116 | + * @since 15.0.0 |
|
117 | + * |
|
118 | + * @return int |
|
119 | + */ |
|
120 | + public function getModifiedTime(): int; |
|
121 | + |
|
122 | + /** |
|
123 | + * Check if the original document of the IIndexDocument is older than $time. |
|
124 | + * |
|
125 | + * @since 15.0.0 |
|
126 | + * |
|
127 | + * @param int $time |
|
128 | + * |
|
129 | + * @return bool |
|
130 | + */ |
|
131 | + public function isOlderThan(int $time): bool; |
|
132 | + |
|
133 | + |
|
134 | + /** |
|
135 | + * Set the read rights of the original document using a IDocumentAccess. |
|
136 | + * |
|
137 | + * @see IDocumentAccess |
|
138 | + * |
|
139 | + * @since 15.0.0 |
|
140 | + * |
|
141 | + * @param IDocumentAccess $access |
|
142 | + * |
|
143 | + * @return $this |
|
144 | + */ |
|
145 | + public function setAccess(IDocumentAccess $access): IIndexDocument; |
|
146 | + |
|
147 | + /** |
|
148 | + * Get the IDocumentAccess related to the original document. |
|
149 | + * |
|
150 | + * @since 15.0.0 |
|
151 | + * |
|
152 | + * @return IDocumentAccess |
|
153 | + */ |
|
154 | + public function getAccess(): IDocumentAccess; |
|
155 | + |
|
156 | + |
|
157 | + /** |
|
158 | + * Add a tag to the list. |
|
159 | + * |
|
160 | + * @since 15.0.0 |
|
161 | + * |
|
162 | + * @param string $tag |
|
163 | + * |
|
164 | + * @return IIndexDocument |
|
165 | + */ |
|
166 | + public function addTag(string $tag): IIndexDocument; |
|
167 | + |
|
168 | + /** |
|
169 | + * Set the list of tags assigned to the original document. |
|
170 | + * |
|
171 | + * @since 15.0.0 |
|
172 | + * |
|
173 | + * @param array $tags |
|
174 | + * |
|
175 | + * @return IIndexDocument |
|
176 | + */ |
|
177 | + public function setTags(array $tags): IIndexDocument; |
|
178 | + |
|
179 | + /** |
|
180 | + * Get the list of tags assigned to the original document. |
|
181 | + * |
|
182 | + * @since 15.0.0 |
|
183 | + * |
|
184 | + * @return array |
|
185 | + */ |
|
186 | + public function getTags(): array; |
|
187 | + |
|
188 | + |
|
189 | + /** |
|
190 | + * Add a meta tag to the list. |
|
191 | + * |
|
192 | + * @since 15.0.0 |
|
193 | + * |
|
194 | + * @param string $tag |
|
195 | + * |
|
196 | + * @return IIndexDocument |
|
197 | + */ |
|
198 | + public function addMetaTag(string $tag): IIndexDocument; |
|
199 | + |
|
200 | + /** |
|
201 | + * Set the list of meta tags assigned to the original document. |
|
202 | + * |
|
203 | + * @since 15.0.0 |
|
204 | + * |
|
205 | + * @param array $tags |
|
206 | + * |
|
207 | + * @return IIndexDocument |
|
208 | + */ |
|
209 | + public function setMetaTags(array $tags): IIndexDocument; |
|
210 | + |
|
211 | + /** |
|
212 | + * Get the list of meta tags assigned to the original document. |
|
213 | + * |
|
214 | + * @since 15.0.0 |
|
215 | + * |
|
216 | + * @return array |
|
217 | + */ |
|
218 | + public function getMetaTags(): array; |
|
219 | + |
|
220 | + |
|
221 | + /** |
|
222 | + * Add a sub tag to the list. |
|
223 | + * |
|
224 | + * @since 15.0.0 |
|
225 | + * |
|
226 | + * @param string $sub |
|
227 | + * @param string $tag |
|
228 | + * |
|
229 | + * @return IIndexDocument |
|
230 | + */ |
|
231 | + public function addSubTag(string $sub, string $tag): IIndexDocument; |
|
232 | + |
|
233 | + /** |
|
234 | + * Set the list of sub tags assigned to the original document. |
|
235 | + * |
|
236 | + * @since 15.0.0 |
|
237 | + * |
|
238 | + * @param array $tags |
|
239 | + * |
|
240 | + * @return IIndexDocument |
|
241 | + */ |
|
242 | + public function setSubTags(array $tags): IIndexDocument; |
|
243 | + |
|
244 | + /** |
|
245 | + * Get the list of sub tags assigned to the original document. |
|
246 | + * If $formatted is true, the result will be formatted in a one |
|
247 | + * dimensional array. |
|
248 | + * |
|
249 | + * @since 15.0.0 |
|
250 | + * |
|
251 | + * @param bool $formatted |
|
252 | + * |
|
253 | + * @return array |
|
254 | + */ |
|
255 | + public function getSubTags(bool $formatted = false): array; |
|
256 | + |
|
257 | + |
|
258 | + /** |
|
259 | + * Set the source of the original document. |
|
260 | + * |
|
261 | + * @since 15.0.0 |
|
262 | + * |
|
263 | + * @param string $source |
|
264 | + * |
|
265 | + * @return IIndexDocument |
|
266 | + */ |
|
267 | + public function setSource(string $source): IIndexDocument; |
|
268 | + |
|
269 | + /** |
|
270 | + * Get the source of the original document. |
|
271 | + * |
|
272 | + * @since 15.0.0 |
|
273 | + * |
|
274 | + * @return string |
|
275 | + */ |
|
276 | + public function getSource(): string; |
|
277 | + |
|
278 | + |
|
279 | + /** |
|
280 | + * Set the title of the original document. |
|
281 | + * |
|
282 | + * @since 15.0.0 |
|
283 | + * |
|
284 | + * @param string $title |
|
285 | + * |
|
286 | + * @return IIndexDocument |
|
287 | + */ |
|
288 | + public function setTitle(string $title): IIndexDocument; |
|
289 | + |
|
290 | + /** |
|
291 | + * Get the title of the original document. |
|
292 | + * |
|
293 | + * @since 15.0.0 |
|
294 | + * |
|
295 | + * @return string |
|
296 | + */ |
|
297 | + public function getTitle(): string; |
|
298 | + |
|
299 | + |
|
300 | + /** |
|
301 | + * Set the content of the document. |
|
302 | + * $encoded can be NOT_ENCODED or ENCODED_BASE64 if the content is raw or |
|
303 | + * encoded in base64. |
|
304 | + * |
|
305 | + * @since 15.0.0 |
|
306 | + * |
|
307 | + * @param string $content |
|
308 | + * @param int $encoded |
|
309 | + * |
|
310 | + * @return IIndexDocument |
|
311 | + */ |
|
312 | + public function setContent(string $content, int $encoded = 0): IIndexDocument; |
|
313 | + |
|
314 | + /** |
|
315 | + * Get the content of the original document. |
|
316 | + * |
|
317 | + * @since 15.0.0 |
|
318 | + * |
|
319 | + * @return string |
|
320 | + */ |
|
321 | + public function getContent(): string; |
|
322 | + |
|
323 | + /** |
|
324 | + * Returns the type of the encoding on the content. |
|
325 | + * |
|
326 | + * @since 15.0.0 |
|
327 | + * |
|
328 | + * @return int |
|
329 | + */ |
|
330 | + public function isContentEncoded(): int; |
|
331 | + |
|
332 | + /** |
|
333 | + * Return the size of the content. |
|
334 | + * |
|
335 | + * @since 15.0.0 |
|
336 | + * |
|
337 | + * @return int |
|
338 | + */ |
|
339 | + public function getContentSize(): int; |
|
340 | + |
|
341 | + |
|
342 | + /** |
|
343 | + * Generate an hash, based on the content of the original document. |
|
344 | + * |
|
345 | + * @since 15.0.0 |
|
346 | + * |
|
347 | + * @return IIndexDocument |
|
348 | + */ |
|
349 | + public function initHash(): IIndexDocument; |
|
350 | + |
|
351 | + /** |
|
352 | + * Set the hash of the original document. |
|
353 | + * |
|
354 | + * @since 15.0.0 |
|
355 | + * |
|
356 | + * @param string $hash |
|
357 | + * |
|
358 | + * @return IIndexDocument |
|
359 | + */ |
|
360 | + public function setHash(string $hash): IIndexDocument; |
|
361 | + |
|
362 | + /** |
|
363 | + * Get the hash of the original document. |
|
364 | + * |
|
365 | + * @since 15.0.0 |
|
366 | + * |
|
367 | + * @return string |
|
368 | + */ |
|
369 | + public function getHash(): string; |
|
370 | + |
|
371 | + |
|
372 | + /** |
|
373 | + * Add a part, identified by a string, and its content. |
|
374 | + * |
|
375 | + * It is strongly advised to use alphanumerical chars with no space in the |
|
376 | + * $part string. |
|
377 | + * |
|
378 | + * @since 15.0.0 |
|
379 | + * |
|
380 | + * @param string $part |
|
381 | + * @param string $content |
|
382 | + * |
|
383 | + * @return IIndexDocument |
|
384 | + */ |
|
385 | + public function addPart(string $part, string $content): IIndexDocument; |
|
386 | + |
|
387 | + /** |
|
388 | + * Set all parts and their content. |
|
389 | + * |
|
390 | + * @since 15.0.0 |
|
391 | + * |
|
392 | + * @param array $parts |
|
393 | + * |
|
394 | + * @return IIndexDocument |
|
395 | + */ |
|
396 | + public function setParts(array $parts): IIndexDocument; |
|
397 | + |
|
398 | + /** |
|
399 | + * Get all parts of the IIndexDocument. |
|
400 | + * |
|
401 | + * @since 15.0.0 |
|
402 | + * |
|
403 | + * @return array |
|
404 | + */ |
|
405 | + public function getParts(): array; |
|
406 | + |
|
407 | + |
|
408 | + /** |
|
409 | + * Add a link, usable by the frontend. |
|
410 | + * |
|
411 | + * @since 15.0.0 |
|
412 | + * |
|
413 | + * @param string $link |
|
414 | + * |
|
415 | + * @return IIndexDocument |
|
416 | + */ |
|
417 | + public function setLink(string $link): IIndexDocument; |
|
418 | + |
|
419 | + /** |
|
420 | + * Get the link. |
|
421 | + * |
|
422 | + * @since 15.0.0 |
|
423 | + * |
|
424 | + * @return string |
|
425 | + */ |
|
426 | + public function getLink(): string; |
|
427 | + |
|
428 | + |
|
429 | + /** |
|
430 | + * Set more information that couldn't be set using other method. |
|
431 | + * |
|
432 | + * @since 15.0.0 |
|
433 | + * |
|
434 | + * @param array $more |
|
435 | + * |
|
436 | + * @return IIndexDocument |
|
437 | + */ |
|
438 | + public function setMore(array $more): IIndexDocument; |
|
439 | + |
|
440 | + /** |
|
441 | + * Get more information. |
|
442 | + * |
|
443 | + * @since 15.0.0 |
|
444 | + * |
|
445 | + * @return array |
|
446 | + */ |
|
447 | + public function getMore(): array; |
|
448 | + |
|
449 | + |
|
450 | + /** |
|
451 | + * Add some excerpt of the content of the original document, usually based |
|
452 | + * on the search request. |
|
453 | + * |
|
454 | + * @since 16.0.0 |
|
455 | + * |
|
456 | + * @param string $source |
|
457 | + * @param string $excerpt |
|
458 | + * |
|
459 | + * @return IIndexDocument |
|
460 | + */ |
|
461 | + public function addExcerpt(string $source, string $excerpt): IIndexDocument; |
|
462 | + |
|
463 | + /** |
|
464 | + * Set all excerpts of the content of the original document. |
|
465 | + * |
|
466 | + * @since 16.0.0 |
|
467 | + * |
|
468 | + * @param array $excerpts |
|
469 | + * |
|
470 | + * @return IIndexDocument |
|
471 | + */ |
|
472 | + public function setExcerpts(array $excerpts): IIndexDocument; |
|
473 | + |
|
474 | + /** |
|
475 | + * Get all excerpts of the content of the original document. |
|
476 | + * |
|
477 | + * @since 15.0.0 |
|
478 | + * |
|
479 | + * @return array |
|
480 | + */ |
|
481 | + public function getExcerpts(): array; |
|
482 | + |
|
483 | + |
|
484 | + /** |
|
485 | + * Set the score to the result assigned to this document during a search |
|
486 | + * request. |
|
487 | + * |
|
488 | + * @since 15.0.0 |
|
489 | + * |
|
490 | + * @param string $score |
|
491 | + * |
|
492 | + * @return IIndexDocument |
|
493 | + */ |
|
494 | + public function setScore(string $score): IIndexDocument; |
|
495 | + |
|
496 | + /** |
|
497 | + * Get the score. |
|
498 | + * |
|
499 | + * @since 15.0.0 |
|
500 | + * |
|
501 | + * @return string |
|
502 | + */ |
|
503 | + public function getScore(): string; |
|
504 | + |
|
505 | + |
|
506 | + /** |
|
507 | + * Set some information about the original document that will be available |
|
508 | + * to the front-end when displaying search result. (as string) |
|
509 | + * Because this information will not be indexed, this method can also be |
|
510 | + * used to manage some data while filling the IIndexDocument before its |
|
511 | + * indexing. |
|
512 | + * |
|
513 | + * @since 15.0.0 |
|
514 | + * |
|
515 | + * @param string $info |
|
516 | + * @param string $value |
|
517 | + * |
|
518 | + * @return IIndexDocument |
|
519 | + */ |
|
520 | + public function setInfo(string $info, string $value): IIndexDocument; |
|
521 | + |
|
522 | + /** |
|
523 | + * Get an information about a document. (string) |
|
524 | + * |
|
525 | + * @since 15.0.0 |
|
526 | + * |
|
527 | + * @param string $info |
|
528 | + * @param string $default |
|
529 | + * |
|
530 | + * @return string |
|
531 | + */ |
|
532 | + public function getInfo(string $info, string $default = ''): string; |
|
533 | + |
|
534 | + /** |
|
535 | + * Set some information about the original document that will be available |
|
536 | + * to the front-end when displaying search result. (as array) |
|
537 | + * Because this information will not be indexed, this method can also be |
|
538 | + * used to manage some data while filling the IIndexDocument before its |
|
539 | + * indexing. |
|
540 | + * |
|
541 | + * @since 15.0.0 |
|
542 | + * |
|
543 | + * @param string $info |
|
544 | + * @param array $value |
|
545 | + * |
|
546 | + * @return IIndexDocument |
|
547 | + */ |
|
548 | + public function setInfoArray(string $info, array $value): IIndexDocument; |
|
549 | + |
|
550 | + /** |
|
551 | + * Get an information about a document. (array) |
|
552 | + * |
|
553 | + * @since 15.0.0 |
|
554 | + * |
|
555 | + * @param string $info |
|
556 | + * @param array $default |
|
557 | + * |
|
558 | + * @return array |
|
559 | + */ |
|
560 | + public function getInfoArray(string $info, array $default = []): array; |
|
561 | + |
|
562 | + /** |
|
563 | + * Set some information about the original document that will be available |
|
564 | + * to the front-end when displaying search result. (as int) |
|
565 | + * Because this information will not be indexed, this method can also be |
|
566 | + * used to manage some data while filling the IIndexDocument before its |
|
567 | + * indexing. |
|
568 | + * |
|
569 | + * @since 15.0.0 |
|
570 | + * |
|
571 | + * @param string $info |
|
572 | + * @param int $value |
|
573 | + * |
|
574 | + * @return IIndexDocument |
|
575 | + */ |
|
576 | + public function setInfoInt(string $info, int $value): IIndexDocument; |
|
577 | + |
|
578 | + /** |
|
579 | + * Get an information about a document. (int) |
|
580 | + * |
|
581 | + * @since 15.0.0 |
|
582 | + * |
|
583 | + * @param string $info |
|
584 | + * @param int $default |
|
585 | + * |
|
586 | + * @return int |
|
587 | + */ |
|
588 | + public function getInfoInt(string $info, int $default = 0): int; |
|
589 | + |
|
590 | + /** |
|
591 | + * Set some information about the original document that will be available |
|
592 | + * to the front-end when displaying search result. (as bool) |
|
593 | + * Because this information will not be indexed, this method can also be |
|
594 | + * used to manage some data while filling the IIndexDocument before its |
|
595 | + * indexing. |
|
596 | + * |
|
597 | + * @since 15.0.0 |
|
598 | + * |
|
599 | + * @param string $info |
|
600 | + * @param bool $value |
|
601 | + * |
|
602 | + * @return IIndexDocument |
|
603 | + */ |
|
604 | + public function setInfoBool(string $info, bool $value): IIndexDocument; |
|
605 | + |
|
606 | + /** |
|
607 | + * Get an information about a document. (bool) |
|
608 | + * |
|
609 | + * @since 15.0.0 |
|
610 | + * |
|
611 | + * @param string $info |
|
612 | + * @param bool $default |
|
613 | + * |
|
614 | + * @return bool |
|
615 | + */ |
|
616 | + public function getInfoBool(string $info, bool $default = false): bool; |
|
617 | + |
|
618 | + /** |
|
619 | + * Get all info. |
|
620 | + * |
|
621 | + * @since 15.0.0 |
|
622 | + * |
|
623 | + * @return array |
|
624 | + */ |
|
625 | + public function getInfoAll(): array; |
|
626 | 626 | } |
@@ -44,239 +44,239 @@ |
||
44 | 44 | * |
45 | 45 | */ |
46 | 46 | interface IIndex { |
47 | - public const INDEX_OK = 1; |
|
48 | - public const INDEX_IGNORE = 2; |
|
49 | - |
|
50 | - public const INDEX_META = 4; |
|
51 | - public const INDEX_CONTENT = 8; |
|
52 | - public const INDEX_PARTS = 16; |
|
53 | - public const INDEX_FULL = 28; |
|
54 | - public const INDEX_REMOVE = 32; |
|
55 | - public const INDEX_DONE = 64; |
|
56 | - public const INDEX_FAILED = 128; |
|
57 | - |
|
58 | - public const ERROR_FAILED = 1; |
|
59 | - public const ERROR_FAILED2 = 2; |
|
60 | - public const ERROR_FAILED3 = 4; |
|
61 | - |
|
62 | - public const ERROR_SEV_1 = 1; |
|
63 | - public const ERROR_SEV_2 = 2; |
|
64 | - public const ERROR_SEV_3 = 3; |
|
65 | - public const ERROR_SEV_4 = 4; |
|
66 | - |
|
67 | - |
|
68 | - /** |
|
69 | - * Get the Id of the Content Provider. |
|
70 | - * |
|
71 | - * @since 15.0.0 |
|
72 | - * |
|
73 | - * @return string |
|
74 | - */ |
|
75 | - public function getProviderId(): string; |
|
76 | - |
|
77 | - |
|
78 | - /** |
|
79 | - * Get the Id of the original document. |
|
80 | - * |
|
81 | - * @since 15.0.0 |
|
82 | - * |
|
83 | - * @return string |
|
84 | - */ |
|
85 | - public function getDocumentId(): string; |
|
86 | - |
|
87 | - |
|
88 | - /** |
|
89 | - * Set the source of the original document. |
|
90 | - * |
|
91 | - * @since 15.0.0 |
|
92 | - * |
|
93 | - * @param string $source |
|
94 | - * |
|
95 | - * @return IIndex |
|
96 | - */ |
|
97 | - public function setSource(string $source): IIndex; |
|
98 | - |
|
99 | - /** |
|
100 | - * Get the source of the original document. |
|
101 | - * |
|
102 | - * @since 15.0.0 |
|
103 | - * |
|
104 | - * @return string |
|
105 | - */ |
|
106 | - public function getSource(): string; |
|
107 | - |
|
108 | - |
|
109 | - /** |
|
110 | - * Set the owner of the original document. |
|
111 | - * |
|
112 | - * @since 15.0.0 |
|
113 | - * |
|
114 | - * @param string $ownerId |
|
115 | - * |
|
116 | - * @return IIndex |
|
117 | - */ |
|
118 | - public function setOwnerId(string $ownerId): IIndex; |
|
119 | - |
|
120 | - /** |
|
121 | - * Get the owner of the original document. |
|
122 | - * |
|
123 | - * @since 15.0.0 |
|
124 | - * |
|
125 | - * @return string |
|
126 | - */ |
|
127 | - public function getOwnerId(): string; |
|
128 | - |
|
129 | - |
|
130 | - /** |
|
131 | - * Set the current index status (bit flag) of the original document. |
|
132 | - * If $reset is true, the status is reset to the defined value. |
|
133 | - * |
|
134 | - * @since 15.0.0 |
|
135 | - * |
|
136 | - * @param int $status |
|
137 | - * @param bool $reset |
|
138 | - * |
|
139 | - * @return IIndex |
|
140 | - */ |
|
141 | - public function setStatus(int $status, bool $reset = false): IIndex; |
|
142 | - |
|
143 | - /** |
|
144 | - * Get the current index status of the original document. |
|
145 | - * |
|
146 | - * @since 15.0.0 |
|
147 | - * |
|
148 | - * @return int |
|
149 | - */ |
|
150 | - public function getStatus(): int; |
|
151 | - |
|
152 | - /** |
|
153 | - * Check if the document fit a specific status. |
|
154 | - * |
|
155 | - * @since 15.0.0 |
|
156 | - * |
|
157 | - * @param int $status |
|
158 | - * |
|
159 | - * @return bool |
|
160 | - */ |
|
161 | - public function isStatus(int $status): bool; |
|
162 | - |
|
163 | - /** |
|
164 | - * Remove a status. |
|
165 | - * |
|
166 | - * @since 15.0.0 |
|
167 | - * |
|
168 | - * @param int $status |
|
169 | - * |
|
170 | - * @return IIndex |
|
171 | - */ |
|
172 | - public function unsetStatus(int $status): IIndex; |
|
173 | - |
|
174 | - |
|
175 | - /** |
|
176 | - * Add an option related to the original document (as string). |
|
177 | - * |
|
178 | - * @since 15.0.0 |
|
179 | - * |
|
180 | - * @param string $option |
|
181 | - * @param string $value |
|
182 | - * |
|
183 | - * @return IIndex |
|
184 | - */ |
|
185 | - public function addOption(string $option, string $value): IIndex; |
|
186 | - |
|
187 | - /** |
|
188 | - * Add an option related to the original document (as integer). |
|
189 | - * |
|
190 | - * @since 15.0.0 |
|
191 | - * |
|
192 | - * @param string $option |
|
193 | - * @param int $value |
|
194 | - * |
|
195 | - * @return IIndex |
|
196 | - */ |
|
197 | - public function addOptionInt(string $option, int $value): IIndex; |
|
198 | - |
|
199 | - /** |
|
200 | - * Get the option related to the original document (as string). |
|
201 | - * |
|
202 | - * @since 15.0.0 |
|
203 | - * |
|
204 | - * @param string $option |
|
205 | - * @param string $default |
|
206 | - * |
|
207 | - * @return string |
|
208 | - */ |
|
209 | - public function getOption(string $option, string $default = ''): string; |
|
210 | - |
|
211 | - /** |
|
212 | - * Get the option related to the original document (as integer). |
|
213 | - * |
|
214 | - * @since 15.0.0 |
|
215 | - * |
|
216 | - * @param string $option |
|
217 | - * @param int $default |
|
218 | - * |
|
219 | - * @return int |
|
220 | - */ |
|
221 | - public function getOptionInt(string $option, int $default = 0): int; |
|
222 | - |
|
223 | - /** |
|
224 | - * Get all options related to the original document. |
|
225 | - * |
|
226 | - * @since 15.0.0 |
|
227 | - * |
|
228 | - * @return array |
|
229 | - */ |
|
230 | - public function getOptions(): array; |
|
231 | - |
|
232 | - |
|
233 | - /** |
|
234 | - * Add an error log related to the Index. |
|
235 | - * |
|
236 | - * @since 15.0.0 |
|
237 | - * |
|
238 | - * @param string $message |
|
239 | - * @param string $exception |
|
240 | - * @param int $sev |
|
241 | - * |
|
242 | - * @return IIndex |
|
243 | - */ |
|
244 | - public function addError(string $message, string $exception = '', int $sev = self::ERROR_SEV_3): IIndex; |
|
245 | - |
|
246 | - /** |
|
247 | - * Returns the number of known errors related to the Index. |
|
248 | - * |
|
249 | - * @since 15.0.0 |
|
250 | - * |
|
251 | - * @return int |
|
252 | - */ |
|
253 | - public function getErrorCount(): int; |
|
254 | - |
|
255 | - /** |
|
256 | - * Reset all error logs related to the Index. |
|
257 | - * |
|
258 | - * @since 15.0.0 |
|
259 | - */ |
|
260 | - public function resetErrors(): IIndex; |
|
261 | - |
|
262 | - |
|
263 | - /** |
|
264 | - * Set the date of the last index. |
|
265 | - * |
|
266 | - * @since 15.0.0 |
|
267 | - * |
|
268 | - * @param int $lastIndex |
|
269 | - * |
|
270 | - * @return IIndex |
|
271 | - */ |
|
272 | - public function setLastIndex(int $lastIndex = -1): IIndex; |
|
273 | - |
|
274 | - /** |
|
275 | - * Get the date of the last index. |
|
276 | - * |
|
277 | - * @since 15.0.0 |
|
278 | - * |
|
279 | - * @return int |
|
280 | - */ |
|
281 | - public function getLastIndex(): int; |
|
47 | + public const INDEX_OK = 1; |
|
48 | + public const INDEX_IGNORE = 2; |
|
49 | + |
|
50 | + public const INDEX_META = 4; |
|
51 | + public const INDEX_CONTENT = 8; |
|
52 | + public const INDEX_PARTS = 16; |
|
53 | + public const INDEX_FULL = 28; |
|
54 | + public const INDEX_REMOVE = 32; |
|
55 | + public const INDEX_DONE = 64; |
|
56 | + public const INDEX_FAILED = 128; |
|
57 | + |
|
58 | + public const ERROR_FAILED = 1; |
|
59 | + public const ERROR_FAILED2 = 2; |
|
60 | + public const ERROR_FAILED3 = 4; |
|
61 | + |
|
62 | + public const ERROR_SEV_1 = 1; |
|
63 | + public const ERROR_SEV_2 = 2; |
|
64 | + public const ERROR_SEV_3 = 3; |
|
65 | + public const ERROR_SEV_4 = 4; |
|
66 | + |
|
67 | + |
|
68 | + /** |
|
69 | + * Get the Id of the Content Provider. |
|
70 | + * |
|
71 | + * @since 15.0.0 |
|
72 | + * |
|
73 | + * @return string |
|
74 | + */ |
|
75 | + public function getProviderId(): string; |
|
76 | + |
|
77 | + |
|
78 | + /** |
|
79 | + * Get the Id of the original document. |
|
80 | + * |
|
81 | + * @since 15.0.0 |
|
82 | + * |
|
83 | + * @return string |
|
84 | + */ |
|
85 | + public function getDocumentId(): string; |
|
86 | + |
|
87 | + |
|
88 | + /** |
|
89 | + * Set the source of the original document. |
|
90 | + * |
|
91 | + * @since 15.0.0 |
|
92 | + * |
|
93 | + * @param string $source |
|
94 | + * |
|
95 | + * @return IIndex |
|
96 | + */ |
|
97 | + public function setSource(string $source): IIndex; |
|
98 | + |
|
99 | + /** |
|
100 | + * Get the source of the original document. |
|
101 | + * |
|
102 | + * @since 15.0.0 |
|
103 | + * |
|
104 | + * @return string |
|
105 | + */ |
|
106 | + public function getSource(): string; |
|
107 | + |
|
108 | + |
|
109 | + /** |
|
110 | + * Set the owner of the original document. |
|
111 | + * |
|
112 | + * @since 15.0.0 |
|
113 | + * |
|
114 | + * @param string $ownerId |
|
115 | + * |
|
116 | + * @return IIndex |
|
117 | + */ |
|
118 | + public function setOwnerId(string $ownerId): IIndex; |
|
119 | + |
|
120 | + /** |
|
121 | + * Get the owner of the original document. |
|
122 | + * |
|
123 | + * @since 15.0.0 |
|
124 | + * |
|
125 | + * @return string |
|
126 | + */ |
|
127 | + public function getOwnerId(): string; |
|
128 | + |
|
129 | + |
|
130 | + /** |
|
131 | + * Set the current index status (bit flag) of the original document. |
|
132 | + * If $reset is true, the status is reset to the defined value. |
|
133 | + * |
|
134 | + * @since 15.0.0 |
|
135 | + * |
|
136 | + * @param int $status |
|
137 | + * @param bool $reset |
|
138 | + * |
|
139 | + * @return IIndex |
|
140 | + */ |
|
141 | + public function setStatus(int $status, bool $reset = false): IIndex; |
|
142 | + |
|
143 | + /** |
|
144 | + * Get the current index status of the original document. |
|
145 | + * |
|
146 | + * @since 15.0.0 |
|
147 | + * |
|
148 | + * @return int |
|
149 | + */ |
|
150 | + public function getStatus(): int; |
|
151 | + |
|
152 | + /** |
|
153 | + * Check if the document fit a specific status. |
|
154 | + * |
|
155 | + * @since 15.0.0 |
|
156 | + * |
|
157 | + * @param int $status |
|
158 | + * |
|
159 | + * @return bool |
|
160 | + */ |
|
161 | + public function isStatus(int $status): bool; |
|
162 | + |
|
163 | + /** |
|
164 | + * Remove a status. |
|
165 | + * |
|
166 | + * @since 15.0.0 |
|
167 | + * |
|
168 | + * @param int $status |
|
169 | + * |
|
170 | + * @return IIndex |
|
171 | + */ |
|
172 | + public function unsetStatus(int $status): IIndex; |
|
173 | + |
|
174 | + |
|
175 | + /** |
|
176 | + * Add an option related to the original document (as string). |
|
177 | + * |
|
178 | + * @since 15.0.0 |
|
179 | + * |
|
180 | + * @param string $option |
|
181 | + * @param string $value |
|
182 | + * |
|
183 | + * @return IIndex |
|
184 | + */ |
|
185 | + public function addOption(string $option, string $value): IIndex; |
|
186 | + |
|
187 | + /** |
|
188 | + * Add an option related to the original document (as integer). |
|
189 | + * |
|
190 | + * @since 15.0.0 |
|
191 | + * |
|
192 | + * @param string $option |
|
193 | + * @param int $value |
|
194 | + * |
|
195 | + * @return IIndex |
|
196 | + */ |
|
197 | + public function addOptionInt(string $option, int $value): IIndex; |
|
198 | + |
|
199 | + /** |
|
200 | + * Get the option related to the original document (as string). |
|
201 | + * |
|
202 | + * @since 15.0.0 |
|
203 | + * |
|
204 | + * @param string $option |
|
205 | + * @param string $default |
|
206 | + * |
|
207 | + * @return string |
|
208 | + */ |
|
209 | + public function getOption(string $option, string $default = ''): string; |
|
210 | + |
|
211 | + /** |
|
212 | + * Get the option related to the original document (as integer). |
|
213 | + * |
|
214 | + * @since 15.0.0 |
|
215 | + * |
|
216 | + * @param string $option |
|
217 | + * @param int $default |
|
218 | + * |
|
219 | + * @return int |
|
220 | + */ |
|
221 | + public function getOptionInt(string $option, int $default = 0): int; |
|
222 | + |
|
223 | + /** |
|
224 | + * Get all options related to the original document. |
|
225 | + * |
|
226 | + * @since 15.0.0 |
|
227 | + * |
|
228 | + * @return array |
|
229 | + */ |
|
230 | + public function getOptions(): array; |
|
231 | + |
|
232 | + |
|
233 | + /** |
|
234 | + * Add an error log related to the Index. |
|
235 | + * |
|
236 | + * @since 15.0.0 |
|
237 | + * |
|
238 | + * @param string $message |
|
239 | + * @param string $exception |
|
240 | + * @param int $sev |
|
241 | + * |
|
242 | + * @return IIndex |
|
243 | + */ |
|
244 | + public function addError(string $message, string $exception = '', int $sev = self::ERROR_SEV_3): IIndex; |
|
245 | + |
|
246 | + /** |
|
247 | + * Returns the number of known errors related to the Index. |
|
248 | + * |
|
249 | + * @since 15.0.0 |
|
250 | + * |
|
251 | + * @return int |
|
252 | + */ |
|
253 | + public function getErrorCount(): int; |
|
254 | + |
|
255 | + /** |
|
256 | + * Reset all error logs related to the Index. |
|
257 | + * |
|
258 | + * @since 15.0.0 |
|
259 | + */ |
|
260 | + public function resetErrors(): IIndex; |
|
261 | + |
|
262 | + |
|
263 | + /** |
|
264 | + * Set the date of the last index. |
|
265 | + * |
|
266 | + * @since 15.0.0 |
|
267 | + * |
|
268 | + * @param int $lastIndex |
|
269 | + * |
|
270 | + * @return IIndex |
|
271 | + */ |
|
272 | + public function setLastIndex(int $lastIndex = -1): IIndex; |
|
273 | + |
|
274 | + /** |
|
275 | + * Get the date of the last index. |
|
276 | + * |
|
277 | + * @since 15.0.0 |
|
278 | + * |
|
279 | + * @return int |
|
280 | + */ |
|
281 | + public function getLastIndex(): int; |
|
282 | 282 | } |