| 1 | <?php |
||
| 19 | class NullSegment implements SegmentInterface |
||
| 20 | { |
||
| 21 | /** |
||
| 22 | * |
||
| 23 | * The segment data. |
||
| 24 | * |
||
| 25 | * @var array |
||
| 26 | * |
||
| 27 | */ |
||
| 28 | protected $data = array(); |
||
| 29 | |||
| 30 | /** |
||
| 31 | * |
||
| 32 | * Gets a value from the segment. |
||
| 33 | * |
||
| 34 | * @param mixed $key A key for the segment value. |
||
| 35 | * |
||
| 36 | * @param mixed $alt Return this value if the segment key does not exist. |
||
| 37 | * |
||
| 38 | * @return mixed |
||
| 39 | * |
||
| 40 | */ |
||
| 41 | 1 | public function get($key, $alt = null) |
|
| 42 | { |
||
| 43 | 1 | if (isset($this->data[$key])) { |
|
| 44 | 1 | return $this->data[$key]; |
|
| 45 | } |
||
| 46 | |||
| 47 | 1 | return $alt; |
|
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * |
||
| 52 | * Sets a value in the segment. |
||
| 53 | * |
||
| 54 | * @param mixed $key The key in the segment. |
||
| 55 | * |
||
| 56 | * @param mixed $val The value to set. |
||
| 57 | * |
||
| 58 | */ |
||
| 59 | 1 | public function set($key, $val) |
|
| 63 | } |
||
| 64 |