Lines 100.00% 4 / 4
Functions and Methods 100.00% 2 / 2
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
CaptchaRequirementTrait 100.00% 4 / 4 100.00% 2 / 2 4 100.00% 1 / 1
 isCaptchaRequiredForOfficeIds 100.00% 1 / 1 100.00% 1 / 1 1
 isCaptchaRequiredForOfficeId 100.00% 3 / 3 100.00% 1 / 1 3
1<?php
2
3declare(strict_types=1);
4
5namespace BO\Zmscitizenapi\Services\Captcha;
6
7/**
8 * Requires the using class to define: private ZmsApiFacadeService $zmsApiFacadeService
9 */
10trait CaptchaRequirementTrait
11{
12    private function isCaptchaRequiredForOfficeIds(array $officeIds): bool
13    {
14        return $this->zmsApiFacadeService->isCaptchaRequiredForAnyOffice($officeIds);
15    }
16
17    private function isCaptchaRequiredForOfficeId(?int $officeId): bool
18    {
19        if ($officeId === null || $officeId <= 0) {
20            return false;
21        }
22
23        return $this->isCaptchaRequiredForOfficeIds([(string) $officeId]);
24    }
25}