Linkable.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\web;
  8. /**
  9. * Linkable is the interface that should be implemented by classes that typically represent locatable resources.
  10. *
  11. * @author Qiang Xue <qiang.xue@gmail.com>
  12. * @since 2.0
  13. */
  14. interface Linkable
  15. {
  16. /**
  17. * Returns a list of links.
  18. *
  19. * Each link is either a URI or a [[Link]] object. The return value of this method should
  20. * be an array whose keys are the relation names and values the corresponding links.
  21. *
  22. * If a relation name corresponds to multiple links, use an array to represent them.
  23. *
  24. * For example,
  25. *
  26. * ```php
  27. * [
  28. * 'self' => 'http://example.com/users/1',
  29. * 'friends' => [
  30. * 'http://example.com/users/2',
  31. * 'http://example.com/users/3',
  32. * ],
  33. * 'manager' => $managerLink, // $managerLink is a Link object
  34. * ]
  35. * ```
  36. *
  37. * @return array the links
  38. */
  39. public function getLinks();
  40. }