* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace PrestaShop\PrestaShop\Adapter\Profile\Employee; use Employee; use PrestaShop\PrestaShop\Core\Domain\Employee\Exception\EmployeeNotFoundException; use PrestaShop\PrestaShop\Core\Domain\Employee\ValueObject\EmployeeId; abstract class AbstractEmployeeHandler { /** * @param EmployeeId $employeeId * * @return Employee * * @throws EmployeeNotFoundException */ protected function getEmployee(EmployeeId $employeeId): Employee { $employee = new Employee($employeeId->getValue()); if ($employee->id !== $employeeId->getValue()) { throw new EmployeeNotFoundException($employeeId, sprintf('Employee with id "%s" was not found', $employeeId->getValue())); } return $employee; } }