5Shdqz44xBlOnq4LsDdE2g changeset

Changeset333133363533 (b)
ParentNone (a)
ab
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+?>
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
--- Revision None
+++ Revision 333133363533
@@ -0,0 +1,52 @@
+<?php
+class test
+{
+ private static $instance = null;
+ public $dispatcher;
+
+ public function __construct()
+ {
+ $this->dispatcher = new testclass();
+ }
+
+ public static function get_instance()
+ {
+ if (is_null(self::$instance))
+ {
+ self::$instance = new test();
+ }
+ return self::$instance;
+ }
+
+ public function serve()
+ {
+ $this->dispatcher->test();
+ }
+}
+
+class testclass
+{
+ private $request_config;
+ public function __construct()
+ {
+ $this->request_config = $this->get_midgard_connection()->get_request_config();
+ }
+
+ public function get_midgard_connection()
+ {
+ return midgard_connection::get_instance();
+ }
+
+ public function test()
+ {
+ $host = $this->request_config->get_host();
+ foreach ($this->request_config->get_pages() as $page)
+ {
+ var_dump($page);
+ }
+ }
+}
+
+test::get_instance()->serve();
+
+?>