use newest zend modules
[GitHub/Stricted/Domain-Control-Panel.git] / vendor / Zend / Router / RouteMatch.php
1 <?php
2 /**
3 * @link http://github.com/zendframework/zend-router for the canonical source repository
4 * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
5 * @license http://framework.zend.com/license/new-bsd New BSD License
6 */
7
8 namespace Zend\Router;
9
10 /**
11 * RouteInterface match.
12 */
13 class RouteMatch
14 {
15 /**
16 * Match parameters.
17 *
18 * @var array
19 */
20 protected $params = [];
21
22 /**
23 * Matched route name.
24 *
25 * @var string
26 */
27 protected $matchedRouteName;
28
29 /**
30 * Create a RouteMatch with given parameters.
31 *
32 * @param array $params
33 */
34 public function __construct(array $params)
35 {
36 $this->params = $params;
37 }
38
39 /**
40 * Set name of matched route.
41 *
42 * @param string $name
43 * @return RouteMatch
44 */
45 public function setMatchedRouteName($name)
46 {
47 $this->matchedRouteName = $name;
48 return $this;
49 }
50
51 /**
52 * Get name of matched route.
53 *
54 * @return string
55 */
56 public function getMatchedRouteName()
57 {
58 return $this->matchedRouteName;
59 }
60
61 /**
62 * Set a parameter.
63 *
64 * @param string $name
65 * @param mixed $value
66 * @return RouteMatch
67 */
68 public function setParam($name, $value)
69 {
70 $this->params[$name] = $value;
71 return $this;
72 }
73
74 /**
75 * Get all parameters.
76 *
77 * @return array
78 */
79 public function getParams()
80 {
81 return $this->params;
82 }
83
84 /**
85 * Get a specific parameter.
86 *
87 * @param string $name
88 * @param mixed $default
89 * @return mixed
90 */
91 public function getParam($name, $default = null)
92 {
93 if (array_key_exists($name, $this->params)) {
94 return $this->params[$name];
95 }
96
97 return $default;
98 }
99 }