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


PHP Bar::get方法代码示例

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


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

示例1: of

    }
    public function of($target)
    {
        return HermitDaoManager::get($target);
    }
}
class Foo
{
    public function get()
    {
        return HermitDaoManager::get(__CLASS__);
    }
}
class Bar
{
    public function get()
    {
        return HermitDaoManager::get(__CLASS__);
    }
}
$hoge = new Hoge();
$foo = new Foo();
$bar = new Bar();
$test->is($hoge->get(), 'A01Dao');
$test->is($hoge->of('Foo'), 'A02Dao');
$test->is($foo->get(), 'A02Dao');
$test->is($bar->get(), null);
$test->is(HermitDaoManager::has('Hoge'), true);
$test->is(HermitDaoManager::has('Foo'), true);
$test->is(HermitDaoManager::has('A01Dao'), false);
$test->is(HermitDaoManager::has('A02Dao'), false);
开发者ID:nowelium,项目名称:Hermit,代码行数:31,代码来源:DaoManagerTest.php

示例2: testUnset

	public function testUnset()
	{
		$foo = Foo::get('foo3');
		$this->assertEquals(2, count($foo->bars));
		$this->assertEquals('Bar 1', $foo->bars[0]->barbar);
		$this->assertEquals('Bar 2', $foo->bars[1]->barbar);
		
		unset($foo->bars[0]);
		
		$foo = Foo::get('foo3');
		$bar = Bar::get('bar 1');
		$this->assertEquals(1, count($foo->bars));
		$this->assertEquals('Bar 2', $foo->bars[0]->barbar);
		
		$this->assertEquals(1, count($bar->foos));
		$this->assertEquals('Foo 2', $bar->foos[0]->foofoo);
	}
开发者ID:nathansamson,项目名称:CoOrg,代码行数:17,代码来源:many2many.Test.php

示例3: var_dump

var_dump($person3);
class Foo
{
    protected static $prop = 'Foo';
    public static function get()
    {
        echo static::$prop;
        //        Если бы тут был self то наследуемый класс тоже давал бы Foo
    }
}
class Bar extends Foo
{
    protected static $prop = 'Bar';
}
Foo::get();
Bar::get();
class Team
{
    protected $developers = [];
    //    Всегда лучше всё закрывать, то есть лучше использовать protected
    //    Сначала всё закрывать, потом открывать
    public function addDeveloper(Developer $developer)
    {
        array_push($this->developers, $developer);
    }
}
$team = new Team();
//$team->addDeveloper($person);
$team->addDeveloper($person3);
//$team->addDeveloper(666);
var_dump($team);
开发者ID:itmo-it-group-305,项目名称:sergey.poliakov-blog,代码行数:31,代码来源:oop.php

示例4: testBatchSave

	public function testBatchSave()
	{
		$foo = new Foo;
		$foo->ID = 'SomeFoo';
		// No foofoo -> invalid
		
		$bar = new Bar;
		$bar->ID = 'Somebar';
		$bar->barbar = '...';
		$bar->foo = $foo;
		
		try
		{
			DBModel::batchSave(array($foo, $bar));
			$this->fail('Expected exception');
		}
		catch (ValidationException $e)
		{
			$bar2 = Bar::get('Somebar');
			$foo2 = Foo::get('SomeFoo');
			$this->assertNull($bar2);
			$this->assertNull($foo2);
			
			$this->assertEquals('FooFoo is required', $foo->foofoo_error);
		}
	}
开发者ID:nathansamson,项目名称:CoOrg,代码行数:26,代码来源:one2one.Test.php

示例5: ping

<?php

require "tests.php";
require "director_unroll.php";
// No new functions
check::functions(array(foo_ping, foo_pong));
// No new classes
check::classes(array(Foo, Bar));
// now new vars
check::globals(array(bar));
class MyFoo extends Foo
{
    function ping()
    {
        return "MyFoo::ping()";
    }
}
$a = new MyFoo();
$b = new Bar();
$b->set($a);
$c = $b->get();
check::equal($a->this, $c->this, "this failed");
check::done();
开发者ID:daxiazh,项目名称:swig,代码行数:23,代码来源:director_unroll_runme.php

示例6: Foo

<?php

use js\tools\commons\traits\DataWriter;
use js\tools\commons\traits\StaticDataWriter;
require __DIR__ . '/../autoloader.php';
class Foo
{
    use DataWriter;
}
class Bar
{
    use StaticDataWriter;
}
$foo = new Foo();
$foo->set('a.b.c', 'foo');
var_dump($foo->getArray('a.b'));
var_dump($foo->get('a.b.c'));
Bar::set('a.b.c', 'bar');
var_dump(Bar::getArray('a.b'));
var_dump(Bar::get('a.b.c'));
开发者ID:jurchiks,项目名称:commons,代码行数:20,代码来源:example.php

示例7: call

<?php

class Foo
{
    static function call()
    {
        return 'fail';
    }
    static function test()
    {
        return static::call();
    }
    static function get()
    {
        return new static();
    }
}
class Bar extends Foo
{
    static function call()
    {
        return 'success';
    }
}
$bar = Bar::get();
if (!$bar instanceof Bar) {
    return 'fail_get';
}
return Bar::test();
开发者ID:lihuibin,项目名称:jphp,代码行数:29,代码来源:static.php


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