Expression   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 3 1
A value() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace Foolz\SphinxQL;
4
5
/**
6
 * Wraps expressions so they aren't quoted or modified
7
 * when inserted into the query
8
 */
9
class Expression
10
{
11
    /**
12
     * The expression content
13
     *
14
     * @var string
15
     */
16
    protected $string;
17
18
    /**
19
     * The constructor accepts the expression as string
20
     *
21
     * @param string $string The content to prevent being quoted
22
     */
23
    public function __construct($string = '')
24
    {
25
        $this->string = $string;
26
    }
27
28
    /**
29
     * Return the unmodified expression
30
     *
31
     * @return string The unaltered content of the expression
32
     */
33
    public function value()
34
    {
35
        return (string) $this->string;
36
    }
37
38
    /**
39
     * Returns the unmodified expression
40
     *
41
     * @return string The unaltered content of the expression
42
     */
43
    public function __toString()
44
    {
45
        return $this->value();
46
    }
47
}
48