http://phing.info/

Source Code Coverage

Designed for use with PHPUnit2, Xdebug and Phing.

Methods: 3 LOC: 67 Statements: 4
Legend: executednot executeddead code
Source file Statements Methods Total coverage
Map.php 100.0% 100.0% 100.0%
 
1
<?php
2
/**
3
 * Xyster Framework
4
 *
5
 * This source file is subject to the new BSD license that is bundled
6
 * with this package in the file LICENSE.txt.
7
 * It is also available through the world-wide-web at this URL:
8
 * http://www.opensource.org/licenses/bsd-license.php
9
 *
10
 * @category  Xyster
11
 * @package   Xyster_Type
12
 * @copyright Copyright LibreWorks, LLC (http://libreworks.net)
13
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
14
 * @version   $Id: Map.php 418 2010-10-18 21:40:08Z jonathanhawk $
15
 */
16
namespace Xyster\Type\Property;
17
/**
18
 * A mediator for setting and getting values from a named field
19
 *
20
 * This field mapper will work with arrays and ArrayAccess objects
21
 *
22
 * @category  Xyster
23
 * @package   Xyster_Type
24
 * @copyright Copyright LibreWorks, LLC (http://libreworks.net)
25
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
26
 */
27
class Map implements IProperty
28
{
29
    /**
30
     * The property name
31
     *
32
     * @var string
33
     */
34
    protected $_name;
35
36
    /**
37
     * Creates a new field mapper
38
     *
39
     * @param string $name The name of the property
40
     */
41
    public function __construct( $name )
42
    {
43 2
        $this->_name = $name;
44
    }
45
46
    /**
47
     * Gets the value in the field of the target
48
     *
49
     * @param mixed $target
50
     * @return mixed
51
     */
52
    public function get( $target )
53
    {
54 2
        return $target[$this->_name];
55
    }
56
57
    /**
58
     * Sets the value in the field of the target
59
     *
60
     * @param mixed $target
61
     * @param mixed $value
62
     */
63
    public function set( $target, $value )
64
    {
65 2
        $target[$this->_name] = $value;
66
    }
67 1
}


Report generated at 2010-10-18T17:19:48-04:00