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


PHP ReflectionClass::isInternal方法代碼示例

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


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

示例1: classData

function classData(ReflectionClass $class)
{
    $details = "";
    $name = $class->getName();
    if ($class->isUserDefined()) {
        $details .= "{$name} is user defined \n";
    }
    if ($class->isInternal()) {
        $details .= "{$name} is built-in\n";
    }
    if ($class->isInternal()) {
        $details .= "{$name} is interface \n";
    }
    if ($class->isAbstract()) {
        $details .= "{$name} is a final class\n";
    }
    if ($class->isFinal()) {
        $details .= "{$name} is a final class\n";
    }
    if ($class->isInstantiable()) {
        $details .= "{$name} can be instantiated\n";
    } else {
        $details .= "{$name} can not be instantiated\n";
    }
    return $details;
}
開發者ID:flydement,項目名稱:MyTest,代碼行數:26,代碼來源:test.2.php

示例2: throwErrorIfRpcRequestIsInvalid

 /**
  * @param $rpcRequest \RpcGateway\Request
  * @throws \Exception
  */
 protected function throwErrorIfRpcRequestIsInvalid($rpcRequest)
 {
     $serviceMethodName = $rpcRequest->getMethodName();
     // create a PHP compatible version of the requested service class
     $serviceClassName = $this->getServiceClassNamespace() . str_replace(Request::METHOD_DELIMITER, '_', $rpcRequest->getClassName());
     try {
         class_exists($serviceClassName);
     } catch (\Exception $exception) {
         throw new \Exception("Invalid rpc.method [" . $rpcRequest->getMethod() . "] (not found) at " . __METHOD__);
     }
     $serviceClassReflection = new \ReflectionClass($serviceClassName);
     if ($serviceClassReflection->isAbstract() || $serviceClassReflection->isInterface() || $serviceClassReflection->isInternal()) {
         throw new \Exception("Invalid rpc.class [" . $rpcRequest->getMethod() . "] at " . __METHOD__);
     }
     if ($serviceClassReflection->hasMethod($serviceMethodName) !== true) {
         throw new \Exception("Invalid rpc.method [" . $rpcRequest->getMethod() . "] (not found) at " . __METHOD__);
     }
     $serviceMethodReflection = $serviceClassReflection->getMethod($serviceMethodName);
     if ($serviceMethodReflection->isAbstract() || $serviceMethodReflection->isConstructor() || $serviceMethodReflection->isStatic() || !$serviceMethodReflection->isPublic()) {
         throw new \Exception("Invalid rpc.method [" . $rpcRequest->getMethod() . "] (not invokable) at " . __METHOD__);
     }
     $argsExpectedMin = $serviceMethodReflection->getNumberOfRequiredParameters();
     $argsExpectedMax = $serviceMethodReflection->getNumberOfParameters();
     $argsOptional = $argsExpectedMax - $argsExpectedMin;
     $argsGiven = count($rpcRequest->getParams());
     if ($argsGiven < $argsExpectedMin || $argsGiven > $argsExpectedMax) {
         $msg = 'Invalid rpc.method [' . $rpcRequest->getMethod() . ']' . " Wrong number of parameters:" . " " . $argsGiven . " given" . " (required: " . $argsExpectedMin . " optional: " . $argsOptional . ")" . " expectedMin: " . $argsExpectedMin . " expectedMax: " . $argsExpectedMax;
         throw new Exception($msg);
     }
 }
開發者ID:basilicom,項目名稱:rpc-gateway,代碼行數:34,代碼來源:Gateway.php

示例3: isPhpClass

 public function isPhpClass()
 {
     try {
         $r = new \ReflectionClass($this->name);
         return $r->isInternal();
     } catch (\ReflectionException $e) {
         return false;
     }
 }
開發者ID:NicholasJohn16,項目名稱:Sami,代碼行數:9,代碼來源:ClassReflection.php

示例4: isPhpClass

 private function isPhpClass(Link $link)
 {
     $className = $link->getDestination();
     if (!class_exists($className, false)) {
         return false;
     }
     $classReflection = new \ReflectionClass($link->getDestination());
     return $classReflection->isInternal();
 }
開發者ID:ashleighpearson,項目名稱:developer-documentation,代碼行數:9,代碼來源:PhpInternalFormatter.php

示例5: internalSymbolsProvider

 /**
  * @return string[] internal symbols
  */
 public function internalSymbolsProvider()
 {
     $allSymbols = array_merge(get_declared_classes(), get_declared_interfaces(), get_declared_traits());
     $indexedSymbols = array_combine($allSymbols, $allSymbols);
     return array_map(function ($symbol) {
         return [$symbol];
     }, array_filter($indexedSymbols, function ($symbol) {
         $reflection = new PhpReflectionClass($symbol);
         return $reflection->isInternal();
     }));
 }
開發者ID:AydinHassan,項目名稱:BetterReflection,代碼行數:14,代碼來源:PhpInternalSourceLocatorTest.php

示例6: _fillClassPathInfo

 protected function _fillClassPathInfo($serialized)
 {
     $classes = self::extractSerializedClasses($serialized);
     $this->class_paths = array();
     foreach ($classes as $class) {
         $reflect = new ReflectionClass($class);
         if ($reflect->isInternal()) {
             throw new lmbException("Class '{$class}' can't be serialized since it's an iternal PHP class, consider omitting object of this class by providing custom __sleep, __wakeup handlers");
         }
         $this->class_paths[] = self::getClassPath($reflect);
     }
 }
開發者ID:anykey84,項目名稱:YaBackup,代碼行數:12,代碼來源:lmbSerializable.class.php

示例7: getInternalReflectionClassName

 /**
  * @param Identifier $identifier
  *
  * @return null|string
  */
 private function getInternalReflectionClassName(Identifier $identifier)
 {
     if (!$identifier->isClass()) {
         return null;
     }
     $name = $identifier->getName();
     if (!(class_exists($name, false) || interface_exists($name, false) || trait_exists($name, false))) {
         return null;
         // not an available internal class
     }
     $reflection = new \ReflectionClass($name);
     return $reflection->isInternal() ? $reflection->getName() : null;
 }
開發者ID:stof,項目名稱:BetterReflection,代碼行數:18,代碼來源:PhpInternalSourceLocator.php

示例8: isVendorClass

 /**
  * Checks if the given class is located in the vendor directory.
  *
  * For convenience, it is also possible to pass an object whose
  * class is then checked.
  *
  * @param string|object $classNameOrObject
  * @return boolean
  * @throws \InvalidArgumentException If no valid class name or object is passed.
  */
 public static function isVendorClass($classNameOrObject)
 {
     $className = is_object($classNameOrObject) ? get_class($classNameOrObject) : $classNameOrObject;
     if (!class_exists($className)) {
         $message = '"' . $className . '" is not the name of a loadable class.';
         throw new \InvalidArgumentException($message);
     }
     $reflection = new \ReflectionClass($className);
     if ($reflection->isInternal()) {
         return false;
     }
     return static::isVendorFile($reflection->getFileName());
 }
開發者ID:webfactory,項目名稱:symfony-application-tests,代碼行數:23,代碼來源:VendorResources.php

示例9: processElementsItems

 protected function processElementsItems()
 {
     $items = [];
     foreach (array_merge(get_declared_classes(), get_declared_interfaces(), get_declared_traits()) as $name) {
         $reflection = new \ReflectionClass($name);
         if ($reflection->isInternal() || mb_substr($name, 0, 11) === 'FixinTools\\') {
             continue;
         }
         $items[$reflection->name] = new Item($this, $reflection);
     }
     ksort($items);
     $this->items = $items;
 }
開發者ID:fixin,項目名稱:fixin,代碼行數:13,代碼來源:Processor.php

示例10: arrayToObject

 /**
  * @param array $data
  * @return mixed
  * @throws \Exception
  * @todo refactor this out somewhere once we start implementing in new formats
  */
 protected function arrayToObject(array $data)
 {
     $reflection = new \ReflectionClass($data['className']);
     if (false === $reflection->isInternal()) {
         $object = $reflection->newInstanceWithoutConstructor();
     } else {
         $object = $reflection->newInstance();
     }
     $breadth = array();
     $object = $this->extractAndSetSingleDepthProperties($data, $breadth, $reflection, $object);
     $object = $this->extractAndSetMultipleDepthProperties($breadth, $reflection, $object);
     return $object;
 }
開發者ID:brettminnie,項目名稱:breakfast-serializer,代碼行數:19,代碼來源:JSONSerializer.php

示例11: addClasses

 function addClasses($parent, array $classes)
 {
     foreach ($classes as $rc) {
         if (is_string($rc)) {
             $rc = new \ReflectionClass($rc);
         }
         if (!$rc->isInternal()) {
             return;
         }
         $class = $this->append($parent, array($rc->getName(), $rc));
         $this->addFunctions($class, $rc->getMethods());
     }
 }
開發者ID:johannes,項目名稱:php-explorer,代碼行數:13,代碼來源:ExtensionTree.php

示例12: getParentClass

 public function getParentClass()
 {
     if (!$this->getParent()) {
         return;
     }
     // Return internal objects Reflection
     if (class_exists($this->getParent(), false)) {
         $reflection = new \ReflectionClass($this->getParent());
         if ($reflection->isInternal()) {
             return $reflection;
         }
     }
     return $this->index->getClass($this->getParent());
 }
開發者ID:benoth,項目名稱:static-reflection,代碼行數:14,代碼來源:ReflectionClass.php

示例13: isCloneable

 private function isCloneable($class)
 {
     if (!is_string($class) || in_array($class, self::$nonCloneableClasses) || false !== strpos($class, '[')) {
         // partial mock
         return false;
     }
     $rClass = new \ReflectionClass($class);
     // native php objects may not be cloneable, and we cannot rely on any
     // custom __clone implementation (ex: Symfony's Request object)
     if ($rClass->isInternal() || $rClass->hasMethod('__clone')) {
         self::$nonCloneableClasses[] = $class;
         return false;
     }
     return true;
 }
開發者ID:ngydat,項目名稱:CoreBundle,代碼行數:15,代碼來源:MockeryTestCase.php

示例14: testLoad

 public function testLoad()
 {
     $name = $this->getClassName();
     $this->assertTrue(class_exists($name));
     $r = new \ReflectionClass($name);
     if ($r->isInstantiable() && !$r->isInternal()) {
         try {
             $class = $r->newInstanceWithoutConstructor();
             $this->assertInstanceOf($name, $class);
             $this->assertInstanceOf('PHPJ\\Lang\\Object', $class);
         } catch (\ReflectionException $e) {
             $this->markTestSkipped($e->getMessage());
         }
     }
 }
開發者ID:phpj,項目名稱:phpj,代碼行數:15,代碼來源:Test.php

示例15: load

 protected function load($dir, $name = '')
 {
     $old_classes = array_flip(get_declared_classes());
     $this->load_dir($dir, $name);
     $new_classes = get_declared_classes();
     foreach ($new_classes as $class) {
         // check if this is an abstract class, or bultin class
         $ref_class = new ReflectionClass($class);
         if ($ref_class->isAbstract()) {
             continue;
         }
         if ($ref_class->isInternal()) {
             continue;
         }
         if (!isset($old_classes[$class])) {
             $this->handle($class);
         }
     }
 }
開發者ID:roverrobot,項目名稱:components,代碼行數:19,代碼來源:component_manager.php


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