Rand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 18
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSql() 0 3 1
A parse() 0 5 1
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