本文整理汇总了PHP中Zend\Barcode\Barcode::getObjectPluginManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Barcode::getObjectPluginManager方法的具体用法?PHP Barcode::getObjectPluginManager怎么用?PHP Barcode::getObjectPluginManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Barcode\Barcode
的用法示例。
在下文中一共展示了Barcode::getObjectPluginManager方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Creates and draws a barcode (wrapping the Zend Barcode component).
*
* @param mixed $barcode String name of barcode class, or Traversable object.
* @param mixed $barcodeConfig An array or Traversable object with barcode parameters.
* @param mixed $rendererConfig An array or Traversable object with renderer parameters.
* @param boolean $automaticRenderError Set the automatic rendering of exception
* @return resource
**/
public function create($barcode, $barcodeConfig = array(), $rendererConfig = array(), $automaticRenderError = true)
{
$renderer = new ImageRenderer($rendererConfig);
//make sure Zend object plugin manager does not share created barcode object
$objectPluginManager = Barcode::getObjectPluginManager();
$originallySharedByDefault = $objectPluginManager->shareByDefault();
if ($originallySharedByDefault) {
$objectPluginManager->setShareByDefault(false);
}
$barcodeObject = $objectPluginManager->get($barcode, $barcodeConfig);
if ($originallySharedByDefault) {
//reset object plugin manager
$objectPluginManager->setShareByDefault(true);
}
$renderer->setBarcode($barcodeObject);
return new GdImage($renderer->draw(), new RGB(), new MetadataBag());
}
示例2: testBarcodeObjectFactoryWithNamespaceButWithoutExtendingObjectAbstract
public function testBarcodeObjectFactoryWithNamespaceButWithoutExtendingObjectAbstract()
{
$plugins = Barcode\Barcode::getObjectPluginManager();
$plugins->setInvokableClass('barcodeNamespaceWithoutExtendingObjectAbstract', 'ZendTest\\Barcode\\Object\\TestAsset\\BarcodeNamespaceWithoutExtendingObjectAbstract');
$this->setExpectedException('\\Zend\\Barcode\\Exception\\ExceptionInterface');
$barcode = Barcode\Barcode::makeBarcode('barcodeNamespaceWithoutExtendingObjectAbstract');
}