]> git.mxchange.org Git - core.git/commitdiff
also added BaseInfo and ConnectionInfo, now bound to BaseFrameworkSystem
authorRoland Häder <roland@mxchange.org>
Fri, 19 May 2017 16:15:32 +0000 (18:15 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 19 May 2017 16:16:12 +0000 (18:16 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
framework/main/classes/info/.htaccess [new file with mode: 0644]
framework/main/classes/info/class_ [new file with mode: 0644]
framework/main/classes/info/class_BaseInfo.php [new file with mode: 0644]
framework/main/classes/info/connection/.htaccess [new file with mode: 0644]
framework/main/classes/info/connection/class_ConnectionInfo.php [new file with mode: 0644]
framework/main/interfaces/shareable/info/class_ShareableInfo.php

diff --git a/framework/main/classes/info/.htaccess b/framework/main/classes/info/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/framework/main/classes/info/class_ b/framework/main/classes/info/class_
new file mode 100644 (file)
index 0000000..b1926e1
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+/**
+ * A ??? information class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub 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/>.
+ */
+class ???Info extends BaseInfo implements ShareableInfo {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $infoInstance   An instance of a ShareableInfo class
+        */
+       public final static function create???Info () {
+               // Get new instance
+               $infoInstance = new ???Info();
+
+               // Return the prepared instance
+               return $infoInstance;
+       }
+
+}
diff --git a/framework/main/classes/info/class_BaseInfo.php b/framework/main/classes/info/class_BaseInfo.php
new file mode 100644 (file)
index 0000000..dad5870
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+// Own namespace
+namespace CoreFramework\Information;
+
+// Import hub-specific stuff
+use CoreFramework\Object\BaseFrameworkSystem;
+
+/**
+ * A general Info class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub 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/>.
+ */
+class BaseInfo extends BaseFrameworkSystem {
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Name of the class
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+       }
+
+}
diff --git a/framework/main/classes/info/connection/.htaccess b/framework/main/classes/info/connection/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/framework/main/classes/info/connection/class_ConnectionInfo.php b/framework/main/classes/info/connection/class_ConnectionInfo.php
new file mode 100644 (file)
index 0000000..5443ece
--- /dev/null
@@ -0,0 +1,119 @@
+<?php
+// Own namespace
+namespace CoreFramework\Information\Connection;
+
+// Import framework stuff
+use CoreFramework\Listener\Listenable;
+use CoreFramework\Registry\Registerable;
+
+/**
+ * A Connection information class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub 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/>.
+ */
+class ConnectionInfo extends BaseInfo implements ShareableInfo, Registerable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $infoInstance   An instance of a ShareableInfo class
+        */
+       public final static function createConnectionInfo () {
+               // Get new instance
+               $infoInstance = new ConnectionInfo();
+
+               // Return the prepared instance
+               return $infoInstance;
+       }
+
+       /**
+        * Fills the information class with data from a Listenable instance
+        *
+        * @param       $listenerInstance       An instance of a Listenable class
+        * @return      void
+        */
+       public function fillWithListenerInformation (Listenable $listenerInstance) {
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: protocolName=' . $listenerInstance->getProtocolName() . ',listenerInstance=' . $listenerInstance->__toString() . ' - CALLED!');
+
+               // Fill the generic array with several data from the listener:
+               $this->setProtocolName($listenerInstance->getProtocolName());
+               $this->setGenericArrayElement('connection', 'dummy', 'dummy', UniversalNodeLocator::UNL_PART_ADDRESS , $listenerInstance->getListenAddress());
+               $this->setGenericArrayElement('connection', 'dummy', 'dummy', UniversalNodeLocator::UNL_PART_PORT    , $listenerInstance->getListenPort());
+
+               // Set listener here
+               $this->setListenerInstance($listenerInstance);
+
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!');
+       }
+
+       /**
+        * Fills the information class with data from a ConnectionHelper instance
+        *
+        * @param       $helperInstance         An instance of a ConnectionHelper class
+        * @return      void
+        */
+       public function fillWithConnectionHelperInformation (ConnectionHelper $helperInstance) {
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: protocolName=' . $helperInstance->getProtocolName() . ',helperInstance=' . $helperInstance->__toString() . ',socketResource=' . $helperInstance->getSocketResource() . ' - CALLED!');
+
+               // Fill the generic array with several data from the listener:
+               $this->setProtocolName($helperInstance->getProtocolName());
+               $this->setGenericArrayElement('connection', 'dummy', 'dummy', UniversalNodeLocator::UNL_PART_ADDRESS , $helperInstance->getAddress());
+               $this->setGenericArrayElement('connection', 'dummy', 'dummy', UniversalNodeLocator::UNL_PART_PORT    , $helperInstance->getConnectionPort());
+
+               // Set helper here
+               $this->setHelperInstance($helperInstance);
+
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!');
+       }
+
+       /**
+        * Getter for address
+        *
+        * @return      $address        Address from shared information
+        */
+       public final function getAddress () {
+               // Return it from generic array
+               return $this->getGenericArrayElement('connection', 'dummy', 'dummy', UniversalNodeLocator::UNL_PART_ADDRESS);
+       }
+
+       /**
+        * Getter for port
+        *
+        * @return      $port   Port from shared information
+        */
+       public final function getPort () {
+               // Return it from generic array
+               return $this->getGenericArrayElement('connection', 'dummy', 'dummy', UniversalNodeLocator::UNL_PART_PORT);
+       }
+
+}
index fc1367bc7383f824947c2822253ecd1ab6a13cc8..cd7fe45d719a1a5db34c17371763a059c09c3a31 100644 (file)
@@ -44,7 +44,5 @@ interface ShareableInfo extends FrameworkInterface {
         * @return      void
         */
        function fillWithConnectionHelperInformation (ConnectionHelper $helperInstance);
-}
 
-// [EOF]
-?>
+}