Rand::parse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
/**
3
 * @author Gerard van Helden <[email protected]>
4
 * @copyright Zicht Online <http://zicht.nl>
5
 */
6
7
namespace Zicht\Bundle\FrameworkExtraBundle\Doctrine\FunctionNode;
8
9
use Doctrine\ORM\Query\AST\Functions\FunctionNode;
10
use Doctrine\ORM\Query\Lexer;
11
use Doctrine\ORM\Query\Parser;
12
use Doctrine\ORM\Query\SqlWalker;
13
14
/**
15
 * see https://gist.github.com/919465
16
 */
17
/**
18
 * "RAND" "(" ")"
19
 */
20
class Rand extends FunctionNode
21
{
22
    /**
23
     * @{inheritDoc}
24
     */
25
    public function parse(Parser $parser)
26
    {
27
        $parser->match(Lexer::T_IDENTIFIER);
28
        $parser->match(Lexer::T_OPEN_PARENTHESIS);
29
        $parser->match(Lexer::T_CLOSE_PARENTHESIS);
30
    }
31
32
    /**
33
     * @{inheritDoc}
34
     */
35
    public function getSql(SqlWalker $sqlWalker)
36
    {
37
        return 'RAND()';
38
    }
39
}
40