Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

rails.php
Go to the documentation of this file.
1 <?php
11 class ezpMvcRailsRoute extends ezcMvcRailsRoute
12 {
18 protected $protocolActionMap = array();
19
49 public function __construct( $pattern, $controllerClassName, $protocolActionMap, array $defaultValues = array(), $protocol = null )
50 {
51 if ( is_string( $protocolActionMap ) )
52 {
53 if ( $protocol === null )
54 {
55 $protocolActionMap = array( 'http-get' => $protocolActionMap );
56 }
57 else
58 {
59 // compatibility with 4.6 route definition
60 $protocolActionMap = array( $protocol => $protocolActionMap );
61 }
62 }
63 if ( !isset( $protocolActionMap['http-options'] ) )
64 {
65 $protocolActionMap['http-options'] = 'httpOptions';
66 }
67 $this->protocolActionMap = $protocolActionMap;
68 parent::__construct( $pattern, $controllerClassName, '', $defaultValues );
69 }
70
79 public function matches( ezcMvcRequest $request )
80 {
81 if ( $this->match( $request, $matches ) )
82 {
83 if ( !isset( $this->protocolActionMap[$request->protocol] ) )
84 {
85 throw new ezpRouteMethodNotAllowedException( $this->getSupportedHTTPMethods() );
86 }
87 $request->variables = array_merge( $this->defaultValues, $request->variables, $matches );
88 if ( $request->protocol === 'http-options' )
89 {
90 $request->variables['supported_http_methods'] = $this->getSupportedHTTPMethods();
91 }
92 return new ezcMvcRoutingInformation( $this->pattern, $this->controllerClassName, $this->protocolActionMap[$request->protocol] );
93 }
94
95 return null;
96 }
97
104 protected function getSupportedHTTPMethods()
105 {
106 $methods = array_keys( $this->protocolActionMap );
107 foreach ( $methods as &$method )
108 {
109 $method = strtoupper( str_replace( 'http-', '', $method ) );
110 }
111 return $methods;
112 }
113
114 }
115 ?>
ezpMvcRailsRoute
Definition: rails.php:12
ezpMvcRailsRoute\__construct
__construct( $pattern, $controllerClassName, $protocolActionMap, array $defaultValues=array(), $protocol=null)
Definition: rails.php:49
ezpMvcRailsRoute\getSupportedHTTPMethods
getSupportedHTTPMethods()
Definition: rails.php:104
ezpMvcRailsRoute\matches
matches(ezcMvcRequest $request)
Definition: rails.php:79
ezpMvcRailsRoute\$protocolActionMap
$protocolActionMap
Definition: rails.php:18
ezpRouteMethodNotAllowedException
Definition: route_method_not_allowed.php:13
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.