本文整理汇总了PHP中ReflectionClass::export方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionClass::export方法的具体用法?PHP ReflectionClass::export怎么用?PHP ReflectionClass::export使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReflectionClass
的用法示例。
在下文中一共展示了ReflectionClass::export方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: f
<?php
class A
{
private static $a = 0;
protected static $b = 1;
public static $c = 2;
private function f()
{
}
private static function sf()
{
}
}
class C extends A
{
}
ReflectionClass::export("C");
示例2: __construct
<?php
class Base
{
public final function __construct()
{
}
}
class Works extends Base
{
}
class Extended extends Base
{
public function Extended()
{
}
}
ReflectionClass::export('Extended');
示例3: A
#!/usr/bin/env php
<?php
class A
{
public $field = 'value';
}
$a = new A();
$reflection = new ReflectionClass('A');
// echo $reflection;
echo ReflectionClass::export('A', true);
示例4:
<?php
ReflectionClass::export('Countable');
示例5: export
/**
* Exports a ReflectionClass 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 (ReflectionClass::export()).
* @param ReflectionClass|string $class
* ReflectionClass object or name of the class
* @param boolean $return
* Whether to return (TRUE) or print (FALSE) the output
* @return mixed
*/
public static function export($class, $return = false)
{
return parent::export($class, $return);
}
示例6: testExport
public function testExport()
{
self::assertEquals(ReflectionClass::export('TestWebservice', true), ezcReflectionClass::export('TestWebservice', true));
}
示例7: methJ
public function methJ()
{
}
public function methK()
{
}
private function methB()
{
}
}
class C
{
}
$rb = new ReflectionClass("B");
print "--- export() ---\n";
var_dump($rb->export('B', true));
print "\n";
print "--- getConstant() ---\n";
var_dump($rb->getConstant('C0'));
var_dump($rb->getConstant('C1'));
print "\n";
print "--- getConstants() ---\n";
var_dump($rb->getConstants());
print "\n";
print "--- getConstructor() ---\n";
var_dump($rb->getConstructor());
print "\n";
print "--- getDocComment() ---\n";
var_dump($rb->getDocComment());
print "\n";
print "--- getStartLine() ---\n";
示例8: testToString
/**
* Tests export.
*/
public function testToString()
{
$tests = array('lines', 'docComment', 'noDocComment', 'constants', 'noConstants', 'properties', 'noProperties', 'doubleProperties', 'publicConstructor', 'privateConstructor', 'publicClone', 'privateClone', 'methods', 'noMethods', 'instances', 'abstract', 'abstractImplicit', 'noAbstract', 'final', 'noFinal', 'interface', 'noInterface', 'interfaces', 'noInterfaces', 'iterator', 'noIterator', 'parent', 'noParent', 'userDefined', 'noNamespace');
if (PHP_VERSION_ID >= 50400) {
// Test traits only on PHP >= 5.4
$tests[] = 'traits';
}
foreach ($tests as $test) {
$rfl = $this->getClassReflection($test);
$this->assertSame($rfl->internal->__toString(), $rfl->token->__toString());
$this->assertSame(InternalReflectionClass::export($this->getClassName($test), true), ReflectionClass::export($this->getBroker(), $this->getClassName($test), true));
// Test loading from a string
$rfl = $this->getClassReflection($test, true);
$this->assertSame($rfl->internal->__toString(), $rfl->token->__toString());
}
$this->assertSame(InternalReflectionClass::export('ReflectionClass', true), ReflectionClass::export($this->getBroker(), 'ReflectionClass', true));
$this->assertSame(InternalReflectionClass::export(new InternalReflectionClass('ReflectionClass'), true), ReflectionClass::export($this->getBroker(), new InternalReflectionClass('ReflectionClass'), true));
}
示例9: 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 ] ...
示例10: __construct
public function __construct()
{
parent::create(func_get_args());
$this->refelection = ReflectionClass::export('Apple', true);
}
示例11: foo
<?php
class foo
{
public function foo()
{
}
}
class bar extends foo
{
}
ReflectionClass::export("bar");
示例12: foo
<?php
interface a
{
function foo();
function bar();
}
interface b
{
function foo();
}
abstract class c
{
function bar()
{
}
}
class x extends c implements a, b
{
function foo()
{
}
}
ReflectionClass::export('x');