PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.
You can fix this by adding a namespace to your class:
namespaceYourVendor;classYourClass{}
When choosing a vendor namespace, try to pick something that is not too generic
to avoid conflicts with other libraries.
Loading history...
4
{
5
6
// Attributes
7
8
private $startTime;
9
private $endTime;
10
11
// Constructor
12
13
public function __construct(CalendarTime $startTime, CalendarTime $endTime)
14
{
15
$this->setAttributes($startTime, $endTime);
16
}
17
18
// Functions
19
20
public function setAttributes(CalendarTime $startTime, CalendarTime $endTime)
21
{
22
if ($this->isValidPeriod($startTime, $endTime)) {
23
$this->startTime = $startTime;
24
$this->endTime = $endTime;
25
} else {
26
user_error('CalendarTimePeriod::setAttributes() : you cannot construct a \'CalendarTimePeriod\' with the $startTime attribute superior or equal to the $endTime attribute', E_USER_ERROR);
27
}
28
}
29
30
public function isValidPeriod(CalendarTime $startTime, CalendarTime $endTime)
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.