1 | <?php |
||
7 | trait ManagesMaintenancePeriods |
||
8 | { |
||
9 | /** |
||
10 | * @param int $siteId |
||
11 | * |
||
12 | * @return array |
||
13 | */ |
||
14 | public function maintenancePeriods(int $siteId): array |
||
21 | |||
22 | /** |
||
23 | * @param int $siteId |
||
24 | * @param int $stopMaintenanceAfterSeconds Stops after one hour by default |
||
25 | * |
||
26 | * @return MaintenancePeriod |
||
27 | */ |
||
28 | public function startSiteMaintenance(int $siteId, int $stopMaintenanceAfterSeconds = 60 * 60): MaintenancePeriod |
||
36 | |||
37 | /** |
||
38 | * @param int $siteId |
||
39 | */ |
||
40 | public function stopSiteMaintenance(int $siteId) |
||
44 | |||
45 | /** |
||
46 | * @param int $siteId |
||
47 | * @param string $startsAt Y:m:d H:i |
||
48 | * @param string $endsAt Y:m:d H:i |
||
49 | * |
||
50 | * @return MaintenancePeriod |
||
51 | */ |
||
52 | public function createSiteMaintenance(int $siteId, string $startsAt, string $endsAt): MaintenancePeriod |
||
64 | |||
65 | /** |
||
66 | * @param int $maintenancePeriodId |
||
67 | */ |
||
68 | public function deleteSiteMaintenance(int $maintenancePeriodId) |
||
72 | } |
||
73 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.