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

DateTimeCastTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 21
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A toDateTime() 0 2 1
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