|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * Factory for IssueMaker |
| 5 | + * |
| 6 | + * PHP version 7 |
| 7 | + * |
| 8 | + * Copyright (C) Demian Katz 2025. |
| 9 | + * |
| 10 | + * This program is free software; you can redistribute it and/or modify |
| 11 | + * it under the terms of the GNU General Public License version 2, |
| 12 | + * as published by the Free Software Foundation. |
| 13 | + * |
| 14 | + * This program is distributed in the hope that it will be useful, |
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | + * GNU General Public License for more details. |
| 18 | + * |
| 19 | + * You should have received a copy of the GNU General Public License |
| 20 | + * along with this program; if not, write to the Free Software |
| 21 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 22 | + * |
| 23 | + * @category GeebyDeeby |
| 24 | + * @package Console |
| 25 | + * @author Demian Katz <demian.katz@villanova.edu> |
| 26 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
| 27 | + * @link https://github.com/demiankatz/Geeby-Deeby Main Site |
| 28 | + */ |
| 29 | + |
| 30 | +namespace GeebyDeebyLocal\Ingest; |
| 31 | + |
| 32 | +use Interop\Container\ContainerInterface; |
| 33 | +use Laminas\ServiceManager\Factory\FactoryInterface; |
| 34 | + |
| 35 | +/** |
| 36 | + * Factory for IssueMaker |
| 37 | + * |
| 38 | + * @category GeebyDeeby |
| 39 | + * @package Console |
| 40 | + * @author Demian Katz <demian.katz@villanova.edu> |
| 41 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License |
| 42 | + * @link https://github.com/demiankatz/Geeby-Deeby Main Site |
| 43 | + */ |
| 44 | +class IssueMakerFactory implements FactoryInterface |
| 45 | +{ |
| 46 | + /** |
| 47 | + * Create an object |
| 48 | + * |
| 49 | + * @param ContainerInterface $container Service manager |
| 50 | + * @param string $requestedName Service being created |
| 51 | + * @param null|array $options Extra options (optional) |
| 52 | + * |
| 53 | + * @return object |
| 54 | + * |
| 55 | + * @throws ServiceNotFoundException if unable to resolve the service. |
| 56 | + * @throws ServiceNotCreatedException if an exception is raised when |
| 57 | + * creating a service. |
| 58 | + * @throws ContainerException if any other error occurs |
| 59 | + */ |
| 60 | + public function __invoke( |
| 61 | + ContainerInterface $container, |
| 62 | + $requestedName, |
| 63 | + array $options = null |
| 64 | + ) { |
| 65 | + if (!empty($options)) { |
| 66 | + throw new \Exception('Unexpected options sent to factory.'); |
| 67 | + } |
| 68 | + $dbManager = $container->get(\GeebyDeeby\Db\Table\PluginManager::class); |
| 69 | + return new $requestedName( |
| 70 | + $dbManager, |
| 71 | + $container->get(\GeebyDeeby\Articles::class) |
| 72 | + ); |
| 73 | + } |
| 74 | +} |
0 commit comments