1 2/* 3 +------------------------------------------------------------------------+ 4 | Phalcon Framework | 5 +------------------------------------------------------------------------+ 6 | Copyright (c) 2011-2017 Phalcon Team (https://phalconphp.com) | 7 +------------------------------------------------------------------------+ 8 | This source file is subject to the New BSD License that is bundled | 9 | with this package in the file LICENSE.txt. | 10 | | 11 | If you did not receive a copy of the license and are unable to | 12 | obtain it through the world-wide-web, please send an email | 13 | to license@phalconphp.com so we can send you a copy immediately. | 14 +------------------------------------------------------------------------+ 15 | Authors: Andres Gutierrez <andres@phalconphp.com> | 16 | Eduar Carvajal <eduar@phalconphp.com> | 17 +------------------------------------------------------------------------+ 18 */ 19 20namespace Phalcon\Cli; 21 22use Phalcon\Cli\Router\RouteInterface; 23 24/** 25 * Phalcon\Cli\RouterInterface 26 * 27 * Interface for Phalcon\Cli\Router 28 */ 29interface RouterInterface 30{ 31 32 /** 33 * Sets the name of the default module 34 */ 35 public function setDefaultModule(string! moduleName) -> void; 36 37 /** 38 * Sets the default task name 39 */ 40 public function setDefaultTask(string! taskName) -> void; 41 42 /** 43 * Sets the default action name 44 */ 45 public function setDefaultAction(string! actionName) -> void; 46 47 /** 48 * Sets an array of default paths 49 */ 50 public function setDefaults(array! defaults) -> void; 51 52 /** 53 * Handles routing information received from the rewrite engine 54 * 55 * @param array arguments 56 */ 57 public function handle(arguments = null) -> void; 58 59 /** 60 * Adds a route to the router on any HTTP method 61 */ 62 public function add(string! pattern, var paths = null) -> <RouteInterface>; 63 64 /** 65 * Returns processed module name 66 */ 67 public function getModuleName() -> string; 68 69 /** 70 * Returns processed task name 71 */ 72 public function getTaskName() -> string; 73 74 /** 75 * Returns processed action name 76 */ 77 public function getActionName() -> string; 78 79 /** 80 * Returns processed extra params 81 */ 82 public function getParams() -> array; 83 84 /** 85 * Returns the route that matches the handled URI 86 */ 87 public function getMatchedRoute() -> <RouteInterface>; 88 89 /** 90 * Return the sub expressions in the regular expression matched 91 */ 92 public function getMatches() -> array; 93 94 /** 95 * Check if the router matches any of the defined routes 96 */ 97 public function wasMatched() -> boolean; 98 99 /** 100 * Return all the routes defined in the router 101 */ 102 public function getRoutes() -> <RouteInterface[]>; 103 104 /** 105 * Returns a route object by its id 106 */ 107 public function getRouteById(var id) -> <RouteInterface>; 108 109 /** 110 * Returns a route object by its name 111 */ 112 public function getRouteByName(string! name) -> <RouteInterface>; 113} 114