當前位置: 首頁>>代碼示例>>PHP>>正文


PHP XPClass::detailsForClass方法代碼示例

本文整理匯總了PHP中lang\XPClass::detailsForClass方法的典型用法代碼示例。如果您正苦於以下問題:PHP XPClass::detailsForClass方法的具體用法?PHP XPClass::detailsForClass怎麽用?PHP XPClass::detailsForClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在lang\XPClass的用法示例。


在下文中一共展示了XPClass::detailsForClass方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: canBeCachedViaXpRegistry

 public function canBeCachedViaXpRegistry()
 {
     with(\xp::$registry['details.' . ($fixture = 'DummyDetails')] = $details = $this->dummyDetails());
     $actual = \lang\XPClass::detailsForClass($fixture);
     unset(\xp::$registry['details.' . $fixture]);
     $this->assertEquals($details, $actual);
 }
開發者ID:xp-framework,項目名稱:core,代碼行數:7,代碼來源:ClassDetailsTest.class.php

示例2: parseDetails

 public function parseDetails($class)
 {
     $details = XPClass::detailsForClass($class->getName());
     return isset($details['class']);
 }
開發者ID:xp-forge,項目名稱:mirrors,代碼行數:5,代碼來源:ClassParsingPerformance.class.php

示例3: newinstance

function newinstance($spec, $args, $def = null)
{
    static $u = 0;
    if ('#' === $spec[0]) {
        $p = strrpos($spec, ' ');
        $annotations = substr($spec, 0, $p) . ' ';
        $spec = substr($spec, $p + 1);
    } else {
        $annotations = '';
    }
    // Create unique name
    $n = "·" . ++$u;
    if (0 === strncmp($spec, 'php.', 4)) {
        $spec = substr($spec, 4);
    } else {
        if (false === strpos($spec, '.')) {
            $spec = \lang\XPClass::nameOf($spec);
        }
    }
    // Handle generics, PHP types and all others.
    if (strstr($spec, '<')) {
        $class = \lang\Type::forName($spec);
        $type = $class->literal();
        $generic = xp::$meta[$class->getName()]['class'][DETAIL_GENERIC];
    } else {
        if (false === strpos($spec, '.')) {
            $type = $spec;
            $generic = null;
        } else {
            try {
                $type = xp::$loader->loadClass0($spec);
            } catch (\lang\ClassLoadingException $e) {
                xp::error($e->getMessage());
            }
            $generic = null;
        }
    }
    $name = strtr($type, '\\', '.') . $n;
    if (interface_exists($type)) {
        $decl = ['kind' => 'class', 'extends' => ['lang.Object'], 'implements' => ['\\' . $type], 'use' => []];
    } else {
        if (trait_exists($type)) {
            $decl = ['kind' => 'class', 'extends' => ['lang.Object'], 'implements' => [], 'use' => ['\\' . $type]];
        } else {
            $decl = ['kind' => 'class', 'extends' => ['\\' . $type], 'implements' => [], 'use' => []];
        }
    }
    $defined = \lang\ClassLoader::defineType($annotations . $name, $decl, $def);
    if (false === strpos($type, '\\')) {
        xp::$cn[$type . $n] = $spec . $n;
    }
    if ($generic) {
        \lang\XPClass::detailsForClass($name);
        xp::$meta[$name]['class'][DETAIL_GENERIC] = $generic;
    }
    if ($defined->hasConstructor()) {
        return $defined->getConstructor()->newInstance($args);
    } else {
        return $defined->newInstance();
    }
}
開發者ID:johannes85,項目名稱:core,代碼行數:61,代碼來源:lang.base.php

示例4: typeAnnotations

 /** @return var */
 public function typeAnnotations()
 {
     $class = $this->typeName();
     $details = XPClass::detailsForClass($class);
     if ($details && $details['class'][DETAIL_ANNOTATIONS]) {
         return $this->annotationsOf($details['class'][DETAIL_ANNOTATIONS]);
     } else {
         return null;
     }
 }
開發者ID:xp-forge,項目名稱:mirrors,代碼行數:11,代碼來源:FromReflection.class.php


注:本文中的lang\XPClass::detailsForClass方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。