本文整理汇总了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;
}
示例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);
}
}
示例3: isPhpClass
public function isPhpClass()
{
try {
$r = new \ReflectionClass($this->name);
return $r->isInternal();
} catch (\ReflectionException $e) {
return false;
}
}
示例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();
}
示例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();
}));
}
示例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);
}
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}
示例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());
}
}
示例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());
}
示例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;
}
示例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());
}
}
}
示例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);
}
}
}