DateOfBirth::setDateOfBirth()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
ccs 0
cts 6
cp 0
rs 9.6666
cc 2
eloc 6
nc 2
nop 2
crap 6
1
<?php
2
3
namespace ADiaz\AML\OpenList\models;
4
5
/**
6
 * This file is part of the OpenList Parser utility.
7
 *
8
 * @category PHP
9
 *
10
 * @author    Alberto Diaz <[email protected]>
11
 * @copyright 2016 Alberto Diaz <[email protected]>
12
 * @license   This source file is subject to the MIT license that is bundled
13
 *
14
 * @version Release: @package_version@
15
 *
16
 * @link http://tytem.com
17
 */
18
class DateOfBirth
19
{
20
    public $id;
21
    public $date_of_birth;
22
    public $main_entry;
23
24
    /**
25
     * @param $date
26
     * @param bool $format
27
     */
28
    public function setDateOfBirth($date, $format = false)
29
    {
30
        if ($format) {
31
            $myDateTime = \DateTime::createFromFormat('d/m/Y', $date);
32
            $this->date_of_birth = $myDateTime->format('Y-m-d');
33
        } else {
34
            $this->date_of_birth = $date;
35
        }
36
    }
37
}
38