Flow::mysql_if()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 2
nc 2
nop 3
crap 2
1
<?php
2
3
namespace Vectorface\MySQLite\MySQL;
4
5
/**
6
 * Provides Flow Control MySQL compatibility functions for SQLite.
7
 *
8
 * http://dev.mysql.com/doc/refman/5.7/en/control-flow-functions.html
9
 */
10
trait Flow
11
{
12
    /**
13
     * IF - If/else construct
14
     *
15
     * @param bool $condition The boolean condition which determines which result should be returned.
16
     * @param mixed $onTrue The result to be returned if the condition is true.
17
     * @param mixed $onFalse The condition to be returned if the condition is false.
18
     * @return mixed Either the onTrue or onFalse result is returned, depending on the value of the condition.
19
     */
20 1
    public static function mysql_if($condition, $onTrue, $onFalse)
21
    {
22 1
        return $condition ? $onTrue : $onFalse;
23
    }
24
}
25