/** * Constructs a new ezpMvcRailsRoute with $pattern for protocols used as * keys in $protocolActionMap * * Examples: * <code> * $route = new ezpMvcRailsRoute( * '/content/node/:nodeId', * 'ezpRestContentController' * array( * 'http-get' => 'viewContent', * 'http-delete' => 'deleteContent' * ) * ); * </code> * * will define the route /content/node/:nodeId and a different method in * the controller will be called depending on the used HTTP verb. If * $protocolActionMap is a string, we assume the mapping is done for * http-get unless another protocol is indicated in deprecated param $protocol * (kept to not introduce a BC break) * * @param string $pattern * @param string $controllerClassName * @param array|string $protocolActionMap * @param array $defaultValues * @param null|string $protocol (deprecated) Match specific protocol if * $protocolActionMap is a string, eg: 'http-get'; */ public function __construct($pattern, $controllerClassName, $protocolActionMap, array $defaultValues = array(), $protocol = null) { if (is_string($protocolActionMap)) { if ($protocol === null) { $protocolActionMap = array('http-get' => $protocolActionMap); } else { // compatibility with 4.6 route definition $protocolActionMap = array($protocol => $protocolActionMap); } } if (!isset($protocolActionMap['http-options'])) { $protocolActionMap['http-options'] = 'httpOptions'; } $this->protocolActionMap = $protocolActionMap; parent::__construct($pattern, $controllerClassName, '', $defaultValues); }
/** * Constructs a new ezpMvcRailsRoute with $pattern for $protocol. * * Accepted protocol format: http-get, http-post, http-put, http-delete * @see ezcMvcHttpRequestParser::processProtocol(); * * @param string $pattern * @param string $controllerClassName * @param string $action * @param array $defaultValues * @param null|string $protocol Match specific protocol if string value, eg: 'http-get' */ public function __construct( $pattern, $controllerClassName, $action = null, array $defaultValues = array(), $protocol = null ) { $this->protocol = $protocol; parent::__construct( $pattern, $controllerClassName, $action, $defaultValues ); }