]> git.mxchange.org Git - hub.git/commitdiff
Checked change of access level protected -> private:
authorRoland Haeder <roland@mxchange.org>
Sat, 21 Mar 2015 21:14:16 +0000 (22:14 +0100)
committerRoland Haeder <roland@mxchange.org>
Sat, 21 Mar 2015 21:14:16 +0000 (22:14 +0100)
- All class fields must be private and *should always* have protected setters
  as changing "internal" fields (data, in particular object instances) can lead
  to unexpected behaviour and then it is *very, very* hard to trace those bugs.

Signed-off-by: Roland Haeder <roland@mxchange.org>
application/hub/main/template/announcement/class_XmlAnnouncementTemplateEngine.php
application/hub/main/template/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php
application/hub/main/template/answer/dht/class_XmlDhtBootstrapAnswerTemplateEngine.php
application/hub/main/template/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php
application/hub/main/template/class_BaseXmlTemplateEngine.php
application/hub/main/template/connect/class_XmlSelfConnectTemplateEngine.php
application/hub/main/template/dht/class_XmlDhtBootstrapTemplateEngine.php
application/hub/main/template/objects/class_XmlObjectRegistryTemplateEngine.php
application/hub/main/template/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php
application/hub/main/template/publish/class_XmlDhtPublishEntryTemplateEngine.php
application/hub/main/template/requests/class_XmlRequestNodeListTemplateEngine.php

index 0da0cc86bd8335abcd6099c70b8606a1a30a1256..702ef14a793cd6b9dd6c1bf83612223c9924a37e 100644 (file)
@@ -42,7 +42,7 @@ class XmlAnnouncementTemplateEngine extends BaseXmlTemplateEngine implements Com
                parent::__construct(__CLASS__);
 
                // Init array
-               $this->subNodes = array(
+               $this->setSubNodes(array(
                        'announcement-data',
                        'listener',
                        self::ANNOUNCEMENT_DATA_NODE_STATUS,
@@ -51,7 +51,7 @@ class XmlAnnouncementTemplateEngine extends BaseXmlTemplateEngine implements Com
                        self::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS,
                        self::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS,
                        'object-type-list',
-               );
+               ));
        }
 
        /**
index f70a05f554e587e0b46db912e86b5d4660845160..97f3aee639a27c83d44ffef703c6ee1f3075e049 100644 (file)
@@ -41,7 +41,7 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
                parent::__construct(__CLASS__);
 
                // Init sub-nodes array
-               $this->subNodes = array(
+               $this->setSubNodes(array(
                        // These nodes don't contain any data
                        'my-data',
                        'your-data',
@@ -56,7 +56,7 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
                        'your-session-id',
                        // Answer status (generic field)
                        self::ANSWER_STATUS,
-               );
+               ));
        }
 
        /**
index b9a94872bd1b4c887af6145bc5cafb1083b0d153..e03f68169d6d3ee1f2a275c6d343f64d3406e8b7 100644 (file)
@@ -42,7 +42,7 @@ class XmlDhtBootstrapAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
                parent::__construct(__CLASS__);
 
                // Init sub-nodes array
-               $this->subNodes = array(
+               $this->setSubNodes(array(
                        // These nodes don't contain any data
                        'my-data',
                        'your-data',
@@ -59,7 +59,7 @@ class XmlDhtBootstrapAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine im
                        self::ANSWER_STATUS,
                        // DHT node list
                        self::DHT_BOOTSTRAP_DATA_NODE_LIST,
-               );
+               ));
        }
 
        /**
index f2aa8dcab033d0177412847b3fed7d4269630348..b793818748c18cbe92bf6a4ab21d70c3257b560d 100644 (file)
@@ -37,12 +37,12 @@ class XmlRequestNodeListAnswerTemplateEngine extends BaseXmlAnswerTemplateEngine
                parent::__construct(__CLASS__);
 
                // Init sub-nodes array
-               $this->subNodes = array(
+               $this->setSubNodes(array(
                        self::REQUEST_DATA_SESSION_ID,
                        self::REQUEST_DATA_NODE_LIST,
                        // Answer status (generic field)
                        self::ANSWER_STATUS,
-               );
+               ));
        }
 
        /**
index 2f60e58e26da55dc5fe23e4dba287a9f6f2f44ed..de24e1ae1e4252ef5575956a7200e3236ec433fd 100644 (file)
@@ -26,17 +26,17 @@ class BaseXmlTemplateEngine extends BaseTemplateEngine {
        /**
         * Main nodes in the XML tree
         */
-       protected $mainNodes = array();
+       private $mainNodes = array();
 
        /**
         * Sub nodes in the XML tree
         */
-       protected $subNodes = array();
+       private $subNodes = array();
 
        /**
         * Current main node
         */
-       protected $curr = array();
+       private $curr = array();
 
        /**
         * XML template type
@@ -191,6 +191,16 @@ class BaseXmlTemplateEngine extends BaseTemplateEngine {
                return $this->stackerName;
        }
 
+       /**
+        * Setter for sub node array
+        *
+        * @param       $subNodes       Array with valid sub node names
+        * @return      void
+        */
+       public final function setSubNodes (array $subNodes) {
+               $this->subNodes = $subNodes;
+       }
+
        /**
         * Getter for sub node array
         *
index 17f2be09fafd05b09d746d215fb885e2a21e50db..635ede5ccc5762d5610ca45eeff6d13f577e4c1e 100644 (file)
@@ -39,11 +39,11 @@ class XmlSelfConnectTemplateEngine extends BaseXmlTemplateEngine implements Comp
                parent::__construct(__CLASS__);
 
                // Init array
-               $this->subNodes = array(
+               $this->setSubNodes(array(
                        'self-connect-data',
                        self::SELF_CONNECT_DATA_NODE_ID,
                        self::SELF_CONNECT_DATA_SESSION_ID
-               );
+               ));
        }
 
        /**
index 9b95cc37c5a7a32f9b559f91fe296a80e1b51f76..65c1beff1cf0cc01aca02585bf8b5feb5a626721 100644 (file)
@@ -43,7 +43,7 @@ class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements Com
                parent::__construct(__CLASS__);
 
                // Init array
-               $this->subNodes = array(
+               $this->setSubNodes(array(
                        self::DHT_BOOTSTRAP_DATA_BOOTSTRAP_DATA,
                        'listener',
                        self::DHT_BOOTSTRAP_DATA_NODE_STATUS,
@@ -51,7 +51,7 @@ class XmlDhtBootstrapTemplateEngine extends BaseXmlTemplateEngine implements Com
                        self::DHT_BOOTSTRAP_DATA_SESSION_ID,
                        self::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS,
                        self::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS
-               );
+               ));
        }
 
        /**
index 66ef63bdbff05c49628fc441650b58a6ff8182f9..5f679188e2adae45cb2ef0b4c8244573292bddfb 100644 (file)
@@ -48,7 +48,7 @@ class XmlObjectRegistryTemplateEngine extends BaseXmlTemplateEngine implements C
                $this->objectRegistryInstance = ObjectTypeRegistryFactory::createObjectTypeRegistryInstance();
 
                // Init sub nodes
-               $this->subNodes = array(
+               $this->setSubNodes(array(
                        'object-list',
                        'object-list-entry',
                        self::OBJECT_TYPE_DATA_NAME,
@@ -56,7 +56,7 @@ class XmlObjectRegistryTemplateEngine extends BaseXmlTemplateEngine implements C
                        self::OBJECT_TYPE_DATA_MAX_SPREAD,
                        self::OBJECT_TYPE_DATA_PROTOCOL,
                        self::OBJECT_TYPE_DATA_RECIPIENT_TYPE
-               );
+               ));
        }
 
        /**
index ab739f92f6f3a0e11ae6f344df8dcd783b6f2e85..40f19412d0b974e270537388c985a69e43feb3ca 100644 (file)
@@ -33,7 +33,7 @@ class XmlCruncherTestUnitTemplateEngine extends BaseXmlTemplateEngine implements
                parent::__construct(__CLASS__);
 
                // Init sub nodes
-               $this->subNodes = array(
+               $this->setSubNodes(array(
                        'meta-data',
                        'global-project-identifier',
                        'test-unit-created',
@@ -46,7 +46,7 @@ class XmlCruncherTestUnitTemplateEngine extends BaseXmlTemplateEngine implements
                        'cruncher-key',
                        'key-id',
                        'key-value'
-               );
+               ));
        }
 
        /**
index 0360090adc68d16a5b382a426ede87f7bbde305d..85c101397e3d781d9f5d7ee9fd5a766f424750ff 100644 (file)
@@ -44,7 +44,7 @@ class XmlDhtPublishEntryTemplateEngine extends BaseXmlTemplateEngine implements
                parent::__construct(__CLASS__);
 
                // Init array
-               $this->subNodes = array(
+               $this->setSubNodes(array(
                        'publish-data',
                        'listener',
                        self::PUBLISH_DATA_NODE_STATUS,
@@ -55,7 +55,7 @@ class XmlDhtPublishEntryTemplateEngine extends BaseXmlTemplateEngine implements
                        self::PUBLISH_DATA_SESSION_ID,
                        self::PUBLISH_DATA_EXTERNAL_ADDRESS,
                        'object-type-list',
-               );
+               ));
        }
 
        /**
index 1ada53e004e9b4168db19f1054039e5f90f264fc..e014e9aa1e9fdd1fc85b8e3e5c0468d25c2abd2a 100644 (file)
@@ -37,10 +37,10 @@ class XmlRequestNodeListTemplateEngine extends BaseXmlTemplateEngine implements
                parent::__construct(__CLASS__);
 
                // Init sub nodes
-               $this->subNodes = array(
+               $this->setSubNodes(array(
                        self::REQUEST_DATA_ACCEPTED_OBJECT_TYPES,
                        self::REQUEST_DATA_SESSION_ID,
-               );
+               ));
        }
 
        /**