]> git.mxchange.org Git - shipsimu.git/blobdiff - inc/classes/main/factories/objects/class_ObjectFactory.php
Rewrite of initInstance(), more eval() rewritten to call_user_func_array()
[shipsimu.git] / inc / classes / main / factories / objects / class_ObjectFactory.php
index 8fe592bf86ea61e560a2ff7771201494e8ae405b..024020d6d4782d93e9063712e7715c34da869537 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 class ObjectFactory extends BaseFactory {
+       /**
+        * Total objects generated
+        */
+       private static $total = 0;
+
        /**
         * Protected constructor
         *
@@ -71,6 +76,9 @@ class ObjectFactory extends BaseFactory {
                // Run the user function
                $objectInstance = call_user_func_array($callback, $args);
 
+               // Count generated objects up
+               self::$total++;
+
                // Return the prepared instance
                return $objectInstance;
        }
@@ -92,6 +100,15 @@ class ObjectFactory extends BaseFactory {
                // Return the instance
                return $objectInstance;
        }
+
+       /**
+        * Static getter for total object count
+        *
+        * @return      $total  Total amount of generated objects
+        */
+       public final static function getTotal () {
+               return self::$total;
+       }
 }
 
 // [EOF]