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


PHP ReflectionObject::export方法代码示例

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


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

示例1: D

<?php

class C
{
    private $p = 1;
}
class D extends C
{
}
$Obj = new D();
$Obj->p = 'value';
ReflectionObject::export($Obj);
开发者ID:badlamer,项目名称:hhvm,代码行数:12,代码来源:ReflectionObject_export_basic3.php

示例2: __addReflectInfo

 /**
  * Add reflection info
  *
  * @param array $trace
  *
  * @return string
  */
 private static function __addReflectInfo($trace)
 {
     $refLog = array();
     $i = 0;
     foreach ($trace as $row) {
         if (isset($row['class']) && isset($row['function'])) {
             if (isset($row['object'])) {
                 $refLog[$i]['export'] = ReflectionObject::export($row['object'], true);
             }
             $ref = new ReflectionMethod($row['class'], $row['function']);
             $refLog[$i]['file'] = $ref->getFileName();
             $refLog[$i]['doc'] = $ref->getDocComment();
             $refLog[$i]['start'] = $ref->getStartLine();
             $refLog[$i]['end'] = $ref->getEndLine();
         }
         $i++;
     }
     return $refLog;
 }
开发者ID:sssAlchemy,项目名称:Panda,代码行数:26,代码来源:Panda.php

示例3: export

 /**
  * Exports a ReflectionObject instance.
  *
  * Returns the output if TRUE is specified for $return, printing it otherwise.
  * This is purely a wrapper method, which calls the corresponding method of
  * the parent class (ReflectionObject::export()).
  * @param ReflectionObject $object ReflectionClass instance of the object
  * @param boolean $return
  *        Whether to return (TRUE) or print (FALSE) the output
  * @return mixed
  */
 public static function export($object, $return = false)
 {
     return parent::export($object, $return);
 }
开发者ID:naderman,项目名称:ezc-reflection,代码行数:15,代码来源:object.php

示例4: foo

<?php

class Foo
{
    public $bar = 1;
}
$f = new foo();
ReflectionObject::export($f);
开发者ID:badlamer,项目名称:hhvm,代码行数:8,代码来源:ReflectionObject_export_basic1.php

示例5: testExport

 public function testExport()
 {
     $object = new TestWebservice();
     self::assertEquals(ReflectionObject::export($object, true), ezcReflectionObject::export($object, true));
 }
开发者ID:naderman,项目名称:pflow,代码行数:5,代码来源:object_test.php

示例6: Func

<?php

class Foo
{
    public $prop;
    function Func($name)
    {
        echo "Hello {$name}";
    }
}
ReflectionClass::export('Foo');
//output: Class [ class Foo ] { @@ /home/cg/root/main.php 3-10 - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [1] { Property [ public $prop ] } - Methods [1] { Method [ public method Func ] { @@ /home/cg/root/main.php 7 - 9 - Parameters [1] { Parameter #0 [ $name ] } } } }
ReflectionObject::export(new Foo());
// output: Object of class [ class Foo ] { @@ /home/cg/root/main.php 3-10 - Constants [0] { } - Static properties [0] { } - Static methods [0] { } - Properties [1] { Property [ public $prop ] } - Dynamic properties [0] { } - Methods [1] { Method [ public method Func ] { @@ /home/cg/root/main.php 7 - 9 - Parameters [1] { Parameter #0 [ $name ] } } } }
ReflectionMethod::export('Foo', 'func');
// output:  Method [ public method Func ] { @@ /home/cg/root/main.php 7 - 9 - Parameters [1] { Parameter #0 [ $name ] } }
ReflectionProperty::export('Foo', 'prop');
//output: Property [ public $prop ]
ReflectionExtension::export('standard');
//output: Extension [ extension #15 standard version 5.5.18 ] ...
开发者ID:KB-WEB-DEVELOPMENT,项目名称:Kami_Barut_PHP_projects,代码行数:20,代码来源:Reflection+API+example.php

示例7: __construct

    /**
     * My constructor
     * @param string $name
     */
    public function __construct($name)
    {
        $this->name = $name;
    }
    public function getName()
    {
        return $this->name;
    }
    public function setSpouse(Person $spouse)
    {
        $this->spouse = $spouse;
    }
    private function setPassword($password)
    {
        $this->password = $password;
    }
}
$reflectionClass = new ReflectionClass('Person');
echo Reflection::export($reflectionClass, true);
$firstMethod = $reflectionClass->getMethods()[0];
$firstProperty = $reflectionClass->getProperties()[0];
var_dump($reflectionClass->getMethods(), $reflectionClass->hasMethod('getName'), $firstMethod->getDocComment(), $firstMethod->getParameters(), $reflectionClass->getProperties(), $firstProperty->isPublic());
echo '<hr />';
ReflectionObject::export(new Person('Reflection'));
?>
</pre>
开发者ID:milanchheda,项目名称:php-certification-training,代码行数:30,代码来源:Reflection.php


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