Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
91.30% covered (success)
91.30%
21 / 23
60.00% covered (warning)
60.00%
3 / 5
CRAP
0.00% covered (danger)
0.00%
0 / 1
DocumentInformations
91.30% covered (success)
91.30%
21 / 23
60.00% covered (warning)
60.00%
3 / 5
13.11
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getStartDate
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setStartDate
90.00% covered (success)
90.00%
9 / 10
0.00% covered (danger)
0.00%
0 / 1
5.03
 getEndDate
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 setEndDate
90.00% covered (success)
90.00%
9 / 10
0.00% covered (danger)
0.00%
0 / 1
5.03
1<?php
2
3/**
4 * This file is part of PHPProject - A pure PHP library for reading and writing
5 * presentations documents.
6 *
7 * PHPProject is free software distributed under the terms of the GNU Lesser
8 * General Public License version 3 as published by the Free Software Foundation.
9 *
10 * For the full copyright and license information, please read the LICENSE
11 * file that was distributed with this source code. For the full list of
12 * contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
13 *
14 * @link        https://github.com/PHPOffice/PHPProject
15 * @copyright   2009-2014 PHPProject contributors
16 * @license     http://www.gnu.org/licenses/lgpl.txt LGPL version 3
17 */
18
19declare(strict_types=1);
20
21namespace PhpOffice\PhpProject;
22
23/**
24 * PHPProject_DocumentInformations
25 *
26 * @category    PHPProject
27 * @package        PHPProject
28 * @copyright    Copyright (c) 2012 - 2012 PHPProject (https://github.com/PHPOffice/PHPProject)
29 */
30class DocumentInformations
31{
32    /**
33     * Start Date
34     * @var int
35     */
36    private $startDate;
37
38    /**
39     * End Date
40     * @var int
41     */
42    private $endDate;
43
44    /**
45     * Create a new PHPProject_DocumentInformations
46     */
47    public function __construct()
48    {
49    }
50
51    /**
52     * Get Start Date
53     * @return int
54     */
55    public function getStartDate(): ?int
56    {
57        return $this->startDate;
58    }
59
60    /**
61     * Set Start Date
62     * @param int|string|null $pValue
63     * @return self
64     */
65    public function setStartDate($pValue = null): self
66    {
67        if ($pValue === null) {
68            $pValue = time();
69        } elseif (is_string($pValue)) {
70            if (is_numeric($pValue)) {
71                $pValue = intval($pValue);
72            } else {
73                $pValue = strtotime($pValue);
74                if ($pValue === false) {
75                    $pValue = null;
76                }
77            }
78        }
79        $this->startDate = $pValue;
80        return $this;
81    }
82
83    /**
84     * Get End Date
85     * @return int
86     */
87    public function getEndDate(): ?int
88    {
89        return $this->endDate;
90    }
91
92    /**
93     * Set End Date
94     * @param int|string|null $pValue
95     * @return self
96     */
97    public function setEndDate($pValue = null): self
98    {
99        if ($pValue === null) {
100            $pValue = time();
101        } elseif (is_string($pValue)) {
102            if (is_numeric($pValue)) {
103                $pValue = intval($pValue);
104            } else {
105                $pValue = strtotime($pValue);
106                if ($pValue === false) {
107                    $pValue = null;
108                }
109            }
110        }
111        $this->endDate = $pValue;
112        return $this;
113    }
114}