本文整理汇总了PHP中Joomla\DI\Container::isShared方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::isShared方法的具体用法?PHP Container::isShared怎么用?PHP Container::isShared使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Joomla\DI\Container
的用法示例。
在下文中一共展示了Container::isShared方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDecorateArbitraryInteropContainerModes
/**
* @testdox Resources from an arbitrary Interop compatible container are 'shared' and 'protected'
*/
public function testDecorateArbitraryInteropContainerModes()
{
$container = new Container(new \ArbitraryInteropContainer());
$this->assertTrue($container->isShared('aic_foo'), "'aic_foo' is expected to be shared");
$this->assertTrue($container->isProtected('aic_foo'), "'aic_foo' is expected to be protected");
}
示例2: testShareProtected
/**
* @testdox The convenience method share() sets resources as protected when passed true as third arg
*/
public function testShareProtected()
{
$container = new Container();
$container->share('foo', function () {
return new \StdClass();
}, true);
$this->assertTrue($container->isShared('foo'));
$this->assertTrue($container->isProtected('foo'));
}