private function validateIsOrdered($method) { $innerIterator = $this->elements; if (!$innerIterator instanceof Iterators\IOrderedIterator) { throw new PinqException('Invalid call to %s: %s::%s must be called first.', $method, __CLASS__, 'orderBy'); } return $innerIterator; }