* @copyright Copyright (c) 2012 University of Maine * @license http://www.opensource.org/licenses/mit-license.php MIT License */ namespace DOMPDFModule\Mvc\Service; use Zend\ServiceManager\FactoryInterface; use Zend\ServiceManager\ServiceLocatorInterface; use DOMPDFModule\View\Strategy\PdfStrategy; class ViewPdfStrategyFactory implements FactoryInterface { /** * Create and return the PDF view strategy * * Retrieves the ViewPdfRenderer service from the service locator, and * injects it into the constructor for the PDF strategy. * * @param ServiceLocatorInterface $serviceLocator * @return PdfStrategy */ public function createService(ServiceLocatorInterface $serviceLocator) { $pdfRenderer = $serviceLocator->get('ViewPdfRenderer'); $pdfStrategy = new PdfStrategy($pdfRenderer); return $pdfStrategy; } }