renamed lib-local.php -> lib-lfdb.php because it really loads the "legendary"
[core.git] / inc / main / classes / visitor / tasks / class_ShutdownTaskVisitor.php
1 <?php
2 // Own namespace
3 namespace CoreFramework\Visitor\Task\Shutdown;
4
5 /**
6  * An ShutdownTask visitor
7  *
8  * @author              Roland Haeder <webmaster@shipsimu.org>
9  * @version             0.0.0
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
13  *
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.
18  *
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.
23  *
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/>.
26  */
27 class ShutdownTaskVisitor extends BaseVisitor implements TaskVisitor, PoolVisitor, ListenerVisitor, DecoratorVisitor {
28         /**
29          * Protected constructor
30          *
31          * @return      void
32          */
33         protected function __construct () {
34                 // Call parent constructor
35                 parent::__construct(__CLASS__);
36
37                 // Set visitor mode
38                 $this->setVisitorMode('task');
39         }
40
41         /**
42          * Creates an instance of this class
43          *
44          * @return      $visitorInstance                An instance a Visitorable class
45          */
46         public static final function createShutdownTaskVisitor () {
47                 // Get new instance
48                 $visitorInstance = new ShutdownTaskVisitor();
49
50                 // Return the prepared instance
51                 return $visitorInstance;
52         }
53
54         /**
55          * Visits the given task instance
56          *
57          * @param       $taskInstance   A Taskable instance
58          * @return      void
59          */
60         public function visitTask (Taskable $taskInstance) {
61                 // Shutdown the task instance
62                 $taskInstance->doShutdown();
63         }
64
65         /**
66          * Pool visitor method for active tasks
67          *
68          * @param       $poolInstance   A Poolable instance
69          * @return      void
70          */
71         public function visitPool (Poolable $poolInstance) {
72                 // Shutdown the pool instance
73                 $poolInstance->doShutdown();
74         }
75
76         /**
77          * Visits the given listener instance
78          *
79          * @param       $listenerInstance       A Listenable instance
80          * @return      void
81          */
82         public function visitListener (Listenable $listenerInstance) {
83                 // Shutdown the listener instance
84                 $listenerInstance->doShutdown();
85         }
86
87         /**
88          * Visits the given decorator instance
89          *
90          * @param       $decoratorInstance      A decorator instance
91          * @return      void
92          */
93         public function visitDecorator (BaseDecorator $decoratorInstance) {
94                 // Shutdown the decorator instance
95                 $decoratorInstance->doShutdown();
96         }
97
98 }