| a | b | |
|---|
| 0 | + | <?php |
|---|
| 0 | + | class test |
|---|
| 0 | + | { |
|---|
| 0 | + | private static $instance = null; |
|---|
| 0 | + | public $dispatcher; |
|---|
| 0 | + | |
|---|
| 0 | + | public function __construct() |
|---|
| 0 | + | { |
|---|
| 0 | + | $this->dispatcher = new testclass(); |
|---|
| 0 | + | } |
|---|
| 0 | + | |
|---|
| 0 | + | public static function get_instance() |
|---|
| 0 | + | { |
|---|
| 0 | + | if (is_null(self::$instance)) |
|---|
| 0 | + | { |
|---|
| 0 | + | self::$instance = new test(); |
|---|
| 0 | + | } |
|---|
| 0 | + | return self::$instance; |
|---|
| 0 | + | } |
|---|
| 0 | + | |
|---|
| 0 | + | public function serve() |
|---|
| 0 | + | { |
|---|
| 0 | + | $this->dispatcher->test(); |
|---|
| 0 | + | } |
|---|
| 0 | + | } |
|---|
| 0 | + | |
|---|
| 0 | + | class testclass |
|---|
| 0 | + | { |
|---|
| 0 | + | private $request_config; |
|---|
| 0 | + | public function __construct() |
|---|
| 0 | + | { |
|---|
| 0 | + | $this->request_config = $this->get_midgard_connection()->get_request_config(); |
|---|
| 0 | + | } |
|---|
| 0 | + | |
|---|
| 0 | + | public function get_midgard_connection() |
|---|
| 0 | + | { |
|---|
| 0 | + | return midgard_connection::get_instance(); |
|---|
| 0 | + | } |
|---|
| 0 | + | |
|---|
| 0 | + | public function test() |
|---|
| 0 | + | { |
|---|
| 0 | + | $host = $this->request_config->get_host(); |
|---|
| 0 | + | foreach ($this->request_config->get_pages() as $page) |
|---|
| 0 | + | { |
|---|
| 0 | + | var_dump($page); |
|---|
| 0 | + | } |
|---|
| 0 | + | } |
|---|
| 0 | + | } |
|---|
| 0 | + | |
|---|
| 0 | + | test::get_instance()->serve(); |
|---|
| 0 | + | |
|---|
| 0 | + | ?> |
|---|
| ... | |
|---|