result.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * @author Andrew Brown <andrew@casabrown.com>
  4. * @author Jakob Sack <mail@jakobsack.de>
  5. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. *
  8. * @copyright Copyright (c) 2015, ownCloud, Inc.
  9. * @license AGPL-3.0
  10. *
  11. * This code is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License, version 3,
  13. * as published by the Free Software Foundation.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License, version 3,
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>
  22. *
  23. */
  24. namespace OCP\Search;
  25. /**
  26. * The generic result of a search
  27. */
  28. class Result {
  29. /**
  30. * A unique identifier for the result, usually given as the item ID in its
  31. * corresponding application.
  32. * @var string
  33. */
  34. public $id;
  35. /**
  36. * The name of the item returned; this will be displayed in the search
  37. * results.
  38. * @var string
  39. */
  40. public $name;
  41. /**
  42. * URL to the application item.
  43. * @var string
  44. */
  45. public $link;
  46. /**
  47. * The type of search result returned; for consistency, name this the same
  48. * as the class name (e.g. \OC\Search\File -> 'file') in lowercase.
  49. * @var string
  50. */
  51. public $type = 'generic';
  52. /**
  53. * Create a new search result
  54. * @param string $id unique identifier from application: '[app_name]/[item_identifier_in_app]'
  55. * @param string $name displayed text of result
  56. * @param string $link URL to the result within its app
  57. */
  58. public function __construct($id = null, $name = null, $link = null) {
  59. $this->id = $id;
  60. $this->name = $name;
  61. $this->link = $link;
  62. }
  63. }