当前位置: 首页>>代码示例>>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;未经允许,请勿转载。