# shiftcontroller/4.9.95/sh4/shifts/conflicts.php

ShiftController Employee Shift Scheduling, version 4.9.95. 52 lines.

- Page: https://pluginprobe.com/plugins/shiftcontroller/4.9.95/code/sh4/shifts/conflicts.php
- Raw: https://pluginprobe.com/plugins/shiftcontroller/4.9.95/raw/sh4/shifts/conflicts.php
- Modified: 2026-05-23T09:01:50+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/shiftcontroller/4.9.95/code/sh4/shifts/conflicts.php#L10-L20`.

```php
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly
interface SH4_Shifts_IConflicts
{
	public function register( $check );
	public function get( SH4_Shifts_Model $shift );
}

class SH4_Shifts_Conflicts implements SH4_Shifts_IConflicts
{
	protected $checks = array();
	protected $cache = array();
	public $dic;

	public function __construct( HC3_Dic $dic )
	{
		$this->dic = $dic;
	}

	public function register( $check )
	{
		$this->checks[] = $check;
		return $this;
	}

	public function get( SH4_Shifts_Model $shift, array $skipIdList = array() )
	{
		$id = $shift->getId();
		if( ($id > 0) && isset($this->cache[$id]) ){
			return $this->cache[$id];
		}

		$return = array();

		reset( $this->checks );
		foreach( $this->checks as $check ){
			$check = $this->dic->make( $check );

			$checkResult = $check->check( $shift, $skipIdList );
			if( ! $checkResult ){
				$return[] = $check;
			}
		}

        if (null === $id) {
            $id = 0;
        }

		$this->cache[$id] = $return;

		return $return;
	}
}
```
