@@ -37,97 +37,97 @@ |
||
37 | 37 | */ |
38 | 38 | interface IRegistrationContext { |
39 | 39 | |
40 | - /** |
|
41 | - * @param string $capability |
|
42 | - * @see IAppContainer::registerCapability |
|
43 | - * |
|
44 | - * @since 20.0.0 |
|
45 | - */ |
|
46 | - public function registerCapability(string $capability): void; |
|
40 | + /** |
|
41 | + * @param string $capability |
|
42 | + * @see IAppContainer::registerCapability |
|
43 | + * |
|
44 | + * @since 20.0.0 |
|
45 | + */ |
|
46 | + public function registerCapability(string $capability): void; |
|
47 | 47 | |
48 | - /** |
|
49 | - * Register an implementation of \OCP\Support\CrashReport\IReporter that |
|
50 | - * will receive unhandled exceptions and throwables |
|
51 | - * |
|
52 | - * @param string $reporterClass |
|
53 | - * @return void |
|
54 | - * @since 20.0.0 |
|
55 | - */ |
|
56 | - public function registerCrashReporter(string $reporterClass): void; |
|
48 | + /** |
|
49 | + * Register an implementation of \OCP\Support\CrashReport\IReporter that |
|
50 | + * will receive unhandled exceptions and throwables |
|
51 | + * |
|
52 | + * @param string $reporterClass |
|
53 | + * @return void |
|
54 | + * @since 20.0.0 |
|
55 | + */ |
|
56 | + public function registerCrashReporter(string $reporterClass): void; |
|
57 | 57 | |
58 | - /** |
|
59 | - * Register a service |
|
60 | - * |
|
61 | - * @param string $name |
|
62 | - * @param callable $factory |
|
63 | - * @param bool $shared |
|
64 | - * |
|
65 | - * @return void |
|
66 | - * @see IContainer::registerService() |
|
67 | - * |
|
68 | - * @since 20.0.0 |
|
69 | - */ |
|
70 | - public function registerService(string $name, callable $factory, bool $shared = true): void; |
|
58 | + /** |
|
59 | + * Register a service |
|
60 | + * |
|
61 | + * @param string $name |
|
62 | + * @param callable $factory |
|
63 | + * @param bool $shared |
|
64 | + * |
|
65 | + * @return void |
|
66 | + * @see IContainer::registerService() |
|
67 | + * |
|
68 | + * @since 20.0.0 |
|
69 | + */ |
|
70 | + public function registerService(string $name, callable $factory, bool $shared = true): void; |
|
71 | 71 | |
72 | - /** |
|
73 | - * @param string $alias |
|
74 | - * @param string $target |
|
75 | - * |
|
76 | - * @return void |
|
77 | - * @see IContainer::registerAlias() |
|
78 | - * |
|
79 | - * @since 20.0.0 |
|
80 | - */ |
|
81 | - public function registerServiceAlias(string $alias, string $target): void; |
|
72 | + /** |
|
73 | + * @param string $alias |
|
74 | + * @param string $target |
|
75 | + * |
|
76 | + * @return void |
|
77 | + * @see IContainer::registerAlias() |
|
78 | + * |
|
79 | + * @since 20.0.0 |
|
80 | + */ |
|
81 | + public function registerServiceAlias(string $alias, string $target): void; |
|
82 | 82 | |
83 | - /** |
|
84 | - * @param string $name |
|
85 | - * @param mixed $value |
|
86 | - * |
|
87 | - * @return void |
|
88 | - * @see IContainer::registerParameter() |
|
89 | - * |
|
90 | - * @since 20.0.0 |
|
91 | - */ |
|
92 | - public function registerParameter(string $name, $value): void; |
|
83 | + /** |
|
84 | + * @param string $name |
|
85 | + * @param mixed $value |
|
86 | + * |
|
87 | + * @return void |
|
88 | + * @see IContainer::registerParameter() |
|
89 | + * |
|
90 | + * @since 20.0.0 |
|
91 | + */ |
|
92 | + public function registerParameter(string $name, $value): void; |
|
93 | 93 | |
94 | - /** |
|
95 | - * Register a service listener |
|
96 | - * |
|
97 | - * This is equivalent to calling IEventDispatcher::addServiceListener |
|
98 | - * |
|
99 | - * @param string $event preferably the fully-qualified class name of the Event sub class to listen for |
|
100 | - * @param string $listener fully qualified class name (or ::class notation) of a \OCP\EventDispatcher\IEventListener that can be built by the DI container |
|
101 | - * @param int $priority |
|
102 | - * |
|
103 | - * @see IEventDispatcher::addServiceListener() |
|
104 | - * |
|
105 | - * @since 20.0.0 |
|
106 | - */ |
|
107 | - public function registerEventListener(string $event, string $listener, int $priority = 0): void; |
|
94 | + /** |
|
95 | + * Register a service listener |
|
96 | + * |
|
97 | + * This is equivalent to calling IEventDispatcher::addServiceListener |
|
98 | + * |
|
99 | + * @param string $event preferably the fully-qualified class name of the Event sub class to listen for |
|
100 | + * @param string $listener fully qualified class name (or ::class notation) of a \OCP\EventDispatcher\IEventListener that can be built by the DI container |
|
101 | + * @param int $priority |
|
102 | + * |
|
103 | + * @see IEventDispatcher::addServiceListener() |
|
104 | + * |
|
105 | + * @since 20.0.0 |
|
106 | + */ |
|
107 | + public function registerEventListener(string $event, string $listener, int $priority = 0): void; |
|
108 | 108 | |
109 | - /** |
|
110 | - * @param string $class |
|
111 | - * |
|
112 | - * @return void |
|
113 | - * @see IAppContainer::registerMiddleWare() |
|
114 | - * |
|
115 | - * @since 20.0.0 |
|
116 | - */ |
|
117 | - public function registerMiddleware(string $class): void; |
|
109 | + /** |
|
110 | + * @param string $class |
|
111 | + * |
|
112 | + * @return void |
|
113 | + * @see IAppContainer::registerMiddleWare() |
|
114 | + * |
|
115 | + * @since 20.0.0 |
|
116 | + */ |
|
117 | + public function registerMiddleware(string $class): void; |
|
118 | 118 | |
119 | - /** |
|
120 | - * Register a search provider for the unified search |
|
121 | - * |
|
122 | - * It is allowed to register more than one provider per app as the search |
|
123 | - * results can go into distinct sections, e.g. "Files" and "Files shared |
|
124 | - * with you" in the Files app. |
|
125 | - * |
|
126 | - * @param string $class |
|
127 | - * |
|
128 | - * @return void |
|
129 | - * |
|
130 | - * @since 20.0.0 |
|
131 | - */ |
|
132 | - public function registerSearchProvider(string $class): void; |
|
119 | + /** |
|
120 | + * Register a search provider for the unified search |
|
121 | + * |
|
122 | + * It is allowed to register more than one provider per app as the search |
|
123 | + * results can go into distinct sections, e.g. "Files" and "Files shared |
|
124 | + * with you" in the Files app. |
|
125 | + * |
|
126 | + * @param string $class |
|
127 | + * |
|
128 | + * @return void |
|
129 | + * |
|
130 | + * @since 20.0.0 |
|
131 | + */ |
|
132 | + public function registerSearchProvider(string $class): void; |
|
133 | 133 | } |
@@ -33,39 +33,39 @@ |
||
33 | 33 | */ |
34 | 34 | interface ISearch { |
35 | 35 | |
36 | - /** |
|
37 | - * Search all providers for $query |
|
38 | - * @param string $query |
|
39 | - * @param string[] $inApps optionally limit results to the given apps |
|
40 | - * @param int $page pages start at page 1 |
|
41 | - * @param int $size |
|
42 | - * @return array An array of OCP\Search\Result's |
|
43 | - * @since 8.0.0 |
|
44 | - * @deprecated 20.0.0 |
|
45 | - */ |
|
46 | - public function searchPaged($query, array $inApps = [], $page = 1, $size = 30); |
|
36 | + /** |
|
37 | + * Search all providers for $query |
|
38 | + * @param string $query |
|
39 | + * @param string[] $inApps optionally limit results to the given apps |
|
40 | + * @param int $page pages start at page 1 |
|
41 | + * @param int $size |
|
42 | + * @return array An array of OCP\Search\Result's |
|
43 | + * @since 8.0.0 |
|
44 | + * @deprecated 20.0.0 |
|
45 | + */ |
|
46 | + public function searchPaged($query, array $inApps = [], $page = 1, $size = 30); |
|
47 | 47 | |
48 | - /** |
|
49 | - * Register a new search provider to search with |
|
50 | - * @param string $class class name of a OCP\Search\Provider |
|
51 | - * @param array $options optional |
|
52 | - * @since 7.0.0 |
|
53 | - * @deprecated 20.0.0 |
|
54 | - */ |
|
55 | - public function registerProvider($class, array $options = []); |
|
48 | + /** |
|
49 | + * Register a new search provider to search with |
|
50 | + * @param string $class class name of a OCP\Search\Provider |
|
51 | + * @param array $options optional |
|
52 | + * @since 7.0.0 |
|
53 | + * @deprecated 20.0.0 |
|
54 | + */ |
|
55 | + public function registerProvider($class, array $options = []); |
|
56 | 56 | |
57 | - /** |
|
58 | - * Remove one existing search provider |
|
59 | - * @param string $provider class name of a OCP\Search\Provider |
|
60 | - * @since 7.0.0 |
|
61 | - * @deprecated 20.0.0 |
|
62 | - */ |
|
63 | - public function removeProvider($provider); |
|
57 | + /** |
|
58 | + * Remove one existing search provider |
|
59 | + * @param string $provider class name of a OCP\Search\Provider |
|
60 | + * @since 7.0.0 |
|
61 | + * @deprecated 20.0.0 |
|
62 | + */ |
|
63 | + public function removeProvider($provider); |
|
64 | 64 | |
65 | - /** |
|
66 | - * Remove all registered search providers |
|
67 | - * @since 7.0.0 |
|
68 | - * @deprecated 20.0.0 |
|
69 | - */ |
|
70 | - public function clearProviders(); |
|
65 | + /** |
|
66 | + * Remove all registered search providers |
|
67 | + * @since 7.0.0 |
|
68 | + * @deprecated 20.0.0 |
|
69 | + */ |
|
70 | + public function clearProviders(); |
|
71 | 71 | } |
@@ -39,45 +39,45 @@ |
||
39 | 39 | */ |
40 | 40 | interface IProvider { |
41 | 41 | |
42 | - /** |
|
43 | - * Get the unique ID of this search provider |
|
44 | - * |
|
45 | - * Ideally this should be the app name or an identifier identified with the |
|
46 | - * app name, especially if the app registers more than one provider. |
|
47 | - * |
|
48 | - * Example: 'mail', 'mail_recipients', 'files_sharing' |
|
49 | - * |
|
50 | - * @return string |
|
51 | - * |
|
52 | - * @since 20.0.0 |
|
53 | - */ |
|
54 | - public function getId(): string; |
|
42 | + /** |
|
43 | + * Get the unique ID of this search provider |
|
44 | + * |
|
45 | + * Ideally this should be the app name or an identifier identified with the |
|
46 | + * app name, especially if the app registers more than one provider. |
|
47 | + * |
|
48 | + * Example: 'mail', 'mail_recipients', 'files_sharing' |
|
49 | + * |
|
50 | + * @return string |
|
51 | + * |
|
52 | + * @since 20.0.0 |
|
53 | + */ |
|
54 | + public function getId(): string; |
|
55 | 55 | |
56 | - /** |
|
57 | - * Find matching search entries in an app |
|
58 | - * |
|
59 | - * Search results can either be a complete list of all the matches the app can |
|
60 | - * find, or ideally a paginated result set where more data can be fetched on |
|
61 | - * demand. To be able to tell where the next offset starts the search uses |
|
62 | - * "cursors" which are a property of the last result entry. E.g. search results |
|
63 | - * that show most recent entries first can look for entries older than the last |
|
64 | - * one of the first result set. This approach was chosen over a numeric limit/ |
|
65 | - * offset approach as the offset moves as new data comes in. The cursor is |
|
66 | - * resistant to these changes and will still show results without overlaps or |
|
67 | - * gaps. |
|
68 | - * |
|
69 | - * See https://dev.to/jackmarchant/offset-and-cursor-pagination-explained-b89 |
|
70 | - * for the concept of cursors. |
|
71 | - * |
|
72 | - * Implementations that return result pages have to adhere to the limit |
|
73 | - * property of a search query. |
|
74 | - * |
|
75 | - * @param IUser $user |
|
76 | - * @param ISearchQuery $query |
|
77 | - * |
|
78 | - * @return SearchResult |
|
79 | - * |
|
80 | - * @since 20.0.0 |
|
81 | - */ |
|
82 | - public function search(IUser $user, ISearchQuery $query): SearchResult; |
|
56 | + /** |
|
57 | + * Find matching search entries in an app |
|
58 | + * |
|
59 | + * Search results can either be a complete list of all the matches the app can |
|
60 | + * find, or ideally a paginated result set where more data can be fetched on |
|
61 | + * demand. To be able to tell where the next offset starts the search uses |
|
62 | + * "cursors" which are a property of the last result entry. E.g. search results |
|
63 | + * that show most recent entries first can look for entries older than the last |
|
64 | + * one of the first result set. This approach was chosen over a numeric limit/ |
|
65 | + * offset approach as the offset moves as new data comes in. The cursor is |
|
66 | + * resistant to these changes and will still show results without overlaps or |
|
67 | + * gaps. |
|
68 | + * |
|
69 | + * See https://dev.to/jackmarchant/offset-and-cursor-pagination-explained-b89 |
|
70 | + * for the concept of cursors. |
|
71 | + * |
|
72 | + * Implementations that return result pages have to adhere to the limit |
|
73 | + * property of a search query. |
|
74 | + * |
|
75 | + * @param IUser $user |
|
76 | + * @param ISearchQuery $query |
|
77 | + * |
|
78 | + * @return SearchResult |
|
79 | + * |
|
80 | + * @since 20.0.0 |
|
81 | + */ |
|
82 | + public function search(IUser $user, ISearchQuery $query): SearchResult; |
|
83 | 83 | } |
@@ -44,59 +44,59 @@ |
||
44 | 44 | */ |
45 | 45 | abstract class ASearchResultEntry implements JsonSerializable { |
46 | 46 | |
47 | - /** |
|
48 | - * @var string |
|
49 | - * @since 20.0.0 |
|
50 | - */ |
|
51 | - protected $thumbnailUrl; |
|
47 | + /** |
|
48 | + * @var string |
|
49 | + * @since 20.0.0 |
|
50 | + */ |
|
51 | + protected $thumbnailUrl; |
|
52 | 52 | |
53 | - /** |
|
54 | - * @var string |
|
55 | - * @since 20.0.0 |
|
56 | - */ |
|
57 | - protected $title; |
|
53 | + /** |
|
54 | + * @var string |
|
55 | + * @since 20.0.0 |
|
56 | + */ |
|
57 | + protected $title; |
|
58 | 58 | |
59 | - /** |
|
60 | - * @var string |
|
61 | - * @since 20.0.0 |
|
62 | - */ |
|
63 | - protected $subline; |
|
59 | + /** |
|
60 | + * @var string |
|
61 | + * @since 20.0.0 |
|
62 | + */ |
|
63 | + protected $subline; |
|
64 | 64 | |
65 | - /** |
|
66 | - * @var string |
|
67 | - * @since 20.0.0 |
|
68 | - */ |
|
69 | - protected $resourceUrl; |
|
65 | + /** |
|
66 | + * @var string |
|
67 | + * @since 20.0.0 |
|
68 | + */ |
|
69 | + protected $resourceUrl; |
|
70 | 70 | |
71 | - /** |
|
72 | - * @param string $thumbnailUrl a relative or absolute URL to the thumbnail or icon of the entry |
|
73 | - * @param string $title a main title of the entry |
|
74 | - * @param string $subline the secondary line of the entry |
|
75 | - * @param string $resourceUrl the URL where the user can find the detail, like a deep link inside the app |
|
76 | - * |
|
77 | - * @since 20.0.0 |
|
78 | - */ |
|
79 | - public function __construct(string $thumbnailUrl, |
|
80 | - string $title, |
|
81 | - string $subline, |
|
82 | - string $resourceUrl) { |
|
83 | - $this->thumbnailUrl = $thumbnailUrl; |
|
84 | - $this->title = $title; |
|
85 | - $this->subline = $subline; |
|
86 | - $this->resourceUrl = $resourceUrl; |
|
87 | - } |
|
71 | + /** |
|
72 | + * @param string $thumbnailUrl a relative or absolute URL to the thumbnail or icon of the entry |
|
73 | + * @param string $title a main title of the entry |
|
74 | + * @param string $subline the secondary line of the entry |
|
75 | + * @param string $resourceUrl the URL where the user can find the detail, like a deep link inside the app |
|
76 | + * |
|
77 | + * @since 20.0.0 |
|
78 | + */ |
|
79 | + public function __construct(string $thumbnailUrl, |
|
80 | + string $title, |
|
81 | + string $subline, |
|
82 | + string $resourceUrl) { |
|
83 | + $this->thumbnailUrl = $thumbnailUrl; |
|
84 | + $this->title = $title; |
|
85 | + $this->subline = $subline; |
|
86 | + $this->resourceUrl = $resourceUrl; |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * @return array |
|
91 | - * |
|
92 | - * @since 20.0.0 |
|
93 | - */ |
|
94 | - public function jsonSerialize(): array { |
|
95 | - return [ |
|
96 | - 'thumbnailUrl' => $this->thumbnailUrl, |
|
97 | - 'title' => $this->title, |
|
98 | - 'subline' => $this->subline, |
|
99 | - 'resourceUrl' => $this->resourceUrl, |
|
100 | - ]; |
|
101 | - } |
|
89 | + /** |
|
90 | + * @return array |
|
91 | + * |
|
92 | + * @since 20.0.0 |
|
93 | + */ |
|
94 | + public function jsonSerialize(): array { |
|
95 | + return [ |
|
96 | + 'thumbnailUrl' => $this->thumbnailUrl, |
|
97 | + 'title' => $this->title, |
|
98 | + 'subline' => $this->subline, |
|
99 | + 'resourceUrl' => $this->resourceUrl, |
|
100 | + ]; |
|
101 | + } |
|
102 | 102 | } |
@@ -33,52 +33,52 @@ |
||
33 | 33 | */ |
34 | 34 | class Result { |
35 | 35 | |
36 | - /** |
|
37 | - * A unique identifier for the result, usually given as the item ID in its |
|
38 | - * corresponding application. |
|
39 | - * @var string |
|
40 | - * @since 7.0.0 |
|
41 | - * @deprecated 20.0.0 |
|
42 | - */ |
|
43 | - public $id; |
|
36 | + /** |
|
37 | + * A unique identifier for the result, usually given as the item ID in its |
|
38 | + * corresponding application. |
|
39 | + * @var string |
|
40 | + * @since 7.0.0 |
|
41 | + * @deprecated 20.0.0 |
|
42 | + */ |
|
43 | + public $id; |
|
44 | 44 | |
45 | - /** |
|
46 | - * The name of the item returned; this will be displayed in the search |
|
47 | - * results. |
|
48 | - * @var string |
|
49 | - * @since 7.0.0 |
|
50 | - * @deprecated 20.0.0 |
|
51 | - */ |
|
52 | - public $name; |
|
45 | + /** |
|
46 | + * The name of the item returned; this will be displayed in the search |
|
47 | + * results. |
|
48 | + * @var string |
|
49 | + * @since 7.0.0 |
|
50 | + * @deprecated 20.0.0 |
|
51 | + */ |
|
52 | + public $name; |
|
53 | 53 | |
54 | - /** |
|
55 | - * URL to the application item. |
|
56 | - * @var string |
|
57 | - * @since 7.0.0 |
|
58 | - * @deprecated 20.0.0 |
|
59 | - */ |
|
60 | - public $link; |
|
54 | + /** |
|
55 | + * URL to the application item. |
|
56 | + * @var string |
|
57 | + * @since 7.0.0 |
|
58 | + * @deprecated 20.0.0 |
|
59 | + */ |
|
60 | + public $link; |
|
61 | 61 | |
62 | - /** |
|
63 | - * The type of search result returned; for consistency, name this the same |
|
64 | - * as the class name (e.g. \OC\Search\File -> 'file') in lowercase. |
|
65 | - * @var string |
|
66 | - * @since 7.0.0 |
|
67 | - * @deprecated 20.0.0 |
|
68 | - */ |
|
69 | - public $type = 'generic'; |
|
62 | + /** |
|
63 | + * The type of search result returned; for consistency, name this the same |
|
64 | + * as the class name (e.g. \OC\Search\File -> 'file') in lowercase. |
|
65 | + * @var string |
|
66 | + * @since 7.0.0 |
|
67 | + * @deprecated 20.0.0 |
|
68 | + */ |
|
69 | + public $type = 'generic'; |
|
70 | 70 | |
71 | - /** |
|
72 | - * Create a new search result |
|
73 | - * @param string $id unique identifier from application: '[app_name]/[item_identifier_in_app]' |
|
74 | - * @param string $name displayed text of result |
|
75 | - * @param string $link URL to the result within its app |
|
76 | - * @since 7.0.0 |
|
77 | - * @deprecated 20.0.0 |
|
78 | - */ |
|
79 | - public function __construct($id = null, $name = null, $link = null) { |
|
80 | - $this->id = $id; |
|
81 | - $this->name = $name; |
|
82 | - $this->link = $link; |
|
83 | - } |
|
71 | + /** |
|
72 | + * Create a new search result |
|
73 | + * @param string $id unique identifier from application: '[app_name]/[item_identifier_in_app]' |
|
74 | + * @param string $name displayed text of result |
|
75 | + * @param string $link URL to the result within its app |
|
76 | + * @since 7.0.0 |
|
77 | + * @deprecated 20.0.0 |
|
78 | + */ |
|
79 | + public function __construct($id = null, $name = null, $link = null) { |
|
80 | + $this->id = $id; |
|
81 | + $this->name = $name; |
|
82 | + $this->link = $link; |
|
83 | + } |
|
84 | 84 | } |
@@ -38,42 +38,42 @@ |
||
38 | 38 | */ |
39 | 39 | interface ISearchQuery { |
40 | 40 | |
41 | - /** |
|
42 | - * @since 20.0.0 |
|
43 | - */ |
|
44 | - public const SORT_DATE_DESC = 1; |
|
41 | + /** |
|
42 | + * @since 20.0.0 |
|
43 | + */ |
|
44 | + public const SORT_DATE_DESC = 1; |
|
45 | 45 | |
46 | - /** |
|
47 | - * Get the user-entered search term to find matches for |
|
48 | - * |
|
49 | - * @return string the search term |
|
50 | - * @since 20.0.0 |
|
51 | - */ |
|
52 | - public function getTerm(): string; |
|
46 | + /** |
|
47 | + * Get the user-entered search term to find matches for |
|
48 | + * |
|
49 | + * @return string the search term |
|
50 | + * @since 20.0.0 |
|
51 | + */ |
|
52 | + public function getTerm(): string; |
|
53 | 53 | |
54 | - /** |
|
55 | - * Get the sort order of results as defined as SORT_* constants on this interface |
|
56 | - * |
|
57 | - * @return int |
|
58 | - * @since 20.0.0 |
|
59 | - */ |
|
60 | - public function getSortOrder(): int; |
|
54 | + /** |
|
55 | + * Get the sort order of results as defined as SORT_* constants on this interface |
|
56 | + * |
|
57 | + * @return int |
|
58 | + * @since 20.0.0 |
|
59 | + */ |
|
60 | + public function getSortOrder(): int; |
|
61 | 61 | |
62 | - /** |
|
63 | - * Get the number of items to return for a paginated result |
|
64 | - * |
|
65 | - * @return int |
|
66 | - * @see \OCP\Search\IProvider for details |
|
67 | - * @since 20.0.0 |
|
68 | - */ |
|
69 | - public function getLimit(): int; |
|
62 | + /** |
|
63 | + * Get the number of items to return for a paginated result |
|
64 | + * |
|
65 | + * @return int |
|
66 | + * @see \OCP\Search\IProvider for details |
|
67 | + * @since 20.0.0 |
|
68 | + */ |
|
69 | + public function getLimit(): int; |
|
70 | 70 | |
71 | - /** |
|
72 | - * Get the app-specific cursor of the tail of the previous result entries |
|
73 | - * |
|
74 | - * @return int|string|null |
|
75 | - * @see \OCP\Search\IProvider for details |
|
76 | - * @since 20.0.0 |
|
77 | - */ |
|
78 | - public function getCursor(); |
|
71 | + /** |
|
72 | + * Get the app-specific cursor of the tail of the previous result entries |
|
73 | + * |
|
74 | + * @return int|string|null |
|
75 | + * @see \OCP\Search\IProvider for details |
|
76 | + * @since 20.0.0 |
|
77 | + */ |
|
78 | + public function getCursor(); |
|
79 | 79 | } |
@@ -34,43 +34,43 @@ |
||
34 | 34 | */ |
35 | 35 | abstract class PagedProvider extends Provider { |
36 | 36 | |
37 | - /** |
|
38 | - * show all results |
|
39 | - * @since 8.0.0 |
|
40 | - * @deprecated 20.0.0 |
|
41 | - */ |
|
42 | - public const SIZE_ALL = 0; |
|
37 | + /** |
|
38 | + * show all results |
|
39 | + * @since 8.0.0 |
|
40 | + * @deprecated 20.0.0 |
|
41 | + */ |
|
42 | + public const SIZE_ALL = 0; |
|
43 | 43 | |
44 | - /** |
|
45 | - * Constructor |
|
46 | - * @param array $options |
|
47 | - * @since 8.0.0 |
|
48 | - * @deprecated 20.0.0 |
|
49 | - */ |
|
50 | - public function __construct($options) { |
|
51 | - parent::__construct($options); |
|
52 | - } |
|
44 | + /** |
|
45 | + * Constructor |
|
46 | + * @param array $options |
|
47 | + * @since 8.0.0 |
|
48 | + * @deprecated 20.0.0 |
|
49 | + */ |
|
50 | + public function __construct($options) { |
|
51 | + parent::__construct($options); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * Search for $query |
|
56 | - * @param string $query |
|
57 | - * @return array An array of OCP\Search\Result's |
|
58 | - * @since 8.0.0 |
|
59 | - * @deprecated 20.0.0 |
|
60 | - */ |
|
61 | - public function search($query) { |
|
62 | - // old apps might assume they get all results, so we use SIZE_ALL |
|
63 | - return $this->searchPaged($query, 1, self::SIZE_ALL); |
|
64 | - } |
|
54 | + /** |
|
55 | + * Search for $query |
|
56 | + * @param string $query |
|
57 | + * @return array An array of OCP\Search\Result's |
|
58 | + * @since 8.0.0 |
|
59 | + * @deprecated 20.0.0 |
|
60 | + */ |
|
61 | + public function search($query) { |
|
62 | + // old apps might assume they get all results, so we use SIZE_ALL |
|
63 | + return $this->searchPaged($query, 1, self::SIZE_ALL); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * Search for $query |
|
68 | - * @param string $query |
|
69 | - * @param int $page pages start at page 1 |
|
70 | - * @param int $size 0 = SIZE_ALL |
|
71 | - * @return array An array of OCP\Search\Result's |
|
72 | - * @since 8.0.0 |
|
73 | - * @deprecated 20.0.0 |
|
74 | - */ |
|
75 | - abstract public function searchPaged($query, $page, $size); |
|
66 | + /** |
|
67 | + * Search for $query |
|
68 | + * @param string $query |
|
69 | + * @param int $page pages start at page 1 |
|
70 | + * @param int $size 0 = SIZE_ALL |
|
71 | + * @return array An array of OCP\Search\Result's |
|
72 | + * @since 8.0.0 |
|
73 | + * @deprecated 20.0.0 |
|
74 | + */ |
|
75 | + abstract public function searchPaged($query, $page, $size); |
|
76 | 76 | } |
@@ -34,66 +34,66 @@ |
||
34 | 34 | */ |
35 | 35 | abstract class Provider { |
36 | 36 | |
37 | - /** |
|
38 | - * @since 8.0.0 |
|
39 | - * @deprecated 20.0.0 |
|
40 | - */ |
|
41 | - public const OPTION_APPS = 'apps'; |
|
37 | + /** |
|
38 | + * @since 8.0.0 |
|
39 | + * @deprecated 20.0.0 |
|
40 | + */ |
|
41 | + public const OPTION_APPS = 'apps'; |
|
42 | 42 | |
43 | - /** |
|
44 | - * List of options |
|
45 | - * @var array |
|
46 | - * @since 7.0.0 |
|
47 | - * @deprecated 20.0.0 |
|
48 | - */ |
|
49 | - protected $options; |
|
43 | + /** |
|
44 | + * List of options |
|
45 | + * @var array |
|
46 | + * @since 7.0.0 |
|
47 | + * @deprecated 20.0.0 |
|
48 | + */ |
|
49 | + protected $options; |
|
50 | 50 | |
51 | - /** |
|
52 | - * Constructor |
|
53 | - * @param array $options as key => value |
|
54 | - * @since 7.0.0 - default value for $options was added in 8.0.0 |
|
55 | - * @deprecated 20.0.0 |
|
56 | - */ |
|
57 | - public function __construct($options = []) { |
|
58 | - $this->options = $options; |
|
59 | - } |
|
51 | + /** |
|
52 | + * Constructor |
|
53 | + * @param array $options as key => value |
|
54 | + * @since 7.0.0 - default value for $options was added in 8.0.0 |
|
55 | + * @deprecated 20.0.0 |
|
56 | + */ |
|
57 | + public function __construct($options = []) { |
|
58 | + $this->options = $options; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * get a value from the options array or null |
|
63 | - * @param string $key |
|
64 | - * @return mixed |
|
65 | - * @since 8.0.0 |
|
66 | - * @deprecated 20.0.0 |
|
67 | - */ |
|
68 | - public function getOption($key) { |
|
69 | - if (is_array($this->options) && isset($this->options[$key])) { |
|
70 | - return $this->options[$key]; |
|
71 | - } else { |
|
72 | - return null; |
|
73 | - } |
|
74 | - } |
|
61 | + /** |
|
62 | + * get a value from the options array or null |
|
63 | + * @param string $key |
|
64 | + * @return mixed |
|
65 | + * @since 8.0.0 |
|
66 | + * @deprecated 20.0.0 |
|
67 | + */ |
|
68 | + public function getOption($key) { |
|
69 | + if (is_array($this->options) && isset($this->options[$key])) { |
|
70 | + return $this->options[$key]; |
|
71 | + } else { |
|
72 | + return null; |
|
73 | + } |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * checks if the given apps and the apps this provider has results for intersect |
|
78 | - * returns true if the given array is empty (all apps) |
|
79 | - * or if this provider does not have a list of apps it provides results for (legacy search providers) |
|
80 | - * or if the two above arrays have elements in common (intersect) |
|
81 | - * @param string[] $apps |
|
82 | - * @return bool |
|
83 | - * @since 8.0.0 |
|
84 | - * @deprecated 20.0.0 |
|
85 | - */ |
|
86 | - public function providesResultsFor(array $apps = []) { |
|
87 | - $forApps = $this->getOption(self::OPTION_APPS); |
|
88 | - return empty($apps) || empty($forApps) || array_intersect($forApps, $apps); |
|
89 | - } |
|
76 | + /** |
|
77 | + * checks if the given apps and the apps this provider has results for intersect |
|
78 | + * returns true if the given array is empty (all apps) |
|
79 | + * or if this provider does not have a list of apps it provides results for (legacy search providers) |
|
80 | + * or if the two above arrays have elements in common (intersect) |
|
81 | + * @param string[] $apps |
|
82 | + * @return bool |
|
83 | + * @since 8.0.0 |
|
84 | + * @deprecated 20.0.0 |
|
85 | + */ |
|
86 | + public function providesResultsFor(array $apps = []) { |
|
87 | + $forApps = $this->getOption(self::OPTION_APPS); |
|
88 | + return empty($apps) || empty($forApps) || array_intersect($forApps, $apps); |
|
89 | + } |
|
90 | 90 | |
91 | - /** |
|
92 | - * Search for $query |
|
93 | - * @param string $query |
|
94 | - * @return array An array of OCP\Search\Result's |
|
95 | - * @since 7.0.0 |
|
96 | - * @deprecated 20.0.0 |
|
97 | - */ |
|
98 | - abstract public function search($query); |
|
91 | + /** |
|
92 | + * Search for $query |
|
93 | + * @param string $query |
|
94 | + * @return array An array of OCP\Search\Result's |
|
95 | + * @since 7.0.0 |
|
96 | + * @deprecated 20.0.0 |
|
97 | + */ |
|
98 | + abstract public function search($query); |
|
99 | 99 | } |
@@ -32,81 +32,81 @@ |
||
32 | 32 | */ |
33 | 33 | final class SearchResult implements JsonSerializable { |
34 | 34 | |
35 | - /** @var string */ |
|
36 | - private $name; |
|
35 | + /** @var string */ |
|
36 | + private $name; |
|
37 | 37 | |
38 | - /** @var bool */ |
|
39 | - private $isPaginated; |
|
38 | + /** @var bool */ |
|
39 | + private $isPaginated; |
|
40 | 40 | |
41 | - /** @var ASearchResultEntry[] */ |
|
42 | - private $entries; |
|
41 | + /** @var ASearchResultEntry[] */ |
|
42 | + private $entries; |
|
43 | 43 | |
44 | - /** @var int|string|null */ |
|
45 | - private $cursor; |
|
44 | + /** @var int|string|null */ |
|
45 | + private $cursor; |
|
46 | 46 | |
47 | - /** |
|
48 | - * @param string $name the translated name of the result section or group, e.g. "Mail" |
|
49 | - * @param bool $isPaginated |
|
50 | - * @param ASearchResultEntry[] $entries |
|
51 | - * @param null $cursor |
|
52 | - * |
|
53 | - * @since 20.0.0 |
|
54 | - */ |
|
55 | - private function __construct(string $name, |
|
56 | - bool $isPaginated, |
|
57 | - array $entries, |
|
58 | - $cursor = null) { |
|
59 | - $this->name = $name; |
|
60 | - $this->isPaginated = $isPaginated; |
|
61 | - $this->entries = $entries; |
|
62 | - $this->cursor = $cursor; |
|
63 | - } |
|
47 | + /** |
|
48 | + * @param string $name the translated name of the result section or group, e.g. "Mail" |
|
49 | + * @param bool $isPaginated |
|
50 | + * @param ASearchResultEntry[] $entries |
|
51 | + * @param null $cursor |
|
52 | + * |
|
53 | + * @since 20.0.0 |
|
54 | + */ |
|
55 | + private function __construct(string $name, |
|
56 | + bool $isPaginated, |
|
57 | + array $entries, |
|
58 | + $cursor = null) { |
|
59 | + $this->name = $name; |
|
60 | + $this->isPaginated = $isPaginated; |
|
61 | + $this->entries = $entries; |
|
62 | + $this->cursor = $cursor; |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * @param ASearchResultEntry[] $entries |
|
67 | - * |
|
68 | - * @return static |
|
69 | - * |
|
70 | - * @since 20.0.0 |
|
71 | - */ |
|
72 | - public static function complete(string $name, array $entries): self { |
|
73 | - return new self( |
|
74 | - $name, |
|
75 | - false, |
|
76 | - $entries |
|
77 | - ); |
|
78 | - } |
|
65 | + /** |
|
66 | + * @param ASearchResultEntry[] $entries |
|
67 | + * |
|
68 | + * @return static |
|
69 | + * |
|
70 | + * @since 20.0.0 |
|
71 | + */ |
|
72 | + public static function complete(string $name, array $entries): self { |
|
73 | + return new self( |
|
74 | + $name, |
|
75 | + false, |
|
76 | + $entries |
|
77 | + ); |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * @param ASearchResultEntry[] $entries |
|
82 | - * @param int|string $cursor |
|
83 | - * |
|
84 | - * @return static |
|
85 | - * |
|
86 | - * @since 20.0.0 |
|
87 | - */ |
|
88 | - public static function paginated(string $name, |
|
89 | - array $entries, |
|
90 | - $cursor): self { |
|
91 | - return new self( |
|
92 | - $name, |
|
93 | - true, |
|
94 | - $entries, |
|
95 | - $cursor |
|
96 | - ); |
|
97 | - } |
|
80 | + /** |
|
81 | + * @param ASearchResultEntry[] $entries |
|
82 | + * @param int|string $cursor |
|
83 | + * |
|
84 | + * @return static |
|
85 | + * |
|
86 | + * @since 20.0.0 |
|
87 | + */ |
|
88 | + public static function paginated(string $name, |
|
89 | + array $entries, |
|
90 | + $cursor): self { |
|
91 | + return new self( |
|
92 | + $name, |
|
93 | + true, |
|
94 | + $entries, |
|
95 | + $cursor |
|
96 | + ); |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * @return array |
|
101 | - * |
|
102 | - * @since 20.0.0 |
|
103 | - */ |
|
104 | - public function jsonSerialize(): array { |
|
105 | - return [ |
|
106 | - 'name' => $this->name, |
|
107 | - 'isPaginated' => $this->isPaginated, |
|
108 | - 'entries' => $this->entries, |
|
109 | - 'cursor' => $this->cursor, |
|
110 | - ]; |
|
111 | - } |
|
99 | + /** |
|
100 | + * @return array |
|
101 | + * |
|
102 | + * @since 20.0.0 |
|
103 | + */ |
|
104 | + public function jsonSerialize(): array { |
|
105 | + return [ |
|
106 | + 'name' => $this->name, |
|
107 | + 'isPaginated' => $this->isPaginated, |
|
108 | + 'entries' => $this->entries, |
|
109 | + 'cursor' => $this->cursor, |
|
110 | + ]; |
|
111 | + } |
|
112 | 112 | } |