本文整理匯總了PHP中Zend\View\HelperPluginManager::setInvokableClass方法的典型用法代碼示例。如果您正苦於以下問題:PHP HelperPluginManager::setInvokableClass方法的具體用法?PHP HelperPluginManager::setInvokableClass怎麽用?PHP HelperPluginManager::setInvokableClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\View\HelperPluginManager
的用法示例。
在下文中一共展示了HelperPluginManager::setInvokableClass方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testCompatibilityWithZF2View
public function testCompatibilityWithZF2View()
{
$renderer = new PhpRenderer();
$helpers = new HelperPluginManager();
$name = $this->jobleadsHelper->getName();
$helpers->setInvokableClass($name, get_class($this->jobleadsHelper));
$renderer->setHelperPluginManager($helpers);
$this->assertEquals(self::EXPECTED_RETURN, $renderer->{$name}());
}
示例2: testCanCreateServiceWithName
public function testCanCreateServiceWithName()
{
$moduleOptions = new ModuleOptions(['view_helpers' => ['headLink' => ['proxy' => TestProxy::class]]]);
$sm = new ServiceManager();
$sm->setService(ModuleOptions::class, $moduleOptions);
$viewHelperManager = new HelperPluginManager();
$viewHelperManager->setServiceLocator($sm);
$viewHelperManager->setInvokableClass(TestProxy::class, TestProxy::class);
$factory = new ViewHelperProxyAbstractFactory();
$this->assertTrue($factory->canCreateServiceWithName($viewHelperManager, TestProxy::class, TestProxy::class));
$this->assertFalse($factory->canCreateServiceWithName($viewHelperManager, 'not-exist', 'not-exist'));
}
示例3: registerPlugin
/**
* Set invokable class
*
* @param string $name
* @param string $invokableClass
* @return $this
*/
public function registerPlugin($name, $invokableClass)
{
$this->hpm->setInvokableClass($name, $invokableClass);
return $this;
}