DateTimeCastTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A toDateTime() 0 3 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
/**
9
 * Further manipulate the expression as a date-time.
10
 */
11
trait DateTimeCastTrait
12
{
13
14
    use AbstractTrait;
15
16
    /**
17
     * Interpret the expression as a datetime.
18
     *
19
     * > Warning: If the expression's value is in the local timezone
20
     * > you should chain this with {@link DateTime::toUTC()}
21
     *
22
     * SQLite:
23
     * - The expression's value must conform to one of any `time-value` formats.
24
     * - https://www.sqlite.org/lang_datefunc.html
25
     *
26
     * MySQL:
27
     * - The expression's value must conform to `YYYY-MM-DD` or `YYYY-MM-DD hh:mm:ss`
28
     *
29
     * @return DateTime
30
     */
31
    public function toDateTime()
32
    {
33
        return DateTime::factory($this->db, $this);
34
    }
35
}
36