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


PHP Bar::foo方法代码示例

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


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

示例1: var_dump

echo "ReflectionFunction(1):";
var_dump($rf->getStaticVariables());
foo();
echo "ReflectionFunction(2):";
var_dump($rf->getStaticVariables());
foo();
$rf = new ReflectionFunction('foo');
echo "ReflectionFunction(3):";
var_dump($rf->getStaticVariables());
echo "---- ReflectionMethod ----\n";
$rf = new ReflectionMethod('Bar', 'foo');
echo "ReflectionMethod(1):";
var_dump($rf->getStaticVariables());
Bar::foo();
echo "ReflectionMethod(2):";
var_dump($rf->getStaticVariables());
Bar::foo();
$rf = new ReflectionFunction('foo');
echo "ReflectionMethod(3):";
var_dump($rf->getStaticVariables());
echo "---- ReflectionClosure ----\n";
$rf = new ReflectionFunction($foo);
echo "ReflectionFunction(1-closure):";
var_dump($rf->getStaticVariables());
$foo();
echo "ReflectionFunction(2-closure):";
var_dump($rf->getStaticVariables());
$foo();
$rf = new ReflectionFunction($foo);
echo "ReflectionFunction(3-closure):";
var_dump($rf->getStaticVariables());
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:reflection_static_vars.php

示例2: foo

<?php

trait T
{
    public final function foo()
    {
        return 'T::foo';
    }
}
class Foo
{
    use T;
}
class Bar extends Foo
{
    public final function foo()
    {
        return 'Bar::foo';
    }
}
$bar = new Bar();
echo $bar->foo() . "\n";
开发者ID:badlamer,项目名称:hhvm,代码行数:22,代码来源:final_method3.php

示例3: Bar

<?php

namespace jubianchi;

use jubianchi\Traits\Foo;
require_once __DIR__ . '/Traits/Foo.php';
class Bar
{
    use Foo;
}
xdebug_start_code_coverage();
$b = new Bar();
$b->foo();
var_dump(xdebug_get_code_coverage());
$reflector = new \ReflectionClass('\\jubianchi\\Bar');
var_dump($reflector->getMethod('foo')->getFileName(), $reflector->getMethod('foo')->getStartLine(), $reflector->getMethod('foo')->getEndLine());
开发者ID:jubianchi,项目名称:PHPSandbox,代码行数:16,代码来源:traits.php

示例4: Foo

 function test_references()
 {
     // basic references (belongs_to)
     $f = new Foo(array('id' => 1, 'name' => 'Joe'));
     $f->put();
     $b = new Bar(array('id' => 1, 'name' => 'Jim', 'foo' => 1));
     $b->put();
     $this->assertEquals($b->name, 'Jim');
     $this->assertEquals($b->foo, 1);
     $this->assertEquals($b->foo()->name, 'Joe');
     $this->assertEquals($b->foo()->name, 'Joe');
     // fake reference should fail
     try {
         $this->assertTrue($b->fake());
     } catch (Exception $e) {
         $this->assertRegExp('/Call to undefined method Bar::fake in .+tests\\/ModelTest\\.php on line [0-9]+/', $e->getMessage());
     }
 }
开发者ID:Selwyn-b,项目名称:elefant,代码行数:18,代码来源:ModelTest.php

示例5: function

<?php

namespace Dotink\Lab;

use Dotink\Parody\Mime;
return ['setup' => function ($data, $shared) {
    needs('src/Quip.php');
    needs('src/Mime.php');
}, 'tests' => ['Test' => function ($data, $shared) {
    $static = Mime::define('Bar');
    $instance = Mime::create('Bar')->onCall('foo')->give('bar');
    $static->onCall('foo')->give('bar');
    assert(\Bar::foo())->equals('bar');
    assert($instance()->foo())->equals('bar');
    $instance = $static->create()->onCall('foo')->give('bar');
    assert($instance()->foo())->equals('bar');
    $static->onNew('test', function ($mime) {
        $mime->onCall('foo')->give('foo');
    });
    $instance = new \Bar('test');
    assert($instance->foo())->equals('foo');
}]];
开发者ID:dotink,项目名称:parody,代码行数:22,代码来源:Test.php


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