code: public function slice($start, $end)
      {
          if ($start < 0 || !is_int($start)) {
              throw new InvalidArgumentException('Start must be a non-negative integer');
          }
  
          if ($end < 0 || !is_int($end)) {
              throw new InvalidArgumentException('End must be a positive integer');
          }
  
          if ($start > $end) {
              throw new InvalidArgumentException('End must be greater than start');
          }
  
          if ($end > $this->count() + 1) {
              throw new InvalidArgumentException('End must be less than the count of the items in the Collection');
          }
  
          $length = $end - $start + 1;
  
          $subsetItems = array_slice($this->items, $start, $length);
  
          $col = new static($this->type);
          $col->setItemsFromTrustedSource($subsetItems);
  
          return $col;
      }
docs: {@inheritdoc}