本文整理汇总了PHP中ReflectionObject::isInternal方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionObject::isInternal方法的具体用法?PHP ReflectionObject::isInternal怎么用?PHP ReflectionObject::isInternal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReflectionObject
的用法示例。
在下文中一共展示了ReflectionObject::isInternal方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cloneObject
/**
* @param object $original
* @return object
*/
protected function cloneObject($original)
{
$cloneable = null;
$object = new ReflectionObject($original);
// Check the blacklist before asking PHP reflection to work around
// https://bugs.php.net/bug.php?id=53967
if ($object->isInternal() && isset(self::$uncloneableExtensions[$object->getExtensionName()])) {
$cloneable = false;
}
if ($cloneable === null) {
foreach (self::$uncloneableClasses as $class) {
if ($original instanceof $class) {
$cloneable = false;
break;
}
}
}
if ($cloneable === null && method_exists($object, 'isCloneable')) {
$cloneable = $object->isCloneable();
}
if ($cloneable === null && $object->hasMethod('__clone')) {
$method = $object->getMethod('__clone');
$cloneable = $method->isPublic();
}
if ($cloneable === null) {
$cloneable = true;
}
if ($cloneable) {
try {
return clone $original;
} catch (Exception $e) {
return $original;
}
} else {
return $original;
}
}
示例2: ReflectionObject
<?php
class C
{
}
$r1 = new ReflectionObject(new stdClass());
$r2 = new ReflectionObject(new ReflectionClass('C'));
$r3 = new ReflectionObject(new ReflectionProperty('Exception', 'message'));
$r4 = new ReflectionObject(new Exception());
$r5 = new ReflectionObject(new C());
var_dump($r1->isInternal(), $r2->isInternal(), $r3->isInternal(), $r4->isInternal(), $r5->isInternal());
示例3: ReflectionObject
<?php
$r1 = new ReflectionObject(new stdClass());
var_dump($r1->isInternal('X'));
var_dump($r1->isInternal('X', true));
示例4: buildFromObject
/**
* @param $param
* @param \ReflectionObject $reflection
*/
private function buildFromObject($param, $reflection = null)
{
foreach ($param as $key => $value) {
$this->object['Object default'][$key] = $value;
}
// Get info on the object
$this->object['Reflection']['In namespace'] = $reflection->inNamespace() ? 'Yes' : 'No';
if ($reflection->inNamespace()) {
$this->object['Class namespace'] = $reflection->getNamespaceName();
}
$this->object['Reflection']['Class name'] = $reflection->getName();
$this->object['Reflection']['Is internal'] = $reflection->isInternal() ? 'Yes' : 'No';
$this->object['Reflection']['Is iterable'] = $reflection->isIterateable() ? 'Yes' : 'No';
$this->object['Reflection']['Is abstract'] = $reflection->isAbstract() ? 'Yes' : 'No';
$this->object['Reflection']['Is final'] = $reflection->isFinal() ? 'Yes' : 'No';
$this->object['Reflection']['Is user defined'] = $reflection->isUserDefined() ? 'Yes' : 'No';
$this->object['Reflection']['Is instantiable'] = $reflection->isInstantiable() ? 'Yes' : 'No';
$this->object['Reflection']['Is clonable'] = $reflection->isCloneable() ? 'Yes' : 'No';
$this->object['Reflection']['Is interface'] = $reflection->isInterface() ? 'Yes' : 'No';
$this->object['Reflection']['Class constants'] = !empty($reflection->getConstants()) ? $reflection->getConstants() : 'Class has no constants';
$this->object['Reflection']['Class static properties'] = !empty($reflection->getStaticProperties()) ? $reflection->getStaticProperties() : 'Class has no static properties';
$this->object['Reflection']['Class default properties'] = !empty($reflection->getDefaultProperties()) ? $reflection->getDefaultProperties() : 'Class has no default properties';
if (null === $reflection->getConstructor()) {
$this->object['Reflection']['Class construct'] = 'Class has no construct.';
} else {
$this->object['Reflection']['Class construct'] = $reflection->getConstructor();
}
$this->object['Reflection']['Class interfaces'] = !empty($reflection->getInterfaces()) ? $reflection->getInterfaces() : 'Class implements no interfaces';
$this->object['Reflection']['Class traits'] = !empty($reflection->getTraits()) ? $reflection->getTraits() : 'Class has no traits';
$this->object['Reflection']['Class parent'] = $reflection->getParentClass() !== false ? $reflection->getParentClass() : 'Class has no parent';
if (false === $reflection->getFileName()) {
$this->object['Reflection']['Defined in'] = 'Class is internal, no definition to provide.';
} else {
$this->object['Reflection']['Defined in'] = $reflection->getFileName();
}
if (false === $reflection->getFileName()) {
$this->object['Reflection']['Start line'] = 'Class is internal, no start line to provide.';
} else {
$this->object['Reflection']['Start line'] = $reflection->getFileName();
}
if (false === $reflection->getEndLine()) {
$this->object['Reflection']['End line'] = 'Class is internal, no end line to provide.';
} else {
$this->object['Reflection']['End line'] = $reflection->getEndLine();
}
if (false === $reflection->getDocComment()) {
$this->object['Reflection']['Doc comments'] = 'No documents to provide.';
} else {
$this->object['Reflection']['Doc comments'] = $reflection->getDocComment();
}
// End get info
$this->html .= "<span class=\"js-parent-object\">";
if (!empty($this->object['Object default'])) {
$this->html .= "<div class=\"js-object-default-tab \"><button class=\"button-reflection button\">Show reflection</button></div>";
$this->html .= "<div class=\"js-object-default \">";
$this->buildFromObjectIterationInformationRecursive($this->object['Object default']);
$this->html .= "</div>";
}
if ($param instanceof \Closure) {
$this->html .= "<div class=\"js-object-default-tab \"><button class=\"button-reflection button\">Show reflection</button></div>";
$this->html .= "<div class=\"js-object-default \">";
$this->html .= "<span class=\"css-type-string\">Nothing here...</span>";
$this->html .= "</div>";
}
$this->html .= "<div class=\"js-object-reflection-tab hide\"><button class=\"button-class-default button\">Show default</button></div>";
$this->html .= "<div class=\"js-object-reflection hide\">";
$this->buildFromObjectReflectionInformationRecursive($this->object['Reflection']);
$this->html .= "</div>";
$this->html .= "</span>";
$this->object = [];
}