Passed
Push — master ( 222f48...0fa176 )
by y
01:47
created

DateTimeCastTrait::toDateTime()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php
2
3
namespace Helix\DB\Fluent\DateTime;
4
5
use Helix\DB\Fluent\AbstractTrait;
6
use Helix\DB\Fluent\DateTime;
7
8
trait DateTimeCastTrait {
9
10
    use AbstractTrait;
11
12
    /**
13
     * Interpret the expression as a datetime.
14
     *
15
     * > Warning: If the expression is in the local timezone
16
     * > you should chain this with {@link DateTime::toUtc()}
17
     *
18
     * SQLite:
19
     * - The expression's value must conform to one of any `time-value` formats.
20
     * - https://www.sqlite.org/lang_datefunc.html
21
     *
22
     * MySQL:
23
     * - The expression's value must conform to `YYYY-MM-DD hh:mm:ss`
24
     *
25
     * @return DateTime
26
     */
27
    public function toDateTime () {
28
        return DateTime::factory($this->db, $this);
29
    }
30
}
31