123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <?php
- namespace RTP\Module;
- Class OutputStorageModule
- {
-
- private static $registry = NULL;
- private static $instance;
-
- public static function getInstance()
- {
-
- if (!is_null(self::$instance))
- {
- return self::$instance;
- }
- else
- {
-
- return self::getNewInstance();
- }
- }
-
- public static function getNewInstance()
- {
- self::$instance = null;
- self::$instance = new self;
- return self::$instance;
- }
-
- protected function __construct()
- {
- if (is_null(self::$registry))
- self::$registry = array();
- }
-
- public static function get($offset)
- {
- if (isset(self::$registry[$offset]))
- return self::$registry[$offset];
- return NULL;
- }
-
- public static function set($value)
- {
- if (is_null(self::$registry))
- self::$registry = array();
- self::$registry[] = $value;
- }
-
- public static function getAll()
- {
- return self::$registry;
- }
-
- public static function isExist($value)
- {
- if (is_null(self::$registry))
- {
- return FALSE;
- }
- if (in_array($value, self::$registry))
- {
- return TRUE;
- }
- return FALSE;
- }
-
- public static function clean()
- {
- self::$registry = NULL;
- }
- }
- ?>
|