Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
88.89% covered (warning)
88.89%
8 / 9
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
ServiceLocationValidationTrait
88.89% covered (warning)
88.89%
8 / 9
0.00% covered (danger)
0.00%
0 / 1
3.01
0.00% covered (danger)
0.00%
0 / 1
 validateServiceLocations
88.89% covered (warning)
88.89%
8 / 9
0.00% covered (danger)
0.00%
0 / 1
3.01
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}