Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.

My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.


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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
Index: library/Zend/Controller/Router/Route/Chain.php
===================================================================
--- library/Zend/Controller/Router/Route/Chain.php	(revision 24121)
+++ library/Zend/Controller/Router/Route/Chain.php	(working copy)
@@ -154,6 +154,44 @@
     }
 
     /**
+     * Return a single parameter of route's defaults
+     *
+     * @param string $name Array key of the parameter
+     * @return string Previously set default
+     */
+    public function getDefault($name)
+    {
+        $default = null;
+        foreach ($this->_routes as $key => $route) {
+            if (method_exists($route, 'getDefault')) {
+                $current = $route->getDefault($name);
+                if($current !== null) {
+                    $default = $current;
+                }
+            }
+        }
+
+        return $default;
+    }
+
+    /**
+     * Return an array of defaults
+     *
+     * @return array Route defaults
+     */
+    public function getDefaults()
+    {
+        $defaults = array();
+        foreach ($this->_routes as $key => $route) {
+            if (method_exists($route, 'getDefaults')) {
+                $defaults = array_merge($defaults, $route->getDefaults());
+            }
+        }
+
+        return $defaults;
+    }
+
+    /**
      * Set the request object for this and the child routes
      *
      * @param  Zend_Controller_Request_Abstract|null $request
Index: tests/Zend/Controller/Router/Route/ChainTest.php
===================================================================
--- tests/Zend/Controller/Router/Route/ChainTest.php	(revision 24121)
+++ tests/Zend/Controller/Router/Route/ChainTest.php	(working copy)
@@ -344,6 +344,67 @@
         $this->assertRegexp('#[^a-z0-9]?www\.zend\.com/bar$#i', $chain->assemble());
     }
 
+    public function testGetDefaults()
+    {
+        $chain = new Zend_Controller_Router_Route_Chain();
+
+        $foo = new Zend_Controller_Router_Route_Hostname('www.zend.com', array('foo' => 'foo'));
+        $bar = new Zend_Controller_Router_Route_Regex('bar', array('bar' => 'bar'), array(), 'bar');
+        $baz = new Zend_Controller_Router_Route_Static('baz', array('baz' => 'baz'));
+
+        $chain->chain($foo)->chain($bar)->chain($baz);
+
+        $values = $chain->getDefaults();
+
+        $this->assertType('array', $values);
+        $this->assertSame('foo', $values['foo']);
+        $this->assertSame('bar', $values['bar']);
+        $this->assertSame('baz', $values['baz']);
+    }
+
+    public function testGetDefaultsPriority()
+    {
+        $chain = new Zend_Controller_Router_Route_Chain();
+
+        $foo = new Zend_Controller_Router_Route_Hostname('www.zend.com', array('priority' => 1));
+        $bar = new Zend_Controller_Router_Route_Regex('bar', array('priority' => 2), array(), 'bar');
+        $baz = new Zend_Controller_Router_Route_Static('baz', array('priority' => 3));
+
+        $chain->chain($foo)->chain($bar)->chain($baz);
+
+        $values = $chain->getDefaults();
+
+        $this->assertSame(3, $values['priority']);
+    }
+
+    public function testGetDefault()
+    {
+        $chain = new Zend_Controller_Router_Route_Chain();
+
+        $foo = new Zend_Controller_Router_Route_Hostname('www.zend.com', array('foo' => 'foo'));
+        $bar = new Zend_Controller_Router_Route_Regex('bar', array('bar' => 'bar'), array(), 'bar');
+        $baz = new Zend_Controller_Router_Route_Static('baz', array('baz' => 'baz'));
+
+        $chain->chain($foo)->chain($bar)->chain($baz);
+
+        $this->assertSame('foo', $chain->getDefault('foo'));
+        $this->assertSame('bar', $chain->getDefault('bar'));
+        $this->assertSame('baz', $chain->getDefault('baz'));
+    }
+
+    public function testGetDefaultPriority()
+    {
+        $chain = new Zend_Controller_Router_Route_Chain();
+
+        $foo = new Zend_Controller_Router_Route_Hostname('www.zend.com', array('priority' => 1));
+        $bar = new Zend_Controller_Router_Route_Regex('bar', array('priority' => 2), array(), 'bar');
+        $baz = new Zend_Controller_Router_Route_Static('baz', array('priority' => 3));
+
+        $chain->chain($foo)->chain($bar)->chain($baz);
+
+        $this->assertSame(3, $chain->getDefault('priority'));
+    }
+
     public function testChainingReuse()
     {
         $foo = new Zend_Controller_Router_Route_Hostname('www.zend.com', array('foo' => 'foo'));