OfficerWorkflowConditions
in package
uses
WorkflowContextAwareTrait
Workflow condition evaluators for Officers plugin.
Table of Contents
Methods
- hasConflictingOfficer() : bool
- Check if a branch already has a current or upcoming officer overlapping a hire window.
- isMemberWarrantable() : bool
- Check if a member is warrantable (meets all warrant eligibility requirements).
- isOnlyOnePerBranch() : bool
- Check if an office allows only one officer per branch.
- officeRequiresWarrant() : bool
- Check if an office requires a warrant.
- resolveValue() : mixed
- Resolve a config value from context if it starts with '$.'.
- resolveEffectiveOfficerEndDate() : DateTime|null
- windowsOverlap() : bool
Methods
hasConflictingOfficer()
Check if a branch already has a current or upcoming officer overlapping a hire window.
public
hasConflictingOfficer(array<string|int, mixed> $context, array<string|int, mixed> $config) : bool
Parameters
- $context : array<string|int, mixed>
-
Current workflow context
- $config : array<string|int, mixed>
-
Config with officeId, branchId, newOfficerStartDate, newOfficerEndDate
Return values
boolisMemberWarrantable()
Check if a member is warrantable (meets all warrant eligibility requirements).
public
isMemberWarrantable(array<string|int, mixed> $context, array<string|int, mixed> $config) : bool
Parameters
- $context : array<string|int, mixed>
-
Current workflow context
- $config : array<string|int, mixed>
-
Config with 'memberId'
Return values
boolisOnlyOnePerBranch()
Check if an office allows only one officer per branch.
public
isOnlyOnePerBranch(array<string|int, mixed> $context, array<string|int, mixed> $config) : bool
Parameters
- $context : array<string|int, mixed>
-
Current workflow context
- $config : array<string|int, mixed>
-
Config with 'officeId'
Return values
boolofficeRequiresWarrant()
Check if an office requires a warrant.
public
officeRequiresWarrant(array<string|int, mixed> $context, array<string|int, mixed> $config) : bool
Parameters
- $context : array<string|int, mixed>
-
Current workflow context
- $config : array<string|int, mixed>
-
Config with 'officeId'
Return values
boolresolveValue()
Resolve a config value from context if it starts with '$.'.
protected
resolveValue(mixed $value, array<string|int, mixed> $context) : mixed
Parameters
- $value : mixed
-
Raw value or context path (e.g. '$.trigger.memberId')
- $context : array<string|int, mixed>
-
Current workflow context
Return values
mixed —Resolved value
resolveEffectiveOfficerEndDate()
private
resolveEffectiveOfficerEndDate(int $officeId, DateTime $startDate, mixed $endDateRaw) : DateTime|null
Parameters
- $officeId : int
- $startDate : DateTime
- $endDateRaw : mixed
Return values
DateTime|nullwindowsOverlap()
private
windowsOverlap(DateTime $existingStart, DateTime|null $existingEnd, DateTime $newStart, DateTime|null $newEnd) : bool
Parameters
- $existingStart : DateTime
- $existingEnd : DateTime|null
- $newStart : DateTime
- $newEnd : DateTime|null