| Current Path : /var/www/clients/client3/web2/web/lists/admin/plugins/SegmentPlugin/ |
| Current File : /var/www/clients/client3/web2/web/lists/admin/plugins/SegmentPlugin/ControllerFactory.php |
<?php
/**
* SegmentPlugin for phplist.
*
* This file is a part of SegmentPlugin.
*
* SegmentPlugin is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* CriteriaPlugin 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.
*
* @category phplist
*
* @author Duncan Cameron
* @copyright 2018 Duncan Cameron
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, Version 3
*/
namespace phpList\plugin\SegmentPlugin;
use phpList\plugin\Common\Container;
use phpList\plugin\Common\ControllerFactoryBase;
class ControllerFactory extends ControllerFactoryBase
{
/**
* Custom implementation to create a controller using plugin and page.
* The controller is created by the dependency injection container.
*
* @param string $pi the plugin
* @param array $params further parameters from the URL
*
* @return \phpList\plugin\Common\Controller
*/
public function createController($pi, array $params)
{
$depends = include __DIR__ . '/depends.php';
$container = new Container($depends);
$class = __NAMESPACE__ . '\Controller\\' . ucfirst($params['page']);
return $container->get($class);
}
}