Completed
Pull Request — 2.0 (#75)
by Julien
02:03
created

RawString   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 30
c 1
b 1
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __toString() 0 4 1
1
<?php
2
/*
3
 * This file is part of the Pomm's Foundation package.
4
 *
5
 * (c) 2014 - 2015 Grégoire HUBERT <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace PommProject\Foundation;
11
12
/**
13
 * RowString
14
 *
15
 * Expression escaper.
16
 *
17
 * This type allows to pass raw expressions as is to the database. Useful to
18
 * call functions or database expressions.
19
 *
20
 * @package   Foundation
21
 * @copyright 2014 - 2015 Grégoire HUBERT
22
 * @author    Grégoire HUBERT
23
 * @license   X11 {@link http://opensource.org/licenses/mit-license.php}
24
 */
25
class RawString
26
{
27
    protected $expression;
28
29
    /**
30
     * __construct
31
     *
32
     * Create a RawString.
33
     *
34
     * @access public
35
     * @param  string $expression
36
     */
37
    public function __construct($expression)
38
    {
39
        $this->expression = $expression;
40
    }
41
42
    /**
43
     * __toString
44
     *
45
     * String cast this instance.
46
     *
47
     * @access public
48
     * @return string
49
     */
50
    public function __toString()
51
    {
52
        return $this->expression;
53
    }
54
}
55