522ad93440943dedebf33b95600791c8d923ca9c
[core.git] / framework / main / classes / iterator / registry / class_RegistryIterator.php
1 <?php
2 // Own namespace
3 namespace CoreFramework\Iterator\Registry;
4
5 // Import framework stuff
6 use CoreFramework\Iterator\BaseIterator;
7 use CoreFramework\Registry\Register;
8
9 // Import SPL stuff
10 use \Iterator;
11
12 /**
13  * A Registry iterator
14  *
15  * @author              Roland Haeder <webmaster@ship-simu.org>
16  * @version             0.0.0
17  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2017 Core Developer Team
18  * @license             GNU GPL 3.0 or any newer version
19  * @link                http://www.ship-simu.org
20  *
21  * This program is free software: you can redistribute it and/or modify
22  * it under the terms of the GNU General Public License as published by
23  * the Free Software Foundation, either version 3 of the License, or
24  * (at your option) any later version.
25  *
26  * This program is distributed in the hope that it will be useful,
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29  * GNU General Public License for more details.
30  *
31  * You should have received a copy of the GNU General Public License
32  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
33  */
34 class RegistryIterator extends BaseIterator implements Iterator {
35         /**
36          * Protected constructor
37          *
38          * @return      void
39          */
40         protected function __construct () {
41                 // Call parent constructor
42                 parent::__construct(__CLASS__);
43         }
44
45         /**
46          * Creates an instance of this class
47          *
48          * @param       $registryInstance       An instance of a Register class
49          * @return      $iteratorInstance       An instance of a Iterator class
50          */
51         public final static function createRegistryIterator (Register $registryInstance) {
52                 // Get new instance
53                 $iteratorInstance = new RegistryIterator();
54
55                 // Set registry here
56                 $iteratorInstance->setRegistryInstance($registryInstance);
57
58                 // Return the prepared instance
59                 return $iteratorInstance;
60         }
61
62         /**
63          * Getter for current value from group or generic
64          *
65          * @return      $current        Current value in iteration
66          */
67         public function current () {
68                 // Default is null
69                 $current = null;
70
71                 $this->partialStub('Please implement this method.');
72
73                 // Return it
74                 return $current;
75         }
76
77         /**
78          * Getter for key from group or generic
79          *
80          * @return      $key    Current key in iteration
81          */
82         public function key () {
83                 // Default is null
84                 $key = null;
85
86                 $this->partialStub('Please implement this method.');
87
88                 // Return it
89                 return $key;
90         }
91
92         /**
93          * Advances to the next entry
94          *
95          * @return      void
96          */
97         public function next () {
98                 $this->partialStub('Please implement this method.');
99         }
100
101         /**
102          * Rewinds to the beginning of the iteration
103          *
104          * @return      void
105          */
106         public function rewind () {
107                 $this->partialStub('Please implement this method.');
108         }
109
110         /**
111          * Checks wether the current entry is valid (not at the end of the list)
112          *
113          * @return      void
114          */
115         public function valid () {
116                 $this->partialStub('Please implement this method.');
117         }
118
119 }