UrlRuleInterface.php 1.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<?php
/**
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

namespace yii\web;

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