本文整理汇总了PHP中interface_exists函数的典型用法代码示例。如果您正苦于以下问题:PHP interface_exists函数的具体用法?PHP interface_exists怎么用?PHP interface_exists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了interface_exists函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: autoload
public static function autoload($className)
{
$className = str_replace('.', '_', $className);
$className = str_replace(DIRECTORY_SEPARATOR, '_', $className);
$className = str_replace('/', '_', $className);
if (class_exists($className, false) || interface_exists($className, false)) {
return false;
}
$classFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . $className . '.php';
if (file_exists($classFile)) {
require $classFile;
return true;
}
// Search modules directories
foreach (self::_get_modules_dirs() as $module_dir) {
$classFile = $module_dir . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . $className . '.php';
if (file_exists($classFile)) {
require $classFile;
return true;
}
}
// Search templates directories
$lang_class_path = self::_build_search_path($className . '.php', "web", self::detect_language());
foreach (self::_build_search_path($className . '.php', "web", self::detect_language(), true) as $candidate) {
if (file_exists($candidate)) {
require $candidate;
return true;
}
}
return false;
}
开发者ID:jkinner,项目名称:dogma,代码行数:31,代码来源:Dogma.php
示例2: register
/**
* {@inheritdoc}
*/
public function register(Container $app)
{
$app['puli.factory'] = function () {
$factoryClass = PULI_FACTORY_CLASS;
return new $factoryClass();
};
$app['puli.repository'] = function ($app) {
return $app['puli.factory']->createRepository();
};
$app['puli.discovery'] = function ($app) {
return $app['puli.factory']->createDiscovery();
};
$app['puli.url_generator'] = function ($app) {
return $app['puli.factory']->createUrlGenerator($app['puli.discovery']);
};
if (isset($app['twig'])) {
if (interface_exists('Puli\\UrlGenerator\\Api\\UrlGenerator')) {
$app->extend('twig', function ($twig, $app) {
$twig->addExtension(new PuliExtension($app['puli.repository'], $app['puli.url_generator']));
return $twig;
});
}
$app->extend('twig.loader', function ($loader, $app) {
$loader->addLoader(new PuliTemplateLoader($app['puli.repository']));
return $loader;
});
}
}
开发者ID:flint,项目名称:brick,代码行数:31,代码来源:PuliServiceProvider.php
示例3: _replaceAppUses
/**
* Replace App::uses with use <Classname>;
*
* @param string $contents
* @return string
*/
protected function _replaceAppUses($contents)
{
$pattern = '#App::uses\\(\\s*[\'"]([a-z0-9_]+)[\'"]\\s*,\\s*[\'"]([a-z0-9/_]+)(?:\\.([a-z0-9/_]+))?[\'"]\\)#i';
$replacement = function ($matches) {
$matches = $this->_mapClassName($matches);
// Chop Lib out as locations moves those files to the top level.
// But only if Lib is not the last folder.
if (isset($matches[3]) && substr($matches[3], 0, 4) === 'Lib/') {
$use = $matches[2] . '\\' . substr($matches[3], 4) . '\\' . $matches[1];
} elseif (count($matches) === 4) {
$use = $matches[2] . '\\' . $matches[3] . '\\' . $matches[1];
} elseif ($matches[2] === 'Vendor') {
$this->out(sprintf('<info>Skip %s as it is a vendor library.</info>', $matches[1]), 1, Shell::VERBOSE);
return $matches[0];
} else {
$use = 'Cake\\' . $matches[2] . '\\' . $matches[1];
if (!class_exists($use) && !interface_exists($use)) {
$use = 'App\\' . substr($use, 5);
}
}
$use = str_replace('/', '\\', $use);
return 'use ' . $use;
};
return preg_replace_callback($pattern, $replacement, $contents, -1, $count);
}
开发者ID:cakephp,项目名称:upgrade,代码行数:31,代码来源:AppUsesTask.php
示例4: of
/**
* @throws WrongArgumentException
* @return PrimitiveIdentifier
**/
public function of($class)
{
$className = $this->guessClassName($class);
Assert::isTrue(class_exists($className, true) || interface_exists($className, true), "knows nothing about '{$className}' class/interface");
$this->ofClassName = $className;
return $this;
}
开发者ID:justthefish,项目名称:hesper,代码行数:11,代码来源:PrimitiveClass.php
示例5: configureFormFields
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->tab('tab.bruery_classification_category_general')->with('tab.group.bruery_classification_category_general', array('class' => 'col-md-8'))->end()->with('tab.group.bruery_classification_category_options', array('class' => 'col-md-4'))->end()->end();
if ($this->hasProvider()) {
$formMapper->tab('tab.bruery_classification_category_settings')->with('tab.group.bruery_classification_category_settings', array('class' => 'col-md-8'))->end()->end();
}
$formMapper->tab('tab.bruery_classification_category_general')->with('tab.group.bruery_classification_category_general')->add('name')->add('description', 'textarea', array('required' => false))->end()->end();
if ($this->hasSubject()) {
if ($this->getSubject()->getParent() !== null || $this->getSubject()->getId() === null) {
// root category cannot have a parent
$formMapper->tab('tab.bruery_classification_category_general')->with('tab.group.bruery_classification_category_general')->add('parent', 'sonata_category_selector', array('category' => $this->getSubject() ?: null, 'model_manager' => $this->getModelManager(), 'class' => $this->getClass(), 'required' => true, 'context' => $this->getSubject()->getContext() ?: $this->getDefaultContext()))->end()->end();
}
}
$position = $this->hasSubject() && !is_null($this->getSubject()->getPosition()) ? $this->getSubject()->getPosition() : 0;
$formMapper->tab('tab.bruery_classification_category_general')->with('tab.group.bruery_classification_category_options')->add('enabled', null, array('required' => false))->add('position', 'integer', array('required' => false, 'data' => $position))->end()->end();
if (interface_exists('Sonata\\MediaBundle\\Model\\MediaInterface')) {
$formMapper->tab('tab.bruery_classification_category_general')->with('tab.group.bruery_classification_category_general')->add('media', 'sonata_type_model_list', array('required' => false), array('link_parameters' => array('provider' => 'sonata.media.provider.image', 'context' => 'sonata_category')))->end()->end();
}
if ($this->hasProvider()) {
$instance = $this->getSubject();
if ($instance && $instance->getId()) {
$this->provider->load($instance);
$this->provider->buildEditForm($formMapper);
} else {
$this->provider->buildCreateForm($formMapper);
}
}
}
开发者ID:bruery,项目名称:platform,代码行数:31,代码来源:CategoryAdmin.php
示例6: __construct
/**
* Construct a new mock builder.
*
* Each value in `$types` can be either a class name, or an ad hoc mock
* definition. If only a single type is being mocked, the class name or
* definition can be passed without being wrapped in an array.
*
* @param mixed $types The types to mock.
* @param MockFactory $factory The factory to use.
* @param HandleFactory $handleFactory The handle factory to use.
* @param InvocableInspector $invocableInspector The invocable inspector.
* @param FeatureDetector $featureDetector The feature detector to use.
*
* @throws MockException If invalid input is supplied.
*/
public function __construct($types, MockFactory $factory, HandleFactory $handleFactory, InvocableInspector $invocableInspector, FeatureDetector $featureDetector)
{
$this->isTraitSupported = $featureDetector->isSupported('trait');
$this->isAnonymousClassSupported = $featureDetector->isSupported('class.anonymous');
$this->isRelaxedKeywordsSupported = $featureDetector->isSupported('parser.relaxed-keywords');
$this->isEngineErrorExceptionSupported = $featureDetector->isSupported('error.exception.engine');
$this->isDateTimeInterfaceSupported = interface_exists('DateTimeInterface');
$this->factory = $factory;
$this->handleFactory = $handleFactory;
$this->invocableInspector = $invocableInspector;
$this->featureDetector = $featureDetector;
$this->types = array();
$this->parentClassName = null;
$this->customMethods = array();
$this->customProperties = array();
$this->customStaticMethods = array();
$this->customStaticProperties = array();
$this->customConstants = array();
$this->isFinalized = false;
$this->emptyCallback = function () {
};
if (null !== $types) {
$this->like($types);
}
}
开发者ID:eloquent,项目名称:phony,代码行数:40,代码来源:MockBuilder.php
示例7: loadClass
/**
* Loads a class from a PHP file. The filename must be formatted
* as "$class.php".
*
* If $dirs is a string or an array, it will search the directories
* in the order supplied, and attempt to load the first matching file.
*
* If $dirs is null, it will split the class name at underscores to
* generate a path hierarchy (e.g., "Zend_Example_Class" will map
* to "Zend/Example/Class.php").
*
* If the file was not found in the $dirs, or if no $dirs were specified,
* it will attempt to load it from PHP's include_path.
*
* @param string $class - The full class name of a Zend component.
* @param string|array $dirs - OPTIONAL Either a path or an array of paths
* to search.
* @return void
* @throws Zend_Exception
*/
public static function loadClass($class, $dirs = null)
{
if (class_exists($class, false) || interface_exists($class, false)) {
return;
}
if (null !== $dirs && !is_string($dirs) && !is_array($dirs)) {
#require_once 'Zend/Exception.php';
throw new Zend_Exception('Directory argument must be a string or an array');
}
$file = self::standardiseFile($class);
if (!empty($dirs)) {
// use the autodiscovered path
$dirPath = dirname($file);
if (is_string($dirs)) {
$dirs = explode(PATH_SEPARATOR, $dirs);
}
foreach ($dirs as $key => $dir) {
if ($dir == '.') {
$dirs[$key] = $dirPath;
} else {
$dir = rtrim($dir, '\\/');
$dirs[$key] = $dir . DIRECTORY_SEPARATOR . $dirPath;
}
}
$file = basename($file);
self::loadFile($file, $dirs, true);
} else {
self::loadFile($file, null, true);
}
if (!class_exists($class, false) && !interface_exists($class, false)) {
#require_once 'Zend/Exception.php';
throw new Zend_Exception("File \"{$file}\" does not exist or class \"{$class}\" was not found in the file");
}
}
开发者ID:par-orillonsoft,项目名称:Magento,代码行数:54,代码来源:Loader.php
示例8: _findMissingClasses
/**
* Find classes which are used as parameters types of the specified method and are not declared.
*
* @param string $file
* @param \ReflectionClass $classReflection
* @param string $methodName
* @param string $entityType
* @return string[]
*/
protected function _findMissingClasses($file, $classReflection, $methodName, $entityType)
{
$missingClasses = [];
if ($classReflection->hasMethod($methodName)) {
$constructor = $classReflection->getMethod($methodName);
$parameters = $constructor->getParameters();
/** @var $parameter \ReflectionParameter */
foreach ($parameters as $parameter) {
preg_match('/\[\s\<\w+?>\s([\w\\\\]+)/s', $parameter->__toString(), $matches);
if (isset($matches[1]) && substr($matches[1], -strlen($entityType)) == $entityType) {
$missingClassName = $matches[1];
try {
if (class_exists($missingClassName)) {
continue;
}
} catch (\Magento\Framework\Exception\LocalizedException $e) {
}
$sourceClassName = $this->getSourceClassName($missingClassName, $entityType);
if (!class_exists($sourceClassName) && !interface_exists($sourceClassName)) {
$this->_log->add(
Log::CONFIGURATION_ERROR,
$missingClassName,
"Invalid {$entityType} for nonexistent class {$sourceClassName} in file {$file}"
);
continue;
}
$missingClasses[] = $missingClassName;
}
}
}
return $missingClasses;
}
开发者ID:nja78,项目名称:magento2,代码行数:41,代码来源:PhpScanner.php
示例9: loadClass
/**
* Load the file for a class
*
* @param string $class The class that will be loaded
* @return boolean True on success
*/
public static function loadClass($class)
{
// pre-empt further searching for the named class or interface.
// do not use autoload, because this method is registered with
// spl_autoload already.
if (class_exists($class, false) || interface_exists($class, false)) {
return;
}
// if class start with a 'Nooku' it is a Nooku class.
// create the path and register it with the loader.
switch (substr($class, 0, 6)) {
case 'Picman':
$word = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', substr_replace($class, '', 0, 6)));
$parts = explode('_', $word);
if (count($parts) > 1) {
$path = KInflector::pluralize(array_shift($parts)) . DS . implode(DS, $parts);
} else {
$path = $word;
}
if (is_file(dirname(__FILE__) . DS . $path . '.php')) {
KLoader::register($class, dirname(__FILE__) . DS . $path . '.php');
}
break;
}
$classes = KLoader::register();
if (array_key_exists(strtolower($class), $classes)) {
include $classes[strtolower($class)];
return true;
}
return false;
}
开发者ID:janssit,项目名称:www.gincoprojects.be,代码行数:37,代码来源:loader.php
示例10: maxAPIAutoload
/**
* Autoloading of maxAPI classes
*/
function maxAPIAutoload($className)
{
if (class_exists($className, false) || interface_exists($className, false)) {
return;
}
include_once $className . '.php';
}
开发者ID:krit-on,项目名称:maxPostix,代码行数:10,代码来源:autoload.php
示例11: CAS_autoload
/**
* Autoload a class
*
* @param string $class Classname to load
*
* @return bool
*/
function CAS_autoload($class)
{
// Static to hold the Include Path to CAS
static $include_path;
// Check only for CAS classes
if (substr($class, 0, 4) !== 'CAS_') {
return false;
}
// Setup the include path if it's not already set from a previous call
if (empty($include_path)) {
$include_path = array(dirname(dirname(__FILE__)), dirname(dirname(__FILE__)) . '/../test/');
}
// Declare local variable to store the expected full path to the file
foreach ($include_path as $path) {
$file_path = $path . '/' . str_replace('_', '/', $class) . '.php';
$fp = @fopen($file_path, 'r', true);
if ($fp) {
fclose($fp);
include $file_path;
if (!class_exists($class, false) && !interface_exists($class, false)) {
die(new Exception('Class ' . $class . ' was not present in ' . $file_path . ' [CAS_autoload]'));
}
return true;
}
}
$e = new Exception('Class ' . $class . ' could not be loaded from ' . $file_path . ', file does not exist (Path="' . implode(':', $include_path) . '") [CAS_autoload]');
$trace = $e->getTrace();
if (isset($trace[2]) && isset($trace[2]['function']) && in_array($trace[2]['function'], array('class_exists', 'interface_exists'))) {
return false;
}
if (isset($trace[1]) && isset($trace[1]['function']) && in_array($trace[1]['function'], array('class_exists', 'interface_exists'))) {
return false;
}
die((string) $e);
}
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:42,代码来源:Autoload.php
示例12: implementsInterface
public function implementsInterface($interface)
{
if (!interface_exists($interface)) {
throw new ReflectionException("Interface " . $interface . " does not exist ");
}
// todo add actual checking
}
开发者ID:cbsistem,项目名称:php.js,代码行数:7,代码来源:ReflectionClass.php
示例13: autoload
protected static function autoload($class)
{
$className = $class;
if (class_exists($className, false) || interface_exists($className, false)) {
return true;
}
$directory = '';
if (App::isCategoryType($class, self::APP_LOADER_MODEL)) {
//this is a model
$directory = CODE_BASE . DIRECTORY_SEPARATOR . self::APP_MODEL_DIRECTORY_NAME . DIRECTORY_SEPARATOR;
$class = App::resolveCategory($class, self::APP_LOADER_MODEL);
} else {
if (App::isCategoryType($class, self::APP_LOADER_CONTROLLER)) {
//this is a controller
$directory = CODE_BASE . DIRECTORY_SEPARATOR . self::APP_CONTROLLER_DIRECTORY_NAME;
$class = App::resolveCategory($class, self::APP_LOADER_CONTROLLER);
} else {
//this is used library
$directory = CODE_BASE . DIRECTORY_SEPARATOR . self::APP_LIBRARY_DIRECTORY_NAME;
}
}
$file = $directory . DIRECTORY_SEPARATOR . $class . '.php';
if (is_file($file)) {
include $file;
}
return true;
}
开发者ID:sdgdsffdsfff,项目名称:data_web,代码行数:27,代码来源:App.php
示例14: __construct
/**
* Constructor
*
* @param string $interfaceName
* @param MethodDataProviderFactory $methodDataProviderFactory
* @param Reader $reader
*/
public function __construct($interfaceName, MethodDataProviderFactory $methodDataProviderFactory, Reader $reader)
{
Tebru\assertThat(interface_exists($interfaceName), '"%s" is not a valid interface', $interfaceName);
$this->reflectionClass = new ReflectionClass($interfaceName);
$this->methodDataProviderFactory = $methodDataProviderFactory;
$this->reader = $reader;
}
开发者ID:tebru,项目名称:dynamo,代码行数:14,代码来源:InterfaceDataProvider.php
示例15: addRepository
/**
* {@inheritdoc}
*/
protected function addRepository(ContainerBuilder $container, MetadataInterface $metadata)
{
$reflection = new \ReflectionClass($metadata->getClass('model'));
$translatableInterface = TranslatableInterface::class;
$translatable = interface_exists($translatableInterface) && $reflection->implementsInterface($translatableInterface);
$repositoryClassParameterName = sprintf('%s.repository.%s.class', $metadata->getApplicationName(), $metadata->getName());
$repositoryClass = $translatable ? TranslatableResourceRepository::class : EntityRepository::class;
if ($container->hasParameter($repositoryClassParameterName)) {
$repositoryClass = $container->getParameter($repositoryClassParameterName);
}
if ($metadata->hasClass('repository')) {
$repositoryClass = $metadata->getClass('repository');
}
$repositoryReflection = new \ReflectionClass($repositoryClass);
$definition = new Definition($repositoryClass);
$definition->setArguments([new Reference($metadata->getServiceId('manager')), $this->getClassMetadataDefinition($metadata)]);
$definition->setLazy(!$repositoryReflection->isFinal());
if ($metadata->hasParameter('translation')) {
$translatableRepositoryInterface = TranslatableResourceRepositoryInterface::class;
$translationConfig = $metadata->getParameter('translation');
if (interface_exists($translatableRepositoryInterface) && $repositoryReflection->implementsInterface($translatableRepositoryInterface)) {
if (isset($translationConfig['fields'])) {
$definition->addMethodCall('setTranslatableFields', [$translationConfig['fields']]);
}
}
}
$container->setDefinition($metadata->getServiceId('repository'), $definition);
}
开发者ID:starspire,项目名称:eventmanager,代码行数:31,代码来源:DoctrineORMDriver.php
示例16: getPropertyType
public static function getPropertyType(ReflectionProperty $property)
{
if (empty($property->getDocComment())) {
return null;
}
if (strpos($property->getDocComment(), '@var ') === false) {
return null;
}
$typeName = preg_split('/\\s/', substr($property->getDocComment(), strpos($property->getDocComment(), '@var ') + 5))[0];
if (class_exists($typeName) || interface_exists($typeName)) {
return $typeName;
}
$paths = self::getUseStatements($property->getDeclaringClass());
if ($property->getDeclaringClass()->getNamespaceName()) {
$paths[] = $property->getDeclaringClass()->getNamespaceName();
}
$paths[] = '';
foreach ($paths as $alias => $path) {
if (strtolower($alias) == strtolower($typeName)) {
return $path;
} else {
if (class_exists($path . '\\' . $typeName) || interface_exists($path . '\\' . $typeName)) {
return $path . '\\' . $typeName;
}
}
}
return Constants::normalizeType(strtolower($typeName));
}
开发者ID:phspring,项目名称:common,代码行数:28,代码来源:Helper.php
示例17: configureFormFields
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper->add('name')->add('description', 'textarea', array('required' => false))->add('context')->add('enabled', null, array('required' => false));
if (interface_exists('Sonata\\MediaBundle\\Model\\MediaInterface')) {
$formMapper->add('media', 'sonata_type_model_list', array('required' => false), array('link_parameters' => array('provider' => 'sonata.media.provider.image', 'context' => 'sonata_collection')));
}
}
开发者ID:kazak,项目名称:forum,代码行数:10,代码来源:CollectionAdmin.php
示例18: autoload
public static function autoload($class)
{
$filename = self::_autoloaderClassToFile($class);
if (!$filename) {
return false;
}
$proLocation = substr_replace(BETTER_ANALYTICS_PLUGIN_DIR, '-pro', -1);
$allowed = false;
if (file_exists($proLocation . $filename)) {
$betterAnalyticsInternal = get_transient('ba_int');
if (@$betterAnalyticsInternal['v'] || strpos(@$_SERVER['SCRIPT_NAME'], '/plugins.php') !== false || strpos(@$_SERVER['SCRIPT_NAME'], '/tools.php') !== false || $class == 'DigitalPointBetterAnalytics_Helper_Api') {
$allowed = true;
}
}
if ($allowed) {
include $proLocation . $filename;
return class_exists($class, false) || interface_exists($class, false);
}
$ecommerceLocation = substr_replace(BETTER_ANALYTICS_PLUGIN_DIR, '-ecommerce', -1);
if (file_exists($ecommerceLocation . $filename)) {
include $ecommerceLocation . $filename;
return class_exists($class, false) || interface_exists($class, false);
} elseif (file_exists(BETTER_ANALYTICS_PLUGIN_DIR . $filename)) {
include BETTER_ANALYTICS_PLUGIN_DIR . $filename;
return class_exists($class, false) || interface_exists($class, false);
}
}
开发者ID:xalgorithm,项目名称:amcf-wp,代码行数:27,代码来源:Public.php
示例19: mbAutoload
/**
* Mediboard class autoloader
*
* @param string $class Class to be loaded
*
* @return bool
*/
function mbAutoload($class)
{
$file_exists = false;
$time = microtime(true);
// Entry already in cache
if (isset(CApp::$classPaths[$class])) {
// The class is known to not be in MB
if (CApp::$classPaths[$class] === false) {
return false;
}
// Load it if we can
if ($file_exists = file_exists(CApp::$classPaths[$class])) {
CApp::$performance["autoloadCount"]++;
return include_once CApp::$classPaths[$class];
}
}
// File moved ?
if (!$file_exists) {
unset(CApp::$classPaths[$class]);
}
// CSetup* class
if (preg_match('/^CSetup(.+)$/', $class, $matches)) {
$dirs = array("modules/{$matches['1']}/setup.php");
} else {
$class_file = $class;
$suffix = ".class";
// Namespaced class
if (strpos($class_file, "\\") !== false) {
$namespace = explode("\\", $class_file);
// Mediboard class
if ($namespace[0] === "Mediboard") {
array_shift($namespace);
$class_file = implode("/", $namespace);
} else {
$class_file = "vendor/" . implode("/", $namespace);
$suffix = "";
}
}
$class_file .= $suffix;
$dirs = array("classes/{$class_file}.php", "classes/*/{$class_file}.php", "mobile/*/{$class_file}.php", "modules/*/classes/{$class_file}.php", "modules/*/classes/*/{$class_file}.php", "modules/*/classes/*/*/{$class_file}.php", "install/classes/{$class_file}.php");
}
$rootDir = CAppUI::conf("root_dir");
$class_path = false;
foreach ($dirs as $dir) {
$files = glob("{$rootDir}/{$dir}");
foreach ($files as $filename) {
include_once $filename;
// The class was found
if (class_exists($class, false) || interface_exists($class, false)) {
$class_path = $filename;
break 2;
}
}
}
// Class not found, it is not in MB
CApp::$classPaths[$class] = $class_path;
SHM::put("class-paths", CApp::$classPaths);
CApp::$performance["autoload"][$class] = (microtime(true) - $time) * 1000;
return $class_path !== false;
}
开发者ID:fbone,项目名称:mediboard4,代码行数:67,代码来源:autoload.php
示例20: __autoload
function __autoload($className)
{
if (function_exists('smartyAutoload') and smartyAutoload($className)) {
return true;
}
$className = str_replace(chr(0), '', $className);
$classDir = dirname(__FILE__) . '/../classes/';
$overrideDir = dirname(__FILE__) . '/../override/classes/';
$file_in_override = file_exists($overrideDir . $className . '.php');
$file_in_classes = file_exists($classDir . $className . '.php');
// This is a Core class and its name is the same as its declared name
if (substr($className, -4) == 'Core') {
require_once $classDir . substr($className, 0, -4) . '.php';
} else {
if ($file_in_override && $file_in_classes) {
require_once $classDir . str_replace(chr(0), '', $className) . '.php';
require_once $overrideDir . $className . '.php';
} elseif (!$file_in_override && $file_in_classes) {
require_once $classDir . str_replace(chr(0), '', $className) . '.php';
$classInfos = new ReflectionClass($className . ((interface_exists($className, false) or class_exists($className, false)) ? '' : 'Core'));
if (!$classInfos->isInterface() && substr($classInfos->name, -4) == 'Core') {
eval(($classInfos->isAbstract() ? 'abstract ' : '') . 'class ' . $className . ' extends ' . $className . 'Core {}');
}
} elseif ($file_in_override && !$file_in_classes) {
require_once $overrideDir . $className . '.php';
}
}
}
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:28,代码来源:autoload.php
注:本文中的interface_exists函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论