Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

rest_provider.php
Go to the documentation of this file.
1 <?php
12 class ezpRestProvider
13 {
17 protected static $provider = null;
18
19 protected static $providerName = null;
20
21 const DEFAULT_PROVIDER = 'ezp';
22
27 protected static function createProvider( $provider )
28 {
29 $providerOptions = new ezpExtensionOptions();
30 $providerOptions->iniFile = 'rest.ini';
31 $providerOptions->iniSection = 'ApiProvider';
32 $providerOptions->iniVariable = 'ProviderClass';
33 $providerOptions->handlerIndex = $provider;
34
35 $providerInstance = eZExtension::getHandlerClass( $providerOptions );
36
37 if ( !( $providerInstance instanceof ezpRestProviderInterface ) )
38 throw new ezpRestProviderNotFoundException( $provider );
39
40 return $providerInstance;
41 }
42
47 public static function getProvider( $provider )
48 {
49 // If no provider has been given, we fall back to built-in 'ezp' provider.
50 // Note: empty string is not a valid input.
51 if ( empty( $provider ) )
52 {
53 $provider = self::DEFAULT_PROVIDER;
54 }
55
56 // Check if we already have a provider object for this provider
57 // As there can be internal redirects, we also check if the provider name is the same
58 if ( !( self::$provider instanceof ezpRestProviderInterface ) || $provider != self::$providerName )
59 {
60 self::$provider = self::createProvider( $provider );
61 self::$providerName = $provider;
62 }
63
64 return self::$provider;
65 }
66 }
eZExtension\getHandlerClass
static getHandlerClass(ezpExtensionOptions $options)
Definition: ezextension.php:480
ezpExtensionOptions
Definition: ezpextensionoptions.php:59
ezpRestProviderNotFoundException
Definition: rest_provider_not_found.php:13
ezpRestProvider
Definition: rest_provider.php:13
ezpRestProvider\getProvider
static getProvider( $provider)
Definition: rest_provider.php:47
ezpRestProvider\$providerName
static $providerName
Definition: rest_provider.php:19
ezpRestProvider\createProvider
static createProvider( $provider)
Definition: rest_provider.php:27
ezpRestProvider\$provider
static $provider
Definition: rest_provider.php:17
ezpRestProvider\DEFAULT_PROVIDER
const DEFAULT_PROVIDER
Definition: rest_provider.php:21
ezpRestProviderInterface
Definition: interfaces/rest_provider.php:13
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.