Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
ServiceLocationValidationTrait
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
1 / 1
3
100.00% covered (success)
100.00%
1 / 1
 validateServiceLocations
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
1 / 1
3
1<?php
2
3declare(strict_types=1);
4
5namespace BO\Zmscitizenapi\Services\Availability;
6
7use BO\Zmscitizenapi\Services\Core\ValidationService;
8
9trait ServiceLocationValidationTrait
10{
11    private function validateServiceLocations(array $officeIds, array $serviceIds, bool $showUnpublished = false): ?array
12    {
13        foreach ($officeIds as $officeId) {
14            $errors = ValidationService::validateServiceLocationCombination(
15                (int) $officeId,
16                array_map('intval', $serviceIds),
17                $showUnpublished
18            );
19            if (!empty($errors['errors'])) {
20                return $errors;
21            }
22        }
23
24        return null;
25    }
26}