http://phing.info/

Source Code Coverage

Designed for use with PHPUnit2, Xdebug and Phing.

Methods: 4 LOC: 88 Statements: 5

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


Report generated at 2007-11-05T09:09:02-05:00