DatetimeCriteria::setValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 2
c 1
b 0
f 1
dl 0
loc 5
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Noitran\Repositories\Criteria\Support;
6
7
use Illuminate\Support\Carbon;
8
use Noitran\Repositories\Contracts\Criteria\FilterCriteriaInterface;
9
10
/**
11
 * Class DatetimeCriteria.
12
 */
13
class DatetimeCriteria extends AbstractFilterCriteria
14
{
15
    /**
16
     * @param $value
17
     *
18
     * @return FilterCriteriaInterface
19
     */
20
    public function setValue($value): FilterCriteriaInterface
21
    {
22
        $this->value = Carbon::parse($value)->toDateTimeString();
0 ignored issues
show
Bug Best Practice introduced by
The property value does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
23
24
        return $this;
25
    }
26
}
27