*/ class ResultSetDecorator extends Collection implements ResultSetInterface { /** * Make this object countable. * * Part of the Countable interface. Calling this method * will convert the underlying traversable object into an array and * get the count of the underlying data. * * @return int */ public function count(): int { $iterator = $this->getInnerIterator(); if ($iterator instanceof Countable) { return $iterator->count(); } return count($this->toArray()); } /** * @inheritDoc */ public function __debugInfo(): array { $parentInfo = parent::__debugInfo(); $limit = Configure::read('App.ResultSetDebugLimit', 10); return array_merge($parentInfo, ['items' => $this->take($limit)->toArray()]); } }