| Total Complexity | 6 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 16 | final class TargetProcessList implements TargetProcessListInterface |
||
| 17 | { |
||
| 18 | /** @var int[] */ |
||
| 19 | private array $pid_list; |
||
| 20 | |||
| 21 | public function __construct(int ...$pid_list) |
||
| 24 | } |
||
| 25 | |||
| 26 | public function pickOne(): ?int |
||
| 27 | { |
||
| 28 | if ($this->pid_list === []) { |
||
| 29 | return null; |
||
| 30 | } |
||
| 31 | $key = array_rand($this->pid_list); |
||
| 32 | $value = $this->pid_list[$key]; |
||
| 33 | unset($this->pid_list[$key]); |
||
| 34 | return $value; |
||
| 35 | } |
||
| 36 | |||
| 37 | public function putOne(int $pid): void |
||
| 40 | } |
||
| 41 | |||
| 42 | public function getDiff(TargetProcessListInterface $compare_list): self |
||
| 43 | { |
||
| 44 | return new self(...array_diff($this->pid_list, $compare_list->getArray())); |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @return int[] |
||
| 49 | */ |
||
| 50 | public function getArray(): array |
||
| 53 | } |
||
| 54 | } |
||
| 55 |