http://phing.info/

Source Code Coverage

Designed for use with PHPUnit2, Xdebug and Phing.

Methods: 4 LOC: 84 Statements: 6
Legend: executednot executeddead code
Source file Statements Methods Total coverage
Token.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_Db
12
 * @copyright Copyright LibreWorks, LLC (http://libreworks.net)
13
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
14
 * @version   $Id: Token.php 418 2010-10-18 21:40:08Z jonathanhawk $
15
 */
16
namespace Xyster\Db;
17
/**
18
 * Token containing a SQL fragment and bind values
19
 *
20
 * @category  Xyster
21
 * @package   Xyster_Db
22
 * @copyright Copyright LibreWorks, LLC (http://libreworks.net)
23
 * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
24
 */
25
class Token
26
{
27
    /**
28
     * The SQL fragment
29
     *
30
     * @var string
31
     */
32
    protected $_sql;
33
34
    /**
35
     * The bind values, if any
36
     *
37
     * @var array
38
     */
39
    protected $_bind = array();
40
41
    /**
42
     * Creates a new SqlToken
43
     *
44
     * @param string $sql
45
     * @param array $bind
46
     */
47
    public function __construct( $sql, array $bind = array() )
48
    {
49 10
        $this->_sql = $sql;
50 10
        $this->_bind = $bind;
51
    }
52
53
    /**
54
     * Gets the SQL text
55
     *
56
     * @return string
57
     */
58
    public function getSql()
59
    {
60 9
        return $this->_sql;
61
    }
62
63
    /**
64
     * Gets the bind values for the SQL text (if any)
65
     *
66
     * @return array
67
     */
68
    public function getBindValues()
69
    {
70 3
        return $this->_bind;
71
    }
72
73
    /**
74
     * Merges the bind values from another token
75
     *
76
     * If keys are the same, values in this token will be overwritten.
77
     *
78
     * @param Token $token
79
     */
80
    public function addBindValues( Token $token )
81
    {
82 3
        $this->_bind = array_merge($this->_bind, $token->_bind);
83
    }
84 1
}


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