本文整理汇总了PHP中Bar类的典型用法代码示例。如果您正苦于以下问题:PHP Bar类的具体用法?PHP Bar怎么用?PHP Bar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Bar类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: test
public function test()
{
$bar = new Bar();
$bar->setMessage('foobar');
$this->assertEquals('foobar', $bar->getMessage());
$this->assertEquals('foobar', $bar->message);
}
开发者ID:tempbottle,项目名称:owl,代码行数:7,代码来源:DecoratorTest.php
示例2: doSomething
public function doSomething()
{
$this->logger->info("Entering application.");
$bar = new Bar();
$bar->doIt();
echo "<p>done</p>";
$this->logger->info("Exiting application.");
}
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:8,代码来源:testlogger.php
示例3: main
function main()
{
$k = new Bar();
$y = new Baz();
foo();
$k->asd();
$y->k();
}
开发者ID:badlamer,项目名称:hhvm,代码行数:8,代码来源:constants.php
示例4: read
function read($id)
{
global $output;
$output .= "read" . PHP_EOL;
$a = new Bar();
$b = new Foo($a);
$a->set($b);
$session = array('old' => $b);
return msgpack_serialize($session);
}
开发者ID:chenyongze,项目名称:msgpack-hhvm,代码行数:10,代码来源:028d.php
示例5: eraseData
protected function eraseData()
{
Foo::truncate();
Bar::truncate();
Baz::truncate();
Bom::truncate();
}
开发者ID:leloulight,项目名称:trigglog,代码行数:7,代码来源:TestCase.php
示例6: invoke
public static function invoke(Foo $instance)
{
// Same class, other instance, direct call.
$instance->call();
// Same class, other instance, indirect call.
$foo = new Foo();
$foo->call();
// Same class, other instance, indirect call.
$x = new Foo();
$y = $x;
$z = $y;
$z->call();
// Same class, other instance, direct call.
(new Foo())->call();
// Other class, other instance, indirect call.
$bar = new Bar();
$bar->call();
// Other class, other instance, direct call.
(new Bar())->call();
}
开发者ID:basilfx,项目名称:php-obfuscator,代码行数:20,代码来源:private_public_methods.in.php
示例7: test_decorator
public function test_decorator()
{
$foo = new Foo();
$bar = Bar::wrap($foo);
// internal object
$this->assertEquals($foo, $bar->object);
// original property
$this->assertEquals($bar->a1, 10);
// new property
$this->assertEquals($bar->b, 20);
// redifine original property
$this->assertEquals($bar->a2, 22);
// original function
$this->assertEquals($bar->fooFunction(), 14);
// isset
$this->assertTrue(isset($bar->b));
$this->assertTrue(isset($bar->a1));
}
开发者ID:igaster,项目名称:eloquent-decorator,代码行数:18,代码来源:DecoratorTest.php
示例8: __construct
/**
* Bar constructor.
* @param Session $session
* @param string[] $barData
*/
public function __construct($session, $barData)
{
$this->Session = $session;
$this->DB = $session->DB;
if (empty(array_diff_key(Bar::ValidArray(), $barData))) {
//Loading an existing bar
$this->Refresh($barData);
$this->Valid = true;
} else {
if (empty(array_diff_key(Bar::NewArray(), $barData))) {
//Creating a new bar
$this->Type = $barData['type'];
$this->Title = $barData['title'];
$this->Description = $barData['description'];
$this->CreateStamp = $this->ModifyStamp = (double) microtime(true);
$id = (int) $this->DB->Query("\n INSERT INTO tblBars\n (userID, type, title, description, createStamp, modifyStamp)\n VALUES(\n " . (int) $this->Session->ID . "\n , " . $this->DB->Quote($this->Type) . "\n , " . $this->DB->Quote($this->Title) . "\n , " . $this->DB->Quote($this->Description) . "\n , {$this->CreateStamp}\n , {$this->ModifyStamp}\n )\n ", true);
if ($id) {
$this->ID = $id;
$this->Valid = true;
}
}
}
}
开发者ID:bnorm-software,项目名称:barkeep-backend,代码行数:28,代码来源:CLASS_Bar.php
示例9: getFooWithInlineService
/**
* Gets the 'foo_with_inline' service.
*
* This service is shared.
* This method always returns the same instance of the service.
*
* @return \Foo A Foo instance
*/
protected function getFooWithInlineService()
{
$a = new \Bar();
$this->services['foo_with_inline'] = $instance = new \Foo();
$a->setBaz($this->get('baz'));
$a->pub = 'pub';
$instance->setBar($a);
return $instance;
}
开发者ID:xing393939,项目名称:Laravel-5-Bootstrap-3-Starter-Site,代码行数:17,代码来源:services9_compiled.php
示例10: test
<?php
require __DIR__ . "/classes.php.inc";
class Foo
{
public static function test() : A
{
return new A();
}
}
class Bar extends Foo
{
public static function test() : A
{
return new B();
}
}
var_dump(Bar::test());
var_dump(Foo::test());
开发者ID:gleamingthecube,项目名称:php,代码行数:19,代码来源:Zend_tests_return_types_inheritance008.php
示例11: array
$mail->Subject = 'Somebody sent you a token!';
$mail->Body = 'HEY YOU GUYS! LOOK WAT I DONE DID!!!!!!.';
$mail->AltBody = 'Received token.';
$email = $_POST['email'];
$name = $_POST['name'];
if (!$mail->send()) {
$message = 'Message could not be sent. <p>';
} else {
$message = 'Message has been sent.';
}
return $app['twig']->render("email.html.twig", array('message' => $message));
});
$app->post("/add_preferred_bar/{id}", function ($id) use($app) {
$user = Patron::find($id);
$all_bars = Bar::getAll();
$bar = Bar::find($_POST['add_bar']);
$user->addPreferredBar($bar);
return $app['twig']->render("patron.html.twig", array('user' => $user, 'user_tokens' => $user->getTokens(), 'all_bars' => $all_bars, 'preferred_bars' => true, 'send_token' => false, 'token_form' => false, 'edit_user' => false));
});
// $app->delete("/delete_preferred_bar/{id}/{bar_id}", function($id, $bar_id) use($app) {
// $user = Patron::find($id);
// $all_bars = Bar::getAll();
// $bar = Bar::find($bar_id);
// $user->deleteBar($bar);
// return $app['twig']->render("patron.html.twig", array(
// 'user' => $user,
// 'user_tokens' =>$user->getTokens(),
// 'all_bars' => $all_bars,
// 'preferred_bars' => false,
// 'send_token' => false,
// 'token_form' => false,
开发者ID:CaseyH33,项目名称:Beer_Me,代码行数:31,代码来源:app.php
示例12: pang
{
return "FooBar2::ping();";
}
function pang()
{
return "FooBar2::pang();";
}
}
class FooBar3 extends Bar
{
function cheer()
{
return "FooBar3::cheer();";
}
}
$b = new Bar();
$f = $b->create();
$fb = new FooBar();
$fb2 = new FooBar2();
$fb3 = new FooBar3();
check::equal($fb->used(), "Foo::pang();Bar::pong();Foo::pong();FooBar::ping();", "bad FooBar::used");
check::equal($fb2->used(), "FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();", "bad FooBar2::used");
check::equal($b->pong(), "Bar::pong();Foo::pong();Bar::ping();", "bad Bar::pong");
check::equal($f->pong(), "Bar::pong();Foo::pong();Bar::ping();", "bad Foo::pong");
check::equal($fb->pong(), "Bar::pong();Foo::pong();FooBar::ping();", "bad FooBar::pong");
$method = new ReflectionMethod('Bar', 'ping');
check::equal($method->isProtected(), true, "Foo::ping should be protected");
$method = new ReflectionMethod('Foo', 'ping');
check::equal($method->isProtected(), true, "Foo::ping should be protected");
$method = new ReflectionMethod('FooBar', 'pang');
check::equal($method->isProtected(), true, "FooBar::pang should be protected");
开发者ID:daxiazh,项目名称:swig,代码行数:31,代码来源:director_protected_runme.php
示例13: test_references
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
示例14: f
<?php
class Foo
{
protected function f()
{
return 'Foo';
}
}
trait T
{
public function f()
{
return 'Bar';
}
}
class Bar extends Foo
{
use T;
}
$b = new Bar();
echo $b->f() . "\n";
开发者ID:lsqtongxin,项目名称:hhvm,代码行数:22,代码来源:2114.php
示例15: function
}
});
//Sign Up Routes:
$app->get("/show_customer_signup", function () use($app) {
return $app['twig']->render('index.html.twig', array('about' => false, 'sign_up' => true, "sign_in" => false, 'team' => false, 'customer_signup' => true, 'business_signup' => false));
});
$app->get("/show_business_signup", function () use($app) {
return $app['twig']->render('index.html.twig', array('about' => false, 'sign_up' => true, "sign_in" => false, 'team' => false, 'customer_signup' => false, 'business_signup' => true));
});
$app->post("/customer_signup", function () use($app) {
$new_user = new Patron($_POST['username'], $_POST['email']);
$new_user->save();
return $app['twig']->render("signup_confirmation.html.twig");
});
$app->post("/business_signup", function () use($app) {
$new_bar = new Bar($_POST['name'], $_POST['phone'], $_POST['address'], $_POST['website']);
$new_bar->save();
return $app['twig']->render("signup_confirmation.html.twig");
});
//Get Show email search
$app->get("/show_email_search/{id}", function ($id) use($app) {
$user = Patron::find($id);
$all_bars = Bar::getAll();
return $app['twig']->render("patron.html.twig", array('user' => $user, 'user_tokens' => $user->getTokens(), 'all_bars' => $all_bars, 'preferred_bars' => false, 'send_token' => true, 'token_form' => false, 'edit_user' => false));
});
//Get Show User Tokens
$app->get("/show_user_tokens/{id}", function ($id) use($app) {
$user = Patron::find($id);
$tokens = $user->getTokens();
return $app['twig']->render("patron.html.twig", array('user' => $user, 'user_tokens' => $tokens, 'preferred_bars' => false, 'send_token' => false, 'token_form' => true, 'edit_user' => false));
});
开发者ID:kellimargaret,项目名称:Beer-Me,代码行数:31,代码来源:app.php
示例16: var_foo
<?php
require_once $GLOBALS['HACKLIB_ROOT'];
function var_foo($x)
{
$arg_arr = func_get_args();
return $x + count($arg_arr);
}
class Bar
{
public static function var_bar()
{
return count(func_get_args());
}
}
function var_php_variadic($foo, ...$bar)
{
return count($bar);
}
echo var_foo(5) . "\n";
echo var_foo(5, "hi", array(4, 2), null, true) . "\n";
echo Bar::var_bar(1, 2, 3) . "\n";
echo Bar::var_bar() . "\n";
echo var_php_variadic("10") . "\n";
echo var_php_variadic("10", 1, array()) . "\n";
echo var_php_variadic("10", 1, array(), ...array(1, 2, 3)) . "\n";
开发者ID:jeremyadoux,项目名称:hhvm,代码行数:26,代码来源:hack_variadic.php
示例17: printItem
<?php
class Foo
{
public function printItem($string)
{
echo 'Foo: ' . $string . PHP_EOL;
}
public function printPHP()
{
echo 'PHP is great.' . PHP_EOL;
}
}
class Bar extends Foo
{
public function printItem($string)
{
echo 'Bar: ' . $string . PHP_EOL;
}
}
$foo = new Foo();
$bar = new Bar();
$foo->printItem('baz');
// Output: 'Foo: baz'
$foo->printPHP();
// Output: 'PHP is great'
$bar->printItem('baz');
// Output: 'Bar: baz'
$bar->printPHP();
// Output: 'PHP is great'
开发者ID:jperezh,项目名称:paradigms2015,代码行数:30,代码来源:herency.php
示例18: __construct
}
class Foo
{
public function __construct()
{
Stat::getInstance();
}
}
class Error
{
private $trace;
public function __construct()
{
$this->trace = debug_backtrace(1);
}
}
class Bar
{
public function __destruct()
{
Stat::getInstance();
new Error();
}
public function test()
{
new Error();
}
}
$foo = new Foo();
$bar = new Bar();
$bar->test();
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:bug64720.php
示例19: doSomething
public function doSomething()
{
$bar = new Bar();
$bar->doSomething();
echo __METHOD__;
}
开发者ID:breezelife0,项目名称:mycode,代码行数:6,代码来源:bad.php
示例20: f
<?php
class Foo
{
public final function f()
{
return 'Foo';
}
}
class Bar extends Foo
{
public final function f()
{
return 'Bar';
}
}
$bar = new Bar();
echo $bar->f() . "\n";
开发者ID:badlamer,项目名称:hhvm,代码行数:18,代码来源:final_method1.php
注:本文中的Bar类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论