本文整理匯總了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');
}