http://phing.info/

Source Code Coverage

Designed for use with PHPUnit2, Xdebug and Phing.

Methods: 3 LOC: 65 Statements: 4
Legend: executednot executeddead code
Source file Statements Methods Total coverage
Direct.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: Direct.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
 * @category  Xyster
21
 * @package   Xyster_Type
22
 * @copyright Copyright LibreWorks, LLC (http://libreworks.net)
23
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
24
 */
25
class Direct implements IProperty
26
{
27
    /**
28
     * The property name
29
     *
30
     * @var string
31
     */
32
    protected $_name;
33
34
    /**
35
     * Creates a new field mapper
36
     *
37
     * @param string $name The name of the property
38
     */
39
    public function __construct( $name )
40
    {
41 3
        $this->_name = $name;
42
    }
43
44
    /**
45
     * Gets the value in the field of the target
46
     *
47
     * @param mixed $target
48
     * @return mixed
49
     */
50
    public function get( $target )
51
    {
52 1
        return $target->{$this->_name};
53
    }
54
55
    /**
56
     * Sets the value in the field of the target
57
     *
58
     * @param mixed $target
59
     * @param mixed $value
60
     */
61
    public function set( $target, $value )
62
    {
63 3
        $target->{$this->_name} = $value;
64
    }
65 1
}


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