| 1 |
|
<?php |
| 2 |
|
/** |
| 3 |
|
* Xyster Framework |
| 4 |
|
* |
| 5 |
|
* LICENSE |
| 6 |
|
* |
| 7 |
|
* This source file is subject to the new BSD license that is bundled |
| 8 |
|
* with this package in the file LICENSE.txt. |
| 9 |
|
* It is also available through the world-wide-web at this URL: |
| 10 |
|
* http://www.opensource.org/licenses/bsd-license.php |
| 11 |
|
* If you did not receive a copy of the license and are unable to |
| 12 |
|
* obtain it through the world-wide-web, please send an email |
| 13 |
|
* to xyster@devweblog.org so we can send you a copy immediately. |
| 14 |
|
* |
| 15 |
|
* @category Xyster |
| 16 |
|
* @package Xyster_Collection |
| 17 |
|
* @copyright Copyright (c) 2007 Irrational Logic (http://devweblog.org) |
| 18 |
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License |
| 19 |
|
*/ |
| 20 |
|
/** |
| 21 |
|
* Simple Map Entry |
| 22 |
|
* |
| 23 |
|
* @category Xyster |
| 24 |
|
* @package Xyster_Collection |
| 25 |
|
* @copyright Copyright (c) 2007 Irrational Logic (http://devweblog.org) |
| 26 |
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License |
| 27 |
|
*/ |
| 28 |
|
class Xyster_Collection_Map_Entry |
| 29 |
|
{ |
| 30 |
|
protected $_key; |
| 31 |
|
protected $_value; |
| 32 |
|
|
| 33 |
|
/** |
| 34 |
|
* Creates a new map entry |
| 35 |
|
* |
| 36 |
|
* @param mixed $key The key of the entry |
| 37 |
|
* @param mixed $value The value of the entry |
| 38 |
|
*/ |
| 39 |
|
public function __construct( $key, $value ) |
| 40 |
|
{ |
| 41 |
29 |
$this->_key = $key; |
| 42 |
29 |
$this->_value = $value; |
| 43 |
|
} |
| 44 |
|
|
| 45 |
|
/** |
| 46 |
|
* Gets the key for this mapping |
| 47 |
|
* |
| 48 |
|
* @return mixed The key |
| 49 |
|
*/ |
| 50 |
|
public function getKey() |
| 51 |
|
{ |
| 52 |
11 |
return $this->_key; |
| 53 |
|
} |
| 54 |
|
/** |
| 55 |
|
* Gets the value for this mapping |
| 56 |
|
* |
| 57 |
|
* @return mixed The value |
| 58 |
|
*/ |
| 59 |
|
public function getValue() |
| 60 |
|
{ |
| 61 |
15 |
return $this->_value; |
| 62 |
|
} |
| 63 |
|
/** |
| 64 |
|
* Sets the value for this mapping |
| 65 |
|
* |
| 66 |
|
* @param mixed $value The new value |
| 67 |
|
*/ |
| 68 |
|
public function setValue( $value ) |
| 69 |
|
{ |
| 70 |
1 |
$this->_value = $value; |
| 71 |
|
} |
| 72 |
|
/** |
| 73 |
|
* Gets the string equivalent of this mapping |
| 74 |
|
* |
| 75 |
|
* @return string |
| 76 |
|
*/ |
| 77 |
|
public function __toString() |
| 78 |
|
{ |
| 79 |
1 |
return $this->_key . "=" . $this->_value; |
| 80 |
|
} |
| 81 |
|
} |