本文整理匯總了PHP中Zend\Code\Reflection\ClassReflection::getExtensionName方法的典型用法代碼示例。如果您正苦於以下問題:PHP ClassReflection::getExtensionName方法的具體用法?PHP ClassReflection::getExtensionName怎麽用?PHP ClassReflection::getExtensionName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\Code\Reflection\ClassReflection
的用法示例。
在下文中一共展示了ClassReflection::getExtensionName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: cache
/**
* Cache declared interfaces and classes to a single file
*
* @param \Zend\Mvc\MvcEvent $e
* @return void
*/
public function cache($e)
{
$request = $e->getRequest();
if ($request instanceof ConsoleRequest || $request->getQuery()->get('EDPSUPERLUMINAL_CACHE', null) === null) {
return;
}
if (file_exists(ZF_CLASS_CACHE)) {
$this->reflectClassCache();
$code = file_get_contents(ZF_CLASS_CACHE);
} else {
$code = "<?php\n";
}
$classes = array_merge(get_declared_interfaces(), get_declared_classes());
foreach ($classes as $class) {
// Skip non-Zend classes
if (0 !== strpos($class, 'Zend')) {
continue;
}
// Skip the autoloader factory and this class
if (in_array($class, array('Zend\\Loader\\AutoloaderFactory', __CLASS__))) {
continue;
}
if ($class === 'Zend\\Loader\\SplAutoloader') {
continue;
}
// Skip any classes we already know about
if (in_array($class, $this->knownClasses)) {
continue;
}
$this->knownClasses[] = $class;
$class = new ClassReflection($class);
// Skip any Annotation classes
$docBlock = $class->getDocBlock();
if ($docBlock) {
if ($docBlock->getTags('Annotation')) {
continue;
}
}
// Skip ZF2-based autoloaders
if (in_array('Zend\\Loader\\SplAutoloader', $class->getInterfaceNames())) {
continue;
}
// Skip internal classes or classes from extensions
// (this shouldn't happen, as we're only caching Zend classes)
if ($class->isInternal() || $class->getExtensionName()) {
continue;
}
$code .= static::getCacheCode($class);
}
file_put_contents(ZF_CLASS_CACHE, $code);
// minify the file
file_put_contents(ZF_CLASS_CACHE, php_strip_whitespace(ZF_CLASS_CACHE));
}
示例2: isSatisfiedBy
/**
* @param ClassReflection $class
* @return bool
*/
public function isSatisfiedBy(ClassReflection $class)
{
// Skip internal classes or classes from extensions
// (this shouldn't happen, as we're only caching Zend classes)
return $class->isInternal() || $class->getExtensionName();
}