Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezdfsfilehandlerbackendfactory.php
Go to the documentation of this file.
1 <?php
14 class eZDFSFileHandlerBackendFactory
15 {
16 private static $instance;
17
22 public static function build()
23 {
24 if ( !isset( self::$instance ) )
25 {
26 self::$instance = self::buildHandler(
27 eZINI::instance( 'file.ini' )->variable( 'eZDFSClusteringSettings', 'DFSBackend' )
28 );
29 }
30
31 return self::$instance;
32 }
33
43 public static function buildHandler( $className )
44 {
45 if ( !class_exists( $className ) )
46 {
47 throw new InvalidArgumentException( "Invalid DFSBackend class $className. Were autoloads generated ?" );
48 }
49
50 if ( self::hasFactorySupport( $className ) )
51 {
52 $handler = $className::build();
53 }
54 else
55 {
56 $handler = new $className();
57 }
58
59 if ( !$handler instanceof eZDFSFileHandlerDFSBackendInterface )
60 {
61 throw new InvalidArgumentException( "$className doesn't implement eZDFSFileHandlerDFSBackendInterface" );
62 }
63
64 return $handler;
65 }
66
74 private static function hasFactorySupport( $className )
75 {
76 $implementedClasses = class_implements( $className );
77 return isset( $implementedClasses['eZDFSFileHandlerDFSBackendFactoryInterface'] );
78 }
79 }
eZDFSFileHandlerBackendFactory
Definition: ezdfsfilehandlerbackendfactory.php:15
eZDFSFileHandlerBackendFactory\$instance
static $instance
Definition: ezdfsfilehandlerbackendfactory.php:16
eZDFSFileHandlerBackendFactory\build
static build()
Definition: ezdfsfilehandlerbackendfactory.php:22
eZDFSFileHandlerBackendFactory\hasFactorySupport
static hasFactorySupport( $className)
Definition: ezdfsfilehandlerbackendfactory.php:74
eZDFSFileHandlerBackendFactory\buildHandler
static buildHandler( $className)
Definition: ezdfsfilehandlerbackendfactory.php:43
eZDFSFileHandlerDFSBackendInterface
Definition: ezdfsfilehandlerdfsbackendinterface.php:18
$instance
$instance
Definition: orderedit.php:667
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.