Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

default_regexp_prefix_filter.php
Go to the documentation of this file.
1 <?php
15 class ezpRestDefaultRegexpPrefixFilter extends ezpRestPrefixFilterInterface
16 {
21 protected $apiPart;
22
29 public function __construct( ezcMvcRequest $request, $apiPrefix )
30 {
31 $this->request = $request;
32 self::$apiPrefix = $apiPrefix;
33 $this->apiPart = preg_quote( self::$apiPrefix, '@' );
34 }
35
36 protected function getPrefixPattern()
37 {
38 return "@^{$this->apiPart}/(?:(?P<provider>[^/]+)/)(?:(?P<version>v\d+))?@";
39 }
40
46 protected function parseVersionValue( )
47 {
48 if ( empty ( $this->versionToken ) )
49 {
50 return null;
51 }
52 return (int)str_replace( 'v', '', $this->versionToken );
53 }
54
69 public function filter( )
70 {
71 if ( preg_match( $this->getPrefixPattern(), $this->request->uri, $tokenMatches ) )
72 {
73 $this->versionToken = isset( $tokenMatches['version'] ) ? $tokenMatches['version'] : '';
74 $this->apiProviderToken = isset( $tokenMatches['provider'] ) ? $tokenMatches['provider'] : '';
75
76 self::$version = $this->parseVersionValue();
77 self::$apiProvider = empty( $this->apiProviderToken ) ? null : $this->apiProviderToken;
78 }
79 }
80
81
82 }
ezpRestDefaultRegexpPrefixFilter
Definition: default_regexp_prefix_filter.php:16
ezpRestDefaultRegexpPrefixFilter\$apiPart
$apiPart
Definition: default_regexp_prefix_filter.php:21
ezpRestDefaultRegexpPrefixFilter\__construct
__construct(ezcMvcRequest $request, $apiPrefix)
Definition: default_regexp_prefix_filter.php:29
ezpRestDefaultRegexpPrefixFilter\getPrefixPattern
getPrefixPattern()
Definition: default_regexp_prefix_filter.php:36
ezpRestDefaultRegexpPrefixFilter\parseVersionValue
parseVersionValue()
Definition: default_regexp_prefix_filter.php:46
ezpRestDefaultRegexpPrefixFilter\filter
filter()
Definition: default_regexp_prefix_filter.php:69
ezpRestPrefixFilterInterface
Definition: prefix_filter.php:13
ezpRestPrefixFilterInterface\$apiPrefix
static $apiPrefix
Definition: prefix_filter.php:38
ezpRestPrefixFilterInterface\$apiProviderToken
$apiProviderToken
Definition: prefix_filter.php:23
ezpRestPrefixFilterInterface\$request
$request
Definition: prefix_filter.php:14
$version
$version
Definition: ezabout/user/datasupplier.php:29
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.