Lines 88.88% 8 / 9
Functions and Methods 0.00% 0 / 1
Classes and Traits 0.00% 0 / 1
Name Lines Functions and Methods CRAP Classes and Traits
ServiceLocationValidationTrait 88.88% 8 / 9 0.00% 0 / 1 3.01 0.00% 0 / 1
 validateServiceLocations 88.88% 8 / 9 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}