Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace BuyerKiosk\Employee; |
| 4 | |
| 5 | /** |
| 6 | * Interface for employee data providers |
| 7 | * |
| 8 | * Defines the contract for different employee management sources: |
| 9 | * - HomegrownProvider: Manual employee management (full CRUD) |
| 10 | * - WhenIWorkProvider: Sync from WhenIWork API (read + sync) |
| 11 | * - HomebaseProvider: Sync from Homebase API (read + sync) |
| 12 | */ |
| 13 | interface EmployeeProviderInterface |
| 14 | { |
| 15 | /** |
| 16 | * Get all active employees |
| 17 | * |
| 18 | * @return Employee[] Array of active Employee objects |
| 19 | */ |
| 20 | public function getActiveEmployees(): array; |
| 21 | |
| 22 | /** |
| 23 | * Get single employee by ID |
| 24 | * |
| 25 | * @param int $employeeId The employee ID |
| 26 | * @return Employee|null The employee object or null if not found |
| 27 | */ |
| 28 | public function getEmployee(int $employeeId): ?Employee; |
| 29 | |
| 30 | /** |
| 31 | * Update employee data |
| 32 | * |
| 33 | * @param int $employeeId The employee ID to update |
| 34 | * @param array $data Associative array of fields to update |
| 35 | * @return Employee The updated employee object |
| 36 | */ |
| 37 | public function updateEmployee(int $employeeId, array $data): Employee; |
| 38 | |
| 39 | /** |
| 40 | * Deactivate employee |
| 41 | * |
| 42 | * @param int $employeeId The employee ID to deactivate |
| 43 | * @param string|null $reason Optional reason for deactivation |
| 44 | * @return bool True if successful |
| 45 | */ |
| 46 | public function deactivateEmployee(int $employeeId, ?string $reason = null): bool; |
| 47 | |
| 48 | /** |
| 49 | * Whether this provider supports creating new employees |
| 50 | * |
| 51 | * @return bool True if provider can create employees |
| 52 | */ |
| 53 | public function supportsCreate(): bool; |
| 54 | |
| 55 | /** |
| 56 | * Whether this provider supports syncing from external source |
| 57 | * |
| 58 | * @return bool True if provider can sync from external API |
| 59 | */ |
| 60 | public function supportsSync(): bool; |
| 61 | |
| 62 | /** |
| 63 | * Create new employee (if supported) |
| 64 | * |
| 65 | * @param array $data Employee data |
| 66 | * @return Employee The created employee object |
| 67 | * @throws \Exception If provider does not support creation |
| 68 | */ |
| 69 | public function createEmployee(array $data): Employee; |
| 70 | |
| 71 | /** |
| 72 | * Sync employees from external source (if supported) |
| 73 | * |
| 74 | * @return SyncResult Object containing sync statistics and errors |
| 75 | * @throws \Exception If provider does not support sync |
| 76 | */ |
| 77 | public function syncEmployees(): SyncResult; |
| 78 | } |