use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
use Org\Mxchange\CoreFramework\Generic\NullPointerException;
use Org\Mxchange\CoreFramework\Iterator\BaseIterator;
-use Org\Mxchange\CoreFramework\Registry\Register;
use Org\Mxchange\CoreFramework\Registry\Registerable;
use Org\Mxchange\CoreFramework\Registry\Sub\SubRegistry;
+use Org\Mxchange\CoreFramework\Traits\Registry\RegisterTrait;
// Import SPL stuff
use \BadMethodCallException;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class RegistryIterator extends BaseIterator implements IteratableRegistry {
+ // Load traits
+ use RegisterTrait;
+
/**
* All found registry keys
*/
*/
private $key = NULL;
- /**
- * Registry instance (implementing Register)
- */
- private $registryInstance = NULL;
-
/**
* Protected constructor
*
return $iteratorInstance;
}
- /**
- * Setter for registry instance
- *
- * @param $registryInstance An instance of a Register class
- * @return void
- */
- protected final function setRegistryInstance (Register $registryInstance) {
- $this->registryInstance = $registryInstance;
- }
-
- /**
- * Getter for registry instance
- *
- * @return $registryInstance The debug registry instance
- */
- protected final function getRegistryInstance () {
- return $this->registryInstance;
- }
-
/**
* Setter for only-registries array
*
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\Registry;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Registry\Register;
+
+/**
+ * A trait for registries
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program 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.
+ *
+ * This program 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+trait RegisterTrait {
+ /**
+ * Registry instance (implementing Register)
+ */
+ private $registryInstance = NULL;
+
+ /**
+ * Setter for registry instance
+ *
+ * @param $registryInstance An instance of a Register class
+ * @return void
+ */
+ protected final function setRegistryInstance (Register $registryInstance) {
+ $this->registryInstance = $registryInstance;
+ }
+
+ /**
+ * Getter for registry instance
+ *
+ * @return $registryInstance The debug registry instance
+ */
+ protected final function getRegistryInstance () {
+ return $this->registryInstance;
+ }
+
+}