* @param $pointerInstance An instance of an FilePointer class
* @return void
*/
- protected final function setPointerInstance (FilePointer $pointerInstance) {
+ protected final function setPointerInstance (FilePointer $pointerInstance = NULL) {
$this->pointerInstance = $pointerInstance;
}
* @return void
*/
protected final function unsetPointerInstance () {
- // Simply it to NULL
- $this->pointerInstance = NULL;
+ // Simply invoke setter with no parameter
+ $this->setPointerInstance();
}
/**
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Handler\BaseHandler;
-use Org\Mxchange\CoreFramework\Lists\Listable;
use Org\Mxchange\CoreFramework\Registry\Registerable;
use Org\Mxchange\CoreFramework\Task\Taskable;
use Org\Mxchange\CoreFramework\Traits\Iterator\IteratorTrait;
+use Org\Mxchange\CoreFramework\Traits\Lists\ListableTrait;
+use Org\Mxchange\CoreFramework\Traits\Visitor\VisitorTrait;
use Org\Mxchange\CoreFramework\Visitor\Visitable;
-use Org\Mxchange\CoreFramework\Visitor\Visitor;
/**
* A Task handler
class TaskHandler extends BaseHandler implements Registerable, HandleableTask {
// Load traits
use IteratorTrait;
+ use ListableTrait;
+ use VisitorTrait;
// Exception constants
const EXCEPTION_TASK_IS_INVALID = 0xb00;
- /**
- * Visitor handler instance
- */
- private $visitorInstance = NULL;
-
- /**
- * Instance of the list
- */
- private $listInstance = NULL;
-
/**
* Protected constructor
*
return $handlerInstance;
}
- /**
- * Setter for visitor instance
- *
- * @param $visitorInstance An instance of a Visitor class
- * @return void
- */
- protected final function setVisitorInstance (Visitor $visitorInstance) {
- $this->visitorInstance = $visitorInstance;
- }
-
- /**
- * Getter for visitor instance
- *
- * @return $visitorInstance An instance of a Visitor class
- */
- protected final function getVisitorInstance () {
- return $this->visitorInstance;
- }
-
- /**
- * Setter for the list instance
- *
- * @param $listInstance A list of Listable
- * @return void
- */
- protected final function setListInstance (Listable $listInstance) {
- $this->listInstance = $listInstance;
- }
-
- /**
- * Getter for the list instance
- *
- * @return $listInstance A list of Listable
- */
- protected final function getListInstance () {
- return $this->listInstance;
- }
-
/**
* Tries to execute the given task. If as task should not be started (yet)
* or the interval time (see task_interval_delay) is not yet reached the
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\Lists;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Lists\Listable;
+
+/**
+ * A trait for lists
+ *
+ * @author Roland Haeder <webmaster@shipsimu.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.shipsimu.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 ListableTrait {
+ /**
+ * Instance of the list
+ */
+ private $listInstance = NULL;
+
+ /**
+ * Setter for the list instance
+ *
+ * @param $listInstance A list of Listable
+ * @return void
+ */
+ protected final function setListInstance (Listable $listInstance) {
+ $this->listInstance = $listInstance;
+ }
+
+ /**
+ * Getter for the list instance
+ *
+ * @return $listInstance A list of Listable
+ */
+ protected final function getListInstance () {
+ return $this->listInstance;
+ }
+
+}
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\Visitor;
+
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Visitor\Visitor;
+
+/**
+ * A trait for visitors
+ *
+ * @author Roland Haeder <webmaster@shipsimu.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.shipsimu.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 VisitorTrait {
+ /**
+ * Visitor handler instance
+ */
+ private $visitorInstance = NULL;
+
+ /**
+ * Setter for visitor instance
+ *
+ * @param $visitorInstance An instance of a Visitor class
+ * @return void
+ */
+ protected final function setVisitorInstance (Visitor $visitorInstance) {
+ $this->visitorInstance = $visitorInstance;
+ }
+
+ /**
+ * Getter for visitor instance
+ *
+ * @return $visitorInstance An instance of a Visitor class
+ */
+ protected final function getVisitorInstance () {
+ return $this->visitorInstance;
+ }
+
+}