Skip to content
Snippets Groups Projects
Commit 78948bfd authored by Demian Katz's avatar Demian Katz
Browse files

Eliminate static factory for export.

parent 3fe53b5b
No related merge requests found
...@@ -301,7 +301,7 @@ $config = [ ...@@ -301,7 +301,7 @@ $config = [
'VuFind\Db\AdapterFactory' => 'VuFind\Service\Factory::getDbAdapterFactory', 'VuFind\Db\AdapterFactory' => 'VuFind\Service\Factory::getDbAdapterFactory',
'VuFind\Db\Row\PluginManager' => 'VuFind\ServiceManager\AbstractPluginManagerFactory', 'VuFind\Db\Row\PluginManager' => 'VuFind\ServiceManager\AbstractPluginManagerFactory',
'VuFind\Db\Table\PluginManager' => 'VuFind\ServiceManager\AbstractPluginManagerFactory', 'VuFind\Db\Table\PluginManager' => 'VuFind\ServiceManager\AbstractPluginManagerFactory',
'VuFind\Export' => 'VuFind\Service\Factory::getExport', 'VuFind\Export' => 'VuFind\ExportFactory',
'VuFind\Favorites\FavoritesService' => 'VuFind\Favorites\FavoritesServiceFactory', 'VuFind\Favorites\FavoritesService' => 'VuFind\Favorites\FavoritesServiceFactory',
'VuFind\HierarchyDriverPluginManager' => 'VuFind\Service\Factory::getHierarchyDriverPluginManager', 'VuFind\HierarchyDriverPluginManager' => 'VuFind\Service\Factory::getHierarchyDriverPluginManager',
'VuFind\HierarchyTreeDataFormatterPluginManager' => 'VuFind\Service\Factory::getHierarchyTreeDataFormatterPluginManager', 'VuFind\HierarchyTreeDataFormatterPluginManager' => 'VuFind\Service\Factory::getHierarchyTreeDataFormatterPluginManager',
......
<?php
/**
* Export factory.
*
* PHP version 5
*
* Copyright (C) Villanova University 2018.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category VuFind
* @package Export
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development Wiki
*/
namespace VuFind;
use Interop\Container\ContainerInterface;
use Zend\ServiceManager\Factory\FactoryInterface;
/**
* Export factory.
*
* @category VuFind
* @package Export
* @author Demian Katz <demian.katz@villanova.edu>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development Wiki
*/
class ExportFactory implements FactoryInterface
{
/**
* Create an object
*
* @param ContainerInterface $container Service manager
* @param string $requestedName Service being created
* @param null|array $options Extra options (optional)
*
* @return object
*
* @throws ServiceNotFoundException if unable to resolve the service.
* @throws ServiceNotCreatedException if an exception is raised when
* creating a service.
* @throws ContainerException if any other error occurs
*/
public function __invoke(ContainerInterface $container, $requestedName,
array $options = null
) {
if (!empty($options)) {
throw new \Exception('Unexpected options sent to factory.');
}
return new $requestedName(
$container->get('VuFind\Config\PluginManager')->get('config'),
$container->get('VuFind\Config\PluginManager')->get('export')
);
}
}
...@@ -115,21 +115,6 @@ class Factory ...@@ -115,21 +115,6 @@ class Factory
); );
} }
/**
* Construct the export helper.
*
* @param ServiceManager $sm Service manager.
*
* @return \VuFind\Export
*/
public static function getExport(ServiceManager $sm)
{
return new \VuFind\Export(
$sm->get('VuFind\Config\PluginManager')->get('config'),
$sm->get('VuFind\Config\PluginManager')->get('export')
);
}
/** /**
* Generic plugin manager factory (support method). * Generic plugin manager factory (support method).
* *
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment