當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。