当前位置: 首页>>代码示例>>PHP>>正文


PHP ReflectionClass::isCloneable方法代码示例

本文整理汇总了PHP中ReflectionClass::isCloneable方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionClass::isCloneable方法的具体用法?PHP ReflectionClass::isCloneable怎么用?PHP ReflectionClass::isCloneable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ReflectionClass的用法示例。


在下文中一共展示了ReflectionClass::isCloneable方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: classData

/**
 * Created by PhpStorm.
 * User: raynald
 * Date: 2/23/15
 * Time: 8:43 AM
 */
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->isInterface()) {
        $details .= "{$name} is interface\n";
    }
    if ($class->isAbstract()) {
        $details .= "{$name} is an abstract 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";
    }
    if ($class->isCloneable()) {
        $details .= "{$name} can be cloned\n";
    } else {
        $details .= "{$name} can not be cloned\n";
    }
    return $details;
}
开发者ID:raynaldmo,项目名称:php-education,代码行数:37,代码来源:util.php

示例2: testIsCloneable

 /**
  */
 public function testIsCloneable()
 {
     $this->assertTrue($this->object->isCloneable());
     $method = new ReflectionMethod('__clone');
     $this->object->addMethod($method);
     $this->assertTrue($this->object->isCloneable());
     $method->setVisibility('private');
     $this->assertFalse($this->object->isCloneable());
 }
开发者ID:neiluJ,项目名称:Documentor,代码行数:11,代码来源:ReflectionClassTest.php

示例3: testThatCloningIsNotSupported

 public function testThatCloningIsNotSupported()
 {
     $class = new \ReflectionClass('Symfony\\Component\\DependencyInjection\\Container');
     $clone = $class->getMethod('__clone');
     if (PHP_VERSION_ID >= 50400) {
         $this->assertFalse($class->isCloneable());
     }
     $this->assertTrue($clone->isPrivate());
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:9,代码来源:ContainerTest.php

示例4: ReflectionClass

<?php

trait T
{
}
$r = new ReflectionClass('T');
var_dump(Reflection::getModifierNames($r->getModifiers()));
var_dump($r->isAbstract());
var_dump($r->isInstantiable());
var_dump($r->isCloneable());
开发者ID:gleamingthecube,项目名称:php,代码行数:10,代码来源:ext_reflection_reflectionclass_for_traits.php

示例5: isCloneable

 public function isCloneable()
 {
     return $this->reflectionClass->isCloneable();
 }
开发者ID:edde-framework,项目名称:edde,代码行数:4,代码来源:ReflectionReflection.php

示例6: __clone

    private function __clone()
    {
    }
}
$bar = new bar();
print "User class - private __clone\n";
$obj = new ReflectionClass($bar);
var_dump($obj->isCloneable());
$obj = new ReflectionObject($bar);
var_dump($obj->isCloneable());
$h = clone $foo;
print "Closure\n";
$closure = function () {
};
$obj = new ReflectionClass($closure);
var_dump($obj->isCloneable());
$obj = new ReflectionObject($closure);
var_dump($obj->isCloneable());
$h = clone $closure;
print "Internal class - SimpleXMLElement\n";
$obj = new ReflectionClass('simplexmlelement');
var_dump($obj->isCloneable());
$obj = new ReflectionObject(new simplexmlelement('<test></test>'));
var_dump($obj->isCloneable());
$h = clone new simplexmlelement('<test></test>');
print "Internal class - XMLWriter\n";
$obj = new ReflectionClass('xmlwriter');
var_dump($obj->isCloneable());
$obj = new ReflectionObject(new XMLWriter());
var_dump($obj->isCloneable());
$h = clone new xmlwriter();
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:ReflectionClass_isCloneable_001.php

示例7: testClone

 public function testClone()
 {
     $reflection = new \ReflectionClass('SingletonInstance');
     $this->assertFalse($reflection->isCloneable());
 }
开发者ID:diskerror,项目名称:utilities,代码行数:5,代码来源:SingletonTest.php

示例8: loadClassInfo

 protected function loadClassInfo(\ReflectionClass $reflectedObject)
 {
     $this->classFile = $reflectedObject->getFileName();
     if (empty($this->classFile)) {
         $this->classFile = self::CLASSINFO_BUILTIN;
     }
     $this->classInterfaces = implode(', ', $reflectedObject->getInterfaceNames());
     $this->classNamespace = $reflectedObject->getNamespaceName();
     $parent = $reflectedObject->getParentClass();
     if ($parent) {
         $this->classParent = $parent->getName();
     }
     if (version_compare(phpversion(), '5.4', '>=')) {
         $this->classTraits = implode(', ', $reflectedObject->getTraitNames());
     }
     $this->abstract = $reflectedObject->isAbstract();
     $this->final = $reflectedObject->isFinal();
     if (version_compare(phpversion(), '5.4', '>=')) {
         $this->cloneable = $reflectedObject->isCloneable();
     }
 }
开发者ID:ankalagon,项目名称:ladybug,代码行数:21,代码来源:Container.php

示例9: isCloneable

function isCloneable($class_name)
{
    $info = new ReflectionClass($class_name);
    return $info->isCloneable();
}
开发者ID:badlamer,项目名称:hhvm,代码行数:5,代码来源:1596.php


注:本文中的ReflectionClass::isCloneable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。