本文整理汇总了PHP中ClassInfo::allClasses方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassInfo::allClasses方法的具体用法?PHP ClassInfo::allClasses怎么用?PHP ClassInfo::allClasses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClassInfo
的用法示例。
在下文中一共展示了ClassInfo::allClasses方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateExtensionMap
private static function generateExtensionMap()
{
// get a list of classes
$classes = array_unique(array_merge(array_keys(ClassInfo::allClasses()), get_declared_classes()));
// die(print_r($classes,1));
// Silverstripe has broken clases floating around, we need to blacklist them or it's bad times
$blacklist = array('SapphireTestReporter', 'SapphireTest', 'SapphireTestSuite', 'CliTestReporter', 'SilverStripeListener', 'TeamCityListener', 'SS_TestListener');
$blacklistLC = array_map('strtolower', $blacklist);
// init some vars
$extMap = $dOClasses = $dODClasses = array();
// Sort Classes
foreach ($classes as $class) {
if (!in_array(strtolower($class), $blacklistLC)) {
// this breaks when we start looking at some of the broken requires in SapphireTest
if (is_subclass_of($class, 'DataObject')) {
$dOClasses[] = $class;
}
if (is_subclass_of($class, 'Extension')) {
$dODClasses[] = $class;
}
}
}
// Find out what is applied to what
foreach ($dODClasses as $dOD) {
foreach ($dOClasses as $dO) {
if (Object::has_extension($dO, $dOD)) {
$extMap[$dOD][] = $dO;
}
}
}
// Cache the map
self::$extensionMap = $extMap;
}
示例2: testUpdater
function testUpdater()
{
$mock = Phockito::mock('ArrayList');
$this->assertContains(get_class($mock), ClassInfo::allClasses());
$this->assertContains(get_class($mock), ClassInfo::subclassesFor('ViewableData'));
$this->assertContains(get_class($mock), ClassInfo::implementorsOf('SS_List'));
$mock = Phockito::mock('SS_List');
$this->assertContains(get_class($mock), ClassInfo::allClasses());
$this->assertContains(get_class($mock), ClassInfo::implementorsOf('SS_List'));
}
开发者ID:helpfulrobot,项目名称:hafriedlander-silverstripe-phockito,代码行数:10,代码来源:PhockitoIntegrationTest.php
示例3: browse
public function browse()
{
$classes = ClassInfo::subclassesFor('SapphireTest');
array_shift($classes);
ksort($classes);
$result = '<h1>View any of the following test classes</h1>';
$result .= '<ul>';
foreach ($classes as $class) {
$result .= "<li><a href=\"{$this->Link($class)}\">{$class}</a></li>";
}
$result .= '</ul>';
$result .= '<h1>View any of the following other classes</h1>';
$classes = array_keys(ClassInfo::allClasses());
sort($classes);
$result .= '<ul>';
foreach ($classes as $class) {
$result .= "<li><a href=\"{$this->Link($class)}\">{$class}</a></li>";
}
$result .= '</ul>';
return $this->customise(array('Content' => $result))->renderWith('CodeViewer');
}
示例4: Content
function Content() {
$className = $this->urlParams['ID'];
if($className && ClassInfo::exists($className)) {
return $this->testAnalysis(getClassFile($className));
} else {
$result = "<h1>View any of the following test classes</h1>";
$classes = ClassInfo::subclassesFor('SapphireTest');
ksort($classes);
foreach($classes as $className) {
if($className == 'SapphireTest') continue;
$result .= "<li><a href=\"dev/viewcode/show/$className\">$className</a></li>";
}
$result .= "<h1>View any of the following other classes</h1>";
global $_CLASS_MANIFEST;
$classes = array_keys(ClassInfo::allClasses());
sort($classes);
foreach($classes as $className) {
if(preg_match('/^[A-Za-z][A-Za-z0-9]*$/', $className) && isset($_CLASS_MANIFEST[$className])) {
$result .= "<li><a href=\"dev/viewcode/show/$className\">$className</a></li>";
}
}
return $result;
}
}