36 lines
1.2KB

  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. * UrlRuleInterface is the interface that should be implemented by URL rule classes.
  10. *
  11. * @author Qiang Xue <qiang.xue@gmail.com>
  12. * @since 2.0
  13. */
  14. interface UrlRuleInterface
  15. {
  16. /**
  17. * Parses the given request and returns the corresponding route and parameters.
  18. * @param UrlManager $manager the URL manager
  19. * @param Request $request the request component
  20. * @return array|boolean the parsing result. The route and the parameters are returned as an array.
  21. * If false, it means this rule cannot be used to parse this path info.
  22. */
  23. public function parseRequest($manager, $request);
  24. /**
  25. * Creates a URL according to the given route and parameters.
  26. * @param UrlManager $manager the URL manager
  27. * @param string $route the route. It should not have slashes at the beginning or the end.
  28. * @param array $params the parameters
  29. * @return string|boolean the created URL, or false if this rule cannot be used for creating this URL.
  30. */
  31. public function createUrl($manager, $route, $params);
  32. }