3 namespace CoreFramework\Visitor\Task\Shutdown;
6 * An ShutdownTask visitor
8 * @author Roland Haeder <webmaster@shipsimu.org>
10 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
11 * @license GNU GPL 3.0 or any newer version
12 * @link http://www.shipsimu.org
14 * This program is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program. If not, see <http://www.gnu.org/licenses/>.
27 class ShutdownTaskVisitor extends BaseVisitor implements TaskVisitor, PoolVisitor, ListenerVisitor, DecoratorVisitor {
29 * Protected constructor
33 protected function __construct () {
34 // Call parent constructor
35 parent::__construct(__CLASS__);
38 $this->setVisitorMode('task');
42 * Creates an instance of this class
44 * @return $visitorInstance An instance a Visitorable class
46 public static final function createShutdownTaskVisitor () {
48 $visitorInstance = new ShutdownTaskVisitor();
50 // Return the prepared instance
51 return $visitorInstance;
55 * Visits the given task instance
57 * @param $taskInstance A Taskable instance
60 public function visitTask (Taskable $taskInstance) {
61 // Shutdown the task instance
62 $taskInstance->doShutdown();
66 * Pool visitor method for active tasks
68 * @param $poolInstance A Poolable instance
71 public function visitPool (Poolable $poolInstance) {
72 // Shutdown the pool instance
73 $poolInstance->doShutdown();
77 * Visits the given listener instance
79 * @param $listenerInstance A Listenable instance
82 public function visitListener (Listenable $listenerInstance) {
83 // Shutdown the listener instance
84 $listenerInstance->doShutdown();
88 * Visits the given decorator instance
90 * @param $decoratorInstance A decorator instance
93 public function visitDecorator (BaseDecorator $decoratorInstance) {
94 // Shutdown the decorator instance
95 $decoratorInstance->doShutdown();