Code Duplication    Length = 49-49 lines in 2 locations

src/Amadeus/Client/Struct/Air/RetrieveSeatMap/Reservation.php 1 location

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

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