12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- namespace OCP\Search;
- abstract class Provider {
-
- public const OPTION_APPS = 'apps';
-
- protected $options;
-
- public function __construct($options = []) {
- $this->options = $options;
- }
-
- public function getOption($key) {
- if (is_array($this->options) && isset($this->options[$key])) {
- return $this->options[$key];
- } else {
- return null;
- }
- }
-
- public function providesResultsFor(array $apps = []) {
- $forApps = $this->getOption(self::OPTION_APPS);
- return empty($apps) || empty($forApps) || array_intersect($forApps, $apps);
- }
-
- abstract public function search($query);
- }
|