Result.php 2.0 KB

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