Code Duplication    Length = 37-49 lines in 2 locations

src/Amadeus/Client/Struct/Air/MultiAvailability/PointOfCommencement.php 1 location

@@ 16-52 (lines=37) @@
13
 * @package Amadeus\Client\Struct\Air\MultiAvailability
14
 * @author Dieter Devlieghere <[email protected]>
15
 */
16
class PointOfCommencement
17
{
18
    /**
19
     * @var string
20
     */
21
    public $location;
22
23
    /**
24
     * @var string
25
     */
26
    public $date;
27
28
    /**
29
     * @var string
30
     */
31
    public $time;
32
33
    /**
34
     * PointOfCommencement constructor.
35
     *
36
     * @param string $point
37
     * @param \DateTime|null $date
38
     */
39
    public function __construct($point, $date)
40
    {
41
        $this->location = $point;
42
43
        if ($date instanceof \DateTime) {
44
            $this->date = $date->format('dmy');
45
46
            $time = $date->format('Hi');
47
            if ($time !== '0000') {
48
                $this->time = $time;
49
            }
50
        }
51
    }
52
}
53

src/Amadeus/Client/Struct/Pnr/DisplayHistory/Reservation.php 1 location

@@ 31-79 (lines=49) @@
28
 * @package Amadeus\Client\Struct\Pnr\DisplayHistory
29
 * @author Dieter Devlieghere <[email protected]>
30
 */
31
class Reservation
32
{
33
    /**
34
     * @var string
35
     */
36
    public $controlNumber;
37
38
    /**
39
     * YYYYMMDD
40
     *
41
     * @var string
42
     */
43
    public $date;
44
45
    /**
46
     * HHMM
47
     *
48
     * @var string
49
     */
50
    public $time;
51
52
    /**
53
     * Reservation constructor.
54
     *
55
     * @param string $recordLocator
56
     * @param \DateTime|null $creationDateTime
57
     */
58
    public function __construct($recordLocator, $creationDateTime = null)
59
    {
60
        $this->controlNumber = $recordLocator;
61
62
        if ($creationDateTime instanceof \DateTime) {
63
            $this->loadCreationDate($creationDateTime);
64
        }
65
    }
66
67
    /**
68
     * @param \DateTime $creation
69
     */
70
    protected function loadCreationDate(\DateTime $creation)
71
    {
72
        $this->date = $creation->format('Ymd');
73
74
        $time = $creation->format('Hi');
75
        if ($time !== '0000') {
76
            $this->time = $time;
77
        }
78
    }
79
}
80