/** * Вычитает подмножество * * @param SimpleRangeSetInterface $set */ public function subtractSet(SimpleRangeSetInterface $set) { $result = array(); $length = count($this->sets); for ($key = 0; $key < $length; $key++) { $existingSet = $this->sets[$key]; if ($existingSet instanceof SimpleRangeSet) { if ($existingSet->intersect($set)) { $result = array_merge($result, $existingSet->subtract($set)); $this->sets->remove($key); $key--; $length = count($this->sets); } } } $this->sets->merge($result); }