Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $conf = array (
- 'parts' => array(
- 'contr' => 'app/Controller',
- 'mod' => 'app/model/mod_main.php'
- ),
- 'что - то др.' => array(
- '' => '',
- '' => '',
- '' => ''
- )
- );
- class Registry {
- public static $obj = array();
- protected static $instance;
- protected function __construct() {
- global $conf;
- foreach ($conf['parts'] as $name => $parts) {
- self::$obj[$name] = new $parts;
- }
- }
- public static function instance () {
- if(self::$instance === null) self::$instance = new self;
- return self::$instance;
- }
- public function __set($name, $obj) {
- if (!isset(self::$obj[$name])) self::$obj[$name] = new $obj;
- }
- public function __get($name) {
- if (is_object(self::$obj($name))) return self::$obj($name);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement