Datetime::datetime()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
1
<?php
2
3
namespace Sfneal\Models\Traits;
4
5
trait Datetime
6
{
7
    /**
8
     * Format a datetime string.
9
     *
10
     * @param  string  $format
11
     * @param  string|null  $datetime
12
     * @return string
13
     */
14
    private static function datetime(string $format, string $datetime = null): string
15
    {
16
        return (isset($datetime)) ? date($format, strtotime($datetime)) : '';
17
    }
18
}
19