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


PHP ReflectionFunction::export方法代码示例

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


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

示例1: _getClosureDefinition

 /**
  * Return where a closure has been defined
  *
  * If for some reason this doesn't work - it'll return the closure instance in the full knowledge
  * that it'll probably get dumped as the string "function"
  *
  * @param Closure $closure
  * @return mixed string or Closure
  */
 protected function _getClosureDefinition(Closure $closure)
 {
     $exported = ReflectionFunction::export($closure, true);
     preg_match('#@@ (.*) (\\d+) - (\\d+)#', $exported, $match);
     if (!$match) {
         return $closure;
     }
     list($m, $path, $start) = $match;
     $path = Debugger::trimPath($path);
     return "{$path}:{$start}";
 }
开发者ID:linking-arts,项目名称:furry-goggles,代码行数:20,代码来源:CrudPanel.php

示例2: g

var_dump($rf->getStaticVariables());
print "\n";
/**
 * This is g's doc comment.
 */
function g($a = null, $b = array(1, 2, 3), $c = SOME_CONSTANT)
{
    print "In g({$a}, {$b}, {$c})\n";
}
$rg = new ReflectionFunction("g");
print "--- invoke(\"g\") ---\n";
var_dump($rg->invoke("a", "b"));
var_dump($rg->invoke("a", "b"));
print "\n";
print "--- export(\"g\") ---\n";
var_dump($rf->export('g', true));
print "\n";
#===============================================================================
# ReflectionClass.
interface H
{
    public function methH();
}
interface I
{
    public function methI();
}
interface J
{
    public function methJ();
}
开发者ID:alphaxxl,项目名称:hhvm,代码行数:31,代码来源:reflection.php

示例3: testToString

 /**
  * Tests export.
  */
 public function testToString()
 {
     $tests = array('lines', 'docComment', 'noComment', 'invoke', 'noParameters', 'parameters', 'reference', 'noReference', 'noNamespace', 'userDefined', 'noClosure');
     foreach ($tests as $test) {
         $rfl = $this->getFunctionReflection($test);
         $this->assertSame($rfl->internal->__toString(), $rfl->token->__toString());
         $this->assertSame(InternalReflectionFunction::export($this->getFunctionName($test), true), ReflectionFunction::export($this->getBroker(), $this->getFunctionName($test), true));
         // Test loading from a string
         $rfl = $this->getFunctionReflection($test, true);
         $this->assertSame($rfl->internal->__toString(), $rfl->token->__toString());
     }
     $this->assertSame(InternalReflectionFunction::export('strpos', true), ReflectionFunction::export($this->getBroker(), 'strpos', true));
 }
开发者ID:eduardobenito10,项目名称:jenkins-php-quickstart,代码行数:16,代码来源:ReflectionFunctionTest.php

示例4: ReflectionFunction

$func = new ReflectionFunction('clamp');

for($i = $min - .5; $i < $max + .5; $i += 0.01) {
	echo "<tr><td>";
	echo $i,"</td><td>";
	var_dump($func->invokeArgs(Array($i, $max, $min)));
	echo "</td></tr>";
}
?>
</table>

<h1>Test random_val</h1>
<pre>
<?php 
echo ReflectionFunction::export('random_val');
?>
</pre>

<table>
<?
$max = -0.06;
$min = 0.06;
$func = new ReflectionFunction('random_val');

for($i = 0; $i < 50; $i++) {
	echo "<tr><td>";
	echo $i,"</td><td>";
	var_dump($func->invokeArgs(Array($max, $min)));
	echo "</td></tr>";
}
开发者ID:AaronAsAChimp,项目名称:gfonted,代码行数:30,代码来源:test_math.php

示例5: testExport

 public function testExport()
 {
     self::assertEquals(ReflectionFunction::export('m1', true), ezcReflectionFunction::export('m1', true));
     self::assertEquals(ReflectionFunction::export('m2', true), ezcReflectionFunction::export('m2', true));
     self::assertEquals(ReflectionFunction::export('m3', true), ezcReflectionFunction::export('m3', true));
 }
开发者ID:naderman,项目名称:ezc-reflection,代码行数:6,代码来源:function_test.php

示例6: export

 /**
  * Exports a ReflectionFunction object.
  *
  * 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 (ReflectionFunction::export()).
  * @param string $function Name of the function
  * @param boolean $return
  *        Whether to return (TRUE) or print (FALSE) the output
  * @return mixed
  */
 public static function export($function, $return = false)
 {
     return parent::export($function, $return);
 }
开发者ID:zetacomponents,项目名称:reflection,代码行数:15,代码来源:function.php

示例7: ReflectionFunction

<h1>Test Format Duration</h1>
<pre>
<?php 
require_once "utility/date.php";
echo ReflectionFunction::export('format_duration');
?>
</pre>

<table>
<?
$max = 3601;
$min = 1;

$func = new ReflectionFunction('format_duration');

for($i = $min; $i < $max; $i++) {
	echo "<tr><td>";
	echo $i,"</td><td>";
	var_dump($func->invokeArgs(Array($i)));
	echo "</td></tr>";
}
?>
</table>

开发者ID:AaronAsAChimp,项目名称:gfonted,代码行数:23,代码来源:test_date.php

示例8: myFunction

<pre><?php 
/**
 * @see http://php.net/manual/en/class.reflection.php
 * @version PHP 5+
 */
function myFunction($param1 = 'World')
{
    return "Hello {$param1}!";
}
var_dump(get_defined_functions()['user']);
var_dump(ReflectionFunction::export('myFunction', true));
echo '<hr />';
class Person
{
    public $name;
    protected $spouse;
    private $password;
    /**
     * My constructor
     * @param string $name
     */
    public function __construct($name)
    {
        $this->name = $name;
    }
    public function getName()
    {
        return $this->name;
    }
    public function setSpouse(Person $spouse)
    {
开发者ID:milanchheda,项目名称:php-certification-training,代码行数:31,代码来源:Reflection.php

示例9: test

<?php

/**
hoho
*/
function test($a, $b = 1, $c = "")
{
    static $var = 1;
}
$func = new ReflectionFunction("test");
var_dump($func->export("test"));
echo "--getName--\n";
var_dump($func->getName());
echo "--isInternal--\n";
var_dump($func->isInternal());
echo "--isUserDefined--\n";
var_dump($func->isUserDefined());
echo "--getFilename--\n";
var_dump($func->getFilename());
echo "--getStartline--\n";
var_dump($func->getStartline());
echo "--getEndline--\n";
var_dump($func->getEndline());
echo "--getDocComment--\n";
var_dump($func->getDocComment());
echo "--getStaticVariables--\n";
var_dump($func->getStaticVariables());
echo "--invoke--\n";
var_dump($func->invoke(array(1, 2, 3)));
echo "--invokeArgs--\n";
var_dump($func->invokeArgs(array(1, 2, 3)));
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:025.php


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